1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is 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 **************************************************************************/
16 //_________________________________________________________________________
17 // Class for the analysis of high pT pi0 event by event
18 // Pi0/Eta identified by one of the following:
19 // -Invariant mass of 2 cluster in calorimeter
20 // -Shower shape analysis in calorimeter
21 // -Invariant mass of one cluster in calorimeter and one photon reconstructed in CTS
23 // -- Author: Gustavo Conesa (LNF-INFN) & Raphaelle Ichou (SUBATECH)
24 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
29 #include <TClonesArray.h>
30 #include <TObjString.h>
32 // --- Analysis system ---
33 #include "AliAnaPi0EbE.h"
34 #include "AliCaloTrackReader.h"
35 #include "AliIsolationCut.h"
36 #include "AliNeutralMesonSelection.h"
37 #include "AliCaloPID.h"
38 #include "AliMCAnalysisUtils.h"
40 #include "AliFiducialCut.h"
41 #include "TParticle.h"
42 #include "AliVCluster.h"
43 #include "AliAODEvent.h"
44 #include "AliAODMCParticle.h"
46 ClassImp(AliAnaPi0EbE)
48 //____________________________
49 AliAnaPi0EbE::AliAnaPi0EbE() :
50 AliAnaCaloTrackCorrBaseClass(),fAnaType(kIMCalo), fCalorimeter(""),
51 fMinDist(0.),fMinDist2(0.), fMinDist3(0.),
52 fFillWeightHistograms(kFALSE), fFillTMHisto(0),
53 fInputAODGammaConvName(""),
56 fhEEta(0), fhEPhi(0), fhEtaPhi(0),
57 fhPtDecay(0), fhEDecay(0),
59 fhEDispersion(0), fhELambda0(0), fhELambda1(0),
60 fhELambda0NoTRD(0), fhELambda0FracMaxCellCut(0),
61 fhEFracMaxCell(0), fhEFracMaxCellNoTRD(0),
62 fhENCells(0), fhETime(0), fhEPairDiffTime(0),
64 fhPtMCNo(0), fhPhiMCNo(0), fhEtaMCNo(0),
65 fhPtMC(0), fhPhiMC(0), fhEtaMC(0),
66 fhMassPairMCPi0(0), fhMassPairMCEta(0),
67 fhAnglePairMCPi0(0), fhAnglePairMCEta(0),
69 fhECellClusterRatio(0), fhECellClusterLogRatio(0),
70 fhEMaxCellClusterRatio(0), fhEMaxCellClusterLogRatio(0),
71 fhTrackMatchedDEta(0), fhTrackMatchedDPhi(0), fhTrackMatchedDEtaDPhi(0),
72 fhdEdx(0), fhEOverP(0), fhTrackMatchedMCParticle(0),
77 for(Int_t i = 0; i < 6; i++){
79 fhEMCLambda0NoTRD[i]= 0;
80 fhEMCLambda0FracMaxCellCut[i]= 0;
81 fhEMCFracMaxCell[i] = 0;
83 fhEMCDispersion[i] = 0;
87 for(Int_t i =0; i < 14; i++){
88 fhLambda0ForW0[i] = 0;
89 //fhLambda1ForW0[i] = 0;
92 //Initialize parameters
97 //_____________________________________________________________________________________
98 void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster, const Int_t tag){
100 // Fill shower shape, timing and other histograms for selected clusters from decay
102 Float_t e = cluster->E();
103 Float_t disp = cluster->GetDispersion()*cluster->GetDispersion();
104 Float_t l0 = cluster->GetM02();
105 Float_t l1 = cluster->GetM20();
106 Int_t nSM = GetModuleNumber(cluster);
108 AliVCaloCells * cell = 0x0;
109 if(fCalorimeter == "PHOS")
110 cell = GetPHOSCells();
112 cell = GetEMCALCells();
114 Float_t maxCellFraction = 0;
115 GetCaloUtils()->GetMaxEnergyCell(cell, cluster, maxCellFraction);
116 fhEFracMaxCell->Fill(e,maxCellFraction);
118 FillWeightHistograms(cluster);
120 fhEDispersion->Fill(e, disp);
121 fhELambda0 ->Fill(e, l0 );
122 fhELambda1 ->Fill(e, l1 );
124 if(fCalorimeter=="EMCAL" && nSM < 6)
126 fhELambda0NoTRD->Fill(e, l0 );
127 fhEFracMaxCellNoTRD->Fill(e,maxCellFraction);
130 if(maxCellFraction < 0.5)
131 fhELambda0FracMaxCellCut->Fill(e, l0 );
133 fhETime ->Fill(e, cluster->GetTOF()*1.e9);
134 fhENCells->Fill(e, cluster->GetNCells());
136 // Fill Track matching control histograms
139 Float_t dZ = cluster->GetTrackDz();
140 Float_t dR = cluster->GetTrackDx();
142 if(cluster->IsEMCAL() && GetCaloUtils()->IsRecalculationOfClusterTrackMatchingOn())
144 dR = 2000., dZ = 2000.;
145 GetCaloUtils()->GetEMCALRecoUtils()->GetMatchedResiduals(cluster->GetID(),dZ,dR);
147 //printf("Pi0EbE: dPhi %f, dEta %f\n",dR,dZ);
149 if(fhTrackMatchedDEta && TMath::Abs(dR) < 999)
151 fhTrackMatchedDEta->Fill(e,dZ);
152 fhTrackMatchedDPhi->Fill(e,dR);
153 if(e > 0.5) fhTrackMatchedDEtaDPhi->Fill(dZ,dR);
156 // Check dEdx and E/p of matched clusters
158 if(TMath::Abs(dZ) < 0.05 && TMath::Abs(dR) < 0.05)
160 AliVTrack *track = GetCaloUtils()->GetMatchedTrack(cluster, GetReader()->GetInputEvent());
164 Float_t dEdx = track->GetTPCsignal();
165 fhdEdx->Fill(e, dEdx);
167 Float_t eOverp = e/track->P();
168 fhEOverP->Fill(e, eOverp);
170 if(fCalorimeter=="EMCAL" && nSM < 6) fhEOverPNoTRD->Fill(e, eOverp);
174 // printf("AliAnaPi0EbE::FillSelectedClusterHistograms() - Residual OK but (dR, dZ)= (%2.4f,%2.4f) no track associated WHAT? \n", dR,dZ);
180 if ( !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) )
182 if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) ||
183 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) ) fhTrackMatchedMCParticle->Fill(e, 2.5 );
184 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) ) fhTrackMatchedMCParticle->Fill(e, 0.5 );
185 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron) ) fhTrackMatchedMCParticle->Fill(e, 1.5 );
186 else fhTrackMatchedMCParticle->Fill(e, 3.5 );
191 if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) ||
192 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) ) fhTrackMatchedMCParticle->Fill(e, 6.5 );
193 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) ) fhTrackMatchedMCParticle->Fill(e, 4.5 );
194 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron) ) fhTrackMatchedMCParticle->Fill(e, 5.5 );
195 else fhTrackMatchedMCParticle->Fill(e, 7.5 );
199 }// Track matching histograms
204 if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) )
206 fhEMCLambda0[kmcPi0] ->Fill(e, l0);
207 fhEMCLambda1[kmcPi0] ->Fill(e, l1);
208 fhEMCDispersion[kmcPi0] ->Fill(e, disp);
210 fhEMCFracMaxCell[kmcPi0]->Fill(e,maxCellFraction);
211 if(fCalorimeter=="EMCAL" && nSM < 6)
212 fhEMCLambda0NoTRD[kmcPi0]->Fill(e, l0 );
213 if(maxCellFraction < 0.5)
214 fhEMCLambda0FracMaxCellCut[kmcPi0]->Fill(e, l0 );
217 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) )
219 fhEMCLambda0[kmcEta] ->Fill(e, l0);
220 fhEMCLambda1[kmcEta] ->Fill(e, l1);
221 fhEMCDispersion[kmcEta] ->Fill(e, disp);
222 fhEMCFracMaxCell[kmcEta]->Fill(e,maxCellFraction);
223 if(fCalorimeter=="EMCAL" && nSM < 6)
224 fhEMCLambda0NoTRD[kmcEta]->Fill(e, l0 );
225 if(maxCellFraction < 0.5)
226 fhEMCLambda0FracMaxCellCut[kmcEta]->Fill(e, l0 );
228 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) &&
229 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) )
231 fhEMCLambda0[kmcConversion] ->Fill(e, l0);
232 fhEMCLambda1[kmcConversion] ->Fill(e, l1);
233 fhEMCDispersion[kmcConversion] ->Fill(e, disp);
234 fhEMCFracMaxCell[kmcConversion]->Fill(e,maxCellFraction);
235 if(fCalorimeter=="EMCAL" && nSM < 6)
236 fhEMCLambda0NoTRD[kmcConversion]->Fill(e, l0 );
237 if(maxCellFraction < 0.5)
238 fhEMCLambda0FracMaxCellCut[kmcConversion]->Fill(e, l0 );
240 else if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) )
242 fhEMCLambda0[kmcPhoton] ->Fill(e, l0);
243 fhEMCLambda1[kmcPhoton] ->Fill(e, l1);
244 fhEMCDispersion[kmcPhoton] ->Fill(e, disp);
245 fhEMCFracMaxCell[kmcPhoton]->Fill(e,maxCellFraction);
246 if(fCalorimeter=="EMCAL" && nSM < 6)
247 fhEMCLambda0NoTRD[kmcPhoton]->Fill(e, l0 );
248 if(maxCellFraction < 0.5)
249 fhEMCLambda0FracMaxCellCut[kmcPhoton]->Fill(e, l0 );
250 }//photon no conversion
251 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron))
253 fhEMCLambda0[kmcElectron] ->Fill(e, l0);
254 fhEMCLambda1[kmcElectron] ->Fill(e, l1);
255 fhEMCDispersion[kmcElectron] ->Fill(e, disp);
256 fhEMCFracMaxCell[kmcElectron]->Fill(e,maxCellFraction);
257 if(fCalorimeter=="EMCAL" && nSM < 6)
258 fhEMCLambda0NoTRD[kmcElectron]->Fill(e, l0 );
259 if(maxCellFraction < 0.5)
260 fhEMCLambda0FracMaxCellCut[kmcElectron]->Fill(e, l0 );
264 fhEMCLambda0[kmcHadron] ->Fill(e, l0);
265 fhEMCLambda1[kmcHadron] ->Fill(e, l1);
266 fhEMCDispersion[kmcHadron] ->Fill(e, disp);
267 fhEMCFracMaxCell[kmcHadron]->Fill(e,maxCellFraction);
268 if(fCalorimeter=="EMCAL" && nSM < 6)
269 fhEMCLambda0NoTRD[kmcHadron]->Fill(e, l0 );
270 if(maxCellFraction < 0.5)
271 fhEMCLambda0FracMaxCellCut[kmcHadron]->Fill(e, l0 );
276 //________________________________________________________
277 void AliAnaPi0EbE::FillWeightHistograms(AliVCluster *clus)
279 // Calculate weights and fill histograms
281 if(!fFillWeightHistograms || GetMixedEvent()) return;
283 AliVCaloCells* cells = 0;
284 if(fCalorimeter == "EMCAL") cells = GetEMCALCells();
285 else cells = GetPHOSCells();
287 // First recalculate energy in case non linearity was applied
290 for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
293 Int_t id = clus->GetCellsAbsId()[ipos];
295 //Recalibrate cell energy if needed
296 Float_t amp = cells->GetCellAmplitude(id);
297 RecalibrateCellAmplitude(amp,id);
308 printf("AliAnaPi0EbE::WeightHistograms()- Wrong calculated energy %f\n",energy);
312 fhEMaxCellClusterRatio ->Fill(energy,ampMax/energy);
313 fhEMaxCellClusterLogRatio->Fill(energy,TMath::Log(ampMax/energy));
315 //Get the ratio and log ratio to all cells in cluster
316 for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
318 Int_t id = clus->GetCellsAbsId()[ipos];
320 //Recalibrate cell energy if needed
321 Float_t amp = cells->GetCellAmplitude(id);
322 RecalibrateCellAmplitude(amp,id);
324 fhECellClusterRatio ->Fill(energy,amp/energy);
325 fhECellClusterLogRatio->Fill(energy,TMath::Log(amp/energy));
328 //Recalculate shower shape for different W0
329 if(fCalorimeter=="EMCAL"){
331 Float_t l0org = clus->GetM02();
332 Float_t l1org = clus->GetM20();
333 Float_t dorg = clus->GetDispersion();
335 for(Int_t iw = 0; iw < 14; iw++)
337 GetCaloUtils()->GetEMCALRecoUtils()->SetW0(1+iw*0.5);
338 GetCaloUtils()->GetEMCALRecoUtils()->RecalculateClusterShowerShapeParameters(GetEMCALGeometry(), cells, clus);
340 fhLambda0ForW0[iw]->Fill(energy,clus->GetM02());
341 //fhLambda1ForW0[iw]->Fill(energy,clus->GetM20());
345 // Set the original values back
348 clus->SetDispersion(dorg);
353 //__________________________________________
354 TObjString * AliAnaPi0EbE::GetAnalysisCuts()
356 //Save parameters used for analysis
357 TString parList ; //this will be list of parameters used for this analysis.
358 const Int_t buffersize = 255;
359 char onePar[buffersize] ;
361 snprintf(onePar,buffersize,"--- AliAnaPi0EbE ---\n") ;
363 snprintf(onePar,buffersize,"fAnaType=%d (Pi0 selection type) \n",fAnaType) ;
366 if(fAnaType == kSSCalo)
368 snprintf(onePar,buffersize,"Calorimeter: %s\n",fCalorimeter.Data()) ;
370 snprintf(onePar,buffersize,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ;
372 snprintf(onePar,buffersize,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ;
374 snprintf(onePar,buffersize,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ;
378 //Get parameters set in base class.
379 parList += GetBaseParametersList() ;
381 //Get parameters set in PID class.
382 if(fAnaType == kSSCalo) parList += GetCaloPID()->GetPIDParametersList() ;
384 return new TObjString(parList) ;
387 //__________________________________________________________________
388 void AliAnaPi0EbE::HasPairSameMCMother(AliAODPWG4Particle * photon1,
389 AliAODPWG4Particle * photon2,
390 Int_t & label, Int_t & tag)
392 // Check the labels of pare in case mother was same pi0 or eta
393 // Set the new AOD accordingly
395 Int_t label1 = photon1->GetLabel();
396 Int_t label2 = photon2->GetLabel();
398 if(label1 < 0 || label2 < 0 ) return ;
400 //Int_t tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader(), photon1->GetInputFileIndex());
401 //Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex());
402 Int_t tag1 = photon1->GetTag();
403 Int_t tag2 = photon2->GetTag();
405 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2);
406 if( (GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay) &&
407 GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCPi0Decay) ) ||
408 (GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCEtaDecay) &&
409 GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCEtaDecay) )
413 //Check if pi0/eta mother is the same
414 if(GetReader()->ReadStack())
418 TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree
419 label1 = mother1->GetFirstMother();
420 //mother1 = GetMCStack()->Particle(label1);//pi0
424 TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree
425 label2 = mother2->GetFirstMother();
426 //mother2 = GetMCStack()->Particle(label2);//pi0
429 else if(GetReader()->ReadAODMCParticles())
433 AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon1->GetInputFileIndex()))->At(label1);//photon in kine tree
434 label1 = mother1->GetMother();
435 //mother1 = GetMCStack()->Particle(label1);//pi0
439 AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon2->GetInputFileIndex()))->At(label2);//photon in kine tree
440 label2 = mother2->GetMother();
441 //mother2 = GetMCStack()->Particle(label2);//pi0
445 //printf("mother1 %d, mother2 %d\n",label1,label2);
446 if( label1 == label2 && label1>=0 )
451 TLorentzVector mom1 = *(photon1->Momentum());
452 TLorentzVector mom2 = *(photon2->Momentum());
454 Double_t angle = mom2.Angle(mom1.Vect());
455 Double_t mass = (mom1+mom2).M();
456 Double_t epair = (mom1+mom2).E();
458 if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay))
460 fhMassPairMCPi0 ->Fill(epair,mass);
461 fhAnglePairMCPi0->Fill(epair,angle);
462 GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0);
466 fhMassPairMCEta ->Fill(epair,mass);
467 fhAnglePairMCEta->Fill(epair,angle);
468 GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCEta);
472 } // both from eta or pi0 decay
476 //_____________________________________________
477 TList * AliAnaPi0EbE::GetCreateOutputObjects()
479 // Create histograms to be saved in output file and
480 // store them in outputContainer
481 TList * outputContainer = new TList() ;
482 outputContainer->SetName("Pi0EbEHistos") ;
484 Int_t nptbins = GetHistogramRanges()->GetHistoPtBins(); Float_t ptmax = GetHistogramRanges()->GetHistoPtMax(); Float_t ptmin = GetHistogramRanges()->GetHistoPtMin();
485 Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins(); Float_t phimax = GetHistogramRanges()->GetHistoPhiMax(); Float_t phimin = GetHistogramRanges()->GetHistoPhiMin();
486 Int_t netabins = GetHistogramRanges()->GetHistoEtaBins(); Float_t etamax = GetHistogramRanges()->GetHistoEtaMax(); Float_t etamin = GetHistogramRanges()->GetHistoEtaMin();
487 Int_t ssbins = GetHistogramRanges()->GetHistoShowerShapeBins(); Float_t ssmax = GetHistogramRanges()->GetHistoShowerShapeMax(); Float_t ssmin = GetHistogramRanges()->GetHistoShowerShapeMin();
488 Int_t tdbins = GetHistogramRanges()->GetHistoDiffTimeBins() ; Float_t tdmax = GetHistogramRanges()->GetHistoDiffTimeMax(); Float_t tdmin = GetHistogramRanges()->GetHistoDiffTimeMin();
489 Int_t tbins = GetHistogramRanges()->GetHistoTimeBins() ; Float_t tmax = GetHistogramRanges()->GetHistoTimeMax(); Float_t tmin = GetHistogramRanges()->GetHistoTimeMin();
490 Int_t nbins = GetHistogramRanges()->GetHistoNClusterCellBins(); Int_t nmax = GetHistogramRanges()->GetHistoNClusterCellMax(); Int_t nmin = GetHistogramRanges()->GetHistoNClusterCellMin();
492 Int_t nmassbins = GetHistogramRanges()->GetHistoMassBins();
493 Float_t massmin = GetHistogramRanges()->GetHistoMassMin();
494 Float_t massmax = GetHistogramRanges()->GetHistoMassMax();
496 Int_t nresetabins = GetHistogramRanges()->GetHistoTrackResidualEtaBins();
497 Float_t resetamax = GetHistogramRanges()->GetHistoTrackResidualEtaMax();
498 Float_t resetamin = GetHistogramRanges()->GetHistoTrackResidualEtaMin();
499 Int_t nresphibins = GetHistogramRanges()->GetHistoTrackResidualPhiBins();
500 Float_t resphimax = GetHistogramRanges()->GetHistoTrackResidualPhiMax();
501 Float_t resphimin = GetHistogramRanges()->GetHistoTrackResidualPhiMin();
503 Int_t ndedxbins = GetHistogramRanges()->GetHistodEdxBins();
504 Float_t dedxmax = GetHistogramRanges()->GetHistodEdxMax();
505 Float_t dedxmin = GetHistogramRanges()->GetHistodEdxMin();
506 Int_t nPoverEbins = GetHistogramRanges()->GetHistoPOverEBins();
507 Float_t pOverEmax = GetHistogramRanges()->GetHistoPOverEMax();
508 Float_t pOverEmin = GetHistogramRanges()->GetHistoPOverEMin();
511 fhPt = new TH1F("hPt","Number of identified #pi^{0} (#eta) decay",nptbins,ptmin,ptmax);
512 fhPt->SetYTitle("N");
513 fhPt->SetXTitle("p_{T} (GeV/c)");
514 outputContainer->Add(fhPt) ;
516 fhE = new TH1F("hE","Number of identified #pi^{0} (#eta) decay pairs",nptbins,ptmin,ptmax);
518 fhE->SetXTitle("E (GeV)");
519 outputContainer->Add(fhE) ;
522 ("hEPhi","Selected #pi^{0} (#eta) pairs: E vs #phi",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
523 fhEPhi->SetYTitle("#phi (rad)");
524 fhEPhi->SetXTitle("E (GeV)");
525 outputContainer->Add(fhEPhi) ;
528 ("hEEta","Selected #pi^{0} (#eta) pairs: E vs #eta",nptbins,ptmin,ptmax,netabins,etamin,etamax);
529 fhEEta->SetYTitle("#eta");
530 fhEEta->SetXTitle("E (GeV)");
531 outputContainer->Add(fhEEta) ;
534 ("hEtaPhi","Selected #pi^{0} (#eta) pairs: #eta vs #phi",netabins,etamin,etamax, nphibins,phimin,phimax);
535 fhEtaPhi->SetYTitle("#phi (rad)");
536 fhEtaPhi->SetXTitle("#eta");
537 outputContainer->Add(fhEtaPhi) ;
539 fhPtDecay = new TH1F("hPtDecay","Number of identified #pi^{0} (#eta) decay photons",nptbins,ptmin,ptmax);
540 fhPtDecay->SetYTitle("N");
541 fhPtDecay->SetXTitle("p_{T} (GeV/c)");
542 outputContainer->Add(fhPtDecay) ;
544 fhEDecay = new TH1F("hEDecay","Number of identified #pi^{0} (#eta) decay photons",nptbins,ptmin,ptmax);
545 fhEDecay->SetYTitle("N");
546 fhEDecay->SetXTitle("E (GeV)");
547 outputContainer->Add(fhEDecay) ;
551 if(fAnaType == kIMCalo || fAnaType == kIMCaloTracks )
554 fhEDispersion = new TH2F
555 ("hEDispersion","Selected #pi^{0} (#eta) pairs: E vs dispersion",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
556 fhEDispersion->SetYTitle("D^{2}");
557 fhEDispersion->SetXTitle("E (GeV)");
558 outputContainer->Add(fhEDispersion) ;
560 fhELambda0 = new TH2F
561 ("hELambda0","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
562 fhELambda0->SetYTitle("#lambda_{0}^{2}");
563 fhELambda0->SetXTitle("E (GeV)");
564 outputContainer->Add(fhELambda0) ;
566 fhELambda1 = new TH2F
567 ("hELambda1","Selected #pi^{0} (#eta) pairs: E vs #lambda_{1}",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
568 fhELambda1->SetYTitle("#lambda_{1}^{2}");
569 fhELambda1->SetXTitle("E (GeV)");
570 outputContainer->Add(fhELambda1) ;
572 fhELambda0FracMaxCellCut = new TH2F
573 ("hELambda0FracMaxCellCut","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, Max cell fraction of energy < 0.5",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
574 fhELambda0FracMaxCellCut->SetYTitle("#lambda_{0}^{2}");
575 fhELambda0FracMaxCellCut->SetXTitle("E (GeV)");
576 outputContainer->Add(fhELambda0FracMaxCellCut) ;
578 fhEFracMaxCell = new TH2F
579 ("hEFracMaxCell","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, Max cell fraction of energy",nptbins,ptmin,ptmax,100,0,1);
580 fhEFracMaxCell->SetYTitle("Fraction");
581 fhEFracMaxCell->SetXTitle("E (GeV)");
582 outputContainer->Add(fhEFracMaxCell) ;
584 if(fCalorimeter=="EMCAL"){
585 fhELambda0NoTRD = new TH2F
586 ("hELambda0NoTRD","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, not behind TRD",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
587 fhELambda0NoTRD->SetYTitle("#lambda_{0}^{2}");
588 fhELambda0NoTRD->SetXTitle("E (GeV)");
589 outputContainer->Add(fhELambda0NoTRD) ;
591 fhEFracMaxCellNoTRD = new TH2F
592 ("hEFracMaxCellNoTRD","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, Max cell fraction of energy, not behind TRD",nptbins,ptmin,ptmax,100,0,1);
593 fhEFracMaxCellNoTRD->SetYTitle("Fraction");
594 fhEFracMaxCellNoTRD->SetXTitle("E (GeV)");
595 outputContainer->Add(fhEFracMaxCellNoTRD) ;
598 fhENCells = new TH2F ("hENCells","N cells in cluster vs E ", nptbins,ptmin,ptmax, nbins,nmin,nmax);
599 fhENCells->SetXTitle("E (GeV)");
600 fhENCells->SetYTitle("# of cells in cluster");
601 outputContainer->Add(fhENCells);
603 fhETime = new TH2F("hETime","cluster time vs pair E",nptbins,ptmin,ptmax, tbins,tmin,tmax);
604 fhETime->SetXTitle("E (GeV)");
605 fhETime->SetYTitle("t (ns)");
606 outputContainer->Add(fhETime);
608 }// Invariant mass analysis in calorimeters and calorimeter + conversion photons
610 if(fAnaType == kIMCalo){
611 fhEPairDiffTime = new TH2F("hEPairDiffTime","cluster pair time difference vs E",nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
612 fhEPairDiffTime->SetXTitle("E_{pair} (GeV)");
613 fhEPairDiffTime->SetYTitle("#Delta t (ns)");
614 outputContainer->Add(fhEPairDiffTime);
619 fhTrackMatchedDEta = new TH2F
620 ("hTrackMatchedDEta",
621 "d#eta of cluster-track vs cluster energy",
622 nptbins,ptmin,ptmax,nresetabins,resetamin,resetamax);
623 fhTrackMatchedDEta->SetYTitle("d#eta");
624 fhTrackMatchedDEta->SetXTitle("E_{cluster} (GeV)");
626 fhTrackMatchedDPhi = new TH2F
627 ("hTrackMatchedDPhi",
628 "d#phi of cluster-track vs cluster energy",
629 nptbins,ptmin,ptmax,nresphibins,resphimin,resphimax);
630 fhTrackMatchedDPhi->SetYTitle("d#phi (rad)");
631 fhTrackMatchedDPhi->SetXTitle("E_{cluster} (GeV)");
633 fhTrackMatchedDEtaDPhi = new TH2F
634 ("hTrackMatchedDEtaDPhi",
635 "d#eta vs d#phi of cluster-track vs cluster energy",
636 nresetabins,resetamin,resetamax,nresphibins,resphimin,resphimax);
637 fhTrackMatchedDEtaDPhi->SetYTitle("d#phi (rad)");
638 fhTrackMatchedDEtaDPhi->SetXTitle("d#eta");
640 outputContainer->Add(fhTrackMatchedDEta) ;
641 outputContainer->Add(fhTrackMatchedDPhi) ;
642 outputContainer->Add(fhTrackMatchedDEtaDPhi) ;
644 fhdEdx = new TH2F ("hdEdx","matched track <dE/dx> vs cluster E ", nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
645 fhdEdx->SetXTitle("E (GeV)");
646 fhdEdx->SetYTitle("<dE/dx>");
647 outputContainer->Add(fhdEdx);
649 fhEOverP = new TH2F ("hEOverP","matched track E/p vs cluster E ", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
650 fhEOverP->SetXTitle("E (GeV)");
651 fhEOverP->SetYTitle("E/p");
652 outputContainer->Add(fhEOverP);
654 if(fCalorimeter=="EMCAL")
656 fhEOverPNoTRD = new TH2F ("hEOverPNoTRD","matched track E/p vs cluster E, SM not behind TRD ", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
657 fhEOverPNoTRD->SetXTitle("E (GeV)");
658 fhEOverPNoTRD->SetYTitle("E/p");
659 outputContainer->Add(fhEOverPNoTRD);
664 fhTrackMatchedMCParticle = new TH2F
665 ("hTrackMatchedMCParticle",
666 "Origin of particle vs energy",
667 nptbins,ptmin,ptmax,8,0,8);
668 fhTrackMatchedMCParticle->SetXTitle("E (GeV)");
669 //fhTrackMatchedMCParticle->SetYTitle("Particle type");
671 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(1 ,"Photon");
672 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(2 ,"Electron");
673 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(3 ,"Meson Merged");
674 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(4 ,"Rest");
675 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(5 ,"Conv. Photon");
676 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(6 ,"Conv. Electron");
677 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(7 ,"Conv. Merged");
678 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(8 ,"Conv. Rest");
680 outputContainer->Add(fhTrackMatchedMCParticle);
684 if(fFillWeightHistograms)
687 fhECellClusterRatio = new TH2F ("hECellClusterRatio"," cell energy / cluster energy vs cluster energy, for selected decay photons from neutral meson",
688 nptbins,ptmin,ptmax, 100,0,1.);
689 fhECellClusterRatio->SetXTitle("E_{cluster} (GeV) ");
690 fhECellClusterRatio->SetYTitle("E_{cell i}/E_{cluster}");
691 outputContainer->Add(fhECellClusterRatio);
693 fhECellClusterLogRatio = new TH2F ("hECellClusterLogRatio"," Log(cell energy / cluster energy) vs cluster energy, for selected decay photons from neutral meson",
694 nptbins,ptmin,ptmax, 100,-10,0);
695 fhECellClusterLogRatio->SetXTitle("E_{cluster} (GeV) ");
696 fhECellClusterLogRatio->SetYTitle("Log (E_{max cell}/E_{cluster})");
697 outputContainer->Add(fhECellClusterLogRatio);
699 fhEMaxCellClusterRatio = new TH2F ("hEMaxCellClusterRatio"," max cell energy / cluster energy vs cluster energy, for selected decay photons from neutral meson",
700 nptbins,ptmin,ptmax, 100,0,1.);
701 fhEMaxCellClusterRatio->SetXTitle("E_{cluster} (GeV) ");
702 fhEMaxCellClusterRatio->SetYTitle("E_{max cell}/E_{cluster}");
703 outputContainer->Add(fhEMaxCellClusterRatio);
705 fhEMaxCellClusterLogRatio = new TH2F ("hEMaxCellClusterLogRatio"," Log(max cell energy / cluster energy) vs cluster energy, for selected decay photons from neutral meson",
706 nptbins,ptmin,ptmax, 100,-10,0);
707 fhEMaxCellClusterLogRatio->SetXTitle("E_{cluster} (GeV) ");
708 fhEMaxCellClusterLogRatio->SetYTitle("Log (E_{max cell}/E_{cluster})");
709 outputContainer->Add(fhEMaxCellClusterLogRatio);
711 for(Int_t iw = 0; iw < 14; iw++)
713 fhLambda0ForW0[iw] = new TH2F (Form("hLambda0ForW0%d",iw),Form("shower shape, #lambda^{2}_{0} vs E, w0 = %1.1f, for selected decay photons from neutral meson",1+0.5*iw),
714 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
715 fhLambda0ForW0[iw]->SetXTitle("E_{cluster}");
716 fhLambda0ForW0[iw]->SetYTitle("#lambda^{2}_{0}");
717 outputContainer->Add(fhLambda0ForW0[iw]);
719 // fhLambda1ForW0[iw] = new TH2F (Form("hLambda1ForW0%d",iw),Form("shower shape, #lambda^{2}_{1} vs E, w0 = %1.1f, for selected decay photons from neutral meson",0.5+0.5*iw),
720 // nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
721 // fhLambda1ForW0[iw]->SetXTitle("E_{cluster}");
722 // fhLambda1ForW0[iw]->SetYTitle("#lambda^{2}_{1}");
723 // outputContainer->Add(fhLambda1ForW0[iw]);
730 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
731 GetReader()->GetDataType() != AliCaloTrackReader::kMC)
734 fhPtMC = new TH1F("hPtMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax);
735 fhPtMC->SetYTitle("N");
736 fhPtMC->SetXTitle("p_{T} (GeV/c)");
737 outputContainer->Add(fhPtMC) ;
740 ("hPhiMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
741 fhPhiMC->SetYTitle("#phi");
742 fhPhiMC->SetXTitle("p_{T} (GeV/c)");
743 outputContainer->Add(fhPhiMC) ;
746 ("hEtaMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax,netabins,etamin,etamax);
747 fhEtaMC->SetYTitle("#eta");
748 fhEtaMC->SetXTitle("p_{T} (GeV/c)");
749 outputContainer->Add(fhEtaMC) ;
751 fhPtMCNo = new TH1F("hPtMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax);
752 fhPtMCNo->SetYTitle("N");
753 fhPtMCNo->SetXTitle("p_{T} (GeV/c)");
754 outputContainer->Add(fhPtMCNo) ;
757 ("hPhiMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
758 fhPhiMCNo->SetYTitle("#phi");
759 fhPhiMCNo->SetXTitle("p_{T} (GeV/c)");
760 outputContainer->Add(fhPhiMCNo) ;
763 ("hEtaMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax,netabins,etamin,etamax);
764 fhEtaMCNo->SetYTitle("#eta");
765 fhEtaMCNo->SetXTitle("p_{T} (GeV/c)");
766 outputContainer->Add(fhEtaMCNo) ;
768 fhAnglePairMCPi0 = new TH2F
770 "Angle between decay #gamma pair vs E_{pair}, origin #pi^{0}",nptbins,ptmin,ptmax,250,0,0.5);
771 fhAnglePairMCPi0->SetYTitle("#alpha (rad)");
772 fhAnglePairMCPi0->SetXTitle("E_{pair} (GeV)");
773 outputContainer->Add(fhAnglePairMCPi0) ;
775 fhAnglePairMCEta = new TH2F
777 "Angle between decay #gamma pair vs E_{pair}, origin #eta",nptbins,ptmin,ptmax,250,0,0.5);
778 fhAnglePairMCEta->SetYTitle("#alpha (rad)");
779 fhAnglePairMCEta->SetXTitle("E_{pair} (GeV)");
780 outputContainer->Add(fhAnglePairMCEta) ;
782 fhMassPairMCPi0 = new TH2F
784 "Mass for decay #gamma pair vs E_{pair}, origin #pi^{0}",nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
785 fhMassPairMCPi0->SetYTitle("#alpha (rad)");
786 fhMassPairMCPi0->SetXTitle("E_{pair} (GeV)");
787 outputContainer->Add(fhMassPairMCPi0) ;
789 fhMassPairMCEta = new TH2F
791 "Mass for decay #gamma pair vs E_{pair}, origin #eta",nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
792 fhMassPairMCEta->SetYTitle("#alpha (rad)");
793 fhMassPairMCEta->SetXTitle("E_{pair} (GeV)");
794 outputContainer->Add(fhMassPairMCEta) ;
796 if(fAnaType == kIMCalo){
797 TString ptype[] ={"#gamma","#gamma->e^{#pm}","#pi^{0}","#eta","e^{#pm}", "hadron"};
798 TString pname[] ={"Photon","Conversion", "Pi0", "Eta", "Electron","Hadron"};
799 for(Int_t i = 0; i < 6; i++){
801 fhEMCLambda0[i] = new TH2F(Form("hELambda0_MC%s",pname[i].Data()),
802 Form("Selected pair, cluster from %s : E vs #lambda_{0}^{2}",ptype[i].Data()),
803 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
804 fhEMCLambda0[i]->SetYTitle("#lambda_{0}^{2}");
805 fhEMCLambda0[i]->SetXTitle("E (GeV)");
806 outputContainer->Add(fhEMCLambda0[i]) ;
808 if(fCalorimeter=="EMCAL"){
809 fhEMCLambda0NoTRD[i] = new TH2F(Form("hELambda0NoTRD_MC%s",pname[i].Data()),
810 Form("Selected pair, cluster from %s : E vs #lambda_{0}^{2}, NoTRD",ptype[i].Data()),
811 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
812 fhEMCLambda0NoTRD[i]->SetYTitle("#lambda_{0}^{2}");
813 fhEMCLambda0NoTRD[i]->SetXTitle("E (GeV)");
814 outputContainer->Add(fhEMCLambda0NoTRD[i]) ;
817 fhEMCLambda0FracMaxCellCut[i] = new TH2F(Form("hELambda0FracMaxCellCut_MC%s",pname[i].Data()),
818 Form("Selected pair, cluster from %s : E vs #lambda_{0}^{2}, Max cell fraction of energy < 0.5 ",ptype[i].Data()),
819 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
820 fhEMCLambda0FracMaxCellCut[i]->SetYTitle("#lambda_{0}^{2}");
821 fhEMCLambda0FracMaxCellCut[i]->SetXTitle("E (GeV)");
822 outputContainer->Add(fhEMCLambda0FracMaxCellCut[i]) ;
824 fhEMCFracMaxCell[i] = new TH2F(Form("hEFracMaxCell_MC%s",pname[i].Data()),
825 Form("Selected pair, cluster from %s : E vs Max cell fraction of energy",ptype[i].Data()),
826 nptbins,ptmin,ptmax,100,0,1);
827 fhEMCFracMaxCell[i]->SetYTitle("Fraction");
828 fhEMCFracMaxCell[i]->SetXTitle("E (GeV)");
829 outputContainer->Add(fhEMCFracMaxCell[i]) ;
831 fhEMCLambda1[i] = new TH2F(Form("hELambda1_MC%s",pname[i].Data()),
832 Form("Selected pair, cluster from %s : E vs #lambda_{1}^{2}",ptype[i].Data()),
833 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
834 fhEMCLambda1[i]->SetYTitle("#lambda_{1}^{2}");
835 fhEMCLambda1[i]->SetXTitle("E (GeV)");
836 outputContainer->Add(fhEMCLambda1[i]) ;
838 fhEMCDispersion[i] = new TH2F(Form("hEDispersion_MC%s",pname[i].Data()),
839 Form("Selected pair, cluster from %s : E vs dispersion^{2}",ptype[i].Data()),
840 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
841 fhEMCDispersion[i]->SetYTitle("D^{2}");
842 fhEMCDispersion[i]->SetXTitle("E (GeV)");
843 outputContainer->Add(fhEMCDispersion[i]) ;
852 //Keep neutral meson selection histograms if requiered
853 //Setting done in AliNeutralMesonSelection
855 if(fAnaType!=kSSCalo && GetNeutralMesonSelection()){
857 TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ;
858 if(GetNeutralMesonSelection()->AreNeutralMesonSelectionHistosKept())
859 for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ;
864 return outputContainer ;
868 //____________________________________________________________________________
869 void AliAnaPi0EbE::Init()
873 if(fCalorimeter == "PHOS" && !GetReader()->IsPHOSSwitchedOn() && NewOutputAOD()){
874 printf("AliAnaPi0EbE::Init() - !!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
877 else if(fCalorimeter == "EMCAL" && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD()){
878 printf("AliAnaPi0EbE::Init() - !!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
884 //____________________________________________________________________________
885 void AliAnaPi0EbE::InitParameters()
887 //Initialize the parameters of the analysis.
888 AddToHistogramsName("AnaPi0EbE_");
890 fInputAODGammaConvName = "PhotonsCTS" ;
892 fCalorimeter = "EMCAL" ;
899 //__________________________________________________________________
900 void AliAnaPi0EbE::MakeAnalysisFillAOD()
902 //Do analysis and fill aods
907 MakeInvMassInCalorimeter();
911 MakeShowerShapeIdentification();
915 MakeInvMassInCalorimeterAndCTS();
921 //____________________________________________
922 void AliAnaPi0EbE::MakeInvMassInCalorimeter()
924 //Do analysis and fill aods
925 //Search for the photon decay in calorimeters
926 //Read photon list from AOD, produced in class AliAnaPhoton
927 //Check if 2 photons have the mass of the pi0.
936 if(!GetInputAODBranch()){
937 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - No input calo photons in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
941 //Get shower shape information of clusters
942 TObjArray *clusters = 0;
943 if (fCalorimeter=="EMCAL") clusters = GetEMCALClusters();
944 else if(fCalorimeter=="PHOS") clusters = GetPHOSClusters() ;
946 for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast()-1; iphoton++){
947 AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
949 //Vertex cut in case of mixed events
950 Int_t evtIndex1 = 0 ;
952 evtIndex1 = GetMixedEvent()->EventIndexForCaloCluster(photon1->GetCaloLabel(0)) ;
953 if(TMath::Abs(GetVertex(evtIndex1)[2]) > GetZvertexCut()) continue ; //vertex cut
954 mom1 = *(photon1->Momentum());
956 //Get original cluster, to recover some information
958 AliVCluster *cluster1 = FindCluster(clusters,photon1->GetCaloLabel(0),iclus);
961 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - First cluster not found\n");
965 for(Int_t jphoton = iphoton+1; jphoton < GetInputAODBranch()->GetEntriesFast(); jphoton++)
967 AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(jphoton));
969 Int_t evtIndex2 = 0 ;
971 evtIndex2 = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ;
973 if(GetMixedEvent() && (evtIndex1 == evtIndex2))
976 if(TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut()) continue ; //vertex cut
978 mom2 = *(photon2->Momentum());
980 //Get original cluster, to recover some information
982 AliVCluster *cluster2 = FindCluster(clusters,photon2->GetCaloLabel(0),iclus2,iclus+1);
986 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Second cluster not found\n");
990 Float_t e1 = photon1->E();
991 Float_t e2 = photon2->E();
993 //Select clusters with good time window difference
994 Float_t tof1 = cluster1->GetTOF()*1e9;;
995 Float_t tof2 = cluster2->GetTOF()*1e9;;
996 Double_t t12diff = tof1-tof2;
997 fhEPairDiffTime->Fill(e1+e2, t12diff);
998 if(TMath::Abs(t12diff) > GetPairTimeCut()) continue;
1000 //Play with the MC stack if available
1001 if(IsDataMC()) HasPairSameMCMother(photon1, photon2, label, tag) ;
1003 //Select good pair (good phi, pt cuts, aperture and invariant mass)
1004 if(GetNeutralMesonSelection()->SelectPair(mom1, mom2,fCalorimeter))
1007 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());
1009 //Fill some histograms about shower shape
1010 if(clusters && GetReader()->GetDataType()!=AliCaloTrackReader::kMC){
1011 FillSelectedClusterHistograms(cluster1, photon1->GetTag());
1012 FillSelectedClusterHistograms(cluster2, photon2->GetTag());
1015 // Tag both photons as decay
1016 photon1->SetTagged(kTRUE);
1017 photon2->SetTagged(kTRUE);
1019 fhPtDecay->Fill(photon1->Pt());
1020 fhEDecay ->Fill(photon1->E() );
1022 fhPtDecay->Fill(photon2->Pt());
1023 fhEDecay ->Fill(photon2->E() );
1025 //Create AOD for analysis
1028 AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
1030 pi0.SetIdentifiedParticleType(AliCaloPID::kPi0);
1031 pi0.SetDetector(photon1->GetDetector());
1034 pi0.SetLabel(label);
1037 //Set the indeces of the original caloclusters
1038 pi0.SetCaloLabel(photon1->GetCaloLabel(0), photon2->GetCaloLabel(0));
1039 //pi0.SetInputFileIndex(input);
1041 AddAODParticle(pi0);
1049 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - End fill AODs \n");
1053 //__________________________________________________
1054 void AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
1056 //Do analysis and fill aods
1057 //Search for the photon decay in calorimeters
1058 //Read photon list from AOD, produced in class AliAnaPhoton and AliGammaConversion
1059 //Check if 2 photons have the mass of the pi0.
1061 TLorentzVector mom1;
1062 TLorentzVector mom2;
1063 TLorentzVector mom ;
1068 // Check calorimeter input
1069 if(!GetInputAODBranch()){
1070 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input calo photons in AOD branch with name < %s > , STOP\n",GetInputAODName().Data());
1074 // Get the array with conversion photons
1075 TClonesArray * inputAODGammaConv = (TClonesArray *) GetReader()->GetOutputEvent()->FindListObject(fInputAODGammaConvName);
1076 if(!inputAODGammaConv) {
1078 inputAODGammaConv = (TClonesArray *) GetReader()->GetInputEvent()->FindListObject(fInputAODGammaConvName);
1080 if(!inputAODGammaConv) {
1081 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input gamma conversions in AOD branch with name < %s >\n",fInputAODGammaConvName.Data());
1087 //Get shower shape information of clusters
1088 TObjArray *clusters = 0;
1089 if (fCalorimeter=="EMCAL") clusters = GetEMCALClusters();
1090 else if(fCalorimeter=="PHOS") clusters = GetPHOSClusters() ;
1092 Int_t nCTS = inputAODGammaConv->GetEntriesFast();
1093 Int_t nCalo = GetInputAODBranch()->GetEntriesFast();
1094 if(nCTS<=0 || nCalo <=0) {
1095 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - nCalo %d, nCTS %d, cannot loop\n",nCalo,nCTS);
1100 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - Number of conversion photons %d\n",nCTS);
1102 // Do the loop, first calo, second CTS
1103 for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++){
1104 AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
1105 mom1 = *(photon1->Momentum());
1107 //Get original cluster, to recover some information
1109 AliVCluster *cluster = FindCluster(clusters,photon1->GetCaloLabel(0),iclus);
1111 for(Int_t jphoton = 0; jphoton < nCTS; jphoton++){
1112 AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (inputAODGammaConv->At(jphoton));
1114 evtIndex = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ;
1115 if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ; //vertex cut
1117 mom2 = *(photon2->Momentum());
1119 //Play with the MC stack if available
1122 Int_t label2 = photon2->GetLabel();
1123 if(label2 >= 0 )photon2->SetTag(GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex()));
1125 HasPairSameMCMother(photon1, photon2, label, tag) ;
1128 //Select good pair (good phi, pt cuts, aperture and invariant mass)
1129 if(GetNeutralMesonSelection()->SelectPair(mom1, mom2,fCalorimeter))
1131 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());
1133 //Fill some histograms about shower shape
1134 if(cluster && GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
1136 FillSelectedClusterHistograms(cluster, photon1->GetTag());
1139 // Tag both photons as decay
1140 photon1->SetTagged(kTRUE);
1141 photon2->SetTagged(kTRUE);
1143 fhPtDecay->Fill(photon1->Pt());
1144 fhEDecay ->Fill(photon1->E() );
1146 //fhPtDecay->Fill(photon2->Pt());
1147 //fhEDecay ->Fill(photon2->E() );
1149 //Create AOD for analysis
1153 AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
1155 pi0.SetIdentifiedParticleType(AliCaloPID::kPi0);
1156 pi0.SetDetector(photon1->GetDetector());
1159 pi0.SetLabel(label);
1162 //Set the indeces of the original tracks or caloclusters
1163 pi0.SetCaloLabel(photon1->GetCaloLabel(0), -1);
1164 pi0.SetTrackLabel(photon2->GetTrackLabel(0), photon2->GetTrackLabel(1));
1165 //pi0.SetInputFileIndex(input);
1167 AddAODParticle(pi0);
1174 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - End fill AODs \n");
1179 //_________________________________________________
1180 void AliAnaPi0EbE::MakeShowerShapeIdentification()
1182 //Search for pi0 in fCalorimeter with shower shape analysis
1184 TObjArray * pl = 0x0;
1185 //Select the Calorimeter of the photon
1186 if (fCalorimeter == "PHOS" )
1187 pl = GetPHOSClusters();
1188 else if (fCalorimeter == "EMCAL")
1189 pl = GetEMCALClusters();
1192 Info("MakeShowerShapeIdentification","TObjArray with %s clusters is NULL!\n",fCalorimeter.Data());
1196 TLorentzVector mom ;
1197 for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++)
1199 AliVCluster * calo = (AliVCluster*) (pl->At(icalo));
1201 Int_t evtIndex = 0 ;
1202 if (GetMixedEvent())
1204 evtIndex=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
1206 if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ; //vertex cut
1208 //Get Momentum vector,
1209 if(GetReader()->GetDataType() != AliCaloTrackReader::kMC){
1210 calo->GetMomentum(mom,GetVertex(evtIndex)) ;}//Assume that come from vertex in straight line
1212 Double_t vertex[]={0,0,0};
1213 calo->GetMomentum(mom,vertex) ;
1216 //If too small or big pt, skip it
1217 if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ;
1218 //Check acceptance selection
1219 if(IsFiducialCutOn())
1221 Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
1222 if(! in ) continue ;
1225 //Create AOD for analysis
1226 AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);
1227 aodpi0.SetLabel(calo->GetLabel());
1228 //Set the indeces of the original caloclusters
1229 aodpi0.SetCaloLabel(calo->GetID(),-1);
1230 aodpi0.SetDetector(fCalorimeter);
1232 printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Min pt cut and fiducial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodpi0.Pt(),aodpi0.Phi(),aodpi0.Eta());
1234 //Check Distance to Bad channel, set bit.
1235 Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel
1236 if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
1237 if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm)
1240 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Bad channel cut passed %4.2f\n",distBad);
1242 if(distBad > fMinDist3) aodpi0.SetDistToBad(2) ;
1243 else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ;
1244 else aodpi0.SetDistToBad(0) ;
1247 //PID selection or bit setting
1249 //Skip matched clusters with tracks
1250 if(IsTrackMatched(calo, GetReader()->GetInputEvent())) continue ;
1252 // Get most probable PID, 2 options check bayesian PID weights or redo PID
1253 // By default, redo PID
1255 aodpi0.SetIdentifiedParticleType(GetCaloPID()->GetIdentifiedParticleType(fCalorimeter,mom,calo));//PID recalculated
1257 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PDG of identified particle %d\n",aodpi0.GetIdentifiedParticleType());
1259 //If cluster does not pass pid, not pi0, skip it.
1260 if(aodpi0.GetIdentifiedParticleType() != AliCaloPID::kPi0) continue ;
1265 //Set PID bits for later selection
1266 //GetPDG already called in SetPIDBits.
1267 GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodpi0, GetCaloUtils(), GetReader()->GetInputEvent());
1268 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PID Bits set \n");
1271 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Pi0 selection cuts passed: pT %3.2f, pdg %d\n",aodpi0.Pt(), aodpi0.GetIdentifiedParticleType());
1273 //Play with the MC stack if available
1274 //Check origin of the candidates
1276 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
1277 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
1278 //aodpi0.SetInputFileIndex(input);
1280 tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(),GetReader(), aodpi0.GetInputFileIndex());
1281 //GetMCAnalysisUtils()->CheckMultipleOrigin(calo->GetLabels(),calo->GetNLabels(), GetReader(), aodpi0.GetInputFileIndex(), tag);
1283 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Origin of candidate %d\n",aodpi0.GetTag());
1285 }//Work with stack also
1287 //Add AOD with pi0 object to aod branch
1288 AddAODParticle(aodpi0);
1292 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - End fill AODs \n");
1295 //______________________________________________
1296 void AliAnaPi0EbE::MakeAnalysisFillHistograms()
1298 //Do analysis and fill histograms
1300 if(!GetOutputAODBranch())
1302 printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - No output pi0 in AOD branch with name < %s >,STOP \n",GetOutputAODName().Data());
1305 //Loop on stored AOD pi0
1306 Int_t naod = GetOutputAODBranch()->GetEntriesFast();
1307 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
1309 for(Int_t iaod = 0; iaod < naod ; iaod++)
1312 AliAODPWG4Particle* pi0 = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
1313 Int_t pdg = pi0->GetIdentifiedParticleType();
1315 if(IsCaloPIDOn() && pdg != AliCaloPID::kPi0) continue;
1317 //Fill pi0 histograms
1318 Float_t ener = pi0->E();
1319 Float_t pt = pi0->Pt();
1320 Float_t phi = pi0->Phi();
1321 if(phi < 0) phi+=TMath::TwoPi();
1322 Float_t eta = pi0->Eta();
1327 fhEEta ->Fill(ener,eta);
1328 fhEPhi ->Fill(ener,phi);
1329 fhEtaPhi ->Fill(eta,phi);
1333 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
1334 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
1335 if(GetMCAnalysisUtils()->CheckTagBit(pi0->GetTag(), AliMCAnalysisUtils::kMCPi0))
1338 fhPhiMC ->Fill(pt,phi);
1339 fhEtaMC ->Fill(pt,eta);
1343 fhPtMCNo ->Fill(pt);
1344 fhPhiMCNo ->Fill(pt,phi);
1345 fhEtaMCNo ->Fill(pt,eta);
1348 }//Histograms with MC
1354 //__________________________________________________________________
1355 void AliAnaPi0EbE::Print(const Option_t * opt) const
1357 //Print some relevant parameters set for the analysis
1361 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
1362 AliAnaCaloTrackCorrBaseClass::Print("");
1363 printf("Analysis Type = %d \n", fAnaType) ;
1364 if(fAnaType == kSSCalo){
1365 printf("Calorimeter = %s\n", fCalorimeter.Data()) ;
1366 printf("Min Distance to Bad Channel = %2.1f\n",fMinDist);
1367 printf("Min Distance to Bad Channel 2 = %2.1f\n",fMinDist2);
1368 printf("Min Distance to Bad Channel 3 = %2.1f\n",fMinDist3);
1374 //___________________________________________________________________________________
1375 void AliAnaPi0EbE::RecalibrateCellAmplitude(Float_t & amp, const Int_t id)
1377 //Recaculate cell energy if recalibration factor
1379 Int_t icol = -1; Int_t irow = -1; Int_t iRCU = -1;
1380 Int_t nModule = GetModuleNumberCellIndexes(id,fCalorimeter, icol, irow, iRCU);
1382 if (GetCaloUtils()->IsRecalibrationOn())
1384 if(fCalorimeter == "PHOS")
1386 amp *= GetCaloUtils()->GetPHOSChannelRecalibrationFactor(nModule,icol,irow);
1390 amp *= GetCaloUtils()->GetEMCALChannelRecalibrationFactor(nModule,icol,irow);