1 AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calorimeter, Bool_t kUseKinematics = kFALSE, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE)
3 // Creates a PartCorr task, configures it and adds it to the analysis manager.
5 // Get the pointer to the existing analysis manager via the static access method.
6 //==============================================================================
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9 ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
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");
19 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
20 //cout<<"DATA TYPE :: "<<inputDataType<<endl;
21 // inputDataType: data managed by the input handler
22 // data: can be same as one managed by input handler, or the output AOD created by the filter. By default use AOD
25 //===========================================================================
28 AliCaloTrackReader * reader = 0x0;
29 if(data=="AOD") reader = new AliCaloTrackAODReader();
30 else if(data=="ESD") reader = new AliCaloTrackESDReader();
31 else if(data=="MC" && dataType == "ESD") reader = new AliCaloTrackMCReader();
32 //reader->SetDebug(10);//10 for lots of messages
33 reader->SwitchOnCTS();
34 if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
35 if(calorimeter == "EMCAL") {
36 reader->SwitchOnEMCALCells();
37 reader->SwitchOnEMCAL();
39 if(calorimeter == "PHOS") {
40 reader->SwitchOnPHOSCells();
41 reader->SwitchOnPHOS();
44 if(inputDataType == "ESD"){
45 reader->SwitchOnStack();
46 reader->SwitchOffAODMCParticles();
48 else if(inputDataType == "AOD"){
49 reader->SwitchOffStack();
50 reader->SwitchOnAODMCParticles();
55 reader->SetEMCALPtMin(0.1);
56 reader->SetPHOSPtMin(0.);
57 reader->SetCTSPtMin(0.);
58 if(kPrintSettings) reader->Print("");
60 // ##### Analysis algorithm settings ####
62 // --------------------
63 // --- Pi0 Analysis ---
64 // --------------------
66 AliCaloPID * pid = new AliCaloPID();
67 pid->SetDispersionCut(1.5);
68 pid->SetTOFCut(5.e-9);
70 if(kPrintSettings) pid->Print("");
72 AliFiducialCut * fidCut = new AliFiducialCut();
73 fidCut->DoCTSFiducialCut(kFALSE) ;
74 fidCut->DoEMCALFiducialCut(kTRUE) ;
75 fidCut->DoPHOSFiducialCut(kTRUE) ;
77 AliAnaCalorimeterQA *qa = new AliAnaCalorimeterQA();
78 qa->SetDebug(-1); //10 for lots of messages
79 qa->SetCalorimeter(calorimeter);
80 if(kUseKinematics && inputDataType!="AOD") qa->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
81 else qa->SwitchOffDataMC() ;
82 qa->AddToHistogramsName("AnaCaloQA_");
83 qa->SetFiducialCut(fidCut);
84 qa->SwitchOnFiducialCut();
85 if(qa=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
86 else qa->SetNumberOfModules(4); //EMCAL first year
87 //Set Histograms bins and ranges
88 qa->SetHistoPtRangeAndNBins(0, 50, 200) ;
89 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
90 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
91 if(kPrintSettings) qa->Print("");
93 AliFiducialCut * fidCut1stYear = new AliFiducialCut();
94 fidCut1stYear->DoCTSFiducialCut(kFALSE) ;
96 fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
97 fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
98 fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
99 fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
102 fidCut1stYear->DoEMCALFiducialCut(kFALSE) ;
103 fidCut1stYear->DoPHOSFiducialCut(kFALSE) ;
106 AliAnaPhoton *anaphoton1 = new AliAnaPhoton();
107 anaphoton1->SetDebug(-1); //10 for lots of messages
108 anaphoton1->SetMinPt(0.);
109 anaphoton1->SetMinDistanceToBadChannel(2, 4, 5);
110 anaphoton1->SetCaloPID(pid);
111 anaphoton1->SetCalorimeter(calorimeter);
112 if(kUseKinematics) anaphoton1->SwitchOnDataMC() ;//Access MC stack and fill more histograms
113 else anaphoton1->SwitchOffDataMC() ;
114 anaphoton1->SwitchOffCaloPID();
115 anaphoton1->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL
117 anaphoton1->SwitchOnFiducialCut();
118 anaphoton1->SetFiducialCut(fidCut1stYear);
120 anaphoton1->SetOutputAODName(Form("PhotonsForIM%s",calorimeter.Data()));
121 //Set Histograms bins and ranges
122 anaphoton1->SetHistoPtRangeAndNBins(0, 50, 200) ;
123 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
124 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
126 if(kPrintSettings) anaphoton1->Print("");
128 AliAnaPi0 *anapi0 = new AliAnaPi0();
129 anapi0->SetDebug(-1);//10 for lots of messages
130 anapi0->SetInputAODName(Form("PhotonsForIM%s",calorimeter.Data()));
131 anapi0->SetCaloPID(pid);
132 anapi0->SetCalorimeter(calorimeter);
133 anapi0->SwitchOnFiducialCut();
134 anapi0->SetNPID(1); //Available from tag AliRoot::v4-18-15-AN
135 anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms
136 if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
137 else anapi0->SetNumberOfModules(4); //EMCAL first year
138 if(kPrintSettings) anapi0->Print("");
141 // -------------------------------------------------
142 // --- Photon Isolation and Correlation Analysis ---
143 // -------------------------------------------------
145 AliAnaPhoton *anaphoton2 = new AliAnaPhoton();
146 anaphoton2->SetDebug(-1); //10 for lots of messages
147 anaphoton2->SetMinPt(2);
148 anaphoton2->SetCaloPID(pid);
149 anaphoton2->SetCalorimeter(calorimeter);
150 if(kUseKinematics) anaphoton2->SwitchOnDataMC() ;//Access MC stack and fill more histograms
151 else anaphoton2->SwitchOffDataMC() ;
152 anaphoton2->SwitchOffCaloPID();
153 anaphoton2->SwitchOffFiducialCut();
154 anaphoton2->SetOutputAODName(Form("Photons%s",calorimeter.Data()));
155 anaphoton2->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
156 anaphoton2->AddToHistogramsName("AnaPhotonCorr_");
157 //Set Histograms bins and ranges
158 anaphoton2->SetHistoPtRangeAndNBins(0, 50, 200) ;
159 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
160 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
161 if(kPrintSettings) anaphoton2->Print("");
162 // ### Isolation analysis ###
164 AliIsolationCut * ic = new AliIsolationCut();
165 ic->SetConeSize(0.4);
166 ic->SetPtThreshold(0.2);
167 ic->SetICMethod(AliIsolationCut::kPtThresIC);
168 if(kPrintSettings) ic->Print("");
170 AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
171 anaisol->SetDebug(-1);
172 anaisol->SetMinPt(2);
173 anaisol->SetInputAODName(Form("Photons%s",calorimeter.Data()));
174 anaisol->SetCalorimeter(calorimeter);
175 if(kUseKinematics) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms
176 else anaisol->SwitchOffDataMC() ;
177 //Select clusters with no pair, if both clusters with pi0 mass
178 anaisol->SwitchOffInvariantMass();
179 //anaisol->SetNeutralMesonSelection(nms);
181 anaisol->SetIsolationCut(ic);
182 //Do or not do isolation with previously produced AODs.
183 //No effect if use of SwitchOnSeveralIsolation()
184 anaisol->SwitchOffReIsolation();
186 anaisol->SwitchOffSeveralIsolation() ;
187 //Set Histograms bins and ranges
188 anaisol->SetHistoPtRangeAndNBins(0, 50, 200) ;
189 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
190 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
191 anaisol->AddToHistogramsName("AnaIsolPhoton_");
192 if(kPrintSettings) anaisol->Print("");
194 // ### Correlation with Jet Finder AOD output
195 AliAnaParticleJetFinderCorrelation *anacorrjet = new AliAnaParticleJetFinderCorrelation();
196 anacorrjet->SetInputAODName(Form("Photons%s",calorimeter.Data()));
197 anacorrjet->SwitchOffFiducialCut();
198 anacorrjet->SetDebug(-1);
199 anacorrjet->SetConeSize(1);
200 anacorrjet->SelectIsolated(kTRUE); // do correlation with isolated photons
201 anacorrjet->SetPtThresholdInCone(0.2);
202 anacorrjet->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts
203 anacorrjet->SetRatioCutRange(0.01,3); //Mostly Open Cuts
204 anacorrjet->UseJetRefTracks(kFALSE); //Not working now
205 //Set Histograms bins and ranges
206 anacorrjet->SetHistoPtRangeAndNBins(0, 50, 200) ;
207 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
208 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
209 if(kPrintSettings) anacorrjet->Print("");
211 // ### Correlation with hadrons
212 AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation();
213 anacorrhadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
214 anacorrhadron->SetOutputAODName(Form("CorrGammaHadrons%s",calorimeter.Data()));
215 anacorrhadron->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
216 anacorrhadron->AddToHistogramsName("AnaHadronCorrPhoton_");
217 anacorrhadron->SetDebug(-1);
218 anacorrhadron->SwitchOffCaloPID();
219 anacorrhadron->SwitchOffFiducialCut();
220 anacorrhadron->SetPtCutRange(0.1,100);
221 anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
222 anacorrhadron->SwitchOnSeveralUECalculation();
223 anacorrhadron->SelectIsolated(kFALSE); // do correlation with isolated photons
224 if(kUseKinematics) anacorrhadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
225 else anacorrhadron->SwitchOffDataMC() ;
226 //if(calorimeter=="PHOS"){
227 //Correlate with particles in EMCAL
228 //anacorrhadron->SwitchOnCaloPID();
229 //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
231 //Set Histograms bins and ranges
232 anacorrhadron->SetHistoPtRangeAndNBins(0, 50, 200) ;
233 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
234 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
235 if(kPrintSettings) anacorrhadron->Print("");
237 // ### Correlation with hadrons
238 AliAnaParticleHadronCorrelation *anacorrisohadron = new AliAnaParticleHadronCorrelation();
239 anacorrisohadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
240 anacorrisohadron->SetOutputAODName(Form("CorrIsoGammaHadrons%s",calorimeter.Data()));
241 anacorrisohadron->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
242 anacorrisohadron->AddToHistogramsName("AnaHadronCorrIsoPhoton_");
243 anacorrisohadron->SetDebug(-1);
244 anacorrisohadron->SwitchOffCaloPID();
245 anacorrisohadron->SwitchOffFiducialCut();
246 anacorrisohadron->SetPtCutRange(0.1,100);
247 anacorrisohadron->SetDeltaPhiCutRange(1.5,4.5);
248 anacorrisohadron->SwitchOnSeveralUECalculation();
249 anacorrisohadron->SelectIsolated(kTRUE); // do correlation with isolated photons
250 if(kUseKinematics) anacorrisohadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
251 else anacorrisohadron->SwitchOffDataMC() ;
252 //if(calorimeter=="PHOS"){
253 //Correlate with particles in EMCAL
254 //anacorrhadron->SwitchOnCaloPID();
255 //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
257 //Set Histograms bins and ranges
258 anacorrisohadron->SetHistoPtRangeAndNBins(0, 50, 200) ;
259 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
260 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
261 if(kPrintSettings) anacorrisohadron->Print("");
264 AliNeutralMesonSelection *nms = new AliNeutralMesonSelection();
265 nms->SetInvMassCutRange(0.05, 0.2) ;
266 nms->KeepNeutralMesonSelectionHistos(kTRUE);
267 //Set Histrograms bins and ranges
268 nms->SetHistoERangeAndNBins(0, 50, 200) ;
269 // nms->SetHistoPtRangeAndNBins(0, 50, 100) ;
270 // nms->SetHistoAngleRangeAndNBins(0, 0.3, 100) ;
271 // nsm->SetHistoIMRangeAndNBins(0, 0.4, 100) ;
273 AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
274 anapi0ebe->SetDebug(-1);//10 for lots of messages
275 anapi0ebe->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
276 anapi0ebe->SetMinPt(2);
277 anapi0ebe->SetCalorimeter(calorimeter);
278 anapi0ebe->SetInputAODName(Form("Photons%s",calorimeter.Data()));
279 anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
280 anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
281 if(kUseKinematics) anapi0ebe->SwitchOnDataMC() ;//Access MC stack and fill more histograms
282 else anapi0ebe->SwitchOffDataMC() ;
283 anapi0ebe->SetNeutralMesonSelection(nms);
284 //Set Histrograms bins and ranges
285 anapi0ebe->SetHistoPtRangeAndNBins(0, 50, 200) ;
286 // anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
287 // anapi0->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
288 if(kPrintSettings) anapi0ebe->Print("");
290 AliAnaParticleIsolation *anaisolpi0 = new AliAnaParticleIsolation();
291 anaisolpi0->SetDebug(-1);
292 anaisolpi0->SetMinPt(2);
293 anaisolpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
294 anaisolpi0->AddToHistogramsName("AnaIsolPi0_");
295 anaisolpi0->SetCalorimeter(calorimeter);
296 if(kUseKinematics) anaisolpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
297 else anaisolpi0->SwitchOffDataMC() ;
298 //Select clusters with no pair, if both clusters with pi0 mass
299 anaisolpi0->SwitchOffInvariantMass();
300 //anaisol->SetNeutralMesonSelection(nms);
302 anaisolpi0->SetIsolationCut(ic);
303 //Do or not do isolation with previously produced AODs.
304 //No effect if use of SwitchOnSeveralIsolation()
305 anaisolpi0->SwitchOffReIsolation();
307 anaisolpi0->SwitchOffSeveralIsolation() ;
308 //Set Histograms bins and ranges
309 anaisolpi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
310 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
311 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
312 if(kPrintSettings) anaisol->Print("");
315 // ### Pi0 Correlation with hadrons, not isolated
316 AliAnaParticleHadronCorrelation *anacorrhadronpi0 = new AliAnaParticleHadronCorrelation();
317 anacorrhadronpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
318 anacorrhadronpi0->SetOutputAODName(Form("CorrPi0Hadrons%s",calorimeter.Data()));
319 anacorrhadronpi0->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
320 anacorrhadronpi0->AddToHistogramsName("AnaHadronCorrPi0_");
321 anacorrhadronpi0->SetDebug(-1);
322 anacorrhadronpi0->SwitchOffCaloPID();
323 anacorrhadronpi0->SwitchOffFiducialCut();
324 anacorrhadronpi0->SetPtCutRange(0.1,100);
325 anacorrhadronpi0->SetDeltaPhiCutRange(1.5,4.5);
326 anacorrhadronpi0->SelectIsolated(kFALSE); // do correlation with isolated photons
327 if(kUseKinematics) anacorrhadronpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
328 else anacorrhadronpi0->SwitchOffDataMC() ;
329 //if(calorimeter=="PHOS"){
330 // //Correlate with particles in EMCAL
331 // anacorrhadronpi0->SwitchOnCaloPID();
332 // anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
334 //Set Histograms bins and ranges
335 anacorrhadronpi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
336 // ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
337 // ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
338 if(kPrintSettings) anacorrhadronpi0->Print("");
341 // #### Configure Maker ####
342 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
343 maker->SetReader(reader);//pointer to reader
344 maker->AddAnalysis(qa,0);
345 maker->AddAnalysis(anaphoton1,1);
346 maker->AddAnalysis(anapi0,2);
347 maker->AddAnalysis(anaphoton2,3);
348 maker->AddAnalysis(anaisol,4);
349 maker->AddAnalysis(anacorrjet,5);
350 maker->AddAnalysis(anacorrhadron,6);
351 maker->AddAnalysis(anacorrisohadron,7);
352 maker->AddAnalysis(anapi0ebe,8);
353 maker->AddAnalysis(anaisolpi0,9);
354 maker->AddAnalysis(anacorrhadronpi0,10);
356 maker->SetAnaDebug(-1) ;
357 maker->SwitchOnHistogramsMaker() ;
358 maker->SwitchOnAODsMaker() ;
359 if(kPrintSettings) maker->Print("");
361 printf("======================== \n");
362 printf(" End Configuration of PartCorr analysis with detector %s \n",calorimeter.Data());
363 printf("======================== \n");
366 //===========================================================================
367 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (Form("PartCorr%s",calorimeter.Data()));
368 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
369 //task->SetDebugLevel(-1);
370 task->SetAnalysisMaker(maker);
374 sprintf(name,"PartCorr_%s",calorimeter.Data());
375 cout<<"Name of task "<<name<<endl;
376 //AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form(name),TList::Class(),
377 // AliAnalysisManager::kOutputContainer, Form("PartCorr_%s.root",calorimeter.Data()));
379 TString outputfile = AliAnalysisManager::GetCommonFileName();
380 // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("PartCorr_%s",calorimeter.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr_%s",outputfile.Data(),calorimeter.Data()));
381 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(calorimeter.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr",outputfile.Data()));
383 // Create ONLY the output containers for the data produced by the task.
384 // Get and connect other common input/output containers via the manager as below
385 //==============================================================================
386 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
387 // AOD output slot will be used in a different way in future
388 mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
389 mgr->ConnectOutput (task, 1, cout_pc);