]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/macros/AddTaskPartCorr.C
1) Changes needed to read deltaAODs as input, handling of acces to delta AO branches...
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskPartCorr.C
1 AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString data, TString calorimeter, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE)
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 inputDataType = "AOD";
20    if(!data.Contains("delta"))
21            inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
22    //cout<<"DATA TYPE :: "<<inputDataType<<endl;
23    // inputDataType: data managed by the input handler
24    // data: can be same as one managed by input handler, or the output AOD created by the filter. By default use AOD
25    
26    Bool_t kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
27
28    cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
29
30    // Configure analysis
31    //===========================================================================
32    
33    //Reader
34    AliCaloTrackReader * reader = 0x0;
35    if(data.Contains("AOD")) reader = new AliCaloTrackAODReader();
36    else if(data=="ESD") reader = new AliCaloTrackESDReader();
37    else if(data=="MC" && dataType == "ESD") reader = new AliCaloTrackMCReader();
38    //reader->SetDebug(10);//10 for lots of messages
39    reader->SwitchOnCTS();
40    //reader->SetDeltaAODFileName("");
41    //if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
42   if(calorimeter == "EMCAL") {
43     reader->SwitchOnEMCALCells();  
44     reader->SwitchOnEMCAL();
45   }
46   if(calorimeter == "PHOS") { 
47     reader->SwitchOnPHOSCells();  
48     reader->SwitchOnPHOS();
49   }
50         printf("data");
51   // for case data="deltaAOD", no need to fill the EMCAL/PHOS cluster lists
52   if(data.Contains("delta")){
53         reader->SwitchOffEMCAL();
54         reader->SwitchOffPHOS();
55         reader->SwitchOffEMCALCells(); 
56         reader->SwitchOffPHOSCells(); 
57   }
58         
59   if(kUseKinematics){
60     if(inputDataType == "ESD"){
61       reader->SwitchOnStack();          
62       reader->SwitchOffAODMCParticles(); 
63     }
64     else if(inputDataType == "AOD"){
65       reader->SwitchOffStack();          
66       reader->SwitchOnAODMCParticles(); 
67     }
68   }
69   
70   //Min particle pT
71   reader->SetEMCALPtMin(0.1); 
72   reader->SetPHOSPtMin(0.);
73   reader->SetCTSPtMin(0.);
74   if(kPrintSettings) reader->Print("");
75   
76   // ##### Analysis algorithm settings ####
77   
78   // --------------------
79   // --- QA Analysis ---
80   // --------------------
81   
82   AliCaloPID * pid = new AliCaloPID();
83   pid->SetDispersionCut(1.5);
84   pid->SetTOFCut(5.e-9);
85   pid->SetDebug(-1);
86   if(kPrintSettings) pid->Print("");
87         
88   AliFiducialCut * fidCut1stYear = new AliFiducialCut();
89   fidCut1stYear->DoCTSFiducialCut(kFALSE) ;
90   if(kSimulation){
91     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
92     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
93     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
94     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
95   } 
96   else{
97     fidCut1stYear->DoEMCALFiducialCut(kFALSE) ;
98     fidCut1stYear->DoPHOSFiducialCut(kFALSE) ;
99   }     
100   
101 //  AliFiducialCut * fidCut = new AliFiducialCut();
102 //  fidCut->DoCTSFiducialCut(kFALSE) ;
103 //  fidCut->DoEMCALFiducialCut(kTRUE) ;
104 //  fidCut->DoPHOSFiducialCut(kTRUE) ;
105         
106   AliAnaCalorimeterQA *qa = new AliAnaCalorimeterQA();
107   //qa->SetDebug(10); //10 for lots of messages
108   qa->SetCalorimeter(calorimeter);
109   if(kUseKinematics && inputDataType!="AOD") qa->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
110   else  qa->SwitchOffDataMC() ;
111   qa->AddToHistogramsName("AnaCaloQA_");
112   if(kSimulation){
113     qa->SetFiducialCut(fidCut1stYear);
114     qa->SwitchOnFiducialCut();
115   }
116   if(qa=="PHOS") qa->SetNumberOfModules(3); //PHOS first year
117   else  qa->SetNumberOfModules(4); //EMCAL first year
118   //Set Histograms bins and ranges
119   qa->SetHistoPtRangeAndNBins(0, 50, 500) ;
120   qa->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
121   if(calorimeter == "PHOS"){
122     qa->SetHistoEtaRangeAndNBins(-0.13, 0.13, 100) ;
123     qa->SetHistoPhiRangeAndNBins(250*TMath::DegToRad(), 330*TMath::DegToRad() , 200) ;
124   }
125   else if(calorimeter == "EMCAL"){
126     qa->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ;
127     qa->SetHistoPhiRangeAndNBins(70*TMath::DegToRad(), 130*TMath::DegToRad(), 200) ;
128   }
129   qa->SetHistoMassRangeAndNBins(0., 0.6, 300) ;
130   qa->SetHistoAsymmetryRangeAndNBins(0., 1. , 25) ;
131   qa->SetHistoPOverERangeAndNBins(0,10.,100);
132   qa->SetHistodEdxRangeAndNBins(0.,400.,200);
133   qa->SetHistodRRangeAndNBins(0.,TMath::Pi(),300);
134   qa->SetHistoTimeRangeAndNBins(0.,1000,1000);
135   qa->SetHistoRatioRangeAndNBins(0.,2.,100);
136   qa->SetHistoVertexDistRangeAndNBins(0.,500.,100);
137   qa->SetHistoNClusterCellRangeAndNBins(0,300,300);
138         
139   if(kPrintSettings) qa->Print("");     
140   
141         
142   // --------------------
143   // --- Pi0 Analysis ---
144   // --------------------
145
146   AliAnaPhoton *anaphoton1 = new AliAnaPhoton();
147   anaphoton1->SetDebug(-1); //10 for lots of messages
148   anaphoton1->SetMinPt(0.);
149   anaphoton1->SetMinDistanceToBadChannel(2, 4, 5);
150   anaphoton1->SetCaloPID(pid);
151   anaphoton1->SetCalorimeter(calorimeter);
152   if(kUseKinematics) anaphoton1->SwitchOnDataMC() ;//Access MC stack and fill more histograms
153   else  anaphoton1->SwitchOffDataMC() ;
154   anaphoton1->SwitchOffCaloPID();
155   anaphoton1->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL
156   if(kSimulation){
157     anaphoton1->SwitchOnFiducialCut();
158     anaphoton1->SetFiducialCut(fidCut1stYear);
159   }
160         
161   if(!data.Contains("delta")) anaphoton1->SetOutputAODName(Form("PhotonsForIM%s",calorimeter.Data()));
162   else                        anaphoton1->SetInputAODName (Form("PhotonsForIM%s",calorimeter.Data()));
163   //Set Histograms bins and ranges
164   anaphoton1->SetHistoPtRangeAndNBins(0, 50, 500) ;
165   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
166   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
167   
168   if(kPrintSettings) anaphoton1->Print("");
169
170   AliAnaPi0 *anapi0 = new AliAnaPi0();
171   anapi0->SetDebug(-1);//10 for lots of messages
172   anapi0->SetInputAODName(Form("PhotonsForIM%s",calorimeter.Data()));
173   anapi0->SetCaloPID(pid);
174   anapi0->SetCalorimeter(calorimeter);
175   if(kSimulation){
176                 anapi0->SwitchOnFiducialCut();
177                 anapi0->SetFiducialCut(fidCut1stYear);
178   }  
179   anapi0->SetNPID(1); //Available from tag AliRoot::v4-18-15-AN
180   //settings for pp collision
181   anapi0->SetNCentrBin(1);
182   anapi0->SetNZvertBin(1);
183   anapi0->SetNRPBin(1);
184   anapi0->SetNMaxEvMix(10);
185   anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms
186   if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
187   else  anapi0->SetNumberOfModules(4); //EMCAL first year
188   anapi0->SetHistoPtRangeAndNBins(0, 50, 500) ;
189   //anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
190   //anapi0->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ;
191   anapi0->SetHistoMassRangeAndNBins(0., 0.6, 300) ;
192   anapi0->SetHistoAsymmetryRangeAndNBins(0., 1. , 10) ;
193   if(kPrintSettings) anapi0->Print("");
194   
195   
196   // -------------------------------------------------
197   // --- Photon Isolation and Correlation Analysis ---
198   // -------------------------------------------------
199   
200   AliAnaPhoton *anaphoton2 = new AliAnaPhoton();
201   anaphoton2->SetDebug(-1); //10 for lots of messages
202   anaphoton2->SetMinPt(0.);
203   anaphoton2->SetCaloPID(pid);
204   anaphoton2->SetCalorimeter(calorimeter);
205   if(kUseKinematics) anaphoton2->SwitchOnDataMC() ;//Access MC stack and fill more histograms
206   else  anaphoton2->SwitchOffDataMC() ;
207   anaphoton2->SwitchOffCaloPID();
208   anaphoton2->SwitchOffFiducialCut();
209   if(kSimulation){
210                 anaphoton2->SwitchOnFiducialCut();
211                 anaphoton2->SetFiducialCut(fidCut1stYear);
212   }
213         
214   if(!data.Contains("delta")) {
215                 anaphoton2->SetOutputAODName(Form("Photons%s",calorimeter.Data()));
216                 anaphoton2->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
217   }
218   else anaphoton2->SetInputAODName(Form("Photons%s",calorimeter.Data()));
219   anaphoton2->AddToHistogramsName("AnaPhotonCorr_");
220   //Set Histograms bins and ranges
221   anaphoton2->SetHistoPtRangeAndNBins(0, 50, 500) ;
222   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
223   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
224   if(kPrintSettings) anaphoton2->Print("");
225   // ### Isolation analysis ### 
226   
227   AliIsolationCut * ic = new AliIsolationCut();
228   ic->SetConeSize(0.4);
229   ic->SetPtThreshold(0.2);
230   ic->SetICMethod(AliIsolationCut::kPtThresIC);
231   if(kPrintSettings) ic->Print("");
232   
233   AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
234   anaisol->SetDebug(-1);
235   anaisol->SetMinPt(0);
236   anaisol->SetInputAODName(Form("Photons%s",calorimeter.Data()));
237   anaisol->SetCalorimeter(calorimeter);
238   if(kUseKinematics) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms
239   else  anaisol->SwitchOffDataMC() ;
240   //Select clusters with no pair, if both clusters with pi0 mass
241   anaisol->SwitchOffInvariantMass();
242   //anaisol->SetNeutralMesonSelection(nms);
243   //Do isolation cut
244   anaisol->SetIsolationCut(ic); 
245   //Do or not do isolation with previously produced AODs.
246   //No effect if use of SwitchOnSeveralIsolation()
247   anaisol->SwitchOffReIsolation();
248   //Multiple IC
249   anaisol->SwitchOffSeveralIsolation() ;
250   //Set Histograms bins and ranges
251   anaisol->SetHistoPtRangeAndNBins(0, 50, 500) ;
252   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
253   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
254   anaisol->AddToHistogramsName("AnaIsolPhoton_");
255   if(kPrintSettings) anaisol->Print("");
256   
257   // ### Correlation with Jet Finder AOD output
258   AliAnaParticleJetFinderCorrelation *anacorrjet = new AliAnaParticleJetFinderCorrelation();
259   anacorrjet->SetInputAODName(Form("Photons%s",calorimeter.Data()));
260   anacorrjet->SwitchOffFiducialCut();
261   anacorrjet->SetDebug(-1);
262   anacorrjet->SetConeSize(1);  
263   anacorrjet->SelectIsolated(kTRUE); // do correlation with isolated photons
264   anacorrjet->SetPtThresholdInCone(0.2);
265   anacorrjet->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts 
266   anacorrjet->SetRatioCutRange(0.01,3); //Mostly Open Cuts
267   anacorrjet->UseJetRefTracks(kFALSE); //Not working now
268   //Set Histograms bins and ranges
269   anacorrjet->SetHistoPtRangeAndNBins(0, 50, 500) ;
270   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
271   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
272   if(kPrintSettings) anacorrjet->Print("");
273   
274   // ### Correlation with hadrons
275   AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation();
276   anacorrhadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
277   if(!data.Contains("delta")) {
278           anacorrhadron->SetOutputAODName(Form("CorrGammaHadrons%s",calorimeter.Data()));
279           anacorrhadron->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
280   }
281   else anacorrhadron->SetInputAODName(Form("CorrGammaHadrons%s",calorimeter.Data()));
282         
283   anacorrhadron->AddToHistogramsName("AnaHadronCorrPhoton_");
284   anacorrhadron->SetDebug(-1);
285   anacorrhadron->SwitchOffCaloPID();
286   anacorrhadron->SwitchOffFiducialCut();
287   anacorrhadron->SetPtCutRange(0.1,100);
288   anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
289   anacorrhadron->SwitchOnSeveralUECalculation();
290   anacorrhadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
291   anacorrhadron->SelectIsolated(kFALSE); // do correlation with isolated photons
292   if(kUseKinematics) anacorrhadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
293   else  anacorrhadron->SwitchOffDataMC() ;
294   //if(calorimeter=="PHOS"){
295   //Correlate with particles in EMCAL
296   //anacorrhadron->SwitchOnCaloPID();
297   //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
298   //}
299   //Set Histograms bins and ranges
300   anacorrhadron->SetHistoPtRangeAndNBins(0, 50, 500) ;
301   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
302   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
303   if(kPrintSettings) anacorrhadron->Print("");
304   
305   // ### Correlation with hadrons
306   AliAnaParticleHadronCorrelation *anacorrisohadron = new AliAnaParticleHadronCorrelation();
307   anacorrisohadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
308   if(!data.Contains("delta")) {
309           anacorrisohadron->SetOutputAODName(Form("CorrIsoGammaHadrons%s",calorimeter.Data()));
310           anacorrisohadron->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
311   }
312   else  anacorrisohadron->SetInputAODName(Form("CorrIsoGammaHadrons%s",calorimeter.Data()));
313         
314   anacorrisohadron->AddToHistogramsName("AnaHadronCorrIsoPhoton_");
315   anacorrisohadron->SetDebug(-1);
316   anacorrisohadron->SwitchOffCaloPID();
317   anacorrisohadron->SwitchOffFiducialCut();
318   anacorrisohadron->SetPtCutRange(0.1,100);
319   anacorrisohadron->SetDeltaPhiCutRange(1.5,4.5);
320   anacorrisohadron->SwitchOnSeveralUECalculation();
321   anacorrisohadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
322   anacorrisohadron->SelectIsolated(kTRUE); // do correlation with isolated photons
323   if(kUseKinematics) anacorrisohadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
324   else  anacorrisohadron->SwitchOffDataMC() ;
325   //if(calorimeter=="PHOS"){
326   //Correlate with particles in EMCAL
327   //anacorrhadron->SwitchOnCaloPID();
328   //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
329   //}
330   //Set Histograms bins and ranges
331   anacorrisohadron->SetHistoPtRangeAndNBins(0, 50, 500) ;
332   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
333   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
334   if(kPrintSettings) anacorrisohadron->Print("");
335   
336   
337   AliNeutralMesonSelection *nms = new AliNeutralMesonSelection();
338   nms->SetInvMassCutRange(0.05, 0.2)     ;
339   nms->KeepNeutralMesonSelectionHistos(kTRUE);
340   //Set Histrograms bins and ranges
341   nms->SetHistoERangeAndNBins(0, 50, 500) ;
342   //      nms->SetHistoPtRangeAndNBins(0, 50, 100) ;
343   //      nms->SetHistoAngleRangeAndNBins(0, 0.3, 100) ;
344   //      nsm->SetHistoIMRangeAndNBins(0, 0.4, 100) ;  
345   
346   AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
347   anapi0ebe->SetDebug(-1);//10 for lots of messages
348   anapi0ebe->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
349   anapi0ebe->SetMinPt(0);
350   anapi0ebe->SetCalorimeter(calorimeter);
351   anapi0ebe->SetInputAODName(Form("Photons%s",calorimeter.Data()));
352   if(!data.Contains("delta")) {
353           anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
354           anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
355   }
356   else  anapi0ebe->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
357         
358   if(kUseKinematics) anapi0ebe->SwitchOnDataMC() ;//Access MC stack and fill more histograms
359   else  anapi0ebe->SwitchOffDataMC() ;  
360   anapi0ebe->SetNeutralMesonSelection(nms);
361   //Set Histrograms bins and ranges
362   anapi0ebe->SetHistoPtRangeAndNBins(0, 50, 500) ;
363   //      anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
364   //      anapi0->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
365   if(kPrintSettings) anapi0ebe->Print("");
366   
367   AliAnaParticleIsolation *anaisolpi0 = new AliAnaParticleIsolation();
368   anaisolpi0->SetDebug(-1);
369   anaisolpi0->SetMinPt(0);
370   anaisolpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
371   anaisolpi0->AddToHistogramsName("AnaIsolPi0_");
372   anaisolpi0->SetCalorimeter(calorimeter);
373   if(kUseKinematics) anaisolpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
374   else  anaisolpi0->SwitchOffDataMC() ;
375   //Select clusters with no pair, if both clusters with pi0 mass
376   anaisolpi0->SwitchOffInvariantMass();
377   //anaisol->SetNeutralMesonSelection(nms);
378   //Do isolation cut
379   anaisolpi0->SetIsolationCut(ic);      
380   //Do or not do isolation with previously produced AODs.
381   //No effect if use of SwitchOnSeveralIsolation()
382   anaisolpi0->SwitchOffReIsolation();
383   //Multiple IC
384   anaisolpi0->SwitchOffSeveralIsolation() ;
385   //Set Histograms bins and ranges
386   anaisolpi0->SetHistoPtRangeAndNBins(0, 50, 500) ;
387   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
388   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
389   if(kPrintSettings) anaisol->Print("");
390   
391   
392   // ### Pi0 Correlation with hadrons, not isolated
393   AliAnaParticleHadronCorrelation *anacorrhadronpi0 = new AliAnaParticleHadronCorrelation();
394   anacorrhadronpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
395   if(!data.Contains("delta")){ 
396           anacorrhadronpi0->SetOutputAODName(Form("CorrPi0Hadrons%s",calorimeter.Data()));
397           anacorrhadronpi0->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
398   }
399   else anacorrhadronpi0->SetInputAODName(Form("CorrPi0Hadrons%s",calorimeter.Data()));
400         
401   anacorrhadronpi0->AddToHistogramsName("AnaHadronCorrPi0_");
402   anacorrhadronpi0->SetDebug(-1);
403   anacorrhadronpi0->SwitchOffCaloPID();
404   anacorrhadronpi0->SwitchOffFiducialCut();
405   anacorrhadronpi0->SetPtCutRange(0.1,100);
406   anacorrhadronpi0->SetDeltaPhiCutRange(1.5,4.5);
407   anacorrhadronpi0->SelectIsolated(kFALSE); // do correlation with non isolated pi0
408   anacorrhadronpi0->SwitchOnSeveralUECalculation();
409   anacorrhadronpi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
410   if(kUseKinematics) anacorrhadronpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
411   else  anacorrhadronpi0->SwitchOffDataMC() ;
412   //if(calorimeter=="PHOS"){
413   //    //Correlate with particles in EMCAL
414   //    anacorrhadronpi0->SwitchOnCaloPID();
415   //    anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
416   //}
417   //Set Histograms bins and ranges
418   anacorrhadronpi0->SetHistoPtRangeAndNBins(0, 50, 500) ;
419   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
420   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
421   if(kPrintSettings) anacorrhadronpi0->Print("");
422   
423   // ### Pi0 Correlation with hadrons, isolated
424   AliAnaParticleHadronCorrelation *anacorrhadronisopi0 = new AliAnaParticleHadronCorrelation();
425   anacorrhadronisopi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
426   if(!data.Contains("delta")) {
427                 anacorrhadronisopi0->SetOutputAODName(Form("CorrIsoPi0Hadrons%s",calorimeter.Data()));
428                 anacorrhadronisopi0->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
429   }
430   else  anacorrhadronisopi0->SetInputAODName(Form("CorrIsoPi0Hadrons%s",calorimeter.Data()));
431         
432   anacorrhadronisopi0->AddToHistogramsName("AnaHadronCorrIsoPi0_");
433   anacorrhadronisopi0->SetDebug(-1);
434   anacorrhadronisopi0->SwitchOffCaloPID();
435   anacorrhadronisopi0->SwitchOffFiducialCut();
436   anacorrhadronisopi0->SetPtCutRange(0.1,100);
437   anacorrhadronisopi0->SetDeltaPhiCutRange(1.5,4.5);
438   anacorrhadronisopi0->SelectIsolated(kTRUE); // do correlation with isolated pi0
439   anacorrhadronisopi0->SwitchOnSeveralUECalculation();
440   anacorrhadronisopi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
441   if(kUseKinematics) anacorrhadronisopi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
442   else  anacorrhadronisopi0->SwitchOffDataMC() ;
443   //if(calorimeter=="PHOS"){
444   //    //Correlate with particles in EMCAL
445   //    anacorrhadronpi0->SwitchOnCaloPID();
446   //    anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
447   //}
448   //Set Histograms bins and ranges
449   anacorrhadronisopi0->SetHistoPtRangeAndNBins(0, 50, 500) ;
450   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
451   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
452   if(kPrintSettings) anacorrhadronisopi0->Print("");
453  
454   //analysis the omega->pi0+gamma
455   AliAnaOmegaToPi0Gamma *anaomegaToPi0Gamma = new AliAnaOmegaToPi0Gamma();
456   anaomegaToPi0Gamma->SetDebug(-1);//10 for lots of messages
457   anaomegaToPi0Gamma->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
458   anaomegaToPi0Gamma->SetInputAODPhotonName(Form("Photons%s",calorimeter.Data()));
459   anaomegaToPi0Gamma->SetNPID(2);
460   anaomegaToPi0Gamma->SetNVtxZ(2);
461   anaomegaToPi0Gamma->SetNBadChDist(3);
462   anaomegaToPi0Gamma->SetNEventsMixed(4);
463   if(calorimeter.Data()=="PHOS")
464            anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.008); // PHOS
465   else if(calorimeter.Data()=="EMCAL")
466            anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.012); // EMCAL 
467   anaomegaToPi0Gamma->SetHistoPtRangeAndNBins(0, 20, 200) ;
468   anaomegaToPi0Gamma->SetHistoMassRangeAndNBins(0, 1, 200) ;
469   anaomegaToPi0Gamma->SetPi0OverOmegaPtCut(0.8);
470   anaomegaToPi0Gamma->SetGammaOverOmegaPtCut(0.2);
471   if(kUseKinematics) anaomegaToPi0Gamma->SwitchOnDataMC() ;//Access MC stack and fill more histograms
472   else anaomegaToPi0Gamma->SwitchOffDataMC() ;//Access MC stack and fill more histograms
473   anaomegaToPi0Gamma->AddToHistogramsName(Form("AnaOmegaToPi0Gamma%s_",calorimeter.Data()));
474   anaomegaToPi0Gamma->Print("");
475  
476   // #### Configure Maker ####
477   AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
478   maker->SetReader(reader);//pointer to reader
479   if(!data.Contains("delta")) maker->AddAnalysis(qa,0);
480   maker->AddAnalysis(anaphoton1,1);
481   maker->AddAnalysis(anapi0,2);
482   maker->AddAnalysis(anaphoton2,3);
483   maker->AddAnalysis(anaisol,4);
484   maker->AddAnalysis(anacorrjet,5);
485   maker->AddAnalysis(anacorrhadron,6);
486   maker->AddAnalysis(anacorrisohadron,7);
487   maker->AddAnalysis(anapi0ebe,8);
488   maker->AddAnalysis(anaisolpi0,9);
489   maker->AddAnalysis(anacorrhadronpi0,10);
490   maker->AddAnalysis(anacorrhadronisopi0,11);
491   maker->AddAnalysis(anaomegaToPi0Gamma,12);  
492  
493   maker->SetAnaDebug(0)  ;
494   maker->SwitchOnHistogramsMaker()  ;
495   if(data.Contains("delta")) maker->SwitchOffAODsMaker()  ;
496   else                       maker->SwitchOnAODsMaker()  ;
497         
498   if(kPrintSettings) maker->Print("");
499   
500   printf("======================== \n");
501   printf(" End Configuration of PartCorr analysis with detector %s \n",calorimeter.Data());
502   printf("======================== \n");
503   
504   // Create task
505   //===========================================================================
506   AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (Form("PartCorr%s",calorimeter.Data()));
507   task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
508   //task->SetDebugLevel(-1);
509   task->SetAnalysisMaker(maker);
510   //if(!kSimulation)task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before.
511   mgr->AddTask(task);
512   
513   char name[128];
514   sprintf(name,"PartCorr_%s",calorimeter.Data());
515   cout<<"Name of task "<<name<<endl;
516   //AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form(name),TList::Class(),
517   //                                       AliAnalysisManager::kOutputContainer, Form("PartCorr_%s.root",calorimeter.Data()));
518   
519   TString outputfile = AliAnalysisManager::GetCommonFileName(); 
520   //  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("PartCorr_%s",calorimeter.Data()),  TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr_%s",outputfile.Data(),calorimeter.Data()));
521   AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(calorimeter.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr",outputfile.Data()));
522   
523   // Create ONLY the output containers for the data produced by the task.
524   // Get and connect other common input/output containers via the manager as below
525   //==============================================================================
526   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
527   // AOD output slot will be used in a different way in future
528   if(!data.Contains("delta")) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
529   mgr->ConnectOutput (task, 1, cout_pc);
530   
531   return task;
532 }
533
534