]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/macros/AddTaskPartCorr.C
Changes to QA TPC, extra task for cosmics, Added utility classes for UE analysis
[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   AliFiducialCut * fidCut1stYear = new AliFiducialCut();
84   fidCut1stYear->DoCTSFiducialCut(kFALSE) ;
85   if(kSimulation){
86     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
87     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
88     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
89     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
90   } 
91   else{
92     fidCut1stYear->DoEMCALFiducialCut(kFALSE) ;
93     fidCut1stYear->DoPHOSFiducialCut(kFALSE) ;
94   }     
95   
96   
97   // -------------------------------------------------
98   // --- Photon Isolation and Correlation Analysis ---
99   // -------------------------------------------------
100   
101   AliAnaPhoton *anaphoton = new AliAnaPhoton();
102   anaphoton->SetDebug(-1); //10 for lots of messages
103   if(calorimeter == "PHOS"){
104                 anaphoton->SetNCellCut(1);// At least 2 cells
105                 anaphoton->SetMinPt(0.2);
106             anaphoton->SetMinDistanceToBadChannel(2, 4, 5);
107   }
108   else {//EMCAL
109                 //anaphoton->SetNCellCut(0);// At least 2 cells
110                 anaphoton->SetMinPt(0.1); // no effect minium EMCAL cut.
111                 anaphoton->SetTimeCut(550,750);// Time window of [550-750] ns
112             anaphoton->SetMinDistanceToBadChannel(6, 12, 18);
113   }
114   anaphoton->SetCalorimeter(calorimeter);
115   if(kUseKinematics) anaphoton->SwitchOnDataMC() ;//Access MC stack and fill more histograms
116   else  anaphoton->SwitchOffDataMC() ;
117   anaphoton->SwitchOffCaloPID();
118   anaphoton->SwitchOffFiducialCut();
119   if(kSimulation){
120                 anaphoton->SwitchOnFiducialCut();
121                 anaphoton->SetFiducialCut(fidCut1stYear);
122   }
123         
124   if(!data.Contains("delta")) {
125                 anaphoton->SetOutputAODName(Form("Photons%s",calorimeter.Data()));
126                 anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
127   }
128   else anaphoton->SetInputAODName(Form("Photons%s",calorimeter.Data()));
129   anaphoton->AddToHistogramsName("AnaPhotonCorr_");
130   //Set Histograms bins and ranges
131   anaphoton->SetHistoPtRangeAndNBins(0, 50, 200) ;
132   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
133   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
134   if(kPrintSettings) anaphoton->Print("");
135         
136   
137   // -----------------------------------
138   // --- Pi0 Invariant Mass Analysis ---
139   // -----------------------------------
140         
141         
142   AliAnaPi0 *anapi0 = new AliAnaPi0();
143   anapi0->SetDebug(-1);//10 for lots of messages
144   anapi0->SetInputAODName(Form("Photons%s",calorimeter.Data()));
145   anapi0->SetCalorimeter(calorimeter);
146   if(kSimulation){
147           anapi0->SwitchOnFiducialCut();
148           anapi0->SetFiducialCut(fidCut1stYear);
149   }  
150   anapi0->SetNPID(1); //Available from tag AliRoot::v4-18-15-AN
151   //settings for pp collision
152   anapi0->SetNCentrBin(1);
153   anapi0->SetNZvertBin(1);
154   anapi0->SetNRPBin(1);
155   anapi0->SetNMaxEvMix(10);
156   anapi0->SwitchOffDataMC() ;//Access MC stack and fill more histograms
157   if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
158   else  anapi0->SetNumberOfModules(4); //EMCAL first year
159   anapi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
160   //anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
161   //anapi0->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ;
162   anapi0->SetHistoMassRangeAndNBins(0., 0.6, 200) ;
163   anapi0->SetHistoAsymmetryRangeAndNBins(0., 1. , 10) ;
164   if(kPrintSettings) anapi0->Print("");
165         
166   // ### Isolation analysis ### 
167   
168   AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
169   anaisol->SetDebug(-1);
170   anaisol->SetMinPt(0);
171   anaisol->SetInputAODName(Form("Photons%s",calorimeter.Data()));
172   anaisol->SetCalorimeter(calorimeter);
173   if(kUseKinematics) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms
174   else  anaisol->SwitchOffDataMC() ;
175   //Select clusters with no pair, if both clusters with pi0 mass
176   anaisol->SwitchOffInvariantMass();
177   //anaisol->SetNeutralMesonSelection(nms);
178   //Do isolation cut
179   AliIsolationCut * ic =  anaisol->GetIsolationCut();   
180   ic->SetConeSize(0.4);
181   ic->SetPtThreshold(0.2);
182   ic->SetICMethod(AliIsolationCut::kPtThresIC);
183   if(kPrintSettings) ic->Print("");
184         
185   //Do or not do isolation with previously produced AODs.
186   //No effect if use of SwitchOnSeveralIsolation()
187   anaisol->SwitchOffReIsolation();
188   //Multiple IC
189   anaisol->SwitchOffSeveralIsolation() ;
190   //Set Histograms bins and ranges
191   anaisol->SetHistoPtRangeAndNBins(0, 50, 200) ;
192   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
193   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
194   anaisol->AddToHistogramsName("AnaIsolPhoton_");
195   if(kPrintSettings) anaisol->Print("");
196   
197   // ### Correlation with Jet Finder AOD output
198   AliAnaParticleJetFinderCorrelation *anacorrjet = new AliAnaParticleJetFinderCorrelation();
199   anacorrjet->SetInputAODName(Form("Photons%s",calorimeter.Data()));
200   anacorrjet->SwitchOffFiducialCut();
201   anacorrjet->SetDebug(-1);
202   anacorrjet->SetConeSize(1);  
203   anacorrjet->SelectIsolated(kTRUE); // do correlation with isolated photons
204   anacorrjet->SetPtThresholdInCone(0.2);
205   anacorrjet->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts 
206   anacorrjet->SetRatioCutRange(0.01,3); //Mostly Open Cuts
207   anacorrjet->UseJetRefTracks(kFALSE); //Not working now
208   //Set Histograms bins and ranges
209   anacorrjet->SetHistoPtRangeAndNBins(0, 50, 200) ;
210   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
211   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
212   if(kPrintSettings) anacorrjet->Print("");
213   
214   // ### Correlation with hadrons
215   AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation();
216   anacorrhadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
217   if(!data.Contains("delta")) {
218           anacorrhadron->SetOutputAODName(Form("CorrGammaHadrons%s",calorimeter.Data()));
219           anacorrhadron->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
220   }
221   else anacorrhadron->SetInputAODName(Form("CorrGammaHadrons%s",calorimeter.Data()));
222         
223   anacorrhadron->AddToHistogramsName("AnaHadronCorrPhoton_");
224   anacorrhadron->SetDebug(-1);
225   anacorrhadron->SwitchOffCaloPID();
226   anacorrhadron->SwitchOffFiducialCut();
227   anacorrhadron->SetPtCutRange(0.1,100);
228   anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
229   anacorrhadron->SwitchOnSeveralUECalculation();
230   anacorrhadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
231   anacorrhadron->SelectIsolated(kFALSE); // do correlation with isolated photons
232   if(kUseKinematics) anacorrhadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
233   else  anacorrhadron->SwitchOffDataMC() ;
234   //if(calorimeter=="PHOS"){
235   //Correlate with particles in EMCAL
236   //anacorrhadron->SwitchOnCaloPID();
237   //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
238   //}
239   //Set Histograms bins and ranges
240   anacorrhadron->SetHistoPtRangeAndNBins(0, 50, 200) ;
241   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
242   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
243   if(kPrintSettings) anacorrhadron->Print("");
244   
245   // ### Correlation with hadrons
246   AliAnaParticleHadronCorrelation *anacorrisohadron = new AliAnaParticleHadronCorrelation();
247   anacorrisohadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
248   if(!data.Contains("delta")) {
249           anacorrisohadron->SetOutputAODName(Form("CorrIsoGammaHadrons%s",calorimeter.Data()));
250           anacorrisohadron->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
251   }
252   else  anacorrisohadron->SetInputAODName(Form("CorrIsoGammaHadrons%s",calorimeter.Data()));
253         
254   anacorrisohadron->AddToHistogramsName("AnaHadronCorrIsoPhoton_");
255   anacorrisohadron->SetDebug(-1);
256   anacorrisohadron->SwitchOffCaloPID();
257   anacorrisohadron->SwitchOffFiducialCut();
258   anacorrisohadron->SetPtCutRange(0.1,100);
259   anacorrisohadron->SetDeltaPhiCutRange(1.5,4.5);
260   anacorrisohadron->SwitchOnSeveralUECalculation();
261   anacorrisohadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
262   anacorrisohadron->SelectIsolated(kTRUE); // do correlation with isolated photons
263   if(kUseKinematics) anacorrisohadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
264   else  anacorrisohadron->SwitchOffDataMC() ;
265   //if(calorimeter=="PHOS"){
266   //Correlate with particles in EMCAL
267   //anacorrhadron->SwitchOnCaloPID();
268   //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
269   //}
270   //Set Histograms bins and ranges
271   anacorrisohadron->SetHistoPtRangeAndNBins(0, 50, 200) ;
272   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
273   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
274   if(kPrintSettings) anacorrisohadron->Print("");
275   
276   // -------------------------------------------------
277   // --- Pi0    Isolation and Correlation Analysis ---
278   // -------------------------------------------------
279         
280   AliNeutralMesonSelection *nms = new AliNeutralMesonSelection();
281   nms->SetInvMassCutRange(0.05, 0.2)     ;
282   nms->KeepNeutralMesonSelectionHistos(kTRUE);
283   //Set Histrograms bins and ranges
284   nms->SetHistoERangeAndNBins(0, 50, 200) ;
285   //      nms->SetHistoPtRangeAndNBins(0, 50, 100) ;
286   //      nms->SetHistoAngleRangeAndNBins(0, 0.3, 100) ;
287   //      nsm->SetHistoIMRangeAndNBins(0, 0.4, 100) ;  
288   
289   AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
290   anapi0ebe->SetDebug(-1);//10 for lots of messages
291   anapi0ebe->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
292   anapi0ebe->SetMinPt(0);
293   anapi0ebe->SetCalorimeter(calorimeter);
294   anapi0ebe->SetInputAODName(Form("Photons%s",calorimeter.Data()));
295   if(!data.Contains("delta")) {
296           anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
297           anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
298   }
299   else  anapi0ebe->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
300         
301   if(kUseKinematics) anapi0ebe->SwitchOnDataMC() ;//Access MC stack and fill more histograms
302   else  anapi0ebe->SwitchOffDataMC() ;  
303   anapi0ebe->SetNeutralMesonSelection(nms);
304   //Set Histrograms bins and ranges
305   anapi0ebe->SetHistoPtRangeAndNBins(0, 50, 200) ;
306   //      anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
307   //      anapi0->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
308   if(kPrintSettings) anapi0ebe->Print("");
309   
310   AliAnaParticleIsolation *anaisolpi0 = new AliAnaParticleIsolation();
311   anaisolpi0->SetDebug(-1);
312   anaisolpi0->SetMinPt(0);
313   anaisolpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
314   anaisolpi0->AddToHistogramsName("AnaIsolPi0_");
315   anaisolpi0->SetCalorimeter(calorimeter);
316   if(kUseKinematics) anaisolpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
317   else  anaisolpi0->SwitchOffDataMC() ;
318   //Select clusters with no pair, if both clusters with pi0 mass
319   anaisolpi0->SwitchOffInvariantMass();
320   //anaisol->SetNeutralMesonSelection(nms);
321   //Do isolation cut
322   AliIsolationCut * ic2 =  anaisolpi0->GetIsolationCut();       
323   ic2->SetConeSize(0.4);
324   ic2->SetPtThreshold(0.2);
325   ic2->SetICMethod(AliIsolationCut::kPtThresIC);
326   if(kPrintSettings) ic->Print("");
327   //Do or not do isolation with previously produced AODs.
328   //No effect if use of SwitchOnSeveralIsolation()
329   anaisolpi0->SwitchOffReIsolation();
330   //Multiple IC
331   anaisolpi0->SwitchOffSeveralIsolation() ;
332   //Set Histograms bins and ranges
333   anaisolpi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
334   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
335   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
336   if(kPrintSettings) anaisol->Print("");
337   
338   
339   // ### Pi0 Correlation with hadrons, not isolated
340   AliAnaParticleHadronCorrelation *anacorrhadronpi0 = new AliAnaParticleHadronCorrelation();
341   anacorrhadronpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
342   if(!data.Contains("delta")){ 
343           anacorrhadronpi0->SetOutputAODName(Form("CorrPi0Hadrons%s",calorimeter.Data()));
344           anacorrhadronpi0->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
345   }
346   else anacorrhadronpi0->SetInputAODName(Form("CorrPi0Hadrons%s",calorimeter.Data()));
347         
348   anacorrhadronpi0->AddToHistogramsName("AnaHadronCorrPi0_");
349   anacorrhadronpi0->SetDebug(-1);
350   anacorrhadronpi0->SwitchOffCaloPID();
351   anacorrhadronpi0->SwitchOffFiducialCut();
352   anacorrhadronpi0->SetPtCutRange(0.1,100);
353   anacorrhadronpi0->SetDeltaPhiCutRange(1.5,4.5);
354   anacorrhadronpi0->SelectIsolated(kFALSE); // do correlation with non isolated pi0
355   anacorrhadronpi0->SwitchOnSeveralUECalculation();
356   anacorrhadronpi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
357   if(kUseKinematics) anacorrhadronpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
358   else  anacorrhadronpi0->SwitchOffDataMC() ;
359   //if(calorimeter=="PHOS"){
360   //    //Correlate with particles in EMCAL
361   //    anacorrhadronpi0->SwitchOnCaloPID();
362   //    anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
363   //}
364   //Set Histograms bins and ranges
365   anacorrhadronpi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
366   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
367   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
368   if(kPrintSettings) anacorrhadronpi0->Print("");
369   
370   // ### Pi0 Correlation with hadrons, isolated
371   AliAnaParticleHadronCorrelation *anacorrhadronisopi0 = new AliAnaParticleHadronCorrelation();
372   anacorrhadronisopi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
373   if(!data.Contains("delta")) {
374                 anacorrhadronisopi0->SetOutputAODName(Form("CorrIsoPi0Hadrons%s",calorimeter.Data()));
375                 anacorrhadronisopi0->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
376   }
377   else  anacorrhadronisopi0->SetInputAODName(Form("CorrIsoPi0Hadrons%s",calorimeter.Data()));
378         
379   anacorrhadronisopi0->AddToHistogramsName("AnaHadronCorrIsoPi0_");
380   anacorrhadronisopi0->SetDebug(-1);
381   anacorrhadronisopi0->SwitchOffCaloPID();
382   anacorrhadronisopi0->SwitchOffFiducialCut();
383   anacorrhadronisopi0->SetPtCutRange(0.1,100);
384   anacorrhadronisopi0->SetDeltaPhiCutRange(1.5,4.5);
385   anacorrhadronisopi0->SelectIsolated(kTRUE); // do correlation with isolated pi0
386   anacorrhadronisopi0->SwitchOnSeveralUECalculation();
387   anacorrhadronisopi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
388   if(kUseKinematics) anacorrhadronisopi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
389   else  anacorrhadronisopi0->SwitchOffDataMC() ;
390   //if(calorimeter=="PHOS"){
391   //    //Correlate with particles in EMCAL
392   //    anacorrhadronpi0->SwitchOnCaloPID();
393   //    anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
394   //}
395   //Set Histograms bins and ranges
396   anacorrhadronisopi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
397   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
398   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
399   if(kPrintSettings) anacorrhadronisopi0->Print("");
400  
401   //analysis the omega->pi0+gamma
402   AliAnaOmegaToPi0Gamma *anaomegaToPi0Gamma = new AliAnaOmegaToPi0Gamma();
403   anaomegaToPi0Gamma->SetDebug(-1);//10 for lots of messages
404   anaomegaToPi0Gamma->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
405   anaomegaToPi0Gamma->SetInputAODPhotonName(Form("Photons%s",calorimeter.Data()));
406   anaomegaToPi0Gamma->SetNPID(1);
407   anaomegaToPi0Gamma->SetNVtxZ(1);
408   anaomegaToPi0Gamma->SetNEventsMixed(4);
409   if(calorimeter=="PHOS")
410     anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.008); // PHOS
411   else if(calorimeter=="EMCAL")
412     anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.012); // EMCAL 
413   anaomegaToPi0Gamma->SetHistoPtRangeAndNBins(0, 20, 100) ;
414   anaomegaToPi0Gamma->SetHistoMassRangeAndNBins(0, 1, 100) ;
415   anaomegaToPi0Gamma->SetPi0OverOmegaPtCut(0.8);
416   anaomegaToPi0Gamma->SetGammaOverOmegaPtCut(0.2);
417   if(kUseKinematics) anaomegaToPi0Gamma->SwitchOnDataMC() ;//Access MC stack and fill more histograms
418   else anaomegaToPi0Gamma->SwitchOffDataMC() ;//Access MC stack and fill more histograms
419   anaomegaToPi0Gamma->AddToHistogramsName(Form("AnaOmegaToPi0Gamma%s_",calorimeter.Data()));
420  if(kPrintSettings)   anaomegaToPi0Gamma->Print("");
421  
422   // #### Configure Maker ####
423   AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
424   maker->SetReader(reader);//pointer to reader∫
425   //if(!data.Contains("delta")) maker->AddAnalysis(qa,0);
426   maker->AddAnalysis(anaphoton,0);
427   maker->AddAnalysis(anapi0,1);
428   maker->AddAnalysis(anaisol,2);
429   maker->AddAnalysis(anacorrjet,3);
430   maker->AddAnalysis(anacorrhadron,4);
431   maker->AddAnalysis(anacorrisohadron,5);
432   maker->AddAnalysis(anapi0ebe,6);
433   maker->AddAnalysis(anaisolpi0,7);
434   maker->AddAnalysis(anacorrhadronpi0,8);
435   maker->AddAnalysis(anacorrhadronisopi0,9);
436   maker->AddAnalysis(anaomegaToPi0Gamma,10);   
437   maker->SetAnaDebug(-1)  ;
438   maker->SwitchOnHistogramsMaker()  ;
439   if(data.Contains("delta")) maker->SwitchOffAODsMaker()  ;
440   else                       maker->SwitchOnAODsMaker()  ;
441         
442   if(kPrintSettings) maker->Print("");
443   
444   printf("======================== \n");
445   printf(" End Configuration of PartCorr analysis with detector %s \n",calorimeter.Data());
446   printf("======================== \n");
447   
448   // Create task
449   //===========================================================================
450   AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (Form("PartCorr%s",calorimeter.Data()));
451   task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
452   //task->SetDebugLevel(-1);
453   task->SelectCollisionCandidates();
454   task->SetAnalysisMaker(maker);
455   //if(!kSimulation)task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before.
456   mgr->AddTask(task);
457   
458   char name[128];
459   sprintf(name,"PartCorr_%s",calorimeter.Data());
460   cout<<"Name of task "<<name<<endl;
461   //AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form(name),TList::Class(),
462   //                                       AliAnalysisManager::kOutputContainer, Form("PartCorr_%s.root",calorimeter.Data()));
463   
464   TString outputfile = AliAnalysisManager::GetCommonFileName(); 
465   //  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("PartCorr_%s",calorimeter.Data()),  TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr_%s",outputfile.Data(),calorimeter.Data()));
466   AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(calorimeter.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr",outputfile.Data()));
467   
468   // Create ONLY the output containers for the data produced by the task.
469   // Get and connect other common input/output containers via the manager as below
470   //==============================================================================
471   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
472   // AOD output slot will be used in a different way in future
473   if(!data.Contains("delta")) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
474   mgr->ConnectOutput (task, 1, cout_pc);
475   
476   return task;
477 }
478
479