AliPhysics  5a28df1 (5a28df1)
MakeFullTrain.C
Go to the documentation of this file.
1 #include "TrainSetup.C"
13 //====================================================================
25 class MakeFullTrain : public TrainSetup
26 {
27 public:
34  MakeFullTrain(const char* name)
35  : TrainSetup(name)
36  {
37  // General
38  fOptions.Add("cent", "ESTIMATOR", "Use centrality", "none");
39  fOptions.Add("cent-bins", "EDGES", "Centrality bin edges", "");
40  fOptions.Add("ipz-min", "CENTIMETER","Min Ip Z", "-10");
41  fOptions.Add("ipz-max", "CENTIMETER","Max Ip Z", "+10");
42  fOptions.Add("trigger", "TYPE", "Trigger to use", "INEL");
43  fOptions.Add("filter", "FILTER", "Vetos", "");
44  fOptions.Add("satellite", "Use satellite interactions");
45  fOptions.Add("sys", "SYSTEM", "1:pp, 2:PbPb, 3:pPb", "");
46  // ESD settings
47  fOptions.Add("aod-run", "NUMBER", "Run number", 0);
48  fOptions.Add("aod-snn", "ENERGY", "Center of mass energy GeV","");
49  fOptions.Add("aod-field", "STRENGTH","L3 field strength in kG", "");
50  fOptions.Add("aod-forward-config", "FILE", "Forward configuration",
51  "ForwardAODConfig.C");
52  fOptions.Add("aod-central-config", "FILE", "Forward configuration",
53  "CentralAODConfig.C");
54  fOptions.Add("aod-corr", "DIR", "Corrections dir", "");
55  // dNdeta AOD settings
56  fOptions.Add("dndeta", "Add dN/deta tasks");
57  fOptions.Add("dndeta-config", "FILE", "dN/deta configuration",
58  "dNdetaConfig.C");
59  fOptions.Add("dndeta-trig", "TYPE", "Trigger type", "INEL");
60  fOptions.Add("dndeta-scheme", "SCHEME", "Normalization scheme", "");
61  fOptions.Add("dndeta-trigEff", "EFFICENCY","Trigger effeciency", 1);
62  fOptions.Add("dndeta-trigEff0","EFFICENCY","0-bin trigger effeciency", 1);
63  // Multiplicity setttings
64  fOptions.Add("pnch", "Run the P(Nch) task", false);
65  fOptions.Add("pnch-resp", "Run the response matrix task for P(Nch)", false);
66  fOptions.Add("pnch-bias", "Run the trigger bias task for P(Nch)", false);
67  // Flow AOD settings
68  fOptions.Add("flow", "Add flow tasks");
69  fOptions.Add("flow-max-mom", "MOMENT","Max flow moment to analyse", "5");
70  fOptions.Add("flow-detectors", "NAMES", "Forward detectors", "fmd+vzero");
71  fOptions.Add("flow-qc-types", "TYPES",
72  "Which types of QC's to do [std,eta-gap,3cor,all]", "all");
73  fOptions.Add("flow-eta-gap", "DISTANCE","Size of eta gap", "2.0");
74  fOptions.Add("flow-use-b", "Use impact param. for centrality",false);
75  fOptions.Add("flow-afterburner","WHAT",
76  "What to afterburn [eta,phi,b,pid]", "");
77  fOptions.Add("flow-outlier-fmd","NSIGMA", "Outlier cut for FMD", "4.0");
78  fOptions.Add("flow-outlier-spd","NSIGMA", "Outlier cut for SPD", "0.0");
79  fOptions.Add("flow-mc-vtx",
80  "Whether to get the vertex from the MC header");
81  fOptions.Add("flow-ref-tracks", "TYPE",
82  "Whether or only to use tracks for reference flow "
83  "[tpc,hybrid,only]", "tpc+hybrid");
84  fOptions.Add("flow-ep", "Add Event Plane tasks (need VZERO AOD objects)");
85 
86  fOptions.Set("type", "ESD");
87  fOptions.Show(std::cout);
88  }
89 protected:
94  {
95  // --- Get options -----------------------------------------------
96  ULong_t run = fOptions.AsInt ("aod-run", 0);
97  UShort_t sNN = fOptions.AsInt ("aod-snn", 0);
98  UShort_t fld = fOptions.AsInt ("aod-field", 0);
99  UShort_t sys = fOptions.AsInt ("sys", 0);
100  Bool_t satVtx = fOptions.AsBool ("satellite");
101  Bool_t mc = HasMCHandler();
102  TString cor = "";
103  if (fOptions.Has("aod-corr")) cor = fOptions.Get("aod-corr");
104 
105  // --- Add forward task ------------------------------------------
106  TString fwdConfig = fOptions.Get("aod-forward-config");
107  AliAnalysisTask* fwd = CoupleCar("AddTaskForwardMult.C",
108  Form("%d,%lu,%hu,%hu,%hd,\"%s\",\"%s\"",
109  mc, run, sys, sNN, fld,
110  fwdConfig.Data(), cor.Data()));
111  if (!fwd) return false;
112  fRailway->LoadAux(gSystem->Which(gROOT->GetMacroPath(), fwdConfig));
113 
114  // --- Add central task ------------------------------------------
115  TString cenConfig = fOptions.Get("aod-central-config");
116  AliAnalysisTask* cen = CoupleCar("AddTaskCentralMult.C",
117  Form("%d,%lu,%hu,%hu,%hd,\"%s\",\"%s\"",
118  mc, run, sys, sNN, fld,
119  cenConfig.Data(),cor.Data()));
120  if (!cen) return false;
121  fRailway->LoadAux(gSystem->Which(gROOT->GetMacroPath(), cenConfig));
122  if (!cor.IsNull()) {
123  if (fwd)
124  fRailway->LoadAux(Form("%s/fmd_corrections.root",cor.Data()), true);
125  if (cen)
126  fRailway->LoadAux(Form("%s/spd_corrections.root",cor.Data()), true);
127  }
128  return true;
129  }
137  Bool_t CreatedNdetaTask(const char* which)
138  {
139  // --- Get parameters ------------------------------------------
140  TString config = fOptions.Get ("dndeta-config");
141  TString args = Form("\"%s\",\"%s\"", which, config.Data());
142  UInt_t mask = AliVEvent::kAny;
143 
144  AliAnalysisTaskSE* tsk = CoupleSECar("AddTaskdNdeta.C",args,mask);
145  if (!tsk) {
146  Printf("Failed to add task via AddTaskdNdeta.C(%s,%s)",
147  which, config.Data());
148  return false;
149  }
150  FromOption(tsk, "TriggerMask", "trigger", "INEL");
151  FromOption(tsk, "FilterMask", "filter", "OUTLIER|PILEUP-BIN");
152  FromOption(tsk, "CentralityMethod", "cent", "");
153  FromOption(tsk, "CentralityAxis", "cent-bins", "default");
154  FromOption(tsk, "IpZMin", "ipz-min", -10.);
155  FromOption(tsk, "IpZMax", "ipz-max", +10.);
156  FromOption(tsk, "SatelliteVertices", "satellite", false);
157  FromOption(tsk, "NormalizationScheme", "dndeta-scheme", "EVENT,TRIGGER");
158  FromOption(tsk, "TriggerEff", "dndeta-trigEff", 1.);
159  FromOption(tsk, "TriggerEff0", "dndeta-trigEff0",1.);
160  return true;
161  }
173  Bool_t CreateFlowTask(const char* fmt,
174  const char* det,
175  Bool_t useEtaGap,
176  Bool_t use3cor,
177  Short_t tracks)
178  {
179  const char* mac = "AddTaskForwardFlowQC.C";
180  AliAnalysisTaskSE* task =
181  CoupleSECar(mac,Form(fmt, det, useEtaGap, use3cor, tracks));
182  if (!task) return false;
183  FromOption(task, "CentralityAxis", "cent-bins", "default");
184  return true;
185  }
192  {
193  // --- Get the parameters ----------------------------------------
194  Bool_t mc = HasMCHandler();
195  Int_t sys = fOptions.AsInt ("sys");
196  Int_t moment = fOptions.AsInt ("flow-max-mom");
197  TString fwdDets = fOptions.Get ("flow-detectors");
198  TString types = fOptions.Get ("flow-qc-types");
199  Double_t egValue = fOptions.AsDouble("flow-eta-gap");
200  TString tracks = fOptions.Get ("flow-ref-tracks");
201  Bool_t useB = fOptions.AsBool ("flow-use-b");
202  Bool_t useMCVtx = fOptions.AsBool ("flow-mc-vtx");
203  Bool_t addFlow = fOptions.AsBool ("flow-afterburner");
204  Double_t fmdCut = fOptions.AsDouble("flow-outlier-fmd");
205  Double_t spdCut = fOptions.AsDouble("flow-outlier-spd");
206  Bool_t satVtx = fOptions.AsBool ("satellite");
207 
208  fwdDets.ToUpper();
209  Bool_t doFMD = fwdDets.Contains("FMD");
210  Bool_t doVZERO = fwdDets.Contains("VZERO");
211  tracks.ToLower();
212  Bool_t onlyTr = tracks.Contains("only");
213  Bool_t tpcTr = tracks.Contains("tpc");
214  Bool_t hybridTr = tracks.Contains("hybrid");
215  Bool_t ispA = sys == 3 || sys == 4;
216  types.ToLower();
217  Bool_t std = types.Contains("std") || types.Contains("all");
218  Bool_t etaGap = types.Contains("eta-gap") || types.Contains("all");
219  Bool_t cor3 = types.Contains("3cor") || types.Contains("all");
220 
221  // Notice the place holders at arg=2,3,4, and 9, These are
222  //
223  // 2: Detector to use (FMD/VZERO)
224  // 3: Whether to use eta gap (true/false)
225  // 4: Do 3-subevent correlations (true/false)
226  // 9: Use tracks for referernce flow (true/false)
227  TString args;
228  args=TString::Format("%d,\"%%s\",%%d,%%d,%d,%f,%f,%f,%%d,%d,%d,%d,%d,%d",
229  moment,
230  mc,
231  fmdCut,
232  spdCut,
233  egValue,
234  !useB,
235  ispA,
236  useMCVtx,
237  satVtx,
238  addFlow);
239 
240  // --- Add the task ----------------------------------------------
241  if (doFMD) {
242  if (std) {
243  if (!onlyTr &&!CreateFlowTask(args, "FMD",false,false,0)) return false;
244  if (tpcTr &&!CreateFlowTask(args, "FMD",false,false,1)) return false;
245  if (hybridTr&&!CreateFlowTask(args, "FMD",false,false,2)) return false;
246  }
247  if (etaGap) {
248  if (!onlyTr &&!CreateFlowTask(args, "FMD", true,false,0)) return false;
249  if (tpcTr &&!CreateFlowTask(args, "FMD", true,false,1)) return false;
250  if (hybridTr&&!CreateFlowTask(args, "FMD", true,false,2)) return false;
251  }
252  if (cor3) {
253  if (!onlyTr &&!CreateFlowTask(args, "FMD",false,true, 0)) return false;
254  }
255  }
256  if (doVZERO) {
257  if (std) {
258  if (!onlyTr &&!CreateFlowTask(args,"VZERO",false,false,0)) return false;
259  if (tpcTr &&!CreateFlowTask(args,"VZERO",false,false,1)) return false;
260  if (hybridTr&&!CreateFlowTask(args,"VZERO",false,false,2)) return false;
261  }
262  if (etaGap) {
263  if (!onlyTr &&!CreateFlowTask(args,"VZERO", true,false,0)) return false;
264  if (tpcTr &&!CreateFlowTask(args,"VZERO", true,false,1)) return false;
265  if (hybridTr&&!CreateFlowTask(args,"VZERO", true,false,2)) return false;
266  }
267  if (cor3) {
268  if (!onlyTr &&!CreateFlowTask(args,"VZERO",false, true,0)) return false;
269  }
270  }
271 
272  // --- Add the task ----------------------------------------------
273  if (fOptions.Has("flow-ep")) {
274  CoupleCar("AddTaskEventplane.C", "");
275  CoupleCar("AddTaskForwardFlowEP.C",
276  Form("%d, %d, \"%s\"", mc, moment, fwdDets.Data()));
277  }
278  }
284  Bool_t CreatePNchTask(const char* mac)
285  {
286  Info("CreatePNchTask","\n"
287  "*****************************************************\n"
288  "Creating a task via %s\n"
289  "*****************************************************", mac);
290  AliAnalysisTaskSE* tsk = CoupleSECar(mac);
291  if (!tsk) return false;
292  FromOption(tsk, "TriggerMask", "trigger", "INEL");
293  FromOption(tsk, "FilterMask", "filter", "OUTLIER|PILEUP-BIN");
294  // FromOption(tsk, "CentralityMethod", "cent", "");
295  FromOption(tsk, "CentralityAxis", "cent-bins", "default");
296  FromOption(tsk, "IpZMin", "ipz-min", -10.);
297  FromOption(tsk, "IpZMax", "ipz-max", +10.);
298  return true;
299  }
305  {
306  // --- Output file name ------------------------------------------
307  AliAnalysisManager::SetCommonFileName("forward.root");
308 
309  // --- Load libraries/pars ---------------------------------------
310  fRailway->LoadLibrary("PWGLFforward2");
311 
312  // --- Set load path ---------------------------------------------
313  gROOT->SetMacroPath(Form("%s:$(ALICE_PHYSICS)/PWGLF/FORWARD/analysis2",
314  gROOT->GetMacroPath()));
315  gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/ANALYSIS/macros",
316  gROOT->GetMacroPath()));
317 
318  // --- Check if this is MC ---------------------------------------
319  Bool_t mc = HasMCHandler();
320 
321  // --- Task to copy header information ---------------------------
322  CoupleCar("AddTaskCopyHeader.C", "");
323 
324 
325  // --- Add MC particle task --------------------------------------
326  if (mc) CoupleCar("AddTaskMCParticleFilter.C","");
327 
328  // --- Create AOD tasks ------------------------------------------
329  if (!CreateAODTasks()) return;
330 
331  // --- Add dN/deta tasks -----------------------------------------
332  if (fOptions.Has("dndeta")) {
333  if (!CreatedNdetaTask("Forward")) return;
334  if (!CreatedNdetaTask("Central")) return;
335  if (mc && !CreatedNdetaTask("MCTruth")) return;
336  }
337 
338  // --- P(Nch) task -----------------------------------------------
339  if (fOptions.Has("pnch") &&
340  !CreatePNchTask("AddTaskMultDistributions.C")) return;
341 
342  // --- P(Nch) response matrix task -------------------------------
343  if (mc && fOptions.Has("pnch-resp") &&
344  !CreatePNchTask("AddTaskCreateRespMatr.C")) return;
345 
346  // --- P(Nch) trigger bias task ----------------------------------
347  if (mc && fOptions.Has("pnch-bias") &&
348  !CreatePNchTask("AddTaskTriggerCorrection.C")) return;
349 
350  // --- Add the flow task -----------------------------------------
351  if (fOptions.Has("flow") && !CreateFlowTasks()) return;
352  }
353  // The code below is redundant and shouldn't be used. We keep it
354  // here for reference. If one needs a special physics selection,
355  // one can use the option "ps" defined by the TrainSetup.C class.
356 #if 0
357  //__________________________________________________________________
365  AliAnalysisManager* mgr)
366  {
368 
369  // --- Get input event handler -----------------------------------
370  AliInputEventHandler* ih =
371  dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
372  if (!ih)
373  Fatal("CreatePhysicsSelection", "Couldn't get input handler (%p)", ih);
374 
375  // --- Get Physics selection -------------------------------------
376  AliPhysicsSelection* ps =
377  dynamic_cast<AliPhysicsSelection*>(ih->GetEventSelection());
378  if (!ps)
379  Fatal("CreatePhysicsSelection", "Couldn't get PhysicsSelection (%p)",ps);
380 
381  // --- Special for pPb pilot run Sep. 2012 -----------------------
382  UShort_t sys = fOptions.AsInt("sys", 0);
383  if (sys == 3) {
384  Warning("CreatePhysicsSelection",
385  "Special setup for pPb pilot run September, 2012");
386  gROOT->SetMacroPath(Form("%s:$(ALICE_PHYSICS)/ANALYSIS/macros",
387  gROOT->GetMacroPath()));
388  gROOT->LoadMacro("PhysicsSelectionOADB_CINT5_pA.C");
389  gROOT->ProcessLine(Form("((AliPhysicsSelection*)%p)"
390  "->SetCustomOADBObjects("
391  "OADBSelection_CINT5_V0A(),0);", ps));
392  ps->SetSkipTriggerClassSelection(true);
393  }
394  // --- Ignore trigger class when selecting events. This means ---
395  // --- that we get offline+(A,C,E) events too --------------------
396  // ps->SetSkipTriggerClassSelection(true);
397  }
398  //__________________________________________________________________
405  {
406  if (!fOptions.Has("cent")) return;
408  }
409 #endif
410  //__________________________________________________________________
411  const char* ClassName() const { return "MakeFullTrain"; }
412 };
413 //
414 // EOF
415 //
Double_t AsDouble(const TString &name, Double_t def=0) const
Definition: Option.C:673
virtual void CreateCentralitySelection(Bool_t mc)
Definition: TrainSetup.C:760
double Double_t
Definition: External.C:58
Bool_t CreateFlowTasks()
Railway * fRailway
Definition: TrainSetup.C:1674
void CreateTasks(AliAnalysisManager *)
const char * fmt
Bool_t AsBool(const TString &name) const
Definition: Option.C:631
TSystem * gSystem
MakeFullTrain(const char *name)
Definition: MakeFullTrain.C:34
Int_t types
Int_t AsInt(const TString &name, Int_t def=0) const
Definition: Option.C:645
Bool_t CreateAODTasks()
Definition: MakeFullTrain.C:93
Bool_t CreateFlowTask(const char *fmt, const char *det, Bool_t useEtaGap, Bool_t use3cor, Short_t tracks)
const TString & Get(const TString &name) const
Definition: Option.C:596
Bool_t Has(const TString &name) const
Definition: Option.C:584
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
void Set(const TString &name, const TString &value)
Definition: Option.C:736
unsigned long ULong_t
Definition: External.C:38
short Short_t
Definition: External.C:23
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 * fwd
virtual Bool_t LoadAux(const TString &name, Bool_t copy=false)
Definition: Railway.C:255
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
Definition: TrainSetup.C:1236
const char * ClassName() const
OptionList fOptions
Definition: TrainSetup.C:1673
virtual Bool_t HasMCHandler() const
Definition: TrainSetup.C:1325
unsigned short UShort_t
Definition: External.C:28
void Show(std::ostream &o, const char *prefix=" ") const
Definition: Option.C:928
bool Bool_t
Definition: External.C:53
Bool_t CreatedNdetaTask(const char *which)
virtual AliAnalysisTask * CoupleCar(const TString &macro, const TString &args)
Definition: TrainSetup.C:841
virtual void CreatePhysicsSelection(Bool_t mc, AliAnalysisManager *mgr)
Definition: TrainSetup.C:694
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, const TString &args, UInt_t mask=0)
Definition: TrainSetup.C:883
virtual Bool_t LoadLibrary(const TString &name, Bool_t slave=true, Bool_t forcePar=false)=0
Bool_t CreatePNchTask(const char *mac)