]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrDep/AliAnaPi0EbE.cxx
Added ptHard to the information in the AliAODMCHeader, filled in the AODHandler
[u/mrichter/AliRoot.git] / PWG4 / PartCorrDep / AliAnaPi0EbE.cxx
CommitLineData
477d6cee 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes iGetEntriesFast(s hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15/* $Id: AliAnaPi0EbE.cxx 28688 2008-09-11 15:04:07Z gconesab $ */
16
17//_________________________________________________________________________
18// Class for the analysis of high pT pi0 event by event
19// Pi0 identified by one of the following:
20// -Invariant mass of 2 cluster in calorimeter
21// -Shower shape analysis in calorimeter
22// -Invariant mass of one cluster in calorimeter and one photon reconstructed in TPC (in near future)
23//
24// -- Author: Gustavo Conesa (LNF-INFN) & Raphaelle Ichou (SUBATECH)
25//////////////////////////////////////////////////////////////////////////////
26
27
28// --- ROOT system ---
29#include <TList.h>
30#include <TClonesArray.h>
31#include <TObjString.h>
32#include <TH2F.h>
33//#include "Riostream.h"
34
35// --- Analysis system ---
36#include "AliAnaPi0EbE.h"
37#include "AliCaloTrackReader.h"
38#include "AliIsolationCut.h"
39#include "AliNeutralMesonSelection.h"
40#include "AliCaloPID.h"
41#include "AliMCAnalysisUtils.h"
477d6cee 42#include "AliStack.h"
43#include "AliFidutialCut.h"
44#include "TParticle.h"
45#include "AliAODCaloCluster.h"
46#include "AliAODEvent.h"
47
48ClassImp(AliAnaPi0EbE)
49
691bdd02 50//____________________________________________________________________________
477d6cee 51AliAnaPi0EbE::AliAnaPi0EbE() :
52AliAnaPartCorrBaseClass(), fAnaType(kIMCalo),fCalorimeter(""),
53fMinDist(0.),fMinDist2(0.),fMinDist3(0.),
54fInputAODGammaConv(0x0),fInputAODGammaConvName(""),
55fhPtPi0(0),fhPhiPi0(0),fhEtaPi0(0),
56fhPtMCNoPi0(0),fhPhiMCNoPi0(0),fhEtaMCNoPi0(0),
57fhPtMCPi0(0),fhPhiMCPi0(0),fhEtaMCPi0(0)
58{
59 //default ctor
60
61 //Initialize parameters
62 InitParameters();
63
64}
65
66//____________________________________________________________________________
67AliAnaPi0EbE::AliAnaPi0EbE(const AliAnaPi0EbE & p) :
68AliAnaPartCorrBaseClass(p), fAnaType(p.fAnaType), fCalorimeter(p.fCalorimeter),
69fMinDist(p.fMinDist),fMinDist2(p.fMinDist2), fMinDist3(p.fMinDist3),
70fInputAODGammaConv(new TClonesArray(*p.fInputAODGammaConv)),
71fInputAODGammaConvName(p.fInputAODGammaConvName),
72fhPtPi0(p.fhPtPi0),fhPhiPi0(p.fhPhiPi0),fhEtaPi0(p.fhEtaPi0),
73fhPtMCNoPi0(p.fhPtMCNoPi0),fhPhiMCNoPi0(p.fhPhiMCNoPi0),fhEtaMCNoPi0(p.fhEtaMCNoPi0),
74fhPtMCPi0(p.fhPtMCPi0),fhPhiMCPi0(p.fhPhiMCPi0),fhEtaMCPi0(p.fhEtaMCPi0)
75{
76 // cpy ctor
77}
78
79//_________________________________________________________________________
80AliAnaPi0EbE & AliAnaPi0EbE::operator = (const AliAnaPi0EbE & p)
81{
82 // assignment operator
83
84 if(&p == this) return *this;
85
86 fAnaType = p.fAnaType ;
87 fCalorimeter = p.fCalorimeter ;
88 fMinDist = p.fMinDist;
89 fMinDist2 = p.fMinDist2;
90 fMinDist3 = p.fMinDist3;
91
92 fInputAODGammaConv = new TClonesArray(*p.fInputAODGammaConv) ;
93 fInputAODGammaConvName = p.fInputAODGammaConvName ;
94
95 fhPtPi0 = p.fhPtPi0; fhPhiPi0 = p.fhPhiPi0; fhEtaPi0 = p.fhEtaPi0;
96 fhPtMCNoPi0 = p.fhPtMCNoPi0; fhPhiMCNoPi0 = p.fhPhiMCNoPi0; fhEtaMCNoPi0 = p.fhEtaMCPi0;
97 fhPtMCPi0 = p.fhPtMCPi0; fhPhiMCPi0 = p.fhPhiMCPi0; fhEtaMCPi0 = p.fhEtaMCPi0;
98
99 return *this;
100
101}
102
103//____________________________________________________________________________
104AliAnaPi0EbE::~AliAnaPi0EbE()
105{
106 //dtor
107 if(fInputAODGammaConv){
108 fInputAODGammaConv->Clear() ;
109 delete fInputAODGammaConv ;
110 }
111}
112
113//________________________________________________________________________
114TList * AliAnaPi0EbE::GetCreateOutputObjects()
115{
116 // Create histograms to be saved in output file and
117 // store them in outputContainer
118 TList * outputContainer = new TList() ;
119 outputContainer->SetName("Pi0EbEHistos") ;
120
121 Int_t nptbins = GetHistoNPtBins();
122 Int_t nphibins = GetHistoNPhiBins();
123 Int_t netabins = GetHistoNEtaBins();
124 Float_t ptmax = GetHistoPtMax();
125 Float_t phimax = GetHistoPhiMax();
126 Float_t etamax = GetHistoEtaMax();
127 Float_t ptmin = GetHistoPtMin();
128 Float_t phimin = GetHistoPhiMin();
129 Float_t etamin = GetHistoEtaMin();
130
131 fhPtPi0 = new TH1F("hPtPi0","Number of identified #pi^{0} decay",nptbins,ptmin,ptmax);
132 fhPtPi0->SetYTitle("N");
133 fhPtPi0->SetXTitle("p_{T #pi^{0}}(GeV/c)");
134 outputContainer->Add(fhPtPi0) ;
135
136 fhPhiPi0 = new TH2F
137 ("hPhiPi0","#phi_{#pi^{0}}",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
138 fhPhiPi0->SetYTitle("#phi");
139 fhPhiPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");
140 outputContainer->Add(fhPhiPi0) ;
141
142 fhEtaPi0 = new TH2F
143 ("hEtaPi0","#phi_{#pi^{0}}",nptbins,ptmin,ptmax,netabins,etamin,etamax);
144 fhEtaPi0->SetYTitle("#eta");
145 fhEtaPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");
146 outputContainer->Add(fhEtaPi0) ;
147
148 if(IsDataMC()) {
149 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
150 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
151
152 fhPtMCPi0 = new TH1F("hPtMCPi0","Identified pi0 from pi0",nptbins,ptmin,ptmax);
153 fhPtMCPi0->SetYTitle("N");
154 fhPtMCPi0->SetXTitle("p_{T #pi^{0}}(GeV/c)");
155 outputContainer->Add(fhPtMCPi0) ;
156
157 fhPhiMCPi0 = new TH2F
158 ("hPhiMCPi0","Identified pi0 from pi0",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
159 fhPhiMCPi0->SetYTitle("#phi");
160 fhPhiMCPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");
161 outputContainer->Add(fhPhiMCPi0) ;
162
163 fhEtaMCPi0 = new TH2F
164 ("hEtaMCPi0","Identified pi0 from pi0",nptbins,ptmin,ptmax,netabins,etamin,etamax);
165 fhEtaMCPi0->SetYTitle("#eta");
166 fhEtaMCPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");
167 outputContainer->Add(fhEtaMCPi0) ;
168
169 fhPtMCNoPi0 = new TH1F("hPtMCNoPi0","Identified pi0 not from pi0",nptbins,ptmin,ptmax);
170 fhPtMCNoPi0->SetYTitle("N");
171 fhPtMCNoPi0->SetXTitle("p_{T #pi^{0}}(GeV/c)");
172 outputContainer->Add(fhPtMCNoPi0) ;
173
174 fhPhiMCNoPi0 = new TH2F
175 ("hPhiMCNoPi0","Identified pi0 not from pi0",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
176 fhPhiMCNoPi0->SetYTitle("#phi");
177 fhPhiMCNoPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");
178 outputContainer->Add(fhPhiMCNoPi0) ;
179
180 fhEtaMCNoPi0 = new TH2F
181 ("hEtaMCNoPi0","Identified pi0 not from pi0",nptbins,ptmin,ptmax,netabins,etamin,etamax);
182 fhEtaMCNoPi0->SetYTitle("#eta");
183 fhEtaMCNoPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");
184 outputContainer->Add(fhEtaMCNoPi0) ;
185
186 }
187 }//Histos with MC
188
189
190 //Keep neutral meson selection histograms if requiered
191 //Setting done in AliNeutralMesonSelection
192
193 if(fAnaType!=kSSCalo && GetNeutralMesonSelection()){
194
195 TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ;
196 if(GetNeutralMesonSelection()->AreNeutralMesonSelectionHistosKept())
197 for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ;
198 }
199
200 //Save parameters used for analysis
201 TString parList ; //this will be list of parameters used for this analysis.
202 char onePar[255] ;
203
204 sprintf(onePar,"--- AliAnaPi0EbE ---\n") ;
205 parList+=onePar ;
206 sprintf(onePar,"fAnaType=%d (Pi0 selection type) \n",fAnaType) ;
207 parList+=onePar ;
208
209 if(fAnaType == kSSCalo){
210 sprintf(onePar,"Calorimeter: %s\n",fCalorimeter.Data()) ;
211 parList+=onePar ;
212 sprintf(onePar,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ;
213 parList+=onePar ;
214 sprintf(onePar,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ;
215 parList+=onePar ;
216 sprintf(onePar,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ;
217 parList+=onePar ;
218 }
219
220 //Get parameters set in base class.
221 parList += GetBaseParametersList() ;
222
223 //Get parameters set in PID class.
224 if(fAnaType == kSSCalo) parList += GetCaloPID()->GetPIDParametersList() ;
225
226 TObjString *oString= new TObjString(parList) ;
227 outputContainer->Add(oString);
228
229 return outputContainer ;
230
231}
232
233//__________________________________________________________________
234void AliAnaPi0EbE::MakeAnalysisFillAOD()
235{
236 //Do analysis and fill aods
237
238 switch(fAnaType)
239 {
240 case kIMCalo:
241 MakeInvMassInCalorimeter();
242 break;
243
244 case kSSCalo:
245 MakeShowerShapeIdentification();
246 break;
247
248 case kIMCaloTracks:
249 MakeInvMassInCalorimeterAndCTS();
250 break;
251
252 }
253}
254
255//__________________________________________________________________
256void AliAnaPi0EbE::MakeInvMassInCalorimeter()
257{
258 //Do analysis and fill aods
259 //Search for the photon decay in calorimeters
260 //Read photon list from AOD, produced in class AliAnaPhoton
261 //Check if 2 photons have the mass of the pi0.
262
263 TLorentzVector mom1;
264 TLorentzVector mom2;
265 TLorentzVector mom ;
266 Int_t tag1 =-1;
267 Int_t tag2 =-1;
268 Int_t tag = -1;
269
270 if(!GetInputAODBranch()){
a3aebfff 271 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - No input calo photons in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
477d6cee 272 abort();
273 }
274 for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++){
275 AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
276 mom1 = *(photon1->Momentum());
277
278
279 for(Int_t jphoton = iphoton+1; jphoton < GetInputAODBranch()->GetEntriesFast()-1; jphoton++){
280
a3aebfff 281 AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(jphoton));
477d6cee 282 mom2 = *(photon2->Momentum());
283
284 //Select good pair (good phi, pt cuts, aperture and invariant mass)
285 if(GetNeutralMesonSelection()->SelectPair(mom1, mom2))
286 {
287 if(GetDebug()>1)
a3aebfff 288 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Selected gamma pair: pt %f, phi %f, eta%f \n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta());
477d6cee 289
290 //Play with the MC stack if available
291 if(IsDataMC()){
292 //Check origin of the candidates
293 tag1 = GetMCAnalysisUtils()->CheckOrigin(photon1->GetLabel(), GetMCStack());
294 tag2 = GetMCAnalysisUtils()->CheckOrigin(photon2->GetLabel(), GetMCStack());
295
a3aebfff 296 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2);
477d6cee 297 if(tag1 == AliMCAnalysisUtils::kMCPi0Decay && tag2 == AliMCAnalysisUtils::kMCPi0Decay){
298
299 //Check if pi0 mother is the same
300 Int_t label1 = photon1->GetLabel();
301 TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree
302 label1 = mother1->GetFirstMother();
303 //mother1 = GetMCStack()->Particle(label1);//pi0
304
305 Int_t label2 = photon2->GetLabel();
306 TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree
307 label2 = mother2->GetFirstMother();
308 //mother2 = GetMCStack()->Particle(label2);//pi0
309
310 //printf("mother1 %d, mother2 %d\n",label1,label2);
311 if(label1 == label2)
312 tag = AliMCAnalysisUtils::kMCPi0;
313 }
314 }//Work with stack also
315
316 //Create AOD for analysis
317 mom = mom1+mom2;
318 AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
319 //pi0.SetLabel(calo->GetLabel(0));
320 pi0.SetPdg(AliCaloPID::kPi0);
321 pi0.SetDetector(photon1->GetDetector());
322 pi0.SetTag(tag);
323 //Set the indeces of the original caloclusters
324 pi0.SetCaloLabel(photon1->GetCaloLabel(0), photon2->GetCaloLabel(0));
325 AddAODParticle(pi0);
326 }//pi0
327 }//2n photon loop
328
329 }//1st photon loop
330
a3aebfff 331 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - End fill AODs \n");
477d6cee 332
333}
334
335//__________________________________________________________________
336void AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
337{
338 //Do analysis and fill aods
339 //Search for the photon decay in calorimeters
340 //Read photon list from AOD, produced in class AliAnaPhoton and AliGammaConversion
341 //Check if 2 photons have the mass of the pi0.
342
343 TLorentzVector mom1;
344 TLorentzVector mom2;
345 TLorentzVector mom ;
346 Int_t tag1 =-1;
347 Int_t tag2 =-1;
348 Int_t tag = -1;
349
350 if(!GetInputAODBranch()){
a3aebfff 351 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input calo photons in AOD branch with name < %s > , STOP\n",GetInputAODName().Data());
477d6cee 352 abort();
353 }
354 for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++){
355 AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
356 mom1 = *(photon1->Momentum());
357
358 //Play with the MC stack if available
359 fInputAODGammaConv = (TClonesArray *) GetReader()->GetOutputEvent()->FindListObject(fInputAODGammaConvName);
360 if(!fInputAODGammaConv) {
a3aebfff 361 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input gamma conversions in AOD branch with name < %s >, STOP\n",fInputAODGammaConvName.Data());
477d6cee 362 abort();
363 }
364 for(Int_t jphoton = iphoton+1; jphoton < fInputAODGammaConv->GetEntriesFast()-1; jphoton++){
a3aebfff 365 AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (fInputAODGammaConv->At(jphoton));
477d6cee 366 mom2 = *(photon2->Momentum());
367 //Select good pair (good phi, pt cuts, aperture and invariant mass)
368 if(GetNeutralMesonSelection()->SelectPair(mom1, mom2)){
a3aebfff 369 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - Selected gamma pair: pt %f, phi %f, eta%f\n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta());
477d6cee 370
371 if(IsDataMC()){
372 //Check origin of the candidates
373 tag1 = GetMCAnalysisUtils()->CheckOrigin(photon1->GetLabel(), GetMCStack());
374 tag2 = GetMCAnalysisUtils()->CheckOrigin(photon2->GetLabel(), GetMCStack());
a3aebfff 375 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2);
477d6cee 376 if(tag1 == AliMCAnalysisUtils::kMCPi0Decay && tag2 == AliMCAnalysisUtils::kMCPi0Decay){
377 //Check if pi0 mother is the same
378 Int_t label1 = photon1->GetLabel();
379 TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree
380 label1 = mother1->GetFirstMother();
381 //mother1 = GetMCStack()->Particle(label1);//pi0
382
383 Int_t label2 = photon2->GetLabel();
384 TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree
385 label2 = mother2->GetFirstMother();
386 //mother2 = GetMCStack()->Particle(label2);//pi0
387
388 //printf("mother1 %d, mother2 %d\n",label1,label2);
389 if(label1 == label2)
390 tag = AliMCAnalysisUtils::kMCPi0;
391 }
392 }//Work with stack also
393
394 //Create AOD for analysis
395 mom = mom1+mom2;
a3aebfff 396 AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
477d6cee 397 //pi0.SetLabel(calo->GetLabel(0));
398 pi0.SetPdg(AliCaloPID::kPi0);
399 pi0.SetDetector(photon1->GetDetector());
400 pi0.SetTag(tag);
401 //Set the indeces of the original tracks or caloclusters
402 pi0.SetCaloLabel(photon1->GetCaloLabel(0), -1);
403 pi0.SetTrackLabel(photon2->GetTrackLabel(0), photon2->GetTrackLabel(1));
404 AddAODParticle(pi0);
405 }//pi0
406 }//2n photon loop
407
408 }//1st photon loop
409
a3aebfff 410 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - End fill AODs \n");
477d6cee 411
412}
413
414
415//__________________________________________________________________
416void AliAnaPi0EbE::MakeShowerShapeIdentification()
417{
418 //Search for pi0 in fCalorimeter with shower shape analysis
419
420 TRefArray * pl = new TRefArray;
421
422 //Get vertex for photon momentum calculation
423 Double_t vertex[]={0,0,0} ; //vertex ;
424 if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex);
425
426 //Select the Calorimeter of the photon
427 if(fCalorimeter == "PHOS")
428 pl = GetAODPHOS();
429 else if (fCalorimeter == "EMCAL")
430 pl = GetAODEMCAL();
431 //Fill AODCaloClusters and AODParticle with PHOS aods
432 TLorentzVector mom ;
433 for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++){
434 AliAODCaloCluster * calo = (AliAODCaloCluster*) (pl->At(icalo));
435
436 //Cluster selection, not charged, with pi0 id and in fidutial cut
437 //Get Momentum vector,
438 calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line
439 //If too small or big pt, skip it
440 if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ;
441 //Check acceptance selection
442 if(IsFidutialCutOn()){
443 Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,fCalorimeter) ;
444 if(! in ) continue ;
445 }
446
447 //Create AOD for analysis
448 AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);
449 aodpi0.SetLabel(calo->GetLabel(0));
450 //Set the indeces of the original caloclusters
451 aodpi0.SetCaloLabel(calo->GetID(),-1);
452 aodpi0.SetDetector(fCalorimeter);
453 if(GetDebug() > 1)
a3aebfff 454 printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Min pt cut and fidutial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodpi0.Pt(),aodpi0.Phi(),aodpi0.Eta());
477d6cee 455
456 //Check Distance to Bad channel, set bit.
457 Double_t distBad=calo->GetDistToBadChannel() ; //Distance to bad channel
458 if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
459 if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm)
460 continue ;
461
a3aebfff 462 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Bad channel cut passed %4.2f\n",distBad);
477d6cee 463
464 if(distBad > fMinDist3) aodpi0.SetDistToBad(2) ;
465 else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ;
466 else aodpi0.SetDistToBad(0) ;
467
468 //Check PID
469 //PID selection or bit setting
470 if(GetReader()->GetDataType() == AliCaloTrackReader::kMC){
471 //Get most probable PID, check PID weights (in MC this option is mandatory)
472 aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights
473 if(GetDebug() > 1)
a3aebfff 474 printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: PDG of identified particle %d\n",aodpi0.GetPdg());
477d6cee 475 //If primary is not pi0, skip it.
476 if(aodpi0.GetPdg() != AliCaloPID::kPi0) continue ;
477 }
478 else if(IsCaloPIDOn()){
479 //Skip matched clusters with tracks
480 if(calo->GetNTracksMatched() > 0) continue ;
481
482 //Get most probable PID, 2 options check PID weights
483 //or redo PID, recommended option for EMCal.
484 if(!IsCaloPIDRecalculationOn())
485 aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights
486 else
487 aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated
488
a3aebfff 489 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PDG of identified particle %d\n",aodpi0.GetPdg());
477d6cee 490
491 //If cluster does not pass pid, not pi0, skip it.
492 if(aodpi0.GetPdg() != AliCaloPID::kPi0) continue ;
493
494 }
495 else{
496 //Set PID bits for later selection (AliAnaPi0 for example)
497 //GetPDG already called in SetPIDBits.
498 GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodpi0);
a3aebfff 499 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PID Bits set \n");
477d6cee 500 }
501
a3aebfff 502 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Pi0 selection cuts passed: pT %3.2f, pdg %d\n",aodpi0.Pt(), aodpi0.GetPdg());
477d6cee 503
504 //Play with the MC stack if available
505 //Check origin of the candidates
506 if(IsDataMC()){
507 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
508 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
509 aodpi0.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetMCStack()));
a3aebfff 510 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Origin of candidate %d\n",aodpi0.GetTag());
477d6cee 511 }
512 }//Work with stack also
513
514 //Add AOD with pi0 object to aod branch
515 AddAODParticle(aodpi0);
516
517 }//loop
518
a3aebfff 519 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - End fill AODs \n");
477d6cee 520
521}
522//__________________________________________________________________
523void AliAnaPi0EbE::MakeAnalysisFillHistograms()
691bdd02 524{
477d6cee 525 //Do analysis and fill histograms
691bdd02 526
477d6cee 527 if(!GetOutputAODBranch()){
a3aebfff 528 printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - No output pi0 in AOD branch with name < %s >,STOP \n",GetOutputAODName().Data());
477d6cee 529 abort();
530 }
531 //Loop on stored AOD pi0
532 Int_t naod = GetOutputAODBranch()->GetEntriesFast();
a3aebfff 533 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
477d6cee 534
535 for(Int_t iaod = 0; iaod < naod ; iaod++){
536
537 AliAODPWG4Particle* pi0 = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
538 Int_t pdg = pi0->GetPdg();
9415d854 539
540 if(IsCaloPIDOn() && pdg != AliCaloPID::kPi0) continue;
477d6cee 541
542 //Fill pi0 histograms
543 Float_t pt = pi0->Pt();
544 Float_t phi = pi0->Phi();
545 Float_t eta = pi0->Eta();
546
547
548 fhPtPi0 ->Fill(pt);
549 fhPhiPi0 ->Fill(pt,phi);
550 fhEtaPi0 ->Fill(pt,eta);
551
552 if(IsDataMC()){
553 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
554 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
555 if(pi0->GetTag()== AliMCAnalysisUtils::kMCPi0){
556 fhPtMCPi0 ->Fill(pt);
557 fhPhiMCPi0 ->Fill(pt,phi);
558 fhEtaMCPi0 ->Fill(pt,eta);
559 }
560 else{
561 fhPtMCNoPi0 ->Fill(pt);
562 fhPhiMCNoPi0 ->Fill(pt,phi);
563 fhEtaMCNoPi0 ->Fill(pt,eta);
564 }
565 }
566 }//Histograms with MC
567
568 }// aod loop
569
570}
571
572
573//____________________________________________________________________________
574void AliAnaPi0EbE::Init()
575{
691bdd02 576 //Init
577 //Do some checks
578 if(fCalorimeter == "PHOS" && !GetReader()->IsPHOSSwitchedOn()){
a3aebfff 579 printf("AliAnaPi0EbE::Init() - !!ABORT: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
691bdd02 580 abort();
581 }
582 else if(fCalorimeter == "EMCAL" && !GetReader()->IsEMCALSwitchedOn()){
a3aebfff 583 printf("AliAnaPi0EbE::Init() - !!ABORT: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
691bdd02 584 abort();
585 }
586
587}
588
477d6cee 589//____________________________________________________________________________
590void AliAnaPi0EbE::InitParameters()
591{
592 //Initialize the parameters of the analysis.
593 SetOutputAODClassName("AliAODPWG4Particle");
a3aebfff 594 SetOutputAODName("Pi0");
595
596 AddToHistogramsName("AnaPi0EbE_");
597
477d6cee 598 fInputAODGammaConvName = "gammaconv" ;
599 fAnaType = kIMCalo ;
600 fCalorimeter = "EMCAL" ;
601 fMinDist = 2.;
602 fMinDist2 = 4.;
603 fMinDist3 = 5.;
604
605}
606
607//__________________________________________________________________
608void AliAnaPi0EbE::Print(const Option_t * opt) const
609{
610 //Print some relevant parameters set for the analysis
611 if(! opt)
612 return;
613
614 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
615 AliAnaPartCorrBaseClass::Print("");
616 printf("Analysis Type = %d \n", fAnaType) ;
617 if(fAnaType == kSSCalo){
618 printf("Calorimeter = %s\n", fCalorimeter.Data()) ;
619 printf("Min Distance to Bad Channel = %2.1f\n",fMinDist);
620 printf("Min Distance to Bad Channel 2 = %2.1f\n",fMinDist2);
621 printf("Min Distance to Bad Channel 3 = %2.1f\n",fMinDist3);
622 }
623 printf(" \n") ;
624
625}