Clean up obsolte methods
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskPartCorr.C
CommitLineData
90eb3a19 1AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(Char_t * analysis, TString data, TString calorimeter)
2{
3 // Creates a PartCorr task, configures it and adds it to the analysis manager.
4
5 // Get the pointer to the existing analysis manager via the static access method.
6 //==============================================================================
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8 if (!mgr) {
9 ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
10 return NULL;
11 }
12
13 // Check the analysis type using the event handlers connected to the analysis manager.
14 //==============================================================================
15 if (!mgr->GetInputEventHandler()) {
16 ::Error("AddTaskPartCorr", "This task requires an input event handler");
17 return NULL;
18 }
19 //TString dataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
20
21 // Configure analysis
22 //===========================================================================
23
24 //Reader
25 AliCaloTrackReader * reader = 0x0;
26 if(data=="AOD") reader = new AliCaloTrackAODReader();
27 else if(data=="ESD") reader = new AliCaloTrackESDReader();
28 else if(data=="MC") reader = new AliCaloTrackMCReader();
29 reader->SetDebug(-1);//10 for lots of messages
30
31 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
32 switch (analysis) {
33 case "Pi0":
34 AnalysisPi0(maker,reader,calorimeter);
35 break;
36 case "GammaJetFinder":
37 //JETAN must run before
38 AnalysisGammaJetFinderCorrelation(maker,reader,calorimeter);
39 break;
40 case "GammaHadron":
41 AnalysisGammaHadronCorrelation(maker,reader,calorimeter);
42 break;
43 }
44
45
46 // Create task
47 //===========================================================================
48 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (analysis);
49 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
fbeaf916 50 //task->SetDebugLevel(-1);
90eb3a19 51 task->SetAnalysisMaker(maker);
52 mgr->AddTask(task);
53
54 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("%s", analysis),TList::Class(),
55 AliAnalysisManager::kOutputContainer, Form("%s_%s.root",analysis,calorimeter.Data()));
56
57 // Create ONLY the output containers for the data produced by the task.
58 // Get and connect other common input/output containers via the manager as below
59 //==============================================================================
60 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
61 // AOD output slot will be used in a different way in future
62 mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
63 mgr->ConnectOutput (task, 1, cout_pc);
64
65 return task;
66}
67
68//_________________________________________________________________________________________________
69void AnalysisPi0(AliAnaPartCorrMaker * maker, AliCaloTrackReader * reader, TString calorimeter){
70 //Configuration for pi0 invariant mass analysis
71
72 // #### Reader ####
73 //Switch on or off the detectors
74 if(calorimeter=="EMCAL"){
75 reader->SwitchOnEMCAL();
76 reader->SwitchOffPHOS();
77 }
78 else if(calorimeter=="PHOS"){
79 reader->SwitchOffEMCAL();
80 reader->SwitchOnPHOS();
81 }
82 else if {
83 printf("ABORT analysis: Wrong calorimeter in configuration: %s\n",calorimeter.Data());
84 abort();
85 }
86 reader->SwitchOffCTS();
87
88 //Min particle pT
89 reader->SetEMCALPtMin(0.5);
90 reader->SetPHOSPtMin(0.5);
91 reader->Print("");
92
93 // ##### Analysis algorithm ####
94
95 AliCaloPID * pid = new AliCaloPID();
96 pid->SetDispersionCut(1.5);
97 pid->SetTOFCut(5.e-9);
98 pid->SetDebug(-1);
99 pid->Print("");
100
101 AliAnaPhoton *anaphoton = new AliAnaPhoton();
102 anaphoton->SetDebug(-1); //10 for lots of messages
103 //anaphoton->SetMinPt(0.5);
104 anaphoton->SetMinDistanceToBadChannel(2, 4, 5);
105 anaphoton->SetCaloPID(pid);
106 anaphoton->SetCalorimeter(calorimeter);
107 anaphoton->SwitchOffDataMC() ;//Access MC stack and fill more histograms
108 anaphoton->SwitchOffCaloPID();
109 anaphoton->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL
110 anaphoton->SwitchOffFidutialCut();
111 anaphoton->SetOutputAODName("Photons"+calorimeter);
112 anaphoton->SetOutputAODClassName("AliAODPWG4Particle");
113
114 AliAnaPi0 *anapi0 = new AliAnaPi0();
115 anapi0->SetDebug(-1);//10 for lots of messages
116 anapi0->SetInputAODName("Photons"+calorimeter);
117 anapi0->SetCaloPID(pid);
118 anapi0->SetCalorimeter(calorimeter);
119 anapi0->SwitchOnFidutialCut();
120 anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms
121 anapi0->Print("");
122
123 // #### Configure Maker ####
124 maker->SetReader(reader);//pointer to reader
125 maker->AddAnalysis(anaphoton,0);
126 maker->AddAnalysis(anapi0,1);
127 maker->SetAnaDebug(-1) ;
128 maker->SwitchOnHistogramsMaker() ;
129 maker->SwitchOnAODsMaker() ;
130 maker->Print("");
131 //
132 printf("======================== \n");
133 printf("End Configuration of AnalysisPi0() \n");
134 printf("======================== \n");
135
136
137}
138//_________________________________________________________________________________________________
139void AnalysisGammaJetFinderCorrelation(AliAnaPartCorrMaker * maker, AliCaloTrackReader * reader, TString calorimeter){
140 //Configuration for pi0 invariant mass analysis
141
142 // #### Reader ####
143 //Switch on or off the detectors
144 if(calorimeter=="PHOS")
145 reader->SwitchOnPHOS();
146 else if(calorimeter=="EMCAL")
147 reader->SwitchOffPHOS();
148 else if {
149 printf("ABORT analysis: Wrong calorimeter in configuration: %s\n",calorimeter.Data());
150 abort();
151 }
152 reader->SwitchOnEMCAL();
153 reader->SwitchOnCTS();
154
155 //Min particle pT
156 reader->SetEMCALPtMin(0.5);
157 reader->SetPHOSPtMin(0.5);
158 reader->SetCTSPtMin(0.1);
159 reader->Print("");
160
161 // ##### Analysis algorithm ####
162 // ### Photon analysis ###
163 //AliCaloPID * pid = new AliCaloPID();
164 //pid->Print("");
165
166 AliAnaPhoton *anaphoton = new AliAnaPhoton();
167 anaphoton->SetDebug(-1); //10 for lots of messages
168 anaphoton->SetMinPt(5);
169 //anaphoton->SetCaloPID(pid);
170 anaphoton->SetCalorimeter(calorimeter);
171 anaphoton->SwitchOffDataMC() ;//Access MC stack and fill more histograms
172 anaphoton->SwitchOnCaloPID();
173 if(calorimeter == "EMCAL") anaphoton->SwitchOnCaloPIDRecalculation();
174 anaphoton->SwitchOffFidutialCut();
175 anaphoton->SetOutputAODName("DirectPhotonsJet"+calorimeter);
176 anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
177
178 // ### Isolation analysis ###
179
180 AliIsolationCut * ic = new AliIsolationCut();
181 ic->SetConeSize(0.5);
182 ic->SetPtThreshold(1.);
183 ic->SetICMethod(AliIsolationCut::kPtThresIC);
184 ic->Print("");
185
186 AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
187 anaisol->SetDebug(-1);
188 //anaisol->SetMinPt(5);
189 anaisol->SetInputAODName("DirectPhotonsJet"+calorimeter);
190 anaisol->SetCalorimeter(calorimeter);
191 anaisol->SwitchOffDataMC() ;//Access MC stack and fill more histograms
192 //Select clusters with no pair, if both clusters with pi0 mass
193 anaisol->SwitchOffInvariantMass();
194 //anaisol->SetNeutralMesonSelection(nms);
195 //Do isolation cut
196 anaisol->SetIsolationCut(ic);
197 //Do or not do isolation with previously produced AODs.
198 //No effect if use of SwitchOnSeveralIsolation()
199 anaisol->SwitchOffReIsolation();
200 //Multiple IC
201 anaisol->SwitchOffSeveralIsolation() ;
202 anaisol->Print("");
203
204 // ### Correlatio with Jet Finder AOD output
205 AliAnaParticleJetFinderCorrelation *anacorr = new AliAnaParticleJetFinderCorrelation();
206 anacorr->SetInputAODName("DirectPhotonsJet"+calorimeter);
207 anacorr->SwitchOffFidutialCut();
208 anacorr->SetDebug(-1);
209 anacorr->SetConeSize(1);
210 anacorr->SelectIsolated(kTRUE); // do correlation with isolated photons
211 anacorr->SetPtThresholdInCone(0.2);
212 anacorr->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts
213 anacorr->SetRatioCutRange(0.01,3); //Mostly Open Cuts
214 anacorr->UseJetRefTracks(kFALSE); //Not working now
215 anacorr->Print("");
216
217 // #### Configure Maker ####
218 maker->SetReader(reader);//pointer to reader
219 maker->AddAnalysis(anaphoton,0);
220 maker->AddAnalysis(anaisol,1);
221 maker->AddAnalysis(anacorr,2);
222 maker->SetAnaDebug(-1) ;
223 maker->SwitchOnHistogramsMaker() ;
224 maker->SwitchOnAODsMaker() ;
225 maker->Print("");
226 //
227 printf("======================== \n");
228 printf("End Configuration of AnalysisGammaJetFinderCorrelation() \n");
229 printf("======================== \n");
230
231
232}
233
234
235//_________________________________________________________________________________________________
236void AnalysisGammaHadronCorrelation(AliAnaPartCorrMaker * maker, AliCaloTrackReader * reader, TString calorimeter){
237 //Configuration for pi0 invariant mass analysis
238
239 // #### Reader ####
240 //Switch on or off the detectors
241 if(calorimeter=="PHOS")
242 reader->SwitchOnPHOS();
243 else if(calorimeter=="EMCAL")
244 reader->SwitchOffPHOS();
245 else if {
246 printf("ABORT analysis: Wrong calorimeter in configuration: %s\n",calorimeter.Data());
247 abort();
248 }
249 reader->SwitchOnEMCAL();
250 reader->SwitchOnCTS();
251
252 //Min particle pT
253 reader->SetEMCALPtMin(0.5);
254 reader->SetPHOSPtMin(0.5);
255 reader->SetCTSPtMin(0.1);
256 reader->Print("");
257
258 // ##### Analysis algorithm ####
259 // ### Photon analysis ###
260 //AliCaloPID * pid = new AliCaloPID();
261 //pid->Print("");
262
263 AliAnaPhoton *anaphoton = new AliAnaPhoton();
264 anaphoton->SetDebug(-1); //10 for lots of messages
265 anaphoton->SetMinPt(5);
266 //anaphoton->SetCaloPID(pid);
267 anaphoton->SetCalorimeter(calorimeter);
268 anaphoton->SwitchOffDataMC() ;//Access MC stack and fill more histograms
269 anaphoton->SwitchOnCaloPID();
270 if(calorimeter == "EMCAL") anaphoton->SwitchOnCaloPIDRecalculation();
271 anaphoton->SwitchOffFidutialCut();
272 anaphoton->SetOutputAODName("DirectPhotonsHadron"+calorimeter);
273 anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
274
275 // ### Isolation analysis ###
276
277 AliIsolationCut * ic = new AliIsolationCut();
278 ic->SetConeSize(0.5);
279 ic->SetPtThreshold(1.);
280 ic->SetICMethod(AliIsolationCut::kPtThresIC);
281 ic->Print("");
282
283 AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
284 anaisol->SetDebug(-1);
285 //anaisol->SetMinPt(5);
286 anaisol->SetInputAODName("DirectPhotonsHadron"+calorimeter);
287 anaisol->SetCalorimeter(calorimeter);
288 anaisol->SwitchOffDataMC() ;//Access MC stack and fill more histograms
289 //Select clusters with no pair, if both clusters with pi0 mass
290 anaisol->SwitchOffInvariantMass();
291 //anaisol->SetNeutralMesonSelection(nms);
292 //Do isolation cut
293 anaisol->SetIsolationCut(ic);
294 //Do or not do isolation with previously produced AODs.
295 //No effect if use of SwitchOnSeveralIsolation()
296 anaisol->SwitchOffReIsolation();
297 //Multiple IC
298 anaisol->SwitchOffSeveralIsolation() ;
299 anaisol->Print("");
300
301 // ### Correlation with hadrons
302 AliAnaParticleHadronCorrelation *anacorr = new AliAnaParticleHadronCorrelation();
303 anacorr->SetInputAODName("DirectPhotonsHadron"+calorimeter);
304 anacorr->SetDebug(-1);
305 anacorr->SwitchOffFidutialCut();
306 anacorr->SetPtCutRange(1,100);
307 anacorr->SetDeltaPhiCutRange(1.5,4.5);
308 if(calorimeter=="PHOS"){
309 //Correlate with particles in EMCAL
310 anacorr->SwitchOnCaloPID();
311 anacorr->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
312 }
313 anacorr->Print("");
314
315 // #### Configure Maker ####
316 maker->SetReader(reader);//pointer to reader
317 maker->AddAnalysis(anaphoton,0);
318 maker->AddAnalysis(anaisol,1);
319 maker->AddAnalysis(anacorr,2);
320 maker->SetAnaDebug(-1) ;
321 maker->SwitchOnHistogramsMaker() ;
322 maker->SwitchOnAODsMaker() ;
323 maker->Print("");
324 //
325 printf("======================== \n");
326 printf("End Configuration of AnalysisGammaJetFinderCorrelation() \n");
327 printf("======================== \n");
328
329}