]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.cxx
Remove TClonesArray deletions (Diego)
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / 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 *
21a4b1c0 8 * documentation strictly for non-commercial purposes is hereby granted *
477d6cee 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 **************************************************************************/
477d6cee 15
16//_________________________________________________________________________
17// Class for the analysis of high pT pi0 event by event
09273901 18// Pi0/Eta identified by one of the following:
477d6cee 19// -Invariant mass of 2 cluster in calorimeter
20// -Shower shape analysis in calorimeter
21a4b1c0 21// -Invariant mass of one cluster in calorimeter and one photon reconstructed in CTS
477d6cee 22//
23// -- Author: Gustavo Conesa (LNF-INFN) & Raphaelle Ichou (SUBATECH)
24//////////////////////////////////////////////////////////////////////////////
25
26
27// --- ROOT system ---
28#include <TList.h>
29#include <TClonesArray.h>
0c1383b5 30#include <TObjString.h>
477d6cee 31
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"
477d6cee 39#include "AliStack.h"
ff45398a 40#include "AliFiducialCut.h"
477d6cee 41#include "TParticle.h"
0ae57829 42#include "AliVCluster.h"
477d6cee 43#include "AliAODEvent.h"
591cc579 44#include "AliAODMCParticle.h"
477d6cee 45
46ClassImp(AliAnaPi0EbE)
47
78a28af3 48//____________________________
477d6cee 49AliAnaPi0EbE::AliAnaPi0EbE() :
09273901 50 AliAnaCaloTrackCorrBaseClass(),fAnaType(kIMCalo), fCalorimeter(""),
51 fMinDist(0.),fMinDist2(0.), fMinDist3(0.),
52 fFillWeightHistograms(kFALSE), fFillTMHisto(0),
1db06135 53 fInputAODGammaConvName(""),
521636d2 54 //Histograms
09273901 55 fhPt(0), fhE(0),
56 fhEEta(0), fhEPhi(0), fhEtaPhi(0),
57 fhPtDecay(0), fhEDecay(0),
521636d2 58 //Shower shape histos
09273901 59 fhEDispersion(0), fhELambda0(0), fhELambda1(0),
60 fhELambda0NoTRD(0), fhELambda0FracMaxCellCut(0),
61 fhEFracMaxCell(0), fhEFracMaxCellNoTRD(0),
62 fhENCells(0), fhETime(0), fhEPairDiffTime(0),
521636d2 63 //MC histos
09273901 64 fhPtMCNo(0), fhPhiMCNo(0), fhEtaMCNo(0),
65 fhPtMC(0), fhPhiMC(0), fhEtaMC(0),
b5dbb99b 66 fhMassPairMCPi0(0), fhMassPairMCEta(0),
67 fhAnglePairMCPi0(0), fhAnglePairMCEta(0),
78a28af3 68 // Weight studies
09273901 69 fhECellClusterRatio(0), fhECellClusterLogRatio(0),
70 fhEMaxCellClusterRatio(0), fhEMaxCellClusterLogRatio(0),
31ae6d59 71 fhTrackMatchedDEta(0), fhTrackMatchedDPhi(0), fhTrackMatchedDEtaDPhi(0),
b5dbb99b 72 fhdEdx(0), fhEOverP(0), fhTrackMatchedMCParticle(0),
73 fhEOverPNoTRD(0)
477d6cee 74{
75 //default ctor
76
6db946bd 77 for(Int_t i = 0; i < 6; i++){
521636d2 78 fhEMCLambda0[i] = 0;
3bfcb597 79 fhEMCLambda0NoTRD[i]= 0;
80 fhEMCLambda0FracMaxCellCut[i]= 0;
81 fhEMCFracMaxCell[i] = 0;
521636d2 82 fhEMCLambda1[i] = 0;
83 fhEMCDispersion[i] = 0;
521636d2 84 }
85
78a28af3 86 //Weight studies
1a72f6c5 87 for(Int_t i =0; i < 14; i++){
78a28af3 88 fhLambda0ForW0[i] = 0;
1a72f6c5 89 //fhLambda1ForW0[i] = 0;
78a28af3 90 }
91
477d6cee 92 //Initialize parameters
93 InitParameters();
94
95}
477d6cee 96
42d47cb7 97//_____________________________________________________________________________________
98void AliAnaPi0EbE::FillSelectedClusterHistograms(AliVCluster* cluster, const Int_t tag){
99
100 // Fill shower shape, timing and other histograms for selected clusters from decay
101
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);
09273901 107
42d47cb7 108 AliVCaloCells * cell = 0x0;
109 if(fCalorimeter == "PHOS")
110 cell = GetPHOSCells();
111 else
112 cell = GetEMCALCells();
113
114 Float_t maxCellFraction = 0;
115 GetCaloUtils()->GetMaxEnergyCell(cell, cluster, maxCellFraction);
116 fhEFracMaxCell->Fill(e,maxCellFraction);
117
118 FillWeightHistograms(cluster);
119
120 fhEDispersion->Fill(e, disp);
121 fhELambda0 ->Fill(e, l0 );
122 fhELambda1 ->Fill(e, l1 );
123
b5dbb99b 124 if(fCalorimeter=="EMCAL" && nSM < 6)
125 {
42d47cb7 126 fhELambda0NoTRD->Fill(e, l0 );
127 fhEFracMaxCellNoTRD->Fill(e,maxCellFraction);
128 }
129
130 if(maxCellFraction < 0.5)
131 fhELambda0FracMaxCellCut->Fill(e, l0 );
132
133 fhETime ->Fill(e, cluster->GetTOF()*1.e9);
134 fhENCells->Fill(e, cluster->GetNCells());
135
09273901 136 // Fill Track matching control histograms
b5dbb99b 137 if(fFillTMHisto)
138 {
09273901 139 Float_t dZ = cluster->GetTrackDz();
140 Float_t dR = cluster->GetTrackDx();
141
b5dbb99b 142 if(cluster->IsEMCAL() && GetCaloUtils()->IsRecalculationOfClusterTrackMatchingOn())
143 {
09273901 144 dR = 2000., dZ = 2000.;
31ae6d59 145 GetCaloUtils()->GetEMCALRecoUtils()->GetMatchedResiduals(cluster->GetID(),dZ,dR);
09273901 146 }
147 //printf("Pi0EbE: dPhi %f, dEta %f\n",dR,dZ);
148
b5dbb99b 149 if(fhTrackMatchedDEta && TMath::Abs(dR) < 999)
150 {
09273901 151 fhTrackMatchedDEta->Fill(e,dZ);
152 fhTrackMatchedDPhi->Fill(e,dR);
b5dbb99b 153 if(e > 0.5) fhTrackMatchedDEtaDPhi->Fill(dZ,dR);
09273901 154 }
31ae6d59 155
156 // Check dEdx and E/p of matched clusters
157
158 if(TMath::Abs(dZ) < 0.05 && TMath::Abs(dR) < 0.05)
159 {
160 AliVTrack *track = 0;
161 if(!strcmp("AliESDCaloCluster",Form("%s",cluster->ClassName()))){
162 Int_t iESDtrack = cluster->GetTrackMatchedIndex();
163 if(iESDtrack<0) printf("AliAnaPi0EbE::FillSelectedCluster - Wrong track index\n");
164 AliVEvent * event = GetReader()->GetInputEvent();
165 track = dynamic_cast<AliVTrack*> (event->GetTrack(iESDtrack));
166 }
167 else {
168 track = dynamic_cast<AliVTrack*>(cluster->GetTrackMatched(0));
169 }
170
171 if(track) {
172
173 Float_t dEdx = track->GetTPCsignal();
174 fhdEdx->Fill(e, dEdx);
175
176 Float_t eOverp = e/track->P();
177 fhEOverP->Fill(e, eOverp);
b5dbb99b 178 if(fCalorimeter=="EMCAL" && nSM < 6) fhEOverPNoTRD->Fill(e, eOverp);
179
31ae6d59 180 }
181
b5dbb99b 182 if(IsDataMC())
183 {
31ae6d59 184 if ( !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) )
185 {
186 if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) ||
187 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) ) fhTrackMatchedMCParticle->Fill(e, 2.5 );
188 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) ) fhTrackMatchedMCParticle->Fill(e, 0.5 );
189 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron) ) fhTrackMatchedMCParticle->Fill(e, 1.5 );
190 else fhTrackMatchedMCParticle->Fill(e, 3.5 );
191
192 }
193 else
194 {
195 if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) ||
196 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) ) fhTrackMatchedMCParticle->Fill(e, 6.5 );
197 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) ) fhTrackMatchedMCParticle->Fill(e, 4.5 );
198 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron) ) fhTrackMatchedMCParticle->Fill(e, 5.5 );
199 else fhTrackMatchedMCParticle->Fill(e, 7.5 );
200 }
201 } // MC
202 }
09273901 203 }// Track matching histograms
204
b5dbb99b 205 if(IsDataMC())
206 {
42d47cb7 207 //Photon1
b5dbb99b 208 if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) )
209 {
c5693f62 210 fhEMCLambda0[kmcPi0] ->Fill(e, l0);
211 fhEMCLambda1[kmcPi0] ->Fill(e, l1);
212 fhEMCDispersion[kmcPi0] ->Fill(e, disp);
42d47cb7 213
c5693f62 214 fhEMCFracMaxCell[kmcPi0]->Fill(e,maxCellFraction);
42d47cb7 215 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 216 fhEMCLambda0NoTRD[kmcPi0]->Fill(e, l0 );
42d47cb7 217 if(maxCellFraction < 0.5)
c5693f62 218 fhEMCLambda0FracMaxCellCut[kmcPi0]->Fill(e, l0 );
42d47cb7 219
220 }//pi0
b5dbb99b 221 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) )
222 {
c5693f62 223 fhEMCLambda0[kmcEta] ->Fill(e, l0);
224 fhEMCLambda1[kmcEta] ->Fill(e, l1);
225 fhEMCDispersion[kmcEta] ->Fill(e, disp);
226 fhEMCFracMaxCell[kmcEta]->Fill(e,maxCellFraction);
42d47cb7 227 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 228 fhEMCLambda0NoTRD[kmcEta]->Fill(e, l0 );
42d47cb7 229 if(maxCellFraction < 0.5)
c5693f62 230 fhEMCLambda0FracMaxCellCut[kmcEta]->Fill(e, l0 );
42d47cb7 231 }//eta
232 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) &&
b5dbb99b 233 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) )
234 {
c5693f62 235 fhEMCLambda0[kmcConversion] ->Fill(e, l0);
236 fhEMCLambda1[kmcConversion] ->Fill(e, l1);
237 fhEMCDispersion[kmcConversion] ->Fill(e, disp);
238 fhEMCFracMaxCell[kmcConversion]->Fill(e,maxCellFraction);
42d47cb7 239 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 240 fhEMCLambda0NoTRD[kmcConversion]->Fill(e, l0 );
42d47cb7 241 if(maxCellFraction < 0.5)
c5693f62 242 fhEMCLambda0FracMaxCellCut[kmcConversion]->Fill(e, l0 );
42d47cb7 243 }//conversion photon
b5dbb99b 244 else if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) )
245 {
c5693f62 246 fhEMCLambda0[kmcPhoton] ->Fill(e, l0);
247 fhEMCLambda1[kmcPhoton] ->Fill(e, l1);
248 fhEMCDispersion[kmcPhoton] ->Fill(e, disp);
249 fhEMCFracMaxCell[kmcPhoton]->Fill(e,maxCellFraction);
42d47cb7 250 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 251 fhEMCLambda0NoTRD[kmcPhoton]->Fill(e, l0 );
42d47cb7 252 if(maxCellFraction < 0.5)
c5693f62 253 fhEMCLambda0FracMaxCellCut[kmcPhoton]->Fill(e, l0 );
42d47cb7 254 }//photon no conversion
b5dbb99b 255 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron))
256 {
c5693f62 257 fhEMCLambda0[kmcElectron] ->Fill(e, l0);
258 fhEMCLambda1[kmcElectron] ->Fill(e, l1);
259 fhEMCDispersion[kmcElectron] ->Fill(e, disp);
260 fhEMCFracMaxCell[kmcElectron]->Fill(e,maxCellFraction);
42d47cb7 261 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 262 fhEMCLambda0NoTRD[kmcElectron]->Fill(e, l0 );
42d47cb7 263 if(maxCellFraction < 0.5)
c5693f62 264 fhEMCLambda0FracMaxCellCut[kmcElectron]->Fill(e, l0 );
42d47cb7 265 }//electron
b5dbb99b 266 else
267 {
c5693f62 268 fhEMCLambda0[kmcHadron] ->Fill(e, l0);
269 fhEMCLambda1[kmcHadron] ->Fill(e, l1);
270 fhEMCDispersion[kmcHadron] ->Fill(e, disp);
271 fhEMCFracMaxCell[kmcHadron]->Fill(e,maxCellFraction);
42d47cb7 272 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 273 fhEMCLambda0NoTRD[kmcHadron]->Fill(e, l0 );
42d47cb7 274 if(maxCellFraction < 0.5)
c5693f62 275 fhEMCLambda0FracMaxCellCut[kmcHadron]->Fill(e, l0 );
42d47cb7 276 }//other particles
277 }//MC
278}
279
280//________________________________________________________
281void AliAnaPi0EbE::FillWeightHistograms(AliVCluster *clus)
282{
283 // Calculate weights and fill histograms
284
285 if(!fFillWeightHistograms || GetMixedEvent()) return;
286
287 AliVCaloCells* cells = 0;
288 if(fCalorimeter == "EMCAL") cells = GetEMCALCells();
289 else cells = GetPHOSCells();
290
291 // First recalculate energy in case non linearity was applied
292 Float_t energy = 0;
293 Float_t ampMax = 0;
b5dbb99b 294 for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
295 {
42d47cb7 296
297 Int_t id = clus->GetCellsAbsId()[ipos];
298
299 //Recalibrate cell energy if needed
300 Float_t amp = cells->GetCellAmplitude(id);
301 RecalibrateCellAmplitude(amp,id);
302
303 energy += amp;
304
305 if(amp> ampMax)
306 ampMax = amp;
307
308 } // energy loop
309
b5dbb99b 310 if(energy <=0 )
311 {
42d47cb7 312 printf("AliAnaPi0EbE::WeightHistograms()- Wrong calculated energy %f\n",energy);
313 return;
314 }
315
316 fhEMaxCellClusterRatio ->Fill(energy,ampMax/energy);
317 fhEMaxCellClusterLogRatio->Fill(energy,TMath::Log(ampMax/energy));
318
319 //Get the ratio and log ratio to all cells in cluster
b5dbb99b 320 for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
321 {
42d47cb7 322 Int_t id = clus->GetCellsAbsId()[ipos];
323
324 //Recalibrate cell energy if needed
325 Float_t amp = cells->GetCellAmplitude(id);
326 RecalibrateCellAmplitude(amp,id);
327
328 fhECellClusterRatio ->Fill(energy,amp/energy);
329 fhECellClusterLogRatio->Fill(energy,TMath::Log(amp/energy));
330 }
331
332 //Recalculate shower shape for different W0
333 if(fCalorimeter=="EMCAL"){
334
335 Float_t l0org = clus->GetM02();
336 Float_t l1org = clus->GetM20();
337 Float_t dorg = clus->GetDispersion();
338
b5dbb99b 339 for(Int_t iw = 0; iw < 14; iw++)
340 {
1a72f6c5 341 GetCaloUtils()->GetEMCALRecoUtils()->SetW0(1+iw*0.5);
42d47cb7 342 GetCaloUtils()->GetEMCALRecoUtils()->RecalculateClusterShowerShapeParameters(GetEMCALGeometry(), cells, clus);
343
344 fhLambda0ForW0[iw]->Fill(energy,clus->GetM02());
1a72f6c5 345 //fhLambda1ForW0[iw]->Fill(energy,clus->GetM20());
42d47cb7 346
347 } // w0 loop
348
349 // Set the original values back
350 clus->SetM02(l0org);
351 clus->SetM20(l1org);
352 clus->SetDispersion(dorg);
353
354 }// EMCAL
355}
356
b5dbb99b 357//__________________________________________
358TObjString * AliAnaPi0EbE::GetAnalysisCuts()
0c1383b5 359{
360 //Save parameters used for analysis
521636d2 361 TString parList ; //this will be list of parameters used for this analysis.
362 const Int_t buffersize = 255;
363 char onePar[buffersize] ;
364
365 snprintf(onePar,buffersize,"--- AliAnaPi0EbE ---\n") ;
366 parList+=onePar ;
367 snprintf(onePar,buffersize,"fAnaType=%d (Pi0 selection type) \n",fAnaType) ;
368 parList+=onePar ;
369
b5dbb99b 370 if(fAnaType == kSSCalo)
371 {
521636d2 372 snprintf(onePar,buffersize,"Calorimeter: %s\n",fCalorimeter.Data()) ;
373 parList+=onePar ;
374 snprintf(onePar,buffersize,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ;
375 parList+=onePar ;
376 snprintf(onePar,buffersize,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ;
377 parList+=onePar ;
378 snprintf(onePar,buffersize,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ;
379 parList+=onePar ;
380 }
381
382 //Get parameters set in base class.
383 parList += GetBaseParametersList() ;
384
385 //Get parameters set in PID class.
386 if(fAnaType == kSSCalo) parList += GetCaloPID()->GetPIDParametersList() ;
387
388 return new TObjString(parList) ;
0c1383b5 389}
390
b5dbb99b 391//__________________________________________________________________
392void AliAnaPi0EbE::HasPairSameMCMother(AliAODPWG4Particle * photon1,
393 AliAODPWG4Particle * photon2,
394 Int_t & label, Int_t & tag)
395{
396 // Check the labels of pare in case mother was same pi0 or eta
397 // Set the new AOD accordingly
398
399 Int_t label1 = photon1->GetLabel();
400 Int_t label2 = photon2->GetLabel();
401
402 if(label1 < 0 || label2 < 0 ) return ;
403
404 //Int_t tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader(), photon1->GetInputFileIndex());
405 //Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex());
406 Int_t tag1 = photon1->GetTag();
407 Int_t tag2 = photon2->GetTag();
408
409 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2);
410 if( (GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay) &&
411 GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCPi0Decay) ) ||
412 (GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCEtaDecay) &&
413 GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCEtaDecay) )
414 )
415 {
416
417 //Check if pi0/eta mother is the same
418 if(GetReader()->ReadStack())
419 {
420 if(label1>=0)
421 {
422 TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree
423 label1 = mother1->GetFirstMother();
424 //mother1 = GetMCStack()->Particle(label1);//pi0
425 }
426 if(label2>=0)
427 {
428 TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree
429 label2 = mother2->GetFirstMother();
430 //mother2 = GetMCStack()->Particle(label2);//pi0
431 }
432 } // STACK
433 else if(GetReader()->ReadAODMCParticles())
434 {//&& (input > -1)){
435 if(label1>=0)
436 {
437 AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon1->GetInputFileIndex()))->At(label1);//photon in kine tree
438 label1 = mother1->GetMother();
439 //mother1 = GetMCStack()->Particle(label1);//pi0
440 }
441 if(label2>=0)
442 {
443 AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon2->GetInputFileIndex()))->At(label2);//photon in kine tree
444 label2 = mother2->GetMother();
445 //mother2 = GetMCStack()->Particle(label2);//pi0
446 }
447 }// AOD
448
449 //printf("mother1 %d, mother2 %d\n",label1,label2);
450 if( label1 == label2 && label1>=0 )
451 {
452
453 label = label1;
454
455 TLorentzVector mom1 = *(photon1->Momentum());
456 TLorentzVector mom2 = *(photon2->Momentum());
457
458 Double_t angle = mom2.Angle(mom1.Vect());
459 Double_t mass = (mom1+mom2).M();
460 Double_t epair = (mom1+mom2).E();
461
462 if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay))
463 {
464 fhMassPairMCPi0 ->Fill(epair,mass);
465 fhAnglePairMCPi0->Fill(epair,angle);
466 GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0);
467 }
468 else
469 {
470 fhMassPairMCEta ->Fill(epair,mass);
471 fhAnglePairMCEta->Fill(epair,angle);
472 GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCEta);
473 }
474
475 } // same label
476 } // both from eta or pi0 decay
477
478}
479
78a28af3 480//_____________________________________________
477d6cee 481TList * AliAnaPi0EbE::GetCreateOutputObjects()
482{
483 // Create histograms to be saved in output file and
484 // store them in outputContainer
485 TList * outputContainer = new TList() ;
486 outputContainer->SetName("Pi0EbEHistos") ;
487
745913ae 488 Int_t nptbins = GetHistogramRanges()->GetHistoPtBins(); Float_t ptmax = GetHistogramRanges()->GetHistoPtMax(); Float_t ptmin = GetHistogramRanges()->GetHistoPtMin();
489 Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins(); Float_t phimax = GetHistogramRanges()->GetHistoPhiMax(); Float_t phimin = GetHistogramRanges()->GetHistoPhiMin();
490 Int_t netabins = GetHistogramRanges()->GetHistoEtaBins(); Float_t etamax = GetHistogramRanges()->GetHistoEtaMax(); Float_t etamin = GetHistogramRanges()->GetHistoEtaMin();
491 Int_t ssbins = GetHistogramRanges()->GetHistoShowerShapeBins(); Float_t ssmax = GetHistogramRanges()->GetHistoShowerShapeMax(); Float_t ssmin = GetHistogramRanges()->GetHistoShowerShapeMin();
492 Int_t tdbins = GetHistogramRanges()->GetHistoDiffTimeBins() ; Float_t tdmax = GetHistogramRanges()->GetHistoDiffTimeMax(); Float_t tdmin = GetHistogramRanges()->GetHistoDiffTimeMin();
493 Int_t tbins = GetHistogramRanges()->GetHistoTimeBins() ; Float_t tmax = GetHistogramRanges()->GetHistoTimeMax(); Float_t tmin = GetHistogramRanges()->GetHistoTimeMin();
494 Int_t nbins = GetHistogramRanges()->GetHistoNClusterCellBins(); Int_t nmax = GetHistogramRanges()->GetHistoNClusterCellMax(); Int_t nmin = GetHistogramRanges()->GetHistoNClusterCellMin();
42d47cb7 495
b5dbb99b 496 Int_t nmassbins = GetHistogramRanges()->GetHistoMassBins();
497 Float_t massmin = GetHistogramRanges()->GetHistoMassMin();
498 Float_t massmax = GetHistogramRanges()->GetHistoMassMax();
499
09273901 500 Int_t nresetabins = GetHistogramRanges()->GetHistoTrackResidualEtaBins();
501 Float_t resetamax = GetHistogramRanges()->GetHistoTrackResidualEtaMax();
502 Float_t resetamin = GetHistogramRanges()->GetHistoTrackResidualEtaMin();
503 Int_t nresphibins = GetHistogramRanges()->GetHistoTrackResidualPhiBins();
504 Float_t resphimax = GetHistogramRanges()->GetHistoTrackResidualPhiMax();
505 Float_t resphimin = GetHistogramRanges()->GetHistoTrackResidualPhiMin();
506
31ae6d59 507 Int_t ndedxbins = GetHistogramRanges()->GetHistodEdxBins();
508 Float_t dedxmax = GetHistogramRanges()->GetHistodEdxMax();
509 Float_t dedxmin = GetHistogramRanges()->GetHistodEdxMin();
510 Int_t nPoverEbins = GetHistogramRanges()->GetHistoPOverEBins();
511 Float_t pOverEmax = GetHistogramRanges()->GetHistoPOverEMax();
512 Float_t pOverEmin = GetHistogramRanges()->GetHistoPOverEMin();
513
514
b9947879 515 fhPt = new TH1F("hPt","Number of identified #pi^{0} (#eta) decay",nptbins,ptmin,ptmax);
09273901 516 fhPt->SetYTitle("N");
9fb80477 517 fhPt->SetXTitle("p_{T} (GeV/c)");
09273901 518 outputContainer->Add(fhPt) ;
519
b9947879 520 fhE = new TH1F("hE","Number of identified #pi^{0} (#eta) decay pairs",nptbins,ptmin,ptmax);
09273901 521 fhE->SetYTitle("N");
b9947879 522 fhE->SetXTitle("E (GeV)");
09273901 523 outputContainer->Add(fhE) ;
524
525 fhEPhi = new TH2F
b9947879 526 ("hEPhi","Selected #pi^{0} (#eta) pairs: E vs #phi",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
527 fhEPhi->SetYTitle("#phi (rad)");
528 fhEPhi->SetXTitle("E (GeV)");
09273901 529 outputContainer->Add(fhEPhi) ;
530
531 fhEEta = new TH2F
b9947879 532 ("hEEta","Selected #pi^{0} (#eta) pairs: E vs #eta",nptbins,ptmin,ptmax,netabins,etamin,etamax);
533 fhEEta->SetYTitle("#eta");
9fb80477 534 fhEEta->SetXTitle("E (GeV)");
09273901 535 outputContainer->Add(fhEEta) ;
536
537 fhEtaPhi = new TH2F
b9947879 538 ("hEtaPhi","Selected #pi^{0} (#eta) pairs: #eta vs #phi",netabins,etamin,etamax, nphibins,phimin,phimax);
539 fhEtaPhi->SetYTitle("#phi (rad)");
540 fhEtaPhi->SetXTitle("#eta");
09273901 541 outputContainer->Add(fhEtaPhi) ;
542
b9947879 543 fhPtDecay = new TH1F("hPtDecay","Number of identified #pi^{0} (#eta) decay photons",nptbins,ptmin,ptmax);
09273901 544 fhPtDecay->SetYTitle("N");
b9947879 545 fhPtDecay->SetXTitle("p_{T} (GeV/c)");
09273901 546 outputContainer->Add(fhPtDecay) ;
547
b9947879 548 fhEDecay = new TH1F("hEDecay","Number of identified #pi^{0} (#eta) decay photons",nptbins,ptmin,ptmax);
09273901 549 fhEDecay->SetYTitle("N");
b9947879 550 fhEDecay->SetXTitle("E (GeV)");
09273901 551 outputContainer->Add(fhEDecay) ;
57b97dc6 552
c4a7d28a 553 ////////
57b97dc6 554
b5dbb99b 555 if(fAnaType == kIMCalo || fAnaType == kIMCaloTracks )
556 {
c4a7d28a 557
521636d2 558 fhEDispersion = new TH2F
b9947879 559 ("hEDispersion","Selected #pi^{0} (#eta) pairs: E vs dispersion",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
521636d2 560 fhEDispersion->SetYTitle("D^{2}");
561 fhEDispersion->SetXTitle("E (GeV)");
562 outputContainer->Add(fhEDispersion) ;
563
564 fhELambda0 = new TH2F
b9947879 565 ("hELambda0","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
521636d2 566 fhELambda0->SetYTitle("#lambda_{0}^{2}");
567 fhELambda0->SetXTitle("E (GeV)");
568 outputContainer->Add(fhELambda0) ;
3bfcb597 569
42d47cb7 570 fhELambda1 = new TH2F
b9947879 571 ("hELambda1","Selected #pi^{0} (#eta) pairs: E vs #lambda_{1}",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
42d47cb7 572 fhELambda1->SetYTitle("#lambda_{1}^{2}");
573 fhELambda1->SetXTitle("E (GeV)");
574 outputContainer->Add(fhELambda1) ;
575
3bfcb597 576 fhELambda0FracMaxCellCut = new TH2F
b9947879 577 ("hELambda0FracMaxCellCut","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, Max cell fraction of energy < 0.5",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3bfcb597 578 fhELambda0FracMaxCellCut->SetYTitle("#lambda_{0}^{2}");
579 fhELambda0FracMaxCellCut->SetXTitle("E (GeV)");
580 outputContainer->Add(fhELambda0FracMaxCellCut) ;
581
582 fhEFracMaxCell = new TH2F
b9947879 583 ("hEFracMaxCell","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, Max cell fraction of energy",nptbins,ptmin,ptmax,100,0,1);
3bfcb597 584 fhEFracMaxCell->SetYTitle("Fraction");
585 fhEFracMaxCell->SetXTitle("E (GeV)");
586 outputContainer->Add(fhEFracMaxCell) ;
587
588 if(fCalorimeter=="EMCAL"){
589 fhELambda0NoTRD = new TH2F
b9947879 590 ("hELambda0NoTRD","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, not behind TRD",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3bfcb597 591 fhELambda0NoTRD->SetYTitle("#lambda_{0}^{2}");
592 fhELambda0NoTRD->SetXTitle("E (GeV)");
593 outputContainer->Add(fhELambda0NoTRD) ;
594
595 fhEFracMaxCellNoTRD = new TH2F
b9947879 596 ("hEFracMaxCellNoTRD","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, Max cell fraction of energy, not behind TRD",nptbins,ptmin,ptmax,100,0,1);
3bfcb597 597 fhEFracMaxCellNoTRD->SetYTitle("Fraction");
598 fhEFracMaxCellNoTRD->SetXTitle("E (GeV)");
599 outputContainer->Add(fhEFracMaxCellNoTRD) ;
600 }
521636d2 601
42d47cb7 602 fhENCells = new TH2F ("hENCells","N cells in cluster vs E ", nptbins,ptmin,ptmax, nbins,nmin,nmax);
603 fhENCells->SetXTitle("E (GeV)");
604 fhENCells->SetYTitle("# of cells in cluster");
605 outputContainer->Add(fhENCells);
606
607 fhETime = new TH2F("hETime","cluster time vs pair E",nptbins,ptmin,ptmax, tbins,tmin,tmax);
608 fhETime->SetXTitle("E (GeV)");
9fb80477 609 fhETime->SetYTitle("t (ns)");
42d47cb7 610 outputContainer->Add(fhETime);
521636d2 611
e7fd282f 612 }// Invariant mass analysis in calorimeters and calorimeter + conversion photons
613
614 if(fAnaType == kIMCalo){
42d47cb7 615 fhEPairDiffTime = new TH2F("hEPairDiffTime","cluster pair time difference vs E",nptbins,ptmin,ptmax, tdbins,tdmin,tdmax);
616 fhEPairDiffTime->SetXTitle("E_{pair} (GeV)");
617 fhEPairDiffTime->SetYTitle("#Delta t (ns)");
618 outputContainer->Add(fhEPairDiffTime);
e7fd282f 619 }
477d6cee 620
b5dbb99b 621 if(fFillTMHisto)
622 {
09273901 623 fhTrackMatchedDEta = new TH2F
31ae6d59 624 ("hTrackMatchedDEta",
09273901 625 "d#eta of cluster-track vs cluster energy",
626 nptbins,ptmin,ptmax,nresetabins,resetamin,resetamax);
627 fhTrackMatchedDEta->SetYTitle("d#eta");
628 fhTrackMatchedDEta->SetXTitle("E_{cluster} (GeV)");
629
630 fhTrackMatchedDPhi = new TH2F
31ae6d59 631 ("hTrackMatchedDPhi",
09273901 632 "d#phi of cluster-track vs cluster energy",
633 nptbins,ptmin,ptmax,nresphibins,resphimin,resphimax);
634 fhTrackMatchedDPhi->SetYTitle("d#phi (rad)");
635 fhTrackMatchedDPhi->SetXTitle("E_{cluster} (GeV)");
636
637 fhTrackMatchedDEtaDPhi = new TH2F
31ae6d59 638 ("hTrackMatchedDEtaDPhi",
09273901 639 "d#eta vs d#phi of cluster-track vs cluster energy",
640 nresetabins,resetamin,resetamax,nresphibins,resphimin,resphimax);
641 fhTrackMatchedDEtaDPhi->SetYTitle("d#phi (rad)");
642 fhTrackMatchedDEtaDPhi->SetXTitle("d#eta");
643
644 outputContainer->Add(fhTrackMatchedDEta) ;
645 outputContainer->Add(fhTrackMatchedDPhi) ;
646 outputContainer->Add(fhTrackMatchedDEtaDPhi) ;
31ae6d59 647
648 fhdEdx = new TH2F ("hdEdx","matched track <dE/dx> vs cluster E ", nptbins,ptmin,ptmax,ndedxbins, dedxmin, dedxmax);
649 fhdEdx->SetXTitle("E (GeV)");
650 fhdEdx->SetYTitle("<dE/dx>");
651 outputContainer->Add(fhdEdx);
652
653 fhEOverP = new TH2F ("hEOverP","matched track E/p vs cluster E ", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
654 fhEOverP->SetXTitle("E (GeV)");
655 fhEOverP->SetYTitle("E/p");
b5dbb99b 656 outputContainer->Add(fhEOverP);
657
658 if(fCalorimeter=="EMCAL")
659 {
660 fhEOverPNoTRD = new TH2F ("hEOverPNoTRD","matched track E/p vs cluster E, SM not behind TRD ", nptbins,ptmin,ptmax,nPoverEbins,pOverEmin,pOverEmax);
661 fhEOverPNoTRD->SetXTitle("E (GeV)");
662 fhEOverPNoTRD->SetYTitle("E/p");
663 outputContainer->Add(fhEOverPNoTRD);
664 }
31ae6d59 665
666 if(IsDataMC())
667 {
668 fhTrackMatchedMCParticle = new TH2F
669 ("hTrackMatchedMCParticle",
670 "Origin of particle vs energy",
671 nptbins,ptmin,ptmax,8,0,8);
672 fhTrackMatchedMCParticle->SetXTitle("E (GeV)");
673 //fhTrackMatchedMCParticle->SetYTitle("Particle type");
674
675 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(1 ,"Photon");
676 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(2 ,"Electron");
677 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(3 ,"Meson Merged");
678 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(4 ,"Rest");
679 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(5 ,"Conv. Photon");
680 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(6 ,"Conv. Electron");
681 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(7 ,"Conv. Merged");
682 fhTrackMatchedMCParticle->GetYaxis()->SetBinLabel(8 ,"Conv. Rest");
683
684 outputContainer->Add(fhTrackMatchedMCParticle);
685 }
09273901 686 }
687
b5dbb99b 688 if(fFillWeightHistograms)
689 {
78a28af3 690
691 fhECellClusterRatio = new TH2F ("hECellClusterRatio"," cell energy / cluster energy vs cluster energy, for selected decay photons from neutral meson",
692 nptbins,ptmin,ptmax, 100,0,1.);
693 fhECellClusterRatio->SetXTitle("E_{cluster} (GeV) ");
694 fhECellClusterRatio->SetYTitle("E_{cell i}/E_{cluster}");
695 outputContainer->Add(fhECellClusterRatio);
696
697 fhECellClusterLogRatio = new TH2F ("hECellClusterLogRatio"," Log(cell energy / cluster energy) vs cluster energy, for selected decay photons from neutral meson",
1a72f6c5 698 nptbins,ptmin,ptmax, 100,-10,0);
78a28af3 699 fhECellClusterLogRatio->SetXTitle("E_{cluster} (GeV) ");
1a72f6c5 700 fhECellClusterLogRatio->SetYTitle("Log (E_{max cell}/E_{cluster})");
78a28af3 701 outputContainer->Add(fhECellClusterLogRatio);
702
703 fhEMaxCellClusterRatio = new TH2F ("hEMaxCellClusterRatio"," max cell energy / cluster energy vs cluster energy, for selected decay photons from neutral meson",
704 nptbins,ptmin,ptmax, 100,0,1.);
705 fhEMaxCellClusterRatio->SetXTitle("E_{cluster} (GeV) ");
706 fhEMaxCellClusterRatio->SetYTitle("E_{max cell}/E_{cluster}");
707 outputContainer->Add(fhEMaxCellClusterRatio);
708
709 fhEMaxCellClusterLogRatio = new TH2F ("hEMaxCellClusterLogRatio"," Log(max cell energy / cluster energy) vs cluster energy, for selected decay photons from neutral meson",
1a72f6c5 710 nptbins,ptmin,ptmax, 100,-10,0);
78a28af3 711 fhEMaxCellClusterLogRatio->SetXTitle("E_{cluster} (GeV) ");
1a72f6c5 712 fhEMaxCellClusterLogRatio->SetYTitle("Log (E_{max cell}/E_{cluster})");
78a28af3 713 outputContainer->Add(fhEMaxCellClusterLogRatio);
714
b5dbb99b 715 for(Int_t iw = 0; iw < 14; iw++)
716 {
1a72f6c5 717 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),
78a28af3 718 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
719 fhLambda0ForW0[iw]->SetXTitle("E_{cluster}");
720 fhLambda0ForW0[iw]->SetYTitle("#lambda^{2}_{0}");
721 outputContainer->Add(fhLambda0ForW0[iw]);
722
1a72f6c5 723// 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),
724// nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
725// fhLambda1ForW0[iw]->SetXTitle("E_{cluster}");
726// fhLambda1ForW0[iw]->SetYTitle("#lambda^{2}_{1}");
727// outputContainer->Add(fhLambda1ForW0[iw]);
78a28af3 728
729 }
730 }
731
b5dbb99b 732 if(IsDataMC())
733 {
477d6cee 734 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
b5dbb99b 735 GetReader()->GetDataType() != AliCaloTrackReader::kMC)
736 {
477d6cee 737
b9947879 738 fhPtMC = new TH1F("hPtMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax);
09273901 739 fhPtMC->SetYTitle("N");
9fb80477 740 fhPtMC->SetXTitle("p_{T} (GeV/c)");
09273901 741 outputContainer->Add(fhPtMC) ;
477d6cee 742
09273901 743 fhPhiMC = new TH2F
b9947879 744 ("hPhiMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
09273901 745 fhPhiMC->SetYTitle("#phi");
b9947879 746 fhPhiMC->SetXTitle("p_{T} (GeV/c)");
09273901 747 outputContainer->Add(fhPhiMC) ;
477d6cee 748
09273901 749 fhEtaMC = new TH2F
b9947879 750 ("hEtaMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax,netabins,etamin,etamax);
09273901 751 fhEtaMC->SetYTitle("#eta");
b9947879 752 fhEtaMC->SetXTitle("p_{T} (GeV/c)");
09273901 753 outputContainer->Add(fhEtaMC) ;
477d6cee 754
b9947879 755 fhPtMCNo = new TH1F("hPtMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax);
09273901 756 fhPtMCNo->SetYTitle("N");
9fb80477 757 fhPtMCNo->SetXTitle("p_{T} (GeV/c)");
09273901 758 outputContainer->Add(fhPtMCNo) ;
477d6cee 759
09273901 760 fhPhiMCNo = new TH2F
b9947879 761 ("hPhiMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
09273901 762 fhPhiMCNo->SetYTitle("#phi");
b9947879 763 fhPhiMCNo->SetXTitle("p_{T} (GeV/c)");
09273901 764 outputContainer->Add(fhPhiMCNo) ;
477d6cee 765
09273901 766 fhEtaMCNo = new TH2F
b9947879 767 ("hEtaMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax,netabins,etamin,etamax);
09273901 768 fhEtaMCNo->SetYTitle("#eta");
b9947879 769 fhEtaMCNo->SetXTitle("p_{T} (GeV/c)");
09273901 770 outputContainer->Add(fhEtaMCNo) ;
477d6cee 771
b5dbb99b 772 fhAnglePairMCPi0 = new TH2F
773 ("AnglePairMCPi0",
774 "Angle between decay #gamma pair vs E_{pair}, origin #pi^{0}",nptbins,ptmin,ptmax,250,0,0.5);
775 fhAnglePairMCPi0->SetYTitle("#alpha (rad)");
776 fhAnglePairMCPi0->SetXTitle("E_{pair} (GeV)");
777 outputContainer->Add(fhAnglePairMCPi0) ;
778
779 fhAnglePairMCEta = new TH2F
780 ("AnglePairMCEta",
781 "Angle between decay #gamma pair vs E_{pair}, origin #eta",nptbins,ptmin,ptmax,250,0,0.5);
782 fhAnglePairMCEta->SetYTitle("#alpha (rad)");
783 fhAnglePairMCEta->SetXTitle("E_{pair} (GeV)");
784 outputContainer->Add(fhAnglePairMCEta) ;
785
786 fhMassPairMCPi0 = new TH2F
787 ("MassPairMCPi0",
788 "Mass for decay #gamma pair vs E_{pair}, origin #pi^{0}",nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
789 fhMassPairMCPi0->SetYTitle("#alpha (rad)");
790 fhMassPairMCPi0->SetXTitle("E_{pair} (GeV)");
791 outputContainer->Add(fhMassPairMCPi0) ;
792
793 fhMassPairMCEta = new TH2F
794 ("MassPairMCEta",
795 "Mass for decay #gamma pair vs E_{pair}, origin #eta",nptbins,ptmin,ptmax,nmassbins,massmin,massmax);
796 fhMassPairMCEta->SetYTitle("#alpha (rad)");
797 fhMassPairMCEta->SetXTitle("E_{pair} (GeV)");
798 outputContainer->Add(fhMassPairMCEta) ;
799
c4a7d28a 800 if(fAnaType == kIMCalo){
6db946bd 801 TString ptype[] ={"#gamma","#gamma->e^{#pm}","#pi^{0}","#eta","e^{#pm}", "hadron"};
b9947879 802 TString pname[] ={"Photon","Conversion", "Pi0", "Eta", "Electron","Hadron"};
6db946bd 803 for(Int_t i = 0; i < 6; i++){
521636d2 804
805 fhEMCLambda0[i] = new TH2F(Form("hELambda0_MC%s",pname[i].Data()),
806 Form("Selected pair, cluster from %s : E vs #lambda_{0}^{2}",ptype[i].Data()),
807 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
808 fhEMCLambda0[i]->SetYTitle("#lambda_{0}^{2}");
809 fhEMCLambda0[i]->SetXTitle("E (GeV)");
810 outputContainer->Add(fhEMCLambda0[i]) ;
811
3bfcb597 812 if(fCalorimeter=="EMCAL"){
813 fhEMCLambda0NoTRD[i] = new TH2F(Form("hELambda0NoTRD_MC%s",pname[i].Data()),
814 Form("Selected pair, cluster from %s : E vs #lambda_{0}^{2}, NoTRD",ptype[i].Data()),
815 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
816 fhEMCLambda0NoTRD[i]->SetYTitle("#lambda_{0}^{2}");
817 fhEMCLambda0NoTRD[i]->SetXTitle("E (GeV)");
818 outputContainer->Add(fhEMCLambda0NoTRD[i]) ;
819 }
820
821 fhEMCLambda0FracMaxCellCut[i] = new TH2F(Form("hELambda0FracMaxCellCut_MC%s",pname[i].Data()),
822 Form("Selected pair, cluster from %s : E vs #lambda_{0}^{2}, Max cell fraction of energy < 0.5 ",ptype[i].Data()),
823 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
824 fhEMCLambda0FracMaxCellCut[i]->SetYTitle("#lambda_{0}^{2}");
825 fhEMCLambda0FracMaxCellCut[i]->SetXTitle("E (GeV)");
826 outputContainer->Add(fhEMCLambda0FracMaxCellCut[i]) ;
827
828 fhEMCFracMaxCell[i] = new TH2F(Form("hEFracMaxCell_MC%s",pname[i].Data()),
829 Form("Selected pair, cluster from %s : E vs Max cell fraction of energy",ptype[i].Data()),
830 nptbins,ptmin,ptmax,100,0,1);
831 fhEMCFracMaxCell[i]->SetYTitle("Fraction");
832 fhEMCFracMaxCell[i]->SetXTitle("E (GeV)");
833 outputContainer->Add(fhEMCFracMaxCell[i]) ;
834
521636d2 835 fhEMCLambda1[i] = new TH2F(Form("hELambda1_MC%s",pname[i].Data()),
836 Form("Selected pair, cluster from %s : E vs #lambda_{1}^{2}",ptype[i].Data()),
837 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
838 fhEMCLambda1[i]->SetYTitle("#lambda_{1}^{2}");
839 fhEMCLambda1[i]->SetXTitle("E (GeV)");
840 outputContainer->Add(fhEMCLambda1[i]) ;
7c65ad18 841
521636d2 842 fhEMCDispersion[i] = new TH2F(Form("hEDispersion_MC%s",pname[i].Data()),
843 Form("Selected pair, cluster from %s : E vs dispersion^{2}",ptype[i].Data()),
844 nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
845 fhEMCDispersion[i]->SetYTitle("D^{2}");
846 fhEMCDispersion[i]->SetXTitle("E (GeV)");
847 outputContainer->Add(fhEMCDispersion[i]) ;
7c65ad18 848
521636d2 849 }//
c4a7d28a 850
851 }//kIMCalo
521636d2 852 } //Not MC reader
477d6cee 853 }//Histos with MC
854
855
856 //Keep neutral meson selection histograms if requiered
857 //Setting done in AliNeutralMesonSelection
858
859 if(fAnaType!=kSSCalo && GetNeutralMesonSelection()){
860
861 TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ;
862 if(GetNeutralMesonSelection()->AreNeutralMesonSelectionHistosKept())
863 for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ;
5ae09196 864 delete nmsHistos;
a14fd526 865
477d6cee 866 }
867
477d6cee 868 return outputContainer ;
869
870}
871
521636d2 872//____________________________________________________________________________
873void AliAnaPi0EbE::Init()
874{
875 //Init
876 //Do some checks
877 if(fCalorimeter == "PHOS" && !GetReader()->IsPHOSSwitchedOn() && NewOutputAOD()){
878 printf("AliAnaPi0EbE::Init() - !!STOP: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
879 abort();
880 }
881 else if(fCalorimeter == "EMCAL" && !GetReader()->IsEMCALSwitchedOn() && NewOutputAOD()){
882 printf("AliAnaPi0EbE::Init() - !!STOP: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
883 abort();
884 }
885
886}
887
888//____________________________________________________________________________
889void AliAnaPi0EbE::InitParameters()
890{
891 //Initialize the parameters of the analysis.
892 AddToHistogramsName("AnaPi0EbE_");
893
1db06135 894 fInputAODGammaConvName = "PhotonsCTS" ;
521636d2 895 fAnaType = kIMCalo ;
896 fCalorimeter = "EMCAL" ;
897 fMinDist = 2.;
898 fMinDist2 = 4.;
899 fMinDist3 = 5.;
900
901}
902
477d6cee 903//__________________________________________________________________
904void AliAnaPi0EbE::MakeAnalysisFillAOD()
905{
906 //Do analysis and fill aods
907
908 switch(fAnaType)
521636d2 909 {
477d6cee 910 case kIMCalo:
911 MakeInvMassInCalorimeter();
912 break;
913
914 case kSSCalo:
915 MakeShowerShapeIdentification();
916 break;
917
918 case kIMCaloTracks:
919 MakeInvMassInCalorimeterAndCTS();
920 break;
921
521636d2 922 }
477d6cee 923}
924
42d47cb7 925//____________________________________________
477d6cee 926void AliAnaPi0EbE::MakeInvMassInCalorimeter()
927{
57b97dc6 928 //Do analysis and fill aods
929 //Search for the photon decay in calorimeters
930 //Read photon list from AOD, produced in class AliAnaPhoton
931 //Check if 2 photons have the mass of the pi0.
477d6cee 932
933 TLorentzVector mom1;
934 TLorentzVector mom2;
935 TLorentzVector mom ;
b5dbb99b 936
937 Int_t tag = 0;
938 Int_t label = 0;
477d6cee 939
940 if(!GetInputAODBranch()){
a3aebfff 941 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - No input calo photons in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
477d6cee 942 abort();
943 }
f8006433 944
42d47cb7 945 //Get shower shape information of clusters
946 TObjArray *clusters = 0;
947 if (fCalorimeter=="EMCAL") clusters = GetEMCALClusters();
948 else if(fCalorimeter=="PHOS") clusters = GetPHOSClusters() ;
949
c4a7d28a 950 for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast()-1; iphoton++){
477d6cee 951 AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
c8fe2783 952
c4a7d28a 953 //Vertex cut in case of mixed events
c8fe2783 954 Int_t evtIndex1 = 0 ;
955 if(GetMixedEvent())
956 evtIndex1 = GetMixedEvent()->EventIndexForCaloCluster(photon1->GetCaloLabel(0)) ;
5025c139 957 if(TMath::Abs(GetVertex(evtIndex1)[2]) > GetZvertexCut()) continue ; //vertex cut
477d6cee 958 mom1 = *(photon1->Momentum());
959
42d47cb7 960 //Get original cluster, to recover some information
1db06135 961 Int_t iclus = -1;
962 AliVCluster *cluster1 = FindCluster(clusters,photon1->GetCaloLabel(0),iclus);
42d47cb7 963
1db06135 964 if(!cluster1){
42d47cb7 965 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - First cluster not found\n");
966 return;
9ab9e937 967 }
c4a7d28a 968
b5dbb99b 969 for(Int_t jphoton = iphoton+1; jphoton < GetInputAODBranch()->GetEntriesFast(); jphoton++)
970 {
a3aebfff 971 AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(jphoton));
b5dbb99b 972
c8fe2783 973 Int_t evtIndex2 = 0 ;
974 if(GetMixedEvent())
975 evtIndex2 = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ;
b5dbb99b 976
c8fe2783 977 if(GetMixedEvent() && (evtIndex1 == evtIndex2))
978 continue ;
b5dbb99b 979
5025c139 980 if(TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut()) continue ; //vertex cut
b5dbb99b 981
477d6cee 982 mom2 = *(photon2->Momentum());
c4a7d28a 983
1db06135 984 //Get original cluster, to recover some information
985 Int_t iclus2;
986 AliVCluster *cluster2 = FindCluster(clusters,photon2->GetCaloLabel(0),iclus2,iclus+1);
42d47cb7 987
b5dbb99b 988 if(!cluster2)
989 {
42d47cb7 990 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Second cluster not found\n");
1db06135 991 return;
9ab9e937 992 }
c4a7d28a 993
42d47cb7 994 Float_t e1 = photon1->E();
995 Float_t e2 = photon2->E();
996
997 //Select clusters with good time window difference
998 Float_t tof1 = cluster1->GetTOF()*1e9;;
999 Float_t tof2 = cluster2->GetTOF()*1e9;;
1000 Double_t t12diff = tof1-tof2;
1001 fhEPairDiffTime->Fill(e1+e2, t12diff);
1002 if(TMath::Abs(t12diff) > GetPairTimeCut()) continue;
1003
b5dbb99b 1004 //Play with the MC stack if available
1005 if(IsDataMC()) HasPairSameMCMother(photon1, photon2, label, tag) ;
1006
57b97dc6 1007 //Select good pair (good phi, pt cuts, aperture and invariant mass)
3bfcb597 1008 if(GetNeutralMesonSelection()->SelectPair(mom1, mom2,fCalorimeter))
c8fe2783 1009 {
1010 if(GetDebug()>1)
1011 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());
42d47cb7 1012
57b97dc6 1013 //Fill some histograms about shower shape
9ab9e937 1014 if(clusters && GetReader()->GetDataType()!=AliCaloTrackReader::kMC){
b5dbb99b 1015 FillSelectedClusterHistograms(cluster1, photon1->GetTag());
1016 FillSelectedClusterHistograms(cluster2, photon2->GetTag());
42d47cb7 1017 }
521636d2 1018
803d06a8 1019 // Tag both photons as decay
1020 photon1->SetTagged(kTRUE);
1021 photon2->SetTagged(kTRUE);
09273901 1022
1023 fhPtDecay->Fill(photon1->Pt());
1024 fhEDecay ->Fill(photon1->E() );
1025
1026 fhPtDecay->Fill(photon2->Pt());
1027 fhEDecay ->Fill(photon2->E() );
803d06a8 1028
57b97dc6 1029 //Create AOD for analysis
c8fe2783 1030 mom = mom1+mom2;
b5dbb99b 1031
c8fe2783 1032 AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
b5dbb99b 1033
21a4b1c0 1034 pi0.SetIdentifiedParticleType(AliCaloPID::kPi0);
c8fe2783 1035 pi0.SetDetector(photon1->GetDetector());
b5dbb99b 1036
1037 // MC
1038 pi0.SetLabel(label);
c8fe2783 1039 pi0.SetTag(tag);
b5dbb99b 1040
57b97dc6 1041 //Set the indeces of the original caloclusters
c8fe2783 1042 pi0.SetCaloLabel(photon1->GetCaloLabel(0), photon2->GetCaloLabel(0));
f8006433 1043 //pi0.SetInputFileIndex(input);
b5dbb99b 1044
c8fe2783 1045 AddAODParticle(pi0);
b5dbb99b 1046
c8fe2783 1047 }//pi0
57b97dc6 1048
477d6cee 1049 }//2n photon loop
1050
1051 }//1st photon loop
1052
a3aebfff 1053 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - End fill AODs \n");
477d6cee 1054
1055}
1056
e7fd282f 1057//__________________________________________________
477d6cee 1058void AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
1059{
1060 //Do analysis and fill aods
1061 //Search for the photon decay in calorimeters
1062 //Read photon list from AOD, produced in class AliAnaPhoton and AliGammaConversion
1063 //Check if 2 photons have the mass of the pi0.
1064
1065 TLorentzVector mom1;
1066 TLorentzVector mom2;
1067 TLorentzVector mom ;
b5dbb99b 1068 Int_t tag = 0;
1069 Int_t label = 0;
5025c139 1070 Int_t evtIndex = 0;
1db06135 1071
1072 // Check calorimeter input
477d6cee 1073 if(!GetInputAODBranch()){
a3aebfff 1074 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input calo photons in AOD branch with name < %s > , STOP\n",GetInputAODName().Data());
477d6cee 1075 abort();
1076 }
57b97dc6 1077
1db06135 1078 // Get the array with conversion photons
1079 TClonesArray * inputAODGammaConv = (TClonesArray *) GetReader()->GetOutputEvent()->FindListObject(fInputAODGammaConvName);
1080 if(!inputAODGammaConv) {
1081
1082 inputAODGammaConv = (TClonesArray *) GetReader()->GetInputEvent()->FindListObject(fInputAODGammaConvName);
1083
1084 if(!inputAODGammaConv) {
1085 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input gamma conversions in AOD branch with name < %s >\n",fInputAODGammaConvName.Data());
1086
1087 return;
1088 }
1089 }
1090
1091 //Get shower shape information of clusters
1092 TObjArray *clusters = 0;
1093 if (fCalorimeter=="EMCAL") clusters = GetEMCALClusters();
1094 else if(fCalorimeter=="PHOS") clusters = GetPHOSClusters() ;
1095
1096 Int_t nCTS = inputAODGammaConv->GetEntriesFast();
1097 Int_t nCalo = GetInputAODBranch()->GetEntriesFast();
1098 if(nCTS<=0 || nCalo <=0) {
1099 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - nCalo %d, nCTS %d, cannot loop\n",nCalo,nCTS);
1100 return;
1101 }
1102
1103 if(GetDebug() > 1)
1104 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - Number of conversion photons %d\n",nCTS);
1105
1106 // Do the loop, first calo, second CTS
477d6cee 1107 for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++){
1108 AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
1109 mom1 = *(photon1->Momentum());
1110
1db06135 1111 //Get original cluster, to recover some information
1112 Int_t iclus = -1;
1113 AliVCluster *cluster = FindCluster(clusters,photon1->GetCaloLabel(0),iclus);
1114
1115 for(Int_t jphoton = 0; jphoton < nCTS; jphoton++){
1116 AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (inputAODGammaConv->At(jphoton));
5025c139 1117 if(GetMixedEvent())
1118 evtIndex = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ;
1119 if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ; //vertex cut
1120
477d6cee 1121 mom2 = *(photon2->Momentum());
57b97dc6 1122
b5dbb99b 1123 //Play with the MC stack if available
1124 if(IsDataMC())
1125 {
1126 Int_t label2 = photon2->GetLabel();
1127 if(label2 >= 0 )photon2->SetTag(GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex()));
1128
1129 HasPairSameMCMother(photon1, photon2, label, tag) ;
1130 }
1131
477d6cee 1132 //Select good pair (good phi, pt cuts, aperture and invariant mass)
b5dbb99b 1133 if(GetNeutralMesonSelection()->SelectPair(mom1, mom2,fCalorimeter))
1134 {
57b97dc6 1135 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());
1136
1db06135 1137 //Fill some histograms about shower shape
b5dbb99b 1138 if(cluster && GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
1139 {
1140 FillSelectedClusterHistograms(cluster, photon1->GetTag());
1db06135 1141 }
803d06a8 1142
1143 // Tag both photons as decay
1144 photon1->SetTagged(kTRUE);
1145 photon2->SetTagged(kTRUE);
1db06135 1146
09273901 1147 fhPtDecay->Fill(photon1->Pt());
1148 fhEDecay ->Fill(photon1->E() );
1149
1150 //fhPtDecay->Fill(photon2->Pt());
1151 //fhEDecay ->Fill(photon2->E() );
1152
57b97dc6 1153 //Create AOD for analysis
b5dbb99b 1154
57b97dc6 1155 mom = mom1+mom2;
b5dbb99b 1156
57b97dc6 1157 AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
b5dbb99b 1158
21a4b1c0 1159 pi0.SetIdentifiedParticleType(AliCaloPID::kPi0);
57b97dc6 1160 pi0.SetDetector(photon1->GetDetector());
b5dbb99b 1161
1162 // MC
1163 pi0.SetLabel(label);
57b97dc6 1164 pi0.SetTag(tag);
b5dbb99b 1165
57b97dc6 1166 //Set the indeces of the original tracks or caloclusters
1167 pi0.SetCaloLabel(photon1->GetCaloLabel(0), -1);
1168 pi0.SetTrackLabel(photon2->GetTrackLabel(0), photon2->GetTrackLabel(1));
f8006433 1169 //pi0.SetInputFileIndex(input);
b5dbb99b 1170
57b97dc6 1171 AddAODParticle(pi0);
b5dbb99b 1172
477d6cee 1173 }//pi0
1174 }//2n photon loop
1175
1176 }//1st photon loop
1177
a3aebfff 1178 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - End fill AODs \n");
477d6cee 1179
1180}
1181
1182
e7fd282f 1183//_________________________________________________
477d6cee 1184void AliAnaPi0EbE::MakeShowerShapeIdentification()
1185{
1186 //Search for pi0 in fCalorimeter with shower shape analysis
1187
4a745797 1188 TObjArray * pl = 0x0;
5ae09196 1189 //Select the Calorimeter of the photon
b5dbb99b 1190 if (fCalorimeter == "PHOS" )
be518ab0 1191 pl = GetPHOSClusters();
5ae09196 1192 else if (fCalorimeter == "EMCAL")
be518ab0 1193 pl = GetEMCALClusters();
57b97dc6 1194
5ae09196 1195 if(!pl) {
1196 Info("MakeShowerShapeIdentification","TObjArray with %s clusters is NULL!\n",fCalorimeter.Data());
1197 return;
1198 }
233e0df8 1199
477d6cee 1200 TLorentzVector mom ;
b5dbb99b 1201 for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++)
1202 {
0ae57829 1203 AliVCluster * calo = (AliVCluster*) (pl->At(icalo));
477d6cee 1204
f8006433 1205 Int_t evtIndex = 0 ;
b5dbb99b 1206 if (GetMixedEvent())
1207 {
f8006433 1208 evtIndex=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
1209 }
5025c139 1210 if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ; //vertex cut
521636d2 1211
57b97dc6 1212 //Get Momentum vector,
f8006433 1213 if(GetReader()->GetDataType() != AliCaloTrackReader::kMC){
1214 calo->GetMomentum(mom,GetVertex(evtIndex)) ;}//Assume that come from vertex in straight line
1215 else{
1216 Double_t vertex[]={0,0,0};
1217 calo->GetMomentum(mom,vertex) ;
1218 }
233e0df8 1219
57b97dc6 1220 //If too small or big pt, skip it
477d6cee 1221 if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ;
1222 //Check acceptance selection
b5dbb99b 1223 if(IsFiducialCutOn())
1224 {
ff45398a 1225 Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
477d6cee 1226 if(! in ) continue ;
1227 }
1228
1229 //Create AOD for analysis
1230 AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);
c8fe2783 1231 aodpi0.SetLabel(calo->GetLabel());
477d6cee 1232 //Set the indeces of the original caloclusters
1233 aodpi0.SetCaloLabel(calo->GetID(),-1);
1234 aodpi0.SetDetector(fCalorimeter);
1235 if(GetDebug() > 1)
ff45398a 1236 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());
477d6cee 1237
1238 //Check Distance to Bad channel, set bit.
c8fe2783 1239 Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel
477d6cee 1240 if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
1241 if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm)
1242 continue ;
1243
a3aebfff 1244 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Bad channel cut passed %4.2f\n",distBad);
477d6cee 1245
1246 if(distBad > fMinDist3) aodpi0.SetDistToBad(2) ;
1247 else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ;
1248 else aodpi0.SetDistToBad(0) ;
1249
1250 //Check PID
1251 //PID selection or bit setting
49b5c49b 1252 if(IsCaloPIDOn()){
477d6cee 1253 //Skip matched clusters with tracks
49b5c49b 1254 if(IsTrackMatched(calo, GetReader()->GetInputEvent())) continue ;
477d6cee 1255
49b5c49b 1256 // Get most probable PID, 2 options check bayesian PID weights or redo PID
1257 // By default, redo PID
1258
1259 aodpi0.SetIdentifiedParticleType(GetCaloPID()->GetIdentifiedParticleType(fCalorimeter,mom,calo));//PID recalculated
477d6cee 1260
21a4b1c0 1261 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PDG of identified particle %d\n",aodpi0.GetIdentifiedParticleType());
477d6cee 1262
1263 //If cluster does not pass pid, not pi0, skip it.
21a4b1c0 1264 if(aodpi0.GetIdentifiedParticleType() != AliCaloPID::kPi0) continue ;
477d6cee 1265
1266 }
b5dbb99b 1267 else
1268 {
49b5c49b 1269 //Set PID bits for later selection
477d6cee 1270 //GetPDG already called in SetPIDBits.
49b5c49b 1271 GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodpi0, GetCaloUtils(), GetReader()->GetInputEvent());
a3aebfff 1272 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PID Bits set \n");
477d6cee 1273 }
1274
21a4b1c0 1275 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Pi0 selection cuts passed: pT %3.2f, pdg %d\n",aodpi0.Pt(), aodpi0.GetIdentifiedParticleType());
477d6cee 1276
1277 //Play with the MC stack if available
1278 //Check origin of the candidates
1279 if(IsDataMC()){
1280 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
57b97dc6 1281 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
f8006433 1282 //aodpi0.SetInputFileIndex(input);
57b97dc6 1283 Int_t tag =0;
1284 tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(),GetReader(), aodpi0.GetInputFileIndex());
1285 //GetMCAnalysisUtils()->CheckMultipleOrigin(calo->GetLabels(),calo->GetNLabels(), GetReader(), aodpi0.GetInputFileIndex(), tag);
1286 aodpi0.SetTag(tag);
1287 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Origin of candidate %d\n",aodpi0.GetTag());
477d6cee 1288 }
1289 }//Work with stack also
1290
1291 //Add AOD with pi0 object to aod branch
1292 AddAODParticle(aodpi0);
1293
1294 }//loop
1295
a3aebfff 1296 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - End fill AODs \n");
477d6cee 1297
1298}
e7fd282f 1299//______________________________________________
477d6cee 1300void AliAnaPi0EbE::MakeAnalysisFillHistograms()
691bdd02 1301{
477d6cee 1302 //Do analysis and fill histograms
691bdd02 1303
b5dbb99b 1304 if(!GetOutputAODBranch())
1305 {
a3aebfff 1306 printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - No output pi0 in AOD branch with name < %s >,STOP \n",GetOutputAODName().Data());
477d6cee 1307 abort();
1308 }
1309 //Loop on stored AOD pi0
1310 Int_t naod = GetOutputAODBranch()->GetEntriesFast();
a3aebfff 1311 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
477d6cee 1312
b5dbb99b 1313 for(Int_t iaod = 0; iaod < naod ; iaod++)
1314 {
477d6cee 1315
1316 AliAODPWG4Particle* pi0 = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
21a4b1c0 1317 Int_t pdg = pi0->GetIdentifiedParticleType();
9415d854 1318
1319 if(IsCaloPIDOn() && pdg != AliCaloPID::kPi0) continue;
477d6cee 1320
1321 //Fill pi0 histograms
c4a7d28a 1322 Float_t ener = pi0->E();
1323 Float_t pt = pi0->Pt();
1324 Float_t phi = pi0->Phi();
57b97dc6 1325 if(phi < 0) phi+=TMath::TwoPi();
477d6cee 1326 Float_t eta = pi0->Eta();
1327
09273901 1328 fhPt ->Fill(pt);
1329 fhE ->Fill(ener);
477d6cee 1330
09273901 1331 fhEEta ->Fill(ener,eta);
1332 fhEPhi ->Fill(ener,phi);
1333 fhEtaPhi ->Fill(eta,phi);
7a972c0c 1334
b5dbb99b 1335 if(IsDataMC())
1336 {
477d6cee 1337 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
57b97dc6 1338 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
b5dbb99b 1339 if(GetMCAnalysisUtils()->CheckTagBit(pi0->GetTag(), AliMCAnalysisUtils::kMCPi0))
1340 {
09273901 1341 fhPtMC ->Fill(pt);
1342 fhPhiMC ->Fill(pt,phi);
1343 fhEtaMC ->Fill(pt,eta);
57b97dc6 1344 }
b5dbb99b 1345 else
1346 {
09273901 1347 fhPtMCNo ->Fill(pt);
1348 fhPhiMCNo ->Fill(pt,phi);
1349 fhEtaMCNo ->Fill(pt,eta);
57b97dc6 1350 }
477d6cee 1351 }
1352 }//Histograms with MC
1353
1354 }// aod loop
1355
1356}
1357
477d6cee 1358//__________________________________________________________________
1359void AliAnaPi0EbE::Print(const Option_t * opt) const
1360{
1361 //Print some relevant parameters set for the analysis
1362 if(! opt)
1363 return;
1364
1365 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
745913ae 1366 AliAnaCaloTrackCorrBaseClass::Print("");
477d6cee 1367 printf("Analysis Type = %d \n", fAnaType) ;
1368 if(fAnaType == kSSCalo){
1369 printf("Calorimeter = %s\n", fCalorimeter.Data()) ;
1370 printf("Min Distance to Bad Channel = %2.1f\n",fMinDist);
1371 printf("Min Distance to Bad Channel 2 = %2.1f\n",fMinDist2);
1372 printf("Min Distance to Bad Channel 3 = %2.1f\n",fMinDist3);
1373 }
1374 printf(" \n") ;
1375
1376}
78a28af3 1377
1378//___________________________________________________________________________________
1379void AliAnaPi0EbE::RecalibrateCellAmplitude(Float_t & amp, const Int_t id)
1380{
1381 //Recaculate cell energy if recalibration factor
1382
1383 Int_t icol = -1; Int_t irow = -1; Int_t iRCU = -1;
1384 Int_t nModule = GetModuleNumberCellIndexes(id,fCalorimeter, icol, irow, iRCU);
1385
b5dbb99b 1386 if (GetCaloUtils()->IsRecalibrationOn())
1387 {
1388 if(fCalorimeter == "PHOS")
1389 {
78a28af3 1390 amp *= GetCaloUtils()->GetPHOSChannelRecalibrationFactor(nModule,icol,irow);
1391 }
b5dbb99b 1392 else
1393 {
78a28af3 1394 amp *= GetCaloUtils()->GetEMCALChannelRecalibrationFactor(nModule,icol,irow);
1395 }
1396 }
1397}
1398
78a28af3 1399