AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AODTrain.C
Go to the documentation of this file.
1 
11 #ifndef __CINT__
12 # include <AliAnalysisManager.h>
13 #else
14 class AliAnalysisManager;
15 #endif
16 #include "TrainSetup.C"
17 
23 class AODTrain : public TrainSetup
24 {
25 public:
26  //------------------------------------------------------------------
32  AODTrain(const char* name="myTest") : TrainSetup(name)
33  {
34  fOptions.Set("type", "ESD");
35  // over all options
36  fOptions.Add("collision", "TYPE", "Collision system", 0);
37  fOptions.Add("year", "YEAR", "Year", 2011);
38  fOptions.Add("cdb", "Connect to CDB", true);
39  fOptions.Add("physics-selection", "Use PhysicsSelection", true);
40  fOptions.Add("tender", "Use of Tenders", false);
41  fOptions.Add("centrality", "Use centrality", false);
42  fOptions.Add("v0-tender", "Use of V0 tender", false);
43  fOptions.Add("track-refs", "Also read track references");
44  fOptions.Add("kinematics-filter", "Use kinematics fitler");
45  fOptions.Add("sys-info", "Use sys info");
46  fOptions.Add("run", "RUNNUMBER", "Set initial run number", 0);
47 
48  // Task options
49  fOptions.Add("esd-filter", "Use ESD fitler", true);
50  fOptions.Add("muon-copy", "Make additional MUON specific AOD", true);
51  fOptions.Add("jetan", "Use Jet analysis", true);
52  fOptions.Add("jetan-delta", "Make Jet analysis delta AOD", true);
53  fOptions.Add("vertexing", "Use PWGHF vertexing", true);
54  fOptions.Add("jpsi-filter", "Use PWGDQ J/Psi filter", false);
55  fOptions.Add("d0-decay", "Use PWGHF D0->h+h", true);
56  fOptions.Add("high-pt", "Use high pt", true);
57  fOptions.Add("forward-nch", "Forward charged particle", true);
58  // Other
59  fOptions.Add("pid-response", "Use PID response", true);
60  fOptions.Add("pid-qa", "Do PID QA", true);
61  }
62  //------------------------------------------------------------------
69  {
70 
71  fRailway->LoadLibrary("libCORRFW");
72 
73  Bool_t cdb = fOptions.Has("cdb");
74  Bool_t tender = fOptions.Has("tender");
75  Bool_t physicsSelection = fOptions.Has("physics-selection");
76 
77  if (cdb || tender) {
78  fRailway->LoadLibrary("libCDB");
79  fRailway->LoadLibrary("libProof");
80  fRailway->LoadLibrary("libRAWDatabase");
81  fRailway->LoadLibrary("libSTEER");
82  fRailway->LoadLibrary("libSTAT");
83  fRailway->LoadLibrary("libTRDbase");
84  fRailway->LoadLibrary("libVZERObase");
85  fRailway->LoadLibrary("libTPCbase");
86  fRailway->LoadLibrary("libITSbase");
87  fRailway->LoadLibrary("libHMPIDbase");
88  fRailway->LoadLibrary("libTender");
89  fRailway->LoadLibrary("libTenderSupplies");
90  }
91 
92  if (fOptions.Has("sys-info")) mgr->SetNSysInfo(100);
93 
94  const char* aliPhys = "$(ALICE_PHYSICS)";
95  // AliAnalysisTask* task = 0;
96  AliAnalysisTaskSE* seTask = 0;
97 
98  AliAnalysisManager::SetCommonFileName("AODQA.root");
99  if (tender)
100  CoupleCar(Form("%s/TENDER/TenderSupplies/AddTaskTender.C", aliPhys),
101  Form("%d", fOptions.Has("v0-tender")));
102 
103  if (fOptions.Has("pid-response"))
104  CoupleCar("AddTaskPIDResponse.C");
105 
106  if (fOptions.Has("pid-qa")) {
107  seTask = CoupleSECar("AddTaskPIDqa.C");
108  seTask->SelectCollisionCandidates(AliVEvent::kAny);
109  }
110 
111  if (cdb && !tender) {
112  fRailway->LoadLibrary("libRAWDatarec");
113  fRailway->LoadLibrary("libTRDrec");
114  fRailway->LoadLibrary("libVZEROrec");
115  fRailway->LoadLibrary("libTPCrec");
116  fRailway->LoadLibrary("libITSrec");
117  fRailway->LoadLibrary("libPWGPP");
118 
119  // CoupleCar("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C");
120  gROOT->LoadMacro("$ALICE_PHYSICS/PWGPP/PilotTrain/AddTaskCDBconnect.C");
121  gROOT->ProcessLine(Form("AddTaskCDBconnect(%d)", fOptions.AsInt("run")));
122  gROOT->ProcessLine("AliCDBManager* cdb = AliCDBManager::Instance();"
123  "cdb->SetDefaultStorage(\"raw://\");");
124  }
125 
126  if (fOptions.Has("high-pt"))
127  CoupleCar("AddTaskFilteredTree.C");
128 
129  if (fOptions.Has("esd-filter")) {
130  fRailway->LoadLibrary("PWGmuon");
131  if (fOptions.Has("muon-copy")) {
132  mgr->RegisterExtraFile("AliAOD.Muons.root");
133  mgr->RegisterExtraFile("AliAOD.Dimuons.root");
134  }
135  Int_t runFlag = (fOptions.AsInt("year") % 100) * 100;
136  TString args =
137  TString::Format("%d,%d,false,false,false,false,true,false,false,%d",
138  fOptions.Has("kinematics-filter"),
139  fOptions.Has("muon-copy"), runFlag);
140  CoupleCar("AddTaskESDFilter.C", args);
141  }
142 
143  Bool_t vertexing = fOptions.Has("vertexing");
144  Bool_t d0Decay = fOptions.Has("d0-decay");
145  if (vertexing || d0Decay) {
146  TString src = "$ALICE_PHYSICS/PWGHF/vertexingHF/ConfigVertexingHF.C";
147  if (fOptions.AsInt("collision") == 1)
148  src.ReplaceAll(".C", "highmult.C");
149  TFile::Cp(src, "ConfigVertexingHF.C");
150  fRailway->LoadAux("ConfigVertexingHF.C");
151  }
152 
153  if (vertexing) {
154  fRailway->LoadLibrary("PWGflowBase");
155  fRailway->LoadLibrary("PWGflowTasks");
156  fRailway->LoadLibrary("PWGHFvertexingHF");
157  seTask =
158  CoupleSECar("$ALICE_PHYSICS/PWGHF/vertexingHF/macros/AddTaskVertexingHF.C");
159  seTask->SelectCollisionCandidates(0);
160  mgr->RegisterExtraFile("AliAOD.VertexingHF.root");
161  }
162 
163  if (fOptions.Has("jpsi-filtering")) {
164  fRailway->LoadLibrary("PWGDQdielectron");
165  seTask =
166  CoupleSECar("$ALICE_PHYSICS/PWGDQ/dielectron/macros/AddTaskJPSIFilter.C");
167  seTask->SelectCollisionCandidates(0);
168  mgr->RegisterExtraFile("AliAOD.Dielectron.root");
169  }
170 
171  if (d0Decay)
172  CoupleCar("$ALICE_PHYSICS/PWGHF/vertexingHF/AddD2HTrain.C",
173  "kFALSE, 1,0,0,0,0,0,0,0,0,0,0");
174 
175  if (fOptions.Has("jetan")) {
176  fRailway->LoadLibrary("JETAN");
177 
178  Bool_t jetanDelta = fOptions.Has("jetan-delta");
179  if (jetanDelta) {
180  fRailway->LoadLibrary("CGAL");
181  fRailway->LoadLibrary("fastjet");
182  fRailway->LoadLibrary("siscone");
183  fRailway->LoadLibrary("SISConePlugin");
184  fRailway->LoadLibrary("FASTJETAN");
185  // --- For newer fastjet ---
186  // fRailway->LoadLibrary("CGAL");
187  // fRailway->LoadLibrary("fastjet");
188  // fRailway->LoadLibrary("fastjettools");
189  // fRailway->LoadLibrary("siscone");
190  // fRailway->LoadLibrary("siscone_spherical");
191  // fRailway->LoadLibrary("fastjetplugins");
192  // fRailway->LoadLibrary("FASTJETAN");
193  }
194 
195  // Write script to do this - avoid useless links against loadable
196  // library
197  std::ofstream o("AddJets.C");
198  o << "void AddJets(AliAnalysisManager* mgr,\n"
199  << " UInt_t highPt,\n"
200  << " const char* deltaAOD,\n"
201  << " Bool_t useDelta,\n"
202  << " Bool_t usePS,\n"
203  << " Bool_t pbpb,\n"
204  << " Float_t etaCut,\n"
205  << " Float_t centLow,\n"
206  << " Float_t centHigh)\n"
207  << "{\n"
208  << " gROOT->SetMacroPath(Form(\"%s:$ALICE_ROOT/PWGJE/macros\",\n"
209  << " gROOT->GetMacroPath()));\n"
210  << " \n"
211  << " gROOT->LoadMacro(\"AddTaskJets.C\");\n"
212  << " AliAnalysisTaskJets *jTask = 0;\n"
213  << " jTask = AddTaskJets(\"AOD\",\"UA1\",0.4,highPt,1.,0);\n"
214  << " jTask->SetNonStdOutputFile(deltaAOD);\n"
215  << " \n"
216  << " if (useDelta) {\n"
217  << " mgr->RegisterExtraFile(deltaAOD);\n"
218  << " if (pbpb) {\n"
219  << " jTask = AddTaskJets(\"AOD\",\"UA1\",0.4,highPt,1.,2);\n"
220  << " jTask->SetNonStdOutputFile(deltaAOD);\n"
221  << " }\n"
222  << " }\n"
223  << " \n";
224  o << " jTask =AddTaskJets(\"AOD\",\"SISCONE\",0.4,highPt,0.15,0);\n"
225  << " jTask->SetNonStdOutputFile(deltaAOD);\n"
226  << " TString subBranches = jTask->GetNonStdBranch();\n"
227  << " \n";
228  o << " gROOT->LoadMacro(\"AddTaskJetCluster.C\");\n"
229  << " AliAnalysisTaskJetCluster* cTask = 0;\n"
230  << " cTask = AddTaskJetCluster(\"AOD\",\"\",highPt,usePS,\n"
231  << " \"KT\",0.4,0,1,deltaAOD,0.15,etaCut,0);\n"
232  << " cTask->SetBackgroundCalc(kTRUE);\n"
233  << " cTask->SetNRandomCones(10);\n"
234  << " cTask->SetCentralityCut(centLow,centHigh);\n"
235  << " cTask->SetGhostEtamax(etaCut);\n"
236  << " TString bgBranch = Form(\"%s_%s\",\n"
237  << " AliAODJetEventBackground::StdBranchName(),\n"
238  << " cTask->GetJetOutputBranch());\n"
239  << " \n";
240  o << " cTask = AddTaskJetCluster(\"AOD\",\"\",highPt,usePS,\n"
241  << " \"ANTIKT\",0.4,2,1,deltaAOD,0.15);\n"
242  << " cTask->SetNRandomCones(10);\n"
243  << " cTask->SetCentralityCut(centLow,centHigh);\n"
244  << " if (pbpb) cTask->SetBackgroundBranch(bgBranch);\n"
245  << " subBranches += Form(\" %s\",cTask->GetJetOutputBranch());\n"
246  << " \n";
247  o << " cTask = AddTaskJetCluster(\"AOD\",\"\",highPt,usePS,\n"
248  << "\"ANTIKT\",0.2,0,1,deltaAOD,0.15);\n"
249  << " cTask->SetCentralityCut(centLow,centHigh);\n"
250  << " if (pbpb) cTask->SetBackgroundBranch(bgBranch);\n"
251  << " subBranches += Form(\" %s\",cTask->GetJetOutputBranch());\n"
252  << " \n";
253  o << " if (pbpb) {\n"
254  << " gROOT->LoadMacro(\"AddTaskJetBackgroundSubtract.C\");\n"
255  << " AliAnalysisTaskJetBackgroundSubtract* sTask = 0;\n"
256  << " sTask = AddTaskJetBackgroundSubtract(subBranches,1,\"B0\",\n"
257  << " \"B%d\");\n"
258  << " sTask->SetBackgroundBranch(bgBranch);\n"
259  << " sTask->SetNonStdOutputFile(deltaAOD);\n"
260  << " }\n"
261  << "}\n"
262  << std::endl;
263  o.close();
264 
265  UInt_t highPtFilterMask = 272;
266  TString deltaAODJetName = "AliAOD.Jets.root";
267  Float_t trackEtaWindow = 0.9;
268  Float_t centLow = 0;
269  Float_t centHigh = 0;
270  gROOT->Macro(Form("./AddJets.C((AliAnalysisManager*)%p,"
271  "%d,\"%s\",%d,%d,%d,%f,%f,%f);",
272  mgr, highPtFilterMask, deltaAODJetName.Data(),
273  jetanDelta, physicsSelection,
274  fOptions.AsInt("collision") == 1, // pbpb
275  trackEtaWindow, centLow, centHigh));
276  }
277  if (fOptions.Has("forward-nch") && physicsSelection) {
278  Bool_t fwdMC = (mgr->GetMCtruthEventHandler() != 0 &&
279  fOptions.Has("track-refs"));
280 
281  CoupleCar("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/AddTaskForwardMult.C",
282  Form("%d", fwdMC));
283  }
284  }
285  //------------------------------------------------------------------
293  {
294  if (fOptions.Has("physics-selection"))
296  }
297  //------------------------------------------------------------------
305  {
306  if (fOptions.Has("centrality"))
308  }
309  //------------------------------------------------------------------
317  virtual AliVEventHandler* CreateMCHandler(UShort_t /*type*/, bool mc)
318  {
319  if (!mc) return 0;
320  AliMCEventHandler* mcHandler = new AliMCEventHandler();
321  mcHandler->SetReadTR(fOptions.Has("track-refs"));
322  return mcHandler;
323  }
324  //------------------------------------------------------------------
330  const char* ClassName() const { return "AODTrain"; }
331 };
332 //
333 // EOF
334 //
virtual void CreateCentralitySelection(Bool_t mc)
Definition: TrainSetup.C:760
Railway * fRailway
Definition: TrainSetup.C:1667
virtual AliVEventHandler * CreateMCHandler(UShort_t, bool mc)
Definition: AODTrain.C:317
Int_t AsInt(const TString &name, Int_t def=0) const
Definition: Option.C:645
virtual void CreatePhysicsSelection(Bool_t mc, AliAnalysisManager *mgr)
Definition: AODTrain.C:292
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
float Float_t
Definition: External.C:68
void Set(const TString &name, const TString &value)
Definition: Option.C:736
const char * ClassName() const
Definition: AODTrain.C:330
Base classs for train specifications.
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
Definition: Option.C:421
virtual Bool_t LoadAux(const TString &name, Bool_t copy=false)
Definition: Railway.C:255
virtual void CreateCentralitySelection(Bool_t mc, AliAnalysisManager *mgr)
Definition: AODTrain.C:304
AODTrain(const char *name="myTest")
Definition: AODTrain.C:32
OptionList fOptions
Definition: TrainSetup.C:1666
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53
virtual AliAnalysisTask * CoupleCar(const TString &macro, const TString &args)
Definition: TrainSetup.C:834
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:876
virtual Bool_t LoadLibrary(const TString &name, Bool_t slave=true, Bool_t forcePar=false)=0
void CreateTasks(AliAnalysisManager *mgr)
Definition: AODTrain.C:68