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