AliPhysics  2b88e80 (2b88e80)
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("max-ntracklet", "N", "For FAKE centrality", 6000);
72  fOptions.Add("reweigh", "FILE", "File with weights", "");
73  fOptions.Add("reweigh-calc", "MODE", "prod,square,sum", "prod");
74  fOptions.Add("reweigh-mask", "MASK", "Tracklet mask for weighing", 0xFF);
75  fOptions.Add("reweigh-veto", "VETO", "Tracklet veto for weighing", 0x0);
76  fOptions.Add("reweigh-inv", "W -> 1/W", false);
77  fOptions.SetDescription("Analyse AOD for dN/deta from tracklets");
78  fOptions.Set("type", "AOD");
79  }
85  const char* DefaultCentBins() const
86  {
87  return "0-5-10-20-30-40-50-60-70-80-90";
88  }
95  virtual AliVEventHandler* CreateOutputHandler(UShort_t)
96  {
97  return 0;
98  }
105  {
106  mc = fOptions.Has("mc");
107  if (!mc) mc = fRailway->IsMC();
108  if (fOptions.AsBool("multsel"))
110  }
117  {
118  Info("CreateTasks", "Loading code");
119  fRailway->LoadSource("FixPaths.C");
120  fRailway->LoadSource("AliAODSimpleHeader.C");
121  fRailway->LoadSource("AliAODTracklet.C");
122  fRailway->LoadSource("AliTrackletWeights.C");
123  fRailway->LoadSource("AliTrackletAODUtils.C");
124  fRailway->LoadSource("AliTrackletAODdNdeta.C");
125 
126  // --- Create the task using interpreter -------------------------
127  Bool_t mc = fOptions.Has("mc");
128  if (!mc) mc = fRailway->IsMC();
129  Long_t ret =
130  gROOT->ProcessLine(Form("AliTrackletAODdNdeta::Create(%d,\"%s\")",mc,
131  fOptions.AsString("reweigh")));
132  AliAnalysisTaskSE* task = reinterpret_cast<AliAnalysisTaskSE*>(ret);
133  if (!task) return;
134 
135  // --- Figure out the trigger options ----------------------------
136  TString trg = fOptions.Get("trig"); trg.ToUpper();
137  UInt_t sel = AliVEvent::kINT7;
138  if (trg.EqualTo("MB")) sel = AliVEvent::kMB;
139  else if (trg.EqualTo("V0AND")) sel = AliVEvent::kINT7;
140  else if (trg.EqualTo("V0OR")) sel = AliVEvent::kCINT5;
141  else if (trg.EqualTo("ANY")) sel = AliVEvent::kAny;
142  task->SelectCollisionCandidates(sel);
143 
144  // --- Figure out calculation mode -------------------------------
145  TString calc = fOptions.Get("reweigh-calc"); calc.ToUpper();
146  UChar_t mcal = 0;
147  if (calc.BeginsWith("PROD")) mcal = 0;
148  else if (calc.BeginsWith("SQ")) mcal = 1;
149  else if (calc.BeginsWith("SUM")) mcal = 2;
150  else if (calc.BeginsWith("AV")) mcal = 3;
151 
152  // --- Set various options on task -------------------------------
153  const char* defCent = DefaultCentBins();
154  FromOption(task, "CentralityMethod","cent", "V0M");
155  FromOption(task, "CentralityAxis", "cent-bins", defCent);
156  FromOption(task, "AbsMinCent", "abs-min-cent", -1.);
157  FromOption(task, "MaxNTracklet", "max-ntracklet", 6000.);
158  FromOption(task, "EtaAxis", "eta-bins", "r16:2");
159  FromOption(task, "IPzAxis", "ipz-bins", "u15");
160  FromOption(task, "DeltaCut", "delta-cut", 1.5);
161  FromOption(task, "TailDelta", "tail-delta", 5.);
162  FromOption(task, "TailMaximum", "tail-max", -1);
163  FromOption(task, "MaxDelta", "max-delta", 25.);
164  FromOption(task, "DPhiShift", "dphi-shift", 0.0045);
165  FromOption(task, "ShiftedDPhiCut", "shifted-dphi-cut",-1.);
166  FromOption(task, "WeightMask", "reweigh-mask", 0xFF);
167  FromOption(task, "WeightVeto", "reweigh-veto", 0x0);
168  SetOnTask (task, "WeightCalc", mcal);
169  FromOption(task, "WeightInverse", "reweigh-inv", false);
170  task->Print("");
171  }
172  //__________________________________________________________________
178  void SaveSetup(Bool_t asShellScript)
179  {
180  TrainSetup::SaveSetup(asShellScript);
181 
182  SaveCollect();
183  }
190  void SaveCollect()
191  {
192  std::ofstream o("Collect.C");
193  if (!o) {
194  Error("TrackletAODdNdeta::SavePost", "Failed to open Collect.C");
195  return;
196  }
197  o << "// Created by " << ClassName() << "\n"
198  << "// Will draw dN/deta results from produced files\n"
199  << "// \n"
200  << "// Arguments:\n"
201  << "// other Directory of other result (MC or real)\n"
202  << "// output Optional output directory name\n"
203  << "// proc Bit mask of processing options\n"
204  << "// - 0x1 Unit normalisation of C\n"
205  << "// - 0x2 Constant normalisation of C\n"
206  << "// - 0x4 eta-dependent normalisation of C\n"
207  << "// - 0x8 (eta,IPz)-dependent normalisation of C\n"
208  << "// viz Bit mask of visualisation options\n"
209  << "// - 0x0001 General information\n"
210  << "// - 0x0002 Parameters used\n"
211  << "// - 0x0004 Show weights if used\n"
212  << "// - 0x0008 Show dN/deta \n"
213  << "// - 0x0010 Show species\n"
214  << "// - 0x0020 Show delta distribtions\n"
215  << "// - 0x0040 Show details of the calculation\n"
216  << "// - 0x0080 Reserved\n"
217  << "// - 0x0100 Generate PDF and PNGs\n"
218  << "// - 0x0200 Pause after each page\n"
219  << "// - 0x0400 Generate plots in landscape orientation\n"
220  << "// - 0x0800 Use an alternate marker\n"
221  << "// n Number of centrality bins to process\n"
222  << "// \n"
223  << "// Output is generated in the sub-directory\n"
224  << "// \n";
225  if (fRailway->IsMC())
226  o << "// " << fEscapedName << "_<other>\n";
227  else
228  o << "// <other>_" << fEscapedName << "\n";
229  o << "//\n"
230  << "// where <other> is the first argument given\n"
231  << "void Collect(const char* other,\n"
232  << " const char* output=0\n"
233  << " UInt_t proc=0x2,\n"
234  << " UInt_t viz=0x32f,\n"
235  << " UInt_t n=10)\n"
236  << "{\n"
237  << " TString fwd=\n"
238  << " \"$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/dndeta/tracklets3\";\n"
239  << " gSystem->AddIncludePath(Form(\"-I%s\",fwd.Data()));\n"
240  << " gROOT->LoadMacro(Form(\"%s/AliTrackletAODUtils.C+g\",fwd.Data()));"
241  << "\n"
242  << " gROOT->LoadMacro(Form(\"%s/AliTrackletdNdeta2.C+g\",fwd.Data()));"
243  << "\n";
244  TString oName(fEscapedName); oName.Append("/AnalysisResults.root");
245  if (fRailway->IsMC())
246  o << " TString realFile = Form(\"%s/AnalysisResults.root\",other);\n"
247  << " TString simFile = \"" << oName << "\";\n"
248  << " TString outFile = Form(\""<<fEscapedName <<"_%s\",other);\n";
249  else
250  o << " TString realFile = \"" << oName << "\";\n"
251  << " TString simFile = Form(\"%s/AnalysisResults.root\",other);\n"
252  << " TString outFile = Form(\"%s_"<<fEscapedName <<"\",other);\n";
253  o << " if (output && output[0] != '\0') outFile = output;\n"
254  << " AliTrackletdNdeta2* p = new AliTrackletdNdeta2;\n"
255  << " if (proc & 0x1) outFile.Append(\"_unit\");\n"
256  << " if (proc & 0x2) outFile.Append(\"_const\");\n"
257  << " if (proc & 0x4) outFile.Append(\"_eta\");\n"
258  << " if (proc & 0x8) outFile.Append(\"_etaipz\");\n"
259  << " \n"
260  << " p->Run(proc,viz,n,realFile,simFile,outFile);\n"
261  << " \n"
262  << " gROOT->LoadMacro(Form(\"%s/ExtractGSE2.C\",fwd.Data()));\n"
263  << " ExtractGSE2(outFile);\n"
264  << "}\n"
265  << "// EOF\n"
266  << std::endl;
267  o.close();
268  }
274  const char* ClassName() const { return "TrackletAODdNdeta"; }
275 };
276 //
277 // EOF
278 //
virtual void CreateCentralitySelection(Bool_t mc)
Definition: TrainSetup.C:760
Railway * fRailway
Definition: TrainSetup.C:1674
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
void SaveSetup(Bool_t asShellScript)
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
virtual void SaveSetup(Bool_t asShellScript)
Definition: TrainSetup.C:1479
const char * DefaultCentBins() const
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
Definition: TrainSetup.C:1236
OptionList fOptions
Definition: TrainSetup.C:1673
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
TString fEscapedName
Definition: TrainSetup.C:1671
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:1136