AliPhysics  aaf9c62 (aaf9c62)
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("centrality", "Use centrality", false);
39  fOptions.Add("track-refs", "Also read track references");
40  fOptions.Add("kinematics-filter", "Use kinematics fitler");
41  fOptions.Add("sys-info", "Use sys info");
42  fOptions.Add("run", "RUNNUMBER", "Set initial run number", 0);
43 
44  // Task options
45  fOptions.Add("esd-filter", "Use ESD fitler", true);
46  fOptions.Add("muon-copy", "Make additional MUON specific AOD", true);
47  fOptions.Add("jetan", "Use Jet analysis", true);
48  fOptions.Add("jetan-delta", "Make Jet analysis delta AOD", true);
49  fOptions.Add("vertexing", "Use PWGHF vertexing", true);
50  fOptions.Add("jpsi-filter", "Use PWGDQ J/Psi filter", false);
51  fOptions.Add("d0-decay", "Use PWGHF D0->h+h", true);
52  fOptions.Add("high-pt", "Use high pt", true);
53  fOptions.Add("forward-nch", "Forward charged particle", true);
54  // Other
55  fOptions.Add("pid-response", "Use PID response", true);
56  fOptions.Add("pid-qa", "Do PID QA", true);
57  }
58  //==================================================================
60  {
61  CoupleCar("AddTaskPIDResponse.C");
62  }
63  //------------------------------------------------------------------
64  void CouplePidQA()
65  {
66  AliAnalysisTaskSE* seTask = CoupleSECar("AddTaskPIDqa.C");
67  seTask->SelectCollisionCandidates(AliVEvent::kAny);
68  }
69  //------------------------------------------------------------------
70  void CoupleHighPt()
71  {
72  CoupleCar("AddTaskFilteredTree.C");
73  }
74  //------------------------------------------------------------------
75  void CoupleFilter()
76  {
77  fRailway->LoadLibrary("PWGmuon");
78  if (fOptions.Has("muon-copy")) {
79  mgr->RegisterExtraFile("AliAOD.Muons.root");
80  mgr->RegisterExtraFile("AliAOD.Dimuons.root");
81  }
82  Int_t runFlag = (fOptions.AsInt("year") % 100) * 100;
83  TString args =
84  TString::Format("%d,%d,false,false,false,false,true,false,false,%d",
85  fOptions.Has("kinematics-filter"),
86  fOptions.Has("muon-copy"), runFlag);
87  CoupleCar("AddTaskESDFilter.C", args);
88  }
89  //------------------------------------------------------------------
91  {
92  fRailway->LoadLibrary("PWGflowBase");
93  fRailway->LoadLibrary("PWGflowTasks");
94  fRailway->LoadLibrary("PWGHFvertexingHF");
95  AliAnalysisTaskSE* seTask =
96  CoupleSECar("$ALICE_PHYSICS/PWGHF/vertexingHF/macros/AddTaskVertexingHF.C");
97  seTask->SelectCollisionCandidates(0);
98  mgr->RegisterExtraFile("AliAOD.VertexingHF.root");
99  }
100  //------------------------------------------------------------------
102  {
103  fRailway->LoadLibrary("PWGDQdielectron");
104  AliAnalysisTaskSE* seTask =
105  CoupleSECar("$ALICE_PHYSICS/PWGDQ/dielectron/macros/AddTaskJPSIFilter.C");
106  seTask->SelectCollisionCandidates(0);
107  mgr->RegisterExtraFile("AliAOD.Dielectron.root");
108  }
109  //------------------------------------------------------------------
111  {
112  CoupleCar("$ALICE_PHYSICS/PWGHF/vertexingHF/AddD2HTrain.C",
113  "kFALSE, 1,0,0,0,0,0,0,0,0,0,0");
114  }
115  //------------------------------------------------------------------
116  void CoupleJetAN()
117  {
118  fRailway->LoadLibrary("JETAN");
119 
120  Bool_t jetanDelta = fOptions.Has("jetan-delta");
121  if (jetanDelta) {
122  fRailway->LoadLibrary("CGAL");
123  fRailway->LoadLibrary("fastjet");
124  fRailway->LoadLibrary("siscone");
125  fRailway->LoadLibrary("SISConePlugin");
126  fRailway->LoadLibrary("FASTJETAN");
127  // --- For newer fastjet ---
128  // fRailway->LoadLibrary("CGAL");
129  // fRailway->LoadLibrary("fastjet");
130  // fRailway->LoadLibrary("fastjettools");
131  // fRailway->LoadLibrary("siscone");
132  // fRailway->LoadLibrary("siscone_spherical");
133  // fRailway->LoadLibrary("fastjetplugins");
134  // fRailway->LoadLibrary("FASTJETAN");
135  }
136 
137  // Write script to do this - avoid useless links against loadable
138  // library
139  std::ofstream o("AddJets.C");
140  o << "void AddJets(AliAnalysisManager* mgr,\n"
141  << " UInt_t highPt,\n"
142  << " const char* deltaAOD,\n"
143  << " Bool_t useDelta,\n"
144  << " Bool_t usePS,\n"
145  << " Bool_t pbpb,\n"
146  << " Float_t etaCut,\n"
147  << " Float_t centLow,\n"
148  << " Float_t centHigh)\n"
149  << "{\n"
150  << " gROOT->SetMacroPath(Form(\"%s:$ALICE_ROOT/PWGJE/macros\",\n"
151  << " gROOT->GetMacroPath()));\n"
152  << " \n"
153  << " gROOT->LoadMacro(\"AddTaskJets.C\");\n"
154  << " AliAnalysisTaskJets *jTask = 0;\n"
155  << " jTask = AddTaskJets(\"AOD\",\"UA1\",0.4,highPt,1.,0);\n"
156  << " jTask->SetNonStdOutputFile(deltaAOD);\n"
157  << " \n"
158  << " if (useDelta) {\n"
159  << " mgr->RegisterExtraFile(deltaAOD);\n"
160  << " if (pbpb) {\n"
161  << " jTask = AddTaskJets(\"AOD\",\"UA1\",0.4,highPt,1.,2);\n"
162  << " jTask->SetNonStdOutputFile(deltaAOD);\n"
163  << " }\n"
164  << " }\n"
165  << " \n";
166  o << " jTask =AddTaskJets(\"AOD\",\"SISCONE\",0.4,highPt,0.15,0);\n"
167  << " jTask->SetNonStdOutputFile(deltaAOD);\n"
168  << " TString subBranches = jTask->GetNonStdBranch();\n"
169  << " \n";
170  o << " gROOT->LoadMacro(\"AddTaskJetCluster.C\");\n"
171  << " AliAnalysisTaskJetCluster* cTask = 0;\n"
172  << " cTask = AddTaskJetCluster(\"AOD\",\"\",highPt,usePS,\n"
173  << " \"KT\",0.4,0,1,deltaAOD,0.15,etaCut,0);\n"
174  << " cTask->SetBackgroundCalc(kTRUE);\n"
175  << " cTask->SetNRandomCones(10);\n"
176  << " cTask->SetCentralityCut(centLow,centHigh);\n"
177  << " cTask->SetGhostEtamax(etaCut);\n"
178  << " TString bgBranch = Form(\"%s_%s\",\n"
179  << " AliAODJetEventBackground::StdBranchName(),\n"
180  << " cTask->GetJetOutputBranch());\n"
181  << " \n";
182  o << " cTask = AddTaskJetCluster(\"AOD\",\"\",highPt,usePS,\n"
183  << " \"ANTIKT\",0.4,2,1,deltaAOD,0.15);\n"
184  << " cTask->SetNRandomCones(10);\n"
185  << " cTask->SetCentralityCut(centLow,centHigh);\n"
186  << " if (pbpb) cTask->SetBackgroundBranch(bgBranch);\n"
187  << " subBranches += Form(\" %s\",cTask->GetJetOutputBranch());\n"
188  << " \n";
189  o << " cTask = AddTaskJetCluster(\"AOD\",\"\",highPt,usePS,\n"
190  << "\"ANTIKT\",0.2,0,1,deltaAOD,0.15);\n"
191  << " cTask->SetCentralityCut(centLow,centHigh);\n"
192  << " if (pbpb) cTask->SetBackgroundBranch(bgBranch);\n"
193  << " subBranches += Form(\" %s\",cTask->GetJetOutputBranch());\n"
194  << " \n";
195  o << " if (pbpb) {\n"
196  << " gROOT->LoadMacro(\"AddTaskJetBackgroundSubtract.C\");\n"
197  << " AliAnalysisTaskJetBackgroundSubtract* sTask = 0;\n"
198  << " sTask = AddTaskJetBackgroundSubtract(subBranches,1,\"B0\",\n"
199  << " \"B%d\");\n"
200  << " sTask->SetBackgroundBranch(bgBranch);\n"
201  << " sTask->SetNonStdOutputFile(deltaAOD);\n"
202  << " }\n"
203  << "}\n"
204  << std::endl;
205  o.close();
206 
207  UInt_t highPtFilterMask = 272;
208  TString deltaAODJetName = "AliAOD.Jets.root";
209  Float_t trackEtaWindow = 0.9;
210  Float_t centLow = 0;
211  Float_t centHigh = 0;
212  gROOT->Macro(Form("./AddJets.C((AliAnalysisManager*)%p,"
213  "%d,\"%s\",%d,%d,%d,%f,%f,%f);",
214  mgr, highPtFilterMask, deltaAODJetName.Data(),
215  jetanDelta, physicsSelection,
216  fOptions.AsInt("collision") == 1, // pbpb
217  trackEtaWindow, centLow, centHigh));
218  }
219  //------------------------------------------------------------------
221  {
222  Bool_t fwdMC = (mgr->GetMCtruthEventHandler() != 0 &&
223  fOptions.Has("track-refs"));
224 
225  CoupleCar("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/AddTaskForwardMult.C",
226  Form("%d", fwdMC));
227  }
228  //------------------------------------------------------------------
235  {
236 
237  fRailway->LoadLibrary("libCORRFW");
238  Bool_t physicsSelection = fOptions.Has("physics-selection");
239 
240  if (fOptions.Has("sys-info")) mgr->SetNSysInfo(100);
241 
242  const char* aliPhys = "$(ALICE_PHYSICS)";
243  // AliAnalysisTask* task = 0;
244  AliAnalysisTaskSE* seTask = 0;
245 
246  AliAnalysisManager::SetCommonFileName("AODQA.root");
247  if (fOptions.Has("pid-response")) CouplePidResponse();
248  if (fOptions.Has("pid-qa")) CouplePidQA();
249  if (fOptions.Has("high-pt")) CoupleHighPt();
250  if (fOptions.Has("esd-filter")) CoupleFilter();
251 
252  Bool_t vertexing = fOptions.Has("vertexing");
253  Bool_t d0Decay = fOptions.Has("d0-decay");
254  if (vertexing || d0Decay) {
255  TString src = "$ALICE_PHYSICS/PWGHF/vertexingHF/ConfigVertexingHF.C";
256  if (fOptions.AsInt("collision") == 1) src.ReplaceAll(".C", "highmult.C");
257  TFile::Cp(src, "ConfigVertexingHF.C");
258  fRailway->LoadAux("ConfigVertexingHF.C");
259  }
260 
261  if (vertexing) CoupleVertexing();
262  if (fOptions.Has("jpsi-filtering")) CoupleJPsiFilter();
263  if (d0Decay) CoupleD0Decay();
264  if (fOptions.Has("jetan")) CoupleJetAN();
265  if (fOptions.Has("forward-nch") && physicsSelection) CoupleForward();
266  }
267  //------------------------------------------------------------------
275  {
276  if (fOptions.Has("physics-selection"))
278  }
279  //------------------------------------------------------------------
287  {
288  if (fOptions.Has("centrality"))
290  }
291  //------------------------------------------------------------------
299  virtual AliVEventHandler* CreateMCHandler(UShort_t /*type*/, bool mc)
300  {
301  if (!mc) return 0;
302  AliMCEventHandler* mcHandler = new AliMCEventHandler();
303  mcHandler->SetReadTR(fOptions.Has("track-refs"));
304  return mcHandler;
305  }
306  //------------------------------------------------------------------
312  const char* ClassName() const { return "AODTrain"; }
313 };
314 //
315 // EOF
316 //
virtual void CreateCentralitySelection(Bool_t mc)
Definition: TrainSetup.C:760
virtual void CreateCentralitySelection(Bool_t mc)
Definition: AODTrain.C:286
void CoupleD0Decay()
Definition: AODTrain.C:110
void CouplePidResponse()
Definition: AODTrain.C:59
Railway * fRailway
Definition: TrainSetup.C:1674
virtual AliVEventHandler * CreateMCHandler(UShort_t, bool mc)
Definition: AODTrain.C:299
Int_t AsInt(const TString &name, Int_t def=0) const
Definition: Option.C:645
void CoupleFilter()
Definition: AODTrain.C:75
virtual void CreatePhysicsSelection(Bool_t mc, AliAnalysisManager *mgr)
Definition: AODTrain.C:274
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 CouplePidQA()
Definition: AODTrain.C:64
void CoupleForward()
Definition: AODTrain.C:220
void Set(const TString &name, const TString &value)
Definition: Option.C:736
const char * ClassName() const
Definition: AODTrain.C:312
void CoupleHighPt()
Definition: AODTrain.C:70
Base classs for train specifications.
void CoupleJPsiFilter()
Definition: AODTrain.C:101
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
Definition: Option.C:421
void CoupleVertexing()
Definition: AODTrain.C:90
virtual Bool_t LoadAux(const TString &name, Bool_t copy=false)
Definition: Railway.C:255
AODTrain(const char *name="myTest")
Definition: AODTrain.C:32
OptionList fOptions
Definition: TrainSetup.C:1673
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:841
virtual void CreatePhysicsSelection(Bool_t mc, AliAnalysisManager *mgr)
Definition: TrainSetup.C:694
void CoupleJetAN()
Definition: AODTrain.C:116
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
void CreateTasks(AliAnalysisManager *mgr)
Definition: AODTrain.C:234