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