AliPhysics  f05a842 (f05a842)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackletAODdNdeta.C
Go to the documentation of this file.
1 
11 #include "TrainSetup.C"
12 #ifndef __CINT__
13 #include <AliESDInputHandlerRP.h>
14 // #include <AliMixInputEventHandler.h>
15 // #include <AliMixEventPool.h>
16 // #include <AliMixEventCutObj.h>
17 #include <TMacro.h>
18 #else
19 class AliAnalysisTaskSE;
20 #endif
21 
46 {
52  TrackletAODdNdeta(const char* name)
53  : TrainSetup(name)
54  {
55  // Define all our options here
56  const char* defCent = DefaultCentBins();
57  fOptions.Add("trig", "NAME", "Trigger to use", "V0AND");
58  fOptions.Add("cent", "METHOD", "Centrality selector", "V0M");
59  fOptions.Add("cent-bins", "BINS", "Centrality bins", defCent);
60  fOptions.Add("eta-bins", "BINS", "Eta bins", "r16:-2:+2");
61  fOptions.Add("ipz-bins", "BINS", "IPz bins", "u15");
62  fOptions.Add("max-delta", "X", "Cut on weighted distance",25.);
63  fOptions.Add("tail-delta", "X", "Tail cut on distance", 5.);
64  fOptions.Add("tail-max", "X", "Tail cut on distance", -1.);
65  fOptions.Add("delta-cut", "X", "Cut on weighted distance",1.5);
66  fOptions.Add("dphi-shift", "RADIANS","Bending shift", 0.0045);
67  fOptions.Add("shifted-dphi-cut", "RADIANS", "Cut on dPhi-phiBent", -1.);
68  fOptions.Add("mc", "For MC data", false);
69  fOptions.Add("multsel", "Enable MultSelection", false);
70  fOptions.Add("abs-min-cent","PERCENT","Absolute least cent.", -1);
71  fOptions.Add("reweigh", "FILE", "File with weights", "");
72  fOptions.Add("reweigh-calc", "MODE", "prod,square,sum", "prod");
73  fOptions.Add("reweigh-mask", "MASK", "Tracklet mask for weighing", 0xFF);
74  fOptions.Add("reweigh-veto", "VETO", "Tracklet veto for weighing", 0x0);
75  fOptions.Add("reweigh-inv", "W -> 1/W", false);
76  fOptions.SetDescription("Analyse AOD for dN/deta from tracklets");
77  fOptions.Set("type", "AOD");
78  }
84  const char* DefaultCentBins() const
85  {
86  return "0-5-10-20-30-40-50-60-70-80-90";
87  }
94  virtual AliVEventHandler* CreateOutputHandler(UShort_t)
95  {
96  return 0;
97  }
104  {
105  mc = fOptions.Has("mc");
106  if (!mc) mc = fRailway->IsMC();
107  if (fOptions.AsBool("multsel"))
109  }
116  {
117  Info("CreateTasks", "Loading code");
118  fRailway->LoadSource("FixPaths.C");
119  fRailway->LoadSource("AliAODSimpleHeader.C");
120  fRailway->LoadSource("AliAODTracklet.C");
121  fRailway->LoadSource("AliTrackletWeights.C");
122  fRailway->LoadSource("AliTrackletAODUtils.C");
123  fRailway->LoadSource("AliTrackletAODdNdeta.C");
124 
125  // --- Create the task using interpreter -------------------------
126  Bool_t mc = fOptions.Has("mc");
127  if (!mc) mc = fRailway->IsMC();
128  Long_t ret =
129  gROOT->ProcessLine(Form("AliTrackletAODdNdeta::Create(%d,\"%s\")",mc,
130  fOptions.AsString("reweigh")));
131  AliAnalysisTaskSE* task = reinterpret_cast<AliAnalysisTaskSE*>(ret);
132  if (!task) return;
133 
134  // --- Figure out the trigger options ----------------------------
135  TString trg = fOptions.Get("trig"); trg.ToUpper();
136  UInt_t sel = AliVEvent::kINT7;
137  if (trg.EqualTo("MB")) sel = AliVEvent::kMB;
138  else if (trg.EqualTo("V0AND")) sel = AliVEvent::kINT7;
139  else if (trg.EqualTo("V0OR")) sel = AliVEvent::kCINT5;
140  else if (trg.EqualTo("ANY")) sel = AliVEvent::kAny;
141  task->SelectCollisionCandidates(sel);
142 
143  // --- Figure out calculation mode -------------------------------
144  TString calc = fOptions.Get("reweigh-calc"); calc.ToUpper();
145  UChar_t mcal = 0;
146  if (calc.BeginsWith("PROD")) mcal = 0;
147  else if (calc.BeginsWith("SQ")) mcal = 1;
148  else if (calc.BeginsWith("SUM")) mcal = 2;
149  else if (calc.BeginsWith("AV")) mcal = 3;
150 
151  // --- Set various options on task -------------------------------
152  const char* defCent = DefaultCentBins();
153  FromOption(task, "CentralityMethod","cent", "V0M");
154  FromOption(task, "CentralityAxis", "cent-bins", defCent);
155  FromOption(task, "EtaAxis", "eta-bins", "r16:2");
156  FromOption(task, "IPzAxis", "ipz-bins", "u15");
157  FromOption(task, "DeltaCut", "delta-cut", 1.5);
158  FromOption(task, "TailDelta", "tail-delta", 5.);
159  FromOption(task, "TailMaximum", "tail-max", -1);
160  FromOption(task, "MaxDelta", "max-delta", 25.);
161  FromOption(task, "DPhiShift", "dphi-shift", 0.0045);
162  FromOption(task, "ShiftedDPhiCut", "shifted-dphi-cut",-1.);
163  FromOption(task, "AbsMinCent", "abs-min-cent", -1.);
164  FromOption(task, "WeightMask", "reweigh-mask", 0xFF);
165  FromOption(task, "WeightVeto", "reweigh-veto", 0x0);
166  SetOnTask (task, "WeightCalc", mcal);
167  FromOption(task, "WeightInverse", "reweigh-inv", false);
168  // if (mc && we) {
169  // TUrl wurl(fOptions.AsString("reweight"));
170  // TFile* wfile = TFile::Open(wurl.GetFile());
171  // if (!wfile) {
172  // Warning("CreateTasks", "Failed to open weights file: %s",
173  // wurl.GetUrl());
174  // return;
175  // }
176  // TString wnam(wurl.GetAnchor());
177  // if (wnam.IsNull()) wnam = "weights";
178  // TObject* wobj = wfile->Get(wnam);
179  // if (!wobj) {
180  // Warning("CreateTasks", "Failed to get weights %s from file %s",
181  // wnam.Data(), wfile->GetName());
182  // return;
183  // }
184  // if (!wobj->IsA()->InheritsFrom("AliTrackletWeights")) {
185  // Warning("CreateTasks", "Object %s from file %s not an "
186  // "AliTrackletWeights but a %s",
187  // wnam.Data(), wfile->GetName(), wobj->ClassName());
188  // return;
189  // }
190  // SetOnTaskGeneric(task, "Weights",
191  // Form("((AliTrackletWeights*)%p)", wobj));
192  // }
193  Printf("Print the generated task");
194  task->Print("");
195  }
201  const char* ClassName() const { return "TrackletAODdNdeta"; }
202 };
203 //
204 // EOF
205 //
virtual void CreateCentralitySelection(Bool_t mc)
Definition: TrainSetup.C:758
Railway * fRailway
Definition: TrainSetup.C:1664
Bool_t AsBool(const TString &name) const
Definition: Option.C:631
const char * AsString(const TString &name, const TString &def="") const
Definition: Option.C:687
const TString & Get(const TString &name) const
Definition: Option.C:596
const char * ClassName() const
Bool_t Has(const TString &name) const
Definition: Option.C:584
void CreateTasks(AliAnalysisManager *mgr)
unsigned int UInt_t
Definition: External.C:33
TrackletAODdNdeta(const char *name)
virtual void CreateCentralitySelection(Bool_t mc)
void Set(const TString &name, const TString &value)
Definition: Option.C:736
virtual Bool_t IsMC() const
Definition: Railway.C:354
void SetDescription(const TString &d)
Definition: Option.C:359
Base classs for train specifications.
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
Definition: Option.C:421
const char * DefaultCentBins() const
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
Definition: TrainSetup.C:1226
OptionList fOptions
Definition: TrainSetup.C:1663
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
virtual AliVEventHandler * CreateOutputHandler(UShort_t)
virtual Bool_t LoadSource(const TString &name, bool copy=false)
Definition: Railway.C:231
void SetOnTask(AliAnalysisTaskSE *task, const char *what, UInt_t val)
Definition: TrainSetup.C:1126