]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/macros/AddTaskPartCorr.C
Adding the possibility to read additional tracks or MC information to the AOD momentu...
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskPartCorr.C
1 AliAnalysisTaskParticleCorrelation *AddTaskPartCorr(TString inputDataType, TString calorimeter, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE, Bool_t outputAOD=kFALSE, Bool_t oldAOD=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   Bool_t kUseKinematics = kFALSE; 
14   if(kSimulation) { 
15     kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE; 
16     if (!kUseKinematics && inputDataType == "AOD") kUseKinematics = kTRUE; //AOD primary should be available ... 
17   } 
18   
19   cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
20   
21   // Configure analysis
22   //===========================================================================
23   
24   // *** Reader ***
25   AliCaloTrackReader * reader =0x0 ;
26   if(inputDataType.Contains("AOD")) reader = new AliCaloTrackAODReader();
27   else if(inputDataType=="ESD") reader = new AliCaloTrackESDReader();
28   else if(inputDataType=="MC" && inputDataType == "ESD") reader = new AliCaloTrackMCReader();
29   reader->SetDebug(-1);//10 for lots of messages
30   reader->SwitchOnCTS();
31   //reader->SetDeltaAODFileName("");
32   //if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
33   if(calorimeter == "EMCAL") {
34     reader->SwitchOnEMCALCells();  
35     reader->SwitchOnEMCAL();
36   }
37   if(calorimeter == "PHOS") { 
38     reader->SwitchOnPHOSCells();  
39     reader->SwitchOnPHOS();
40   }
41   
42   // for case inputDataType="deltaAOD", no need to fill the EMCAL/PHOS cluster lists
43   if(inputDataType.Contains("delta")){
44     reader->SwitchOffEMCAL();
45     reader->SwitchOffPHOS();
46     reader->SwitchOffEMCALCells(); 
47     reader->SwitchOffPHOSCells(); 
48   }
49   
50   if(kUseKinematics){
51     if(inputDataType == "ESD"){
52       reader->SwitchOnStack();          
53       reader->SwitchOffAODMCParticles(); 
54     }
55     else if(inputDataType == "AOD"){
56       reader->SwitchOffStack();          
57       reader->SwitchOnAODMCParticles(); 
58     }
59   }
60   
61   //Min particle pT
62   reader->SetEMCALPtMin(0.3); 
63   reader->SetPHOSPtMin(0.3);
64   reader->SetCTSPtMin(0.1);
65   if(outputAOD)  reader->SwitchOnWriteDeltaAOD()  ;
66   if(oldAOD) reader->SwitchOnOldAODs();
67   if(kPrintSettings) reader->Print("");
68   
69   // *** Calorimeters Utils     ***
70   AliCalorimeterUtils *cu = new AliCalorimeterUtils;
71   // Remove clusters close to borders, at least max energy cell is 1 cell away 
72   cu->SetNumberOfCellsFromEMCALBorder(1);
73   cu->SetNumberOfCellsFromPHOSBorder(2);
74   
75   // Remove EMCAL hottest channels for first LHC10 periods      
76   cu->SwitchOnBadChannelsRemoval();
77   // SM0
78   cu->SetEMCALChannelStatus(0,3,13);  cu->SetEMCALChannelStatus(0,44,1); cu->SetEMCALChannelStatus(0,3,13); 
79   cu->SetEMCALChannelStatus(0,20,7);  cu->SetEMCALChannelStatus(0,38,2);   
80   // SM1
81   cu->SetEMCALChannelStatus(1,4,7);   cu->SetEMCALChannelStatus(1,4,13);  cu->SetEMCALChannelStatus(1,9,20); 
82   cu->SetEMCALChannelStatus(1,14,15); cu->SetEMCALChannelStatus(1,23,16); cu->SetEMCALChannelStatus(1,32,23); 
83   cu->SetEMCALChannelStatus(1,37,5);  cu->SetEMCALChannelStatus(1,40,1);  cu->SetEMCALChannelStatus(1,40,2);
84   cu->SetEMCALChannelStatus(1,40,5);  cu->SetEMCALChannelStatus(1,41,0);  cu->SetEMCALChannelStatus(1,41,1);
85   cu->SetEMCALChannelStatus(1,41,2);  cu->SetEMCALChannelStatus(1,41,4);
86   // SM2        
87   cu->SetEMCALChannelStatus(2,14,15); cu->SetEMCALChannelStatus(2,18,16); cu->SetEMCALChannelStatus(2,18,17); 
88   cu->SetEMCALChannelStatus(2,18,18); cu->SetEMCALChannelStatus(2,18,20); cu->SetEMCALChannelStatus(2,18,21); 
89   cu->SetEMCALChannelStatus(2,18,23); cu->SetEMCALChannelStatus(2,19,16); cu->SetEMCALChannelStatus(2,19,17); 
90   cu->SetEMCALChannelStatus(2,19,19); cu->SetEMCALChannelStatus(2,19,20); cu->SetEMCALChannelStatus(2,19,21); 
91   cu->SetEMCALChannelStatus(2,19,22);
92   //SM3
93   cu->SetEMCALChannelStatus(3,4,7);
94   
95   
96   //Recalibration
97   //cu->SwitchOnRecalibration();
98   //TFile * f = new TFile("RecalibrationFactors.root","read");
99   //cu->SetEMCALChannelRecalibrationFactors(0,(TH2F*)f->Get("EMCALRecalFactors_SM0"));
100   //cu->SetEMCALChannelRecalibrationFactors(1,(TH2F*)f->Get("EMCALRecalFactors_SM1"));
101   //cu->SetEMCALChannelRecalibrationFactors(2,(TH2F*)f->Get("EMCALRecalFactors_SM2"));
102   //cu->SetEMCALChannelRecalibrationFactors(3,(TH2F*)f->Get("EMCALRecalFactors_SM3"));
103   //f->Close(); 
104   
105   cu->SetDebug(-1);
106   if(kPrintSettings) cu->Print("");
107   
108   
109   // ##### Analysis algorithm settings ####
110   
111   // -------------------------------------------------
112   // --- Photon/Pi0/Omega/Electron Analysis ---
113   // -------------------------------------------------
114   
115   AliAnaPhoton *anaphoton = new AliAnaPhoton();
116   anaphoton->SetDebug(-1); //10 for lots of messages
117   //settings for different multiplicity analysis
118   anaphoton->SwitchOffEventSelection() ;
119   anaphoton->SetZvertexCut(10.);
120   anaphoton->SetMultiplicity(80, 120);
121
122   if(calorimeter == "PHOS"){
123     anaphoton->SetNCellCut(0);// At least 2 cells
124     anaphoton->SetMinPt(0.);
125     anaphoton->SetMinDistanceToBadChannel(2, 4, 5);
126   }
127   else {//EMCAL
128     //anaphoton->SetNCellCut(0);// At least 2 cells
129     anaphoton->SetMinPt(0.1); // no effect minium EMCAL cut.
130     if(!kUseKinematics) anaphoton->SetTimeCut(400,900);// Time window of [400-900] ns
131     anaphoton->SetMinDistanceToBadChannel(6, 12, 18);
132     //anaphoton->SetMinDistanceToBadChannel(1, 2, 3);//For new releases.
133   }
134   anaphoton->SetCalorimeter(calorimeter);
135   if(kUseKinematics) anaphoton->SwitchOnDataMC() ;//Access MC stack and fill more histograms
136   else  anaphoton->SwitchOffDataMC() ;
137   anaphoton->SwitchOffCaloPID();
138   anaphoton->SwitchOffFiducialCut();
139   if(kSimulation){
140     anaphoton->SwitchOnFiducialCut();
141     AliFiducialCut * fidCut1stYear = anaphoton->GetFiducialCut();
142     fidCut1stYear->DoCTSFiducialCut(kFALSE) ;
143     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
144     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
145     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
146     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
147   }
148   
149   if(!inputDataType.Contains("delta")) {
150     anaphoton->SetOutputAODName(Form("Photons%s",calorimeter.Data()));
151     anaphoton->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
152   }
153   else anaphoton->SetInputAODName(Form("Photons%s",calorimeter.Data()));
154   anaphoton->AddToHistogramsName("AnaPhotonCorr_");
155   //Set Histograms bins and ranges
156   anaphoton->SetHistoPtRangeAndNBins(0, 50, 200) ;
157   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
158   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
159   if(kPrintSettings) anaphoton->Print("");
160   
161   // -----------------------------------
162   // --- Pi0 Invariant Mass Analysis ---
163   // -----------------------------------
164   
165   AliAnaPi0 *anapi0 = new AliAnaPi0();
166   anapi0->SetDebug(-1);//10 for lots of messages
167   anapi0->SetInputAODName(Form("Photons%s",calorimeter.Data()));
168   anapi0->SetCalorimeter(calorimeter);
169   anapi0->SwitchOnMultipleCutAnalysis(); 
170   if(kSimulation){
171     anapi0->SwitchOnFiducialCut();
172     AliFiducialCut * fidCut1stYear = anapi0->GetFiducialCut();
173     fidCut1stYear->DoCTSFiducialCut(kFALSE) ;
174     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
175     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
176     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
177     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
178   }     
179
180   //settings for pp collision
181   anapi0->SwitchOnOwnMix();
182   anapi0->SwitchOnEventSelection() ;
183   anapi0->SetNCentrBin(1);
184   anapi0->SetZvertexCut(10.);
185   //anapi0->SetMultiplicity(80, 120);
186   anapi0->SetMultiBin(1);  
187   if(kUseKinematics)anapi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
188   else anapi0->SwitchOffDataMC() ;
189   if(calorimeter=="PHOS") anapi0->SetNumberOfModules(3); //PHOS first year
190   else  anapi0->SetNumberOfModules(4); //EMCAL first year
191   anapi0->SetHistoPtRangeAndNBins(0, 20, 200) ;
192   //anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
193   //anapi0->SetHistoEtaRangeAndNBins(-0.8, 0.8, 200) ;
194   anapi0->SetHistoMassRangeAndNBins(0., 0.9, 300) ;
195   anapi0->SetHistoAsymmetryRangeAndNBins(0., 1. , 100) ;
196   anapi0->SetHistoTrackMultiplicityRangeAndNBins(0, 200, 20); 
197
198   if(kPrintSettings) anapi0->Print("");
199         
200   //---------------------------  
201   //Pi0, event by event
202   //---------------------------  
203   
204   AliAnaPi0EbE *anapi0ebe = new AliAnaPi0EbE();
205   anapi0ebe->SwitchOffEventSelection() ;
206   anapi0ebe->SetZvertexCut(10.);
207   anapi0ebe->SetMultiplicity(80, 120);
208   anapi0ebe->SetMultiBin(1);  
209   anapi0ebe->SetDebug(-1);//10 for lots of messages
210   anapi0ebe->SetAnalysisType(AliAnaPi0EbE::kIMCalo);
211   anapi0ebe->SetMinPt(0);
212   anapi0ebe->SetCalorimeter(calorimeter);
213   anapi0ebe->SetInputAODName(Form("Photons%s",calorimeter.Data()));
214   if(!inputDataType.Contains("delta")) {
215     anapi0ebe->SetOutputAODName(Form("Pi0s%s",calorimeter.Data()));
216     anapi0ebe->SetOutputAODClassName("AliAODPWG4ParticleCorrelation");
217   }
218   else  anapi0ebe->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
219   
220   if(kUseKinematics) anapi0ebe->SwitchOnDataMC() ;//Access MC stack and fill more histograms
221   else  anapi0ebe->SwitchOffDataMC() ;  
222   
223   AliNeutralMesonSelection *nms = anapi0ebe->GetNeutralMesonSelection();
224   nms->SetInvMassCutRange(0.08, 0.18)     ;
225   nms->KeepNeutralMesonSelectionHistos(kTRUE);
226   //Set Histrograms bins and ranges
227   if(calorimeter=="EMCAL" ){
228     nms->SetHistoERangeAndNBins(0, 15, 150) ;  
229     anapi0ebe->SetHistoPtRangeAndNBins(0, 15, 75) ;
230   }
231   else{
232     nms->SetHistoERangeAndNBins(0, 30, 200) ;  
233     anapi0ebe->SetHistoPtRangeAndNBins(0, 30, 100) ;
234   }
235   //      nms->SetHistoPtRangeAndNBins(0, 50, 100) ;
236   //      nms->SetHistoAngleRangeAndNBins(0, 0.3, 100) ;
237   //      nsm->SetHistoIMRangeAndNBins(0, 0.4, 100) ;  
238   //Set Histrograms bins and ranges
239   //      anapi0->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
240   //      anapi0->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
241   if(kPrintSettings) anapi0ebe->Print("");
242         
243   //-------------------------------------
244   //*** analysis the omega->pi0+gamma ***
245   //------------------------------------
246   AliAnaOmegaToPi0Gamma *anaomegaToPi0Gamma = new AliAnaOmegaToPi0Gamma();
247   anaomegaToPi0Gamma->SetDebug(-1);//10 for lots of messages
248   anaomegaToPi0Gamma->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
249   anaomegaToPi0Gamma->SetInputAODPhotonName(Form("Photons%s",calorimeter.Data()));
250   anaomegaToPi0Gamma->SetNPID(1);
251   anaomegaToPi0Gamma->SetNVtxZ(1);
252   anaomegaToPi0Gamma->SetNEventsMixed(4);
253   if(calorimeter=="PHOS")
254     anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.008); // PHOS
255   else if(calorimeter=="EMCAL")
256     anaomegaToPi0Gamma->SetPi0MassPeakWidthCut(0.012); // EMCAL 
257   anaomegaToPi0Gamma->SetHistoPtRangeAndNBins(0, 20, 100) ;
258   anaomegaToPi0Gamma->SetHistoMassRangeAndNBins(0, 1, 100) ;
259   anaomegaToPi0Gamma->SetPi0OverOmegaPtCut(0.8);
260   anaomegaToPi0Gamma->SetGammaOverOmegaPtCut(0.2);
261   if(kUseKinematics) anaomegaToPi0Gamma->SwitchOnDataMC() ;//Access MC stack and fill more histograms
262   else anaomegaToPi0Gamma->SwitchOffDataMC() ;//Access MC stack and fill more histograms
263   anaomegaToPi0Gamma->AddToHistogramsName(Form("AnaOmegaToPi0Gamma%s_",calorimeter.Data()));
264   if(kPrintSettings)   anaomegaToPi0Gamma->Print("");
265         
266         
267 //  //---------------------------------------------------------------------
268 //  // Electron/btag
269 //  //---------------------------------------------------------------------
270 //  if(calorimeter=="EMCAL"){
271 //    
272 //    AliAnaBtag *anabtag = new AliAnaBtag();
273 //    anabtag->SetDebug(-1); //10 for lots of messages
274 //    if(kUseKinematics){
275 //      anabtag->SwitchOnDataMC();
276 //      anabtag->SetMinPt(1.);
277 //    }
278 //    anabtag->SetOutputAODName("ElectronsEMCAL");
279 //    anabtag->SetOutputAODClassName("AliAODPWG4Particle");
280 //    //anabtag->SetHistoPtRangeAndNBins(0, 100, 100) ;
281 //    //anabtag->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
282 //    //anabtag->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
283 //    if(kPrintSettings)anabtag->Print("");
284 //  }
285   
286   //==================================
287   // ### Isolation analysis ### 
288   //=================================
289   //Photon
290   AliAnaParticleIsolation *anaisol = new AliAnaParticleIsolation();
291   anaisol->SetDebug(-1);
292   anaisol->SetMinPt(0);
293   anaisol->SetInputAODName(Form("Photons%s",calorimeter.Data()));
294   anaisol->SetAODObjArrayName("ICPhoton"); 
295   anaisol->SetCalorimeter(calorimeter);
296   if(kUseKinematics) anaisol->SwitchOnDataMC() ;//Access MC stack and fill more histograms
297   else  anaisol->SwitchOffDataMC() ;
298   //Select clusters with no pair, if both clusters with pi0 mass
299   anaisol->SwitchOffInvariantMass();
300   //Do isolation cut
301   AliIsolationCut * ic =  anaisol->GetIsolationCut();   
302   ic->SetConeSize(0.4);
303   ic->SetPtThreshold(0.7);
304   ic->SetPtFraction(0.1);
305   ic->SetSumPtThreshold(1.0) ;
306   ic->SetParticleTypeInCone(AliIsolationCut::kOnlyCharged);
307   ic->SetICMethod(AliIsolationCut::kSumPtFracIC);
308   if(kPrintSettings) ic->Print("");
309   
310   //Do or not do isolation with previously produced AODs.
311   //No effect if use of SwitchOnSeveralIsolation()
312   anaisol->SwitchOffReIsolation();
313   //Multiple IC
314   anaisol->SwitchOffSeveralIsolation() ;
315   //Set Histograms bins and ranges
316   anaisol->SetHistoPtRangeAndNBins(0, 50, 200) ;
317   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
318   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
319   anaisol->AddToHistogramsName("AnaIsolPhoton_");
320   if(kPrintSettings) anaisol->Print("");
321   
322   //Pi0
323   AliAnaParticleIsolation *anaisolpi0 = new AliAnaParticleIsolation();
324   anaisolpi0->SetDebug(-1);
325   anaisolpi0->SetMinPt(0);
326   anaisolpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
327   anaisolpi0->AddToHistogramsName("AnaIsolPi0_");
328   anaisolpi0->SetAODObjArrayName("ICPi0"); 
329   anaisolpi0->SetCalorimeter(calorimeter);
330   if(kUseKinematics) anaisolpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
331   else  anaisolpi0->SwitchOffDataMC() ;
332   //Select clusters with no pair, if both clusters with pi0 mass
333   anaisolpi0->SwitchOffInvariantMass();
334   //Do isolation cut
335   AliIsolationCut * ic2 =  anaisolpi0->GetIsolationCut();       
336   ic2->SetConeSize(0.4);
337   ic2->SetPtThreshold(0.7);
338   ic2->SetPtFraction(0.1);
339   ic2->SetSumPtThreshold(1.0) ;
340   ic2->SetICMethod(AliIsolationCut::kSumPtFracIC);
341   ic2->SetParticleTypeInCone(AliIsolationCut::kOnlyCharged);
342   if(kPrintSettings) ic2->Print("");
343   //Do or not do isolation with previously produced AODs.
344   //No effect if use of SwitchOnSeveralIsolation()
345   anaisolpi0->SwitchOffReIsolation();
346   //Multiple IC
347   anaisolpi0->SwitchOffSeveralIsolation() ;
348   //Set Histograms bins and ranges
349   anaisolpi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
350   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
351   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
352   if(kPrintSettings) anaisolpi0->Print("");
353         
354   //===========================
355   //Correlation analysis
356   //===========================
357         
358   // ### Correlation with Jet Finder AOD output
359   AliAnaParticleJetFinderCorrelation *anacorrjet = new AliAnaParticleJetFinderCorrelation();
360   anacorrjet->SetInputAODName(Form("Photons%s",calorimeter.Data()));
361   anacorrjet->SwitchOffFiducialCut();
362   anacorrjet->SetDebug(-1);
363   anacorrjet->SetConeSize(1);  
364   anacorrjet->SelectIsolated(kTRUE); // do correlation with isolated photons
365   anacorrjet->SetPtThresholdInCone(0.2);
366   anacorrjet->SetDeltaPhiCutRange(0.5,5.5);//Mostly Open Cuts 
367   anacorrjet->SetRatioCutRange(0.01,3); //Mostly Open Cuts
368   anacorrjet->UseJetRefTracks(kFALSE); //Not working now
369   //Set Histograms bins and ranges
370   anacorrjet->SetHistoPtRangeAndNBins(0, 50, 200) ;
371   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
372   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
373   if(kPrintSettings) anacorrjet->Print("");
374   
375   // ### Correlation with hadrons
376   AliAnaParticleHadronCorrelation *anacorrhadron = new AliAnaParticleHadronCorrelation();
377   anacorrhadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
378   anacorrhadron->AddToHistogramsName("AnaHadronCorrPhoton_");
379   anacorrhadron->SetAODObjArrayName("PhotonHadronCorr"); 
380   anacorrhadron->SetDebug(-1);
381   anacorrhadron->SwitchOffCaloPID();
382   if(kSimulation){
383     anacorrhadron->SwitchOnFiducialCut();
384     AliFiducialCut * fidCut1stYear = anacorrhadron->GetFiducialCut();
385     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
386     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
387     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
388     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
389     fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
390     fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
391   }
392   anacorrhadron->SwitchOnDecayCorr();
393   anacorrhadron->SetMultiBin(1);
394   anacorrhadron->SetZvertexCut(10.);
395   anacorrhadron->SwitchOffNeutralCorr();
396   anacorrhadron->SwitchOffEventSelection();
397   anacorrhadron->SetPtCutRange(0.1,100);
398   anacorrhadron->SetDeltaPhiCutRange(1.5,4.5);
399   anacorrhadron->SwitchOnSeveralUECalculation();
400   anacorrhadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
401   anacorrhadron->SelectIsolated(kFALSE); // do correlation with isolated photons
402   if(kUseKinematics) anacorrhadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
403   else  anacorrhadron->SwitchOffDataMC() ;
404   //if(calorimeter=="PHOS"){
405   //Correlate with particles in EMCAL
406   //anacorrhadron->SwitchOnCaloPID();
407   //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
408   //}
409   //Set Histograms bins and ranges
410   anacorrhadron->SetHistoPtRangeAndNBins(0, 50, 200) ;
411   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
412   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
413   if(kPrintSettings) anacorrhadron->Print("");
414   
415   // ### Correlation with hadrons
416   AliAnaParticleHadronCorrelation *anacorrisohadron = new AliAnaParticleHadronCorrelation();
417   anacorrisohadron->SetInputAODName(Form("Photons%s",calorimeter.Data()));
418   anacorrisohadron->AddToHistogramsName("AnaHadronCorrIsoPhoton_");
419   anacorrisohadron->SetAODObjArrayName("IsoPhotonHadronCorr"); 
420   anacorrisohadron->SetDebug(-1);
421   anacorrisohadron->SwitchOffCaloPID();
422     if(kSimulation){
423     anacorrisohadron->SwitchOnFiducialCut();
424     AliFiducialCut * fidCut1stYear = anacorrisohadron->GetFiducialCut();
425     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
426     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
427     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
428     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
429     fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
430     fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
431   }
432   anacorrisohadron->SwitchOnDecayCorr();
433   anacorrisohadron->SetMultiBin(1);
434   anacorrisohadron->SetZvertexCut(10.);
435   anacorrisohadron->SwitchOffNeutralCorr();
436   anacorrisohadron->SwitchOffEventSelection();
437   anacorrisohadron->SetPtCutRange(0.1,100);
438   anacorrisohadron->SetDeltaPhiCutRange(1.5,4.5);
439   anacorrisohadron->SwitchOnSeveralUECalculation();
440   anacorrisohadron->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
441   anacorrisohadron->SelectIsolated(kTRUE); // do correlation with isolated photons
442   if(kUseKinematics) anacorrisohadron->SwitchOnDataMC() ;//Access MC stack and fill more histograms
443   else  anacorrisohadron->SwitchOffDataMC() ;
444   //if(calorimeter=="PHOS"){
445   //Correlate with particles in EMCAL
446   //anacorrhadron->SwitchOnCaloPID();
447   //anacorrhadron->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
448   //}
449   //Set Histograms bins and ranges
450   anacorrisohadron->SetHistoPtRangeAndNBins(0, 50, 200) ;
451   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
452   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
453   if(kPrintSettings) anacorrisohadron->Print("");
454   
455   
456   // ### Pi0 Correlation with hadrons, not isolated
457   AliAnaParticleHadronCorrelation *anacorrhadronpi0 = new AliAnaParticleHadronCorrelation();
458   anacorrhadronpi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
459   anacorrhadronpi0->AddToHistogramsName("AnaHadronCorrPi0_");
460   anacorrhadronpi0->SetAODObjArrayName("Pi0HadronCorr"); 
461   anacorrhadronpi0->SetDebug(-1);
462   anacorrhadronpi0->SwitchOffCaloPID();
463   if(kSimulation){
464     anacorrhadronpi0->SwitchOnFiducialCut();
465     AliFiducialCut * fidCut1stYear = anacorrhadronpi0->GetFiducialCut();
466     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
467     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
468     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
469     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
470     fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
471     fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
472   }
473   anacorrhadronpi0->SwitchOnDecayCorr();
474   anacorrhadronpi0->SetMultiBin(1);
475   anacorrhadronpi0->SetZvertexCut(10.);
476   anacorrhadronpi0->SwitchOffNeutralCorr();
477   anacorrhadronpi0->SwitchOffEventSelection();
478   anacorrhadronpi0->SetPtCutRange(0.1,100);
479   anacorrhadronpi0->SetDeltaPhiCutRange(1.5,4.5);
480   anacorrhadronpi0->SelectIsolated(kFALSE); // do correlation with non isolated pi0
481   anacorrhadronpi0->SwitchOnSeveralUECalculation();
482   anacorrhadronpi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
483   if(kUseKinematics) anacorrhadronpi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
484   else  anacorrhadronpi0->SwitchOffDataMC() ;
485   //if(calorimeter=="PHOS"){
486   //    //Correlate with particles in EMCAL
487   //    anacorrhadronpi0->SwitchOnCaloPID();
488   //    anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
489   //}
490   //Set Histograms bins and ranges
491   anacorrhadronpi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
492   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
493   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
494   if(kPrintSettings) anacorrhadronpi0->Print("");
495   
496   // ### Pi0 Correlation with hadrons, isolated
497   AliAnaParticleHadronCorrelation *anacorrhadronisopi0 = new AliAnaParticleHadronCorrelation();
498   anacorrhadronisopi0->SetInputAODName(Form("Pi0s%s",calorimeter.Data()));
499   anacorrhadronisopi0->AddToHistogramsName("AnaHadronCorrIsoPi0_");
500   anacorrhadronisopi0->SetAODObjArrayName("IsoPi0HadronCorr"); 
501   anacorrhadronisopi0->SetDebug(-1);
502   anacorrhadronisopi0->SwitchOffCaloPID();
503     if(kSimulation){
504     anacorrhadronisopi0->SwitchOnFiducialCut();
505     AliFiducialCut * fidCut1stYear = anacorrhadronisopi0->GetFiducialCut();
506     fidCut1stYear->DoEMCALFiducialCut(kTRUE) ;
507     fidCut1stYear->DoPHOSFiducialCut(kTRUE) ;
508     fidCut1stYear->SetSimpleEMCALFiducialCut(0.7,80.,120.);
509     fidCut1stYear->SetSimplePHOSFiducialCut(0.12,260.,320.);
510     fidCut1stYear->DoCTSFiducialCut(kTRUE) ;
511     fidCut1stYear->SetSimpleCTSFiducialCut(0.8,0.,360.);    
512   }
513   anacorrhadronisopi0->SwitchOnDecayCorr();
514   anacorrhadronisopi0->SetMultiBin(1);
515   anacorrhadronisopi0->SetZvertexCut(10.);
516   anacorrhadronisopi0->SwitchOffNeutralCorr();
517   anacorrhadronisopi0->SwitchOffEventSelection();
518   anacorrhadronisopi0->SetPtCutRange(0.1,100);
519   anacorrhadronisopi0->SetDeltaPhiCutRange(1.5,4.5);
520   anacorrhadronisopi0->SelectIsolated(kTRUE); // do correlation with isolated pi0
521   anacorrhadronisopi0->SwitchOnSeveralUECalculation();
522   anacorrhadronisopi0->SetUeDeltaPhiCutRange(TMath::Pi()/3, 2*TMath::Pi()/3);
523   if(kUseKinematics) anacorrhadronisopi0->SwitchOnDataMC() ;//Access MC stack and fill more histograms
524   else  anacorrhadronisopi0->SwitchOffDataMC() ;
525   //if(calorimeter=="PHOS"){
526   //    //Correlate with particles in EMCAL
527   //    anacorrhadronpi0->SwitchOnCaloPID();
528   //    anacorrhadronpi0->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL
529   //}
530   //Set Histograms bins and ranges
531   anacorrhadronisopi0->SetHistoPtRangeAndNBins(0, 50, 200) ;
532   //      ana->SetHistoPhiRangeAndNBins(0, TMath::TwoPi(), 100) ;
533   //      ana->SetHistoEtaRangeAndNBins(-0.7, 0.7, 100) ;
534   if(kPrintSettings) anacorrhadronisopi0->Print("");
535   
536   
537   // #### Configure Maker ####
538   AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
539   maker->SetReader(reader);//pointer to reader
540   maker->SetCaloUtils(cu); //pointer to calorimeter utils
541   Int_t n = 0;//Analysis number, order is important
542   // Particle selection analysis
543   maker->AddAnalysis(anaphoton,n++);
544   maker->AddAnalysis(anapi0,n++);
545   maker->AddAnalysis(anapi0ebe,n++);
546   maker->AddAnalysis(anaomegaToPi0Gamma,n++);  
547   //if(calorimeter=="EMCAL")maker->AddAnalysis(anabtag,n++);   
548   // Isolation analysis
549   maker->AddAnalysis(anaisol,n++);
550   maker->AddAnalysis(anaisolpi0,n++);
551   // Correlation analysis
552   //maker->AddAnalysis(anacorrjet,n++);
553   //maker->AddAnalysis(anacorrhadron,n++);
554   //maker->AddAnalysis(anacorrhadronpi0,n++);
555   //maker->AddAnalysis(anacorrisohadron,n++);
556   //maker->AddAnalysis(anacorrhadronisopi0,n);
557   maker->SetAnaDebug(0)  ;
558   maker->SwitchOnHistogramsMaker()  ;
559   if(inputDataType.Contains("delta")) maker->SwitchOffAODsMaker()  ;
560   else                       maker->SwitchOnAODsMaker()  ;
561         
562   if(kPrintSettings) maker->Print("");
563   
564   printf("======================== \n");
565   printf(" End Configuration of PartCorr analysis with detector %s \n",calorimeter.Data());
566   printf("======================== \n");
567   
568   // Create task
569   //===========================================================================
570   AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation (Form("PartCorr%s",calorimeter.Data()));
571   task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
572   //task->SetDebugLevel(-1);
573   task->SetAnalysisMaker(maker);
574   if(inputDataType=="ESD" && !kSimulation) task->SelectCollisionCandidates(); //AliPhysicsSelection has to be attached before.
575   mgr->AddTask(task);
576   
577   //Create containers
578   char name[128];
579   sprintf(name,"PartCorr_%s",calorimeter.Data());
580   cout<<"Name of task "<<name<<endl;
581   //AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form(name),TList::Class(),
582   //                                       AliAnalysisManager::kOutputContainer, Form("PartCorr_%s.root",calorimeter.Data()));
583   
584   TString outputfile = AliAnalysisManager::GetCommonFileName(); 
585   //  AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(Form("PartCorr_%s",calorimeter.Data()),  TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:PartCorr_%s",outputfile.Data(),calorimeter.Data()));
586   AliAnalysisDataContainer *cout_pc   = mgr->CreateContainer(calorimeter.Data(), TList::Class(), 
587                                                              AliAnalysisManager::kOutputContainer, 
588                                                              Form("%s:PartCorr",outputfile.Data()));
589         
590   AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(Form("%sCuts",calorimeter.Data()), TList::Class(), 
591                                                              AliAnalysisManager::kParamContainer, 
592                                                              Form("%s:PartCorrCuts",outputfile.Data()));
593         
594   // Create ONLY the output containers for the data produced by the task.
595   // Get and connect other common input/output containers via the manager as below
596   //==============================================================================
597   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
598   // AOD output slot will be used in a different way in future
599   if(!inputDataType.Contains("delta")   && outputAOD) mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
600   mgr->ConnectOutput (task, 1, cout_pc);
601   mgr->ConnectOutput (task, 2, cout_cuts);
602   
603   return task;
604 }
605
606