]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.cxx
Add method to : calculate number of local maxima in cluster; check if cells are neigh...
[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 {
4bfeae64 160 AliVTrack *track = GetCaloUtils()->GetMatchedTrack(cluster, GetReader()->GetInputEvent());
31ae6d59 161
162 if(track) {
163
164 Float_t dEdx = track->GetTPCsignal();
165 fhdEdx->Fill(e, dEdx);
166
167 Float_t eOverp = e/track->P();
168 fhEOverP->Fill(e, eOverp);
4bfeae64 169
b5dbb99b 170 if(fCalorimeter=="EMCAL" && nSM < 6) fhEOverPNoTRD->Fill(e, eOverp);
171
31ae6d59 172 }
4bfeae64 173 //else
174 // printf("AliAnaPi0EbE::FillSelectedClusterHistograms() - Residual OK but (dR, dZ)= (%2.4f,%2.4f) no track associated WHAT? \n", dR,dZ);
175
176
31ae6d59 177
b5dbb99b 178 if(IsDataMC())
179 {
31ae6d59 180 if ( !GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) )
181 {
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 );
187
188 }
189 else
190 {
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 );
196 }
197 } // MC
198 }
09273901 199 }// Track matching histograms
200
b5dbb99b 201 if(IsDataMC())
202 {
42d47cb7 203 //Photon1
b5dbb99b 204 if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0) )
205 {
c5693f62 206 fhEMCLambda0[kmcPi0] ->Fill(e, l0);
207 fhEMCLambda1[kmcPi0] ->Fill(e, l1);
208 fhEMCDispersion[kmcPi0] ->Fill(e, disp);
42d47cb7 209
c5693f62 210 fhEMCFracMaxCell[kmcPi0]->Fill(e,maxCellFraction);
42d47cb7 211 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 212 fhEMCLambda0NoTRD[kmcPi0]->Fill(e, l0 );
42d47cb7 213 if(maxCellFraction < 0.5)
c5693f62 214 fhEMCLambda0FracMaxCellCut[kmcPi0]->Fill(e, l0 );
42d47cb7 215
216 }//pi0
b5dbb99b 217 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCEta) )
218 {
c5693f62 219 fhEMCLambda0[kmcEta] ->Fill(e, l0);
220 fhEMCLambda1[kmcEta] ->Fill(e, l1);
221 fhEMCDispersion[kmcEta] ->Fill(e, disp);
222 fhEMCFracMaxCell[kmcEta]->Fill(e,maxCellFraction);
42d47cb7 223 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 224 fhEMCLambda0NoTRD[kmcEta]->Fill(e, l0 );
42d47cb7 225 if(maxCellFraction < 0.5)
c5693f62 226 fhEMCLambda0FracMaxCellCut[kmcEta]->Fill(e, l0 );
42d47cb7 227 }//eta
228 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) &&
b5dbb99b 229 GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCConversion) )
230 {
c5693f62 231 fhEMCLambda0[kmcConversion] ->Fill(e, l0);
232 fhEMCLambda1[kmcConversion] ->Fill(e, l1);
233 fhEMCDispersion[kmcConversion] ->Fill(e, disp);
234 fhEMCFracMaxCell[kmcConversion]->Fill(e,maxCellFraction);
42d47cb7 235 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 236 fhEMCLambda0NoTRD[kmcConversion]->Fill(e, l0 );
42d47cb7 237 if(maxCellFraction < 0.5)
c5693f62 238 fhEMCLambda0FracMaxCellCut[kmcConversion]->Fill(e, l0 );
42d47cb7 239 }//conversion photon
b5dbb99b 240 else if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton) )
241 {
c5693f62 242 fhEMCLambda0[kmcPhoton] ->Fill(e, l0);
243 fhEMCLambda1[kmcPhoton] ->Fill(e, l1);
244 fhEMCDispersion[kmcPhoton] ->Fill(e, disp);
245 fhEMCFracMaxCell[kmcPhoton]->Fill(e,maxCellFraction);
42d47cb7 246 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 247 fhEMCLambda0NoTRD[kmcPhoton]->Fill(e, l0 );
42d47cb7 248 if(maxCellFraction < 0.5)
c5693f62 249 fhEMCLambda0FracMaxCellCut[kmcPhoton]->Fill(e, l0 );
42d47cb7 250 }//photon no conversion
b5dbb99b 251 else if ( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCElectron))
252 {
c5693f62 253 fhEMCLambda0[kmcElectron] ->Fill(e, l0);
254 fhEMCLambda1[kmcElectron] ->Fill(e, l1);
255 fhEMCDispersion[kmcElectron] ->Fill(e, disp);
256 fhEMCFracMaxCell[kmcElectron]->Fill(e,maxCellFraction);
42d47cb7 257 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 258 fhEMCLambda0NoTRD[kmcElectron]->Fill(e, l0 );
42d47cb7 259 if(maxCellFraction < 0.5)
c5693f62 260 fhEMCLambda0FracMaxCellCut[kmcElectron]->Fill(e, l0 );
42d47cb7 261 }//electron
b5dbb99b 262 else
263 {
c5693f62 264 fhEMCLambda0[kmcHadron] ->Fill(e, l0);
265 fhEMCLambda1[kmcHadron] ->Fill(e, l1);
266 fhEMCDispersion[kmcHadron] ->Fill(e, disp);
267 fhEMCFracMaxCell[kmcHadron]->Fill(e,maxCellFraction);
42d47cb7 268 if(fCalorimeter=="EMCAL" && nSM < 6)
c5693f62 269 fhEMCLambda0NoTRD[kmcHadron]->Fill(e, l0 );
42d47cb7 270 if(maxCellFraction < 0.5)
c5693f62 271 fhEMCLambda0FracMaxCellCut[kmcHadron]->Fill(e, l0 );
42d47cb7 272 }//other particles
273 }//MC
274}
275
276//________________________________________________________
277void AliAnaPi0EbE::FillWeightHistograms(AliVCluster *clus)
278{
279 // Calculate weights and fill histograms
280
281 if(!fFillWeightHistograms || GetMixedEvent()) return;
282
283 AliVCaloCells* cells = 0;
284 if(fCalorimeter == "EMCAL") cells = GetEMCALCells();
285 else cells = GetPHOSCells();
286
287 // First recalculate energy in case non linearity was applied
288 Float_t energy = 0;
289 Float_t ampMax = 0;
b5dbb99b 290 for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
291 {
42d47cb7 292
293 Int_t id = clus->GetCellsAbsId()[ipos];
294
295 //Recalibrate cell energy if needed
296 Float_t amp = cells->GetCellAmplitude(id);
297 RecalibrateCellAmplitude(amp,id);
298
299 energy += amp;
300
301 if(amp> ampMax)
302 ampMax = amp;
303
304 } // energy loop
305
b5dbb99b 306 if(energy <=0 )
307 {
42d47cb7 308 printf("AliAnaPi0EbE::WeightHistograms()- Wrong calculated energy %f\n",energy);
309 return;
310 }
311
312 fhEMaxCellClusterRatio ->Fill(energy,ampMax/energy);
313 fhEMaxCellClusterLogRatio->Fill(energy,TMath::Log(ampMax/energy));
314
315 //Get the ratio and log ratio to all cells in cluster
b5dbb99b 316 for (Int_t ipos = 0; ipos < clus->GetNCells(); ipos++)
317 {
42d47cb7 318 Int_t id = clus->GetCellsAbsId()[ipos];
319
320 //Recalibrate cell energy if needed
321 Float_t amp = cells->GetCellAmplitude(id);
322 RecalibrateCellAmplitude(amp,id);
323
324 fhECellClusterRatio ->Fill(energy,amp/energy);
325 fhECellClusterLogRatio->Fill(energy,TMath::Log(amp/energy));
326 }
327
328 //Recalculate shower shape for different W0
329 if(fCalorimeter=="EMCAL"){
330
331 Float_t l0org = clus->GetM02();
332 Float_t l1org = clus->GetM20();
333 Float_t dorg = clus->GetDispersion();
334
b5dbb99b 335 for(Int_t iw = 0; iw < 14; iw++)
336 {
1a72f6c5 337 GetCaloUtils()->GetEMCALRecoUtils()->SetW0(1+iw*0.5);
42d47cb7 338 GetCaloUtils()->GetEMCALRecoUtils()->RecalculateClusterShowerShapeParameters(GetEMCALGeometry(), cells, clus);
339
340 fhLambda0ForW0[iw]->Fill(energy,clus->GetM02());
1a72f6c5 341 //fhLambda1ForW0[iw]->Fill(energy,clus->GetM20());
42d47cb7 342
343 } // w0 loop
344
345 // Set the original values back
346 clus->SetM02(l0org);
347 clus->SetM20(l1org);
348 clus->SetDispersion(dorg);
349
350 }// EMCAL
351}
352
b5dbb99b 353//__________________________________________
354TObjString * AliAnaPi0EbE::GetAnalysisCuts()
0c1383b5 355{
356 //Save parameters used for analysis
521636d2 357 TString parList ; //this will be list of parameters used for this analysis.
358 const Int_t buffersize = 255;
359 char onePar[buffersize] ;
360
361 snprintf(onePar,buffersize,"--- AliAnaPi0EbE ---\n") ;
362 parList+=onePar ;
363 snprintf(onePar,buffersize,"fAnaType=%d (Pi0 selection type) \n",fAnaType) ;
364 parList+=onePar ;
365
b5dbb99b 366 if(fAnaType == kSSCalo)
367 {
521636d2 368 snprintf(onePar,buffersize,"Calorimeter: %s\n",fCalorimeter.Data()) ;
369 parList+=onePar ;
370 snprintf(onePar,buffersize,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ;
371 parList+=onePar ;
372 snprintf(onePar,buffersize,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ;
373 parList+=onePar ;
374 snprintf(onePar,buffersize,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ;
375 parList+=onePar ;
376 }
377
378 //Get parameters set in base class.
379 parList += GetBaseParametersList() ;
380
381 //Get parameters set in PID class.
382 if(fAnaType == kSSCalo) parList += GetCaloPID()->GetPIDParametersList() ;
383
384 return new TObjString(parList) ;
0c1383b5 385}
386
b5dbb99b 387//__________________________________________________________________
388void AliAnaPi0EbE::HasPairSameMCMother(AliAODPWG4Particle * photon1,
389 AliAODPWG4Particle * photon2,
390 Int_t & label, Int_t & tag)
391{
392 // Check the labels of pare in case mother was same pi0 or eta
393 // Set the new AOD accordingly
394
395 Int_t label1 = photon1->GetLabel();
396 Int_t label2 = photon2->GetLabel();
397
398 if(label1 < 0 || label2 < 0 ) return ;
399
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();
404
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) )
410 )
411 {
412
413 //Check if pi0/eta mother is the same
414 if(GetReader()->ReadStack())
415 {
416 if(label1>=0)
417 {
418 TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree
419 label1 = mother1->GetFirstMother();
420 //mother1 = GetMCStack()->Particle(label1);//pi0
421 }
422 if(label2>=0)
423 {
424 TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree
425 label2 = mother2->GetFirstMother();
426 //mother2 = GetMCStack()->Particle(label2);//pi0
427 }
428 } // STACK
429 else if(GetReader()->ReadAODMCParticles())
430 {//&& (input > -1)){
431 if(label1>=0)
432 {
433 AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon1->GetInputFileIndex()))->At(label1);//photon in kine tree
434 label1 = mother1->GetMother();
435 //mother1 = GetMCStack()->Particle(label1);//pi0
436 }
437 if(label2>=0)
438 {
439 AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(photon2->GetInputFileIndex()))->At(label2);//photon in kine tree
440 label2 = mother2->GetMother();
441 //mother2 = GetMCStack()->Particle(label2);//pi0
442 }
443 }// AOD
444
445 //printf("mother1 %d, mother2 %d\n",label1,label2);
446 if( label1 == label2 && label1>=0 )
447 {
448
449 label = label1;
450
451 TLorentzVector mom1 = *(photon1->Momentum());
452 TLorentzVector mom2 = *(photon2->Momentum());
453
454 Double_t angle = mom2.Angle(mom1.Vect());
455 Double_t mass = (mom1+mom2).M();
456 Double_t epair = (mom1+mom2).E();
457
458 if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay))
459 {
460 fhMassPairMCPi0 ->Fill(epair,mass);
461 fhAnglePairMCPi0->Fill(epair,angle);
462 GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0);
463 }
464 else
465 {
466 fhMassPairMCEta ->Fill(epair,mass);
467 fhAnglePairMCEta->Fill(epair,angle);
468 GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCEta);
469 }
470
471 } // same label
472 } // both from eta or pi0 decay
473
474}
475
78a28af3 476//_____________________________________________
477d6cee 477TList * AliAnaPi0EbE::GetCreateOutputObjects()
478{
479 // Create histograms to be saved in output file and
480 // store them in outputContainer
481 TList * outputContainer = new TList() ;
482 outputContainer->SetName("Pi0EbEHistos") ;
483
745913ae 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();
42d47cb7 491
b5dbb99b 492 Int_t nmassbins = GetHistogramRanges()->GetHistoMassBins();
493 Float_t massmin = GetHistogramRanges()->GetHistoMassMin();
494 Float_t massmax = GetHistogramRanges()->GetHistoMassMax();
495
09273901 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();
502
31ae6d59 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();
509
510
b9947879 511 fhPt = new TH1F("hPt","Number of identified #pi^{0} (#eta) decay",nptbins,ptmin,ptmax);
09273901 512 fhPt->SetYTitle("N");
9fb80477 513 fhPt->SetXTitle("p_{T} (GeV/c)");
09273901 514 outputContainer->Add(fhPt) ;
515
b9947879 516 fhE = new TH1F("hE","Number of identified #pi^{0} (#eta) decay pairs",nptbins,ptmin,ptmax);
09273901 517 fhE->SetYTitle("N");
b9947879 518 fhE->SetXTitle("E (GeV)");
09273901 519 outputContainer->Add(fhE) ;
520
521 fhEPhi = new TH2F
b9947879 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)");
09273901 525 outputContainer->Add(fhEPhi) ;
526
527 fhEEta = new TH2F
b9947879 528 ("hEEta","Selected #pi^{0} (#eta) pairs: E vs #eta",nptbins,ptmin,ptmax,netabins,etamin,etamax);
529 fhEEta->SetYTitle("#eta");
9fb80477 530 fhEEta->SetXTitle("E (GeV)");
09273901 531 outputContainer->Add(fhEEta) ;
532
533 fhEtaPhi = new TH2F
b9947879 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");
09273901 537 outputContainer->Add(fhEtaPhi) ;
538
b9947879 539 fhPtDecay = new TH1F("hPtDecay","Number of identified #pi^{0} (#eta) decay photons",nptbins,ptmin,ptmax);
09273901 540 fhPtDecay->SetYTitle("N");
b9947879 541 fhPtDecay->SetXTitle("p_{T} (GeV/c)");
09273901 542 outputContainer->Add(fhPtDecay) ;
543
b9947879 544 fhEDecay = new TH1F("hEDecay","Number of identified #pi^{0} (#eta) decay photons",nptbins,ptmin,ptmax);
09273901 545 fhEDecay->SetYTitle("N");
b9947879 546 fhEDecay->SetXTitle("E (GeV)");
09273901 547 outputContainer->Add(fhEDecay) ;
57b97dc6 548
c4a7d28a 549 ////////
57b97dc6 550
b5dbb99b 551 if(fAnaType == kIMCalo || fAnaType == kIMCaloTracks )
552 {
c4a7d28a 553
521636d2 554 fhEDispersion = new TH2F
b9947879 555 ("hEDispersion","Selected #pi^{0} (#eta) pairs: E vs dispersion",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
521636d2 556 fhEDispersion->SetYTitle("D^{2}");
557 fhEDispersion->SetXTitle("E (GeV)");
558 outputContainer->Add(fhEDispersion) ;
559
560 fhELambda0 = new TH2F
b9947879 561 ("hELambda0","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
521636d2 562 fhELambda0->SetYTitle("#lambda_{0}^{2}");
563 fhELambda0->SetXTitle("E (GeV)");
564 outputContainer->Add(fhELambda0) ;
3bfcb597 565
42d47cb7 566 fhELambda1 = new TH2F
b9947879 567 ("hELambda1","Selected #pi^{0} (#eta) pairs: E vs #lambda_{1}",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
42d47cb7 568 fhELambda1->SetYTitle("#lambda_{1}^{2}");
569 fhELambda1->SetXTitle("E (GeV)");
570 outputContainer->Add(fhELambda1) ;
571
3bfcb597 572 fhELambda0FracMaxCellCut = new TH2F
b9947879 573 ("hELambda0FracMaxCellCut","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, Max cell fraction of energy < 0.5",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3bfcb597 574 fhELambda0FracMaxCellCut->SetYTitle("#lambda_{0}^{2}");
575 fhELambda0FracMaxCellCut->SetXTitle("E (GeV)");
576 outputContainer->Add(fhELambda0FracMaxCellCut) ;
577
578 fhEFracMaxCell = new TH2F
b9947879 579 ("hEFracMaxCell","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, Max cell fraction of energy",nptbins,ptmin,ptmax,100,0,1);
3bfcb597 580 fhEFracMaxCell->SetYTitle("Fraction");
581 fhEFracMaxCell->SetXTitle("E (GeV)");
582 outputContainer->Add(fhEFracMaxCell) ;
583
584 if(fCalorimeter=="EMCAL"){
585 fhELambda0NoTRD = new TH2F
b9947879 586 ("hELambda0NoTRD","Selected #pi^{0} (#eta) pairs: E vs #lambda_{0}, not behind TRD",nptbins,ptmin,ptmax,ssbins,ssmin,ssmax);
3bfcb597 587 fhELambda0NoTRD->SetYTitle("#lambda_{0}^{2}");
588 fhELambda0NoTRD->SetXTitle("E (GeV)");
589 outputContainer->Add(fhELambda0NoTRD) ;
590
591 fhEFracMaxCellNoTRD = new TH2F
b9947879 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);
3bfcb597 593 fhEFracMaxCellNoTRD->SetYTitle("Fraction");
594 fhEFracMaxCellNoTRD->SetXTitle("E (GeV)");
595 outputContainer->Add(fhEFracMaxCellNoTRD) ;
596 }
521636d2 597
42d47cb7 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);
602
603 fhETime = new TH2F("hETime","cluster time vs pair E",nptbins,ptmin,ptmax, tbins,tmin,tmax);
604 fhETime->SetXTitle("E (GeV)");
9fb80477 605 fhETime->SetYTitle("t (ns)");
42d47cb7 606 outputContainer->Add(fhETime);
521636d2 607
e7fd282f 608 }// Invariant mass analysis in calorimeters and calorimeter + conversion photons
609
610 if(fAnaType == kIMCalo){
42d47cb7 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);
e7fd282f 615 }
477d6cee 616
b5dbb99b 617 if(fFillTMHisto)
618 {
09273901 619 fhTrackMatchedDEta = new TH2F
31ae6d59 620 ("hTrackMatchedDEta",
09273901 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)");
625
626 fhTrackMatchedDPhi = new TH2F
31ae6d59 627 ("hTrackMatchedDPhi",
09273901 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)");
632
633 fhTrackMatchedDEtaDPhi = new TH2F
31ae6d59 634 ("hTrackMatchedDEtaDPhi",
09273901 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");
639
640 outputContainer->Add(fhTrackMatchedDEta) ;
641 outputContainer->Add(fhTrackMatchedDPhi) ;
642 outputContainer->Add(fhTrackMatchedDEtaDPhi) ;
31ae6d59 643
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);
648
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");
b5dbb99b 652 outputContainer->Add(fhEOverP);
653
654 if(fCalorimeter=="EMCAL")
655 {
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);
660 }
31ae6d59 661
662 if(IsDataMC())
663 {
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");
670
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");
679
680 outputContainer->Add(fhTrackMatchedMCParticle);
681 }
09273901 682 }
683
b5dbb99b 684 if(fFillWeightHistograms)
685 {
78a28af3 686
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);
692
693 fhECellClusterLogRatio = new TH2F ("hECellClusterLogRatio"," Log(cell energy / cluster energy) vs cluster energy, for selected decay photons from neutral meson",
1a72f6c5 694 nptbins,ptmin,ptmax, 100,-10,0);
78a28af3 695 fhECellClusterLogRatio->SetXTitle("E_{cluster} (GeV) ");
1a72f6c5 696 fhECellClusterLogRatio->SetYTitle("Log (E_{max cell}/E_{cluster})");
78a28af3 697 outputContainer->Add(fhECellClusterLogRatio);
698
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);
704
705 fhEMaxCellClusterLogRatio = new TH2F ("hEMaxCellClusterLogRatio"," Log(max cell energy / cluster energy) vs cluster energy, for selected decay photons from neutral meson",
1a72f6c5 706 nptbins,ptmin,ptmax, 100,-10,0);
78a28af3 707 fhEMaxCellClusterLogRatio->SetXTitle("E_{cluster} (GeV) ");
1a72f6c5 708 fhEMaxCellClusterLogRatio->SetYTitle("Log (E_{max cell}/E_{cluster})");
78a28af3 709 outputContainer->Add(fhEMaxCellClusterLogRatio);
710
b5dbb99b 711 for(Int_t iw = 0; iw < 14; iw++)
712 {
1a72f6c5 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),
78a28af3 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]);
718
1a72f6c5 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]);
78a28af3 724
725 }
726 }
727
b5dbb99b 728 if(IsDataMC())
729 {
477d6cee 730 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
b5dbb99b 731 GetReader()->GetDataType() != AliCaloTrackReader::kMC)
732 {
477d6cee 733
b9947879 734 fhPtMC = new TH1F("hPtMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax);
09273901 735 fhPtMC->SetYTitle("N");
9fb80477 736 fhPtMC->SetXTitle("p_{T} (GeV/c)");
09273901 737 outputContainer->Add(fhPtMC) ;
477d6cee 738
09273901 739 fhPhiMC = new TH2F
b9947879 740 ("hPhiMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
09273901 741 fhPhiMC->SetYTitle("#phi");
b9947879 742 fhPhiMC->SetXTitle("p_{T} (GeV/c)");
09273901 743 outputContainer->Add(fhPhiMC) ;
477d6cee 744
09273901 745 fhEtaMC = new TH2F
b9947879 746 ("hEtaMC","Identified #pi^{0} (#eta) from #pi^{0} (#eta)",nptbins,ptmin,ptmax,netabins,etamin,etamax);
09273901 747 fhEtaMC->SetYTitle("#eta");
b9947879 748 fhEtaMC->SetXTitle("p_{T} (GeV/c)");
09273901 749 outputContainer->Add(fhEtaMC) ;
477d6cee 750
b9947879 751 fhPtMCNo = new TH1F("hPtMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax);
09273901 752 fhPtMCNo->SetYTitle("N");
9fb80477 753 fhPtMCNo->SetXTitle("p_{T} (GeV/c)");
09273901 754 outputContainer->Add(fhPtMCNo) ;
477d6cee 755
09273901 756 fhPhiMCNo = new TH2F
b9947879 757 ("hPhiMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
09273901 758 fhPhiMCNo->SetYTitle("#phi");
b9947879 759 fhPhiMCNo->SetXTitle("p_{T} (GeV/c)");
09273901 760 outputContainer->Add(fhPhiMCNo) ;
477d6cee 761
09273901 762 fhEtaMCNo = new TH2F
b9947879 763 ("hEtaMCNo","Identified #pi^{0} (#eta) not from #pi^{0} (#eta)",nptbins,ptmin,ptmax,netabins,etamin,etamax);
09273901 764 fhEtaMCNo->SetYTitle("#eta");
b9947879 765 fhEtaMCNo->SetXTitle("p_{T} (GeV/c)");
09273901 766 outputContainer->Add(fhEtaMCNo) ;
477d6cee 767
b5dbb99b 768 fhAnglePairMCPi0 = new TH2F
769 ("AnglePairMCPi0",
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) ;
774
775 fhAnglePairMCEta = new TH2F
776 ("AnglePairMCEta",
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) ;
781
782 fhMassPairMCPi0 = new TH2F
783 ("MassPairMCPi0",
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) ;
788
789 fhMassPairMCEta = new TH2F
790 ("MassPairMCEta",
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) ;
795
c4a7d28a 796 if(fAnaType == kIMCalo){
6db946bd 797 TString ptype[] ={"#gamma","#gamma->e^{#pm}","#pi^{0}","#eta","e^{#pm}", "hadron"};
b9947879 798 TString pname[] ={"Photon","Conversion", "Pi0", "Eta", "Electron","Hadron"};
6db946bd 799 for(Int_t i = 0; i < 6; i++){
521636d2 800
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]) ;
807
3bfcb597 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]) ;
815 }
816
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]) ;
823
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]) ;
830
521636d2 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]) ;
7c65ad18 837
521636d2 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]) ;
7c65ad18 844
521636d2 845 }//
c4a7d28a 846
847 }//kIMCalo
521636d2 848 } //Not MC reader
477d6cee 849 }//Histos with MC
850
851
852 //Keep neutral meson selection histograms if requiered
853 //Setting done in AliNeutralMesonSelection
854
855 if(fAnaType!=kSSCalo && GetNeutralMesonSelection()){
856
857 TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ;
858 if(GetNeutralMesonSelection()->AreNeutralMesonSelectionHistosKept())
859 for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ;
5ae09196 860 delete nmsHistos;
a14fd526 861
477d6cee 862 }
863
477d6cee 864 return outputContainer ;
865
866}
867
521636d2 868//____________________________________________________________________________
869void AliAnaPi0EbE::Init()
870{
871 //Init
872 //Do some checks
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");
875 abort();
876 }
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");
879 abort();
880 }
881
882}
883
884//____________________________________________________________________________
885void AliAnaPi0EbE::InitParameters()
886{
887 //Initialize the parameters of the analysis.
888 AddToHistogramsName("AnaPi0EbE_");
889
1db06135 890 fInputAODGammaConvName = "PhotonsCTS" ;
521636d2 891 fAnaType = kIMCalo ;
892 fCalorimeter = "EMCAL" ;
893 fMinDist = 2.;
894 fMinDist2 = 4.;
895 fMinDist3 = 5.;
896
897}
898
477d6cee 899//__________________________________________________________________
900void AliAnaPi0EbE::MakeAnalysisFillAOD()
901{
902 //Do analysis and fill aods
903
904 switch(fAnaType)
521636d2 905 {
477d6cee 906 case kIMCalo:
907 MakeInvMassInCalorimeter();
908 break;
909
910 case kSSCalo:
911 MakeShowerShapeIdentification();
912 break;
913
914 case kIMCaloTracks:
915 MakeInvMassInCalorimeterAndCTS();
916 break;
917
521636d2 918 }
477d6cee 919}
920
42d47cb7 921//____________________________________________
477d6cee 922void AliAnaPi0EbE::MakeInvMassInCalorimeter()
923{
57b97dc6 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.
477d6cee 928
929 TLorentzVector mom1;
930 TLorentzVector mom2;
931 TLorentzVector mom ;
b5dbb99b 932
933 Int_t tag = 0;
934 Int_t label = 0;
477d6cee 935
936 if(!GetInputAODBranch()){
a3aebfff 937 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - No input calo photons in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
477d6cee 938 abort();
939 }
f8006433 940
42d47cb7 941 //Get shower shape information of clusters
942 TObjArray *clusters = 0;
943 if (fCalorimeter=="EMCAL") clusters = GetEMCALClusters();
944 else if(fCalorimeter=="PHOS") clusters = GetPHOSClusters() ;
945
c4a7d28a 946 for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast()-1; iphoton++){
477d6cee 947 AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
c8fe2783 948
c4a7d28a 949 //Vertex cut in case of mixed events
c8fe2783 950 Int_t evtIndex1 = 0 ;
951 if(GetMixedEvent())
952 evtIndex1 = GetMixedEvent()->EventIndexForCaloCluster(photon1->GetCaloLabel(0)) ;
5025c139 953 if(TMath::Abs(GetVertex(evtIndex1)[2]) > GetZvertexCut()) continue ; //vertex cut
477d6cee 954 mom1 = *(photon1->Momentum());
955
42d47cb7 956 //Get original cluster, to recover some information
1db06135 957 Int_t iclus = -1;
958 AliVCluster *cluster1 = FindCluster(clusters,photon1->GetCaloLabel(0),iclus);
42d47cb7 959
1db06135 960 if(!cluster1){
42d47cb7 961 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - First cluster not found\n");
962 return;
9ab9e937 963 }
c4a7d28a 964
b5dbb99b 965 for(Int_t jphoton = iphoton+1; jphoton < GetInputAODBranch()->GetEntriesFast(); jphoton++)
966 {
a3aebfff 967 AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(jphoton));
b5dbb99b 968
c8fe2783 969 Int_t evtIndex2 = 0 ;
970 if(GetMixedEvent())
971 evtIndex2 = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ;
b5dbb99b 972
c8fe2783 973 if(GetMixedEvent() && (evtIndex1 == evtIndex2))
974 continue ;
b5dbb99b 975
5025c139 976 if(TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut()) continue ; //vertex cut
b5dbb99b 977
477d6cee 978 mom2 = *(photon2->Momentum());
c4a7d28a 979
1db06135 980 //Get original cluster, to recover some information
981 Int_t iclus2;
982 AliVCluster *cluster2 = FindCluster(clusters,photon2->GetCaloLabel(0),iclus2,iclus+1);
42d47cb7 983
b5dbb99b 984 if(!cluster2)
985 {
42d47cb7 986 printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - Second cluster not found\n");
1db06135 987 return;
9ab9e937 988 }
c4a7d28a 989
42d47cb7 990 Float_t e1 = photon1->E();
991 Float_t e2 = photon2->E();
992
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;
999
b5dbb99b 1000 //Play with the MC stack if available
1001 if(IsDataMC()) HasPairSameMCMother(photon1, photon2, label, tag) ;
1002
57b97dc6 1003 //Select good pair (good phi, pt cuts, aperture and invariant mass)
3bfcb597 1004 if(GetNeutralMesonSelection()->SelectPair(mom1, mom2,fCalorimeter))
c8fe2783 1005 {
1006 if(GetDebug()>1)
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());
42d47cb7 1008
57b97dc6 1009 //Fill some histograms about shower shape
9ab9e937 1010 if(clusters && GetReader()->GetDataType()!=AliCaloTrackReader::kMC){
b5dbb99b 1011 FillSelectedClusterHistograms(cluster1, photon1->GetTag());
1012 FillSelectedClusterHistograms(cluster2, photon2->GetTag());
42d47cb7 1013 }
521636d2 1014
803d06a8 1015 // Tag both photons as decay
1016 photon1->SetTagged(kTRUE);
1017 photon2->SetTagged(kTRUE);
09273901 1018
1019 fhPtDecay->Fill(photon1->Pt());
1020 fhEDecay ->Fill(photon1->E() );
1021
1022 fhPtDecay->Fill(photon2->Pt());
1023 fhEDecay ->Fill(photon2->E() );
803d06a8 1024
57b97dc6 1025 //Create AOD for analysis
c8fe2783 1026 mom = mom1+mom2;
b5dbb99b 1027
c8fe2783 1028 AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
b5dbb99b 1029
21a4b1c0 1030 pi0.SetIdentifiedParticleType(AliCaloPID::kPi0);
c8fe2783 1031 pi0.SetDetector(photon1->GetDetector());
b5dbb99b 1032
1033 // MC
1034 pi0.SetLabel(label);
c8fe2783 1035 pi0.SetTag(tag);
b5dbb99b 1036
57b97dc6 1037 //Set the indeces of the original caloclusters
c8fe2783 1038 pi0.SetCaloLabel(photon1->GetCaloLabel(0), photon2->GetCaloLabel(0));
f8006433 1039 //pi0.SetInputFileIndex(input);
b5dbb99b 1040
c8fe2783 1041 AddAODParticle(pi0);
b5dbb99b 1042
c8fe2783 1043 }//pi0
57b97dc6 1044
477d6cee 1045 }//2n photon loop
1046
1047 }//1st photon loop
1048
a3aebfff 1049 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeter() - End fill AODs \n");
477d6cee 1050
1051}
1052
e7fd282f 1053//__________________________________________________
477d6cee 1054void AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
1055{
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.
1060
1061 TLorentzVector mom1;
1062 TLorentzVector mom2;
1063 TLorentzVector mom ;
b5dbb99b 1064 Int_t tag = 0;
1065 Int_t label = 0;
5025c139 1066 Int_t evtIndex = 0;
1db06135 1067
1068 // Check calorimeter input
477d6cee 1069 if(!GetInputAODBranch()){
a3aebfff 1070 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input calo photons in AOD branch with name < %s > , STOP\n",GetInputAODName().Data());
477d6cee 1071 abort();
1072 }
57b97dc6 1073
1db06135 1074 // Get the array with conversion photons
1075 TClonesArray * inputAODGammaConv = (TClonesArray *) GetReader()->GetOutputEvent()->FindListObject(fInputAODGammaConvName);
1076 if(!inputAODGammaConv) {
1077
1078 inputAODGammaConv = (TClonesArray *) GetReader()->GetInputEvent()->FindListObject(fInputAODGammaConvName);
1079
1080 if(!inputAODGammaConv) {
1081 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - No input gamma conversions in AOD branch with name < %s >\n",fInputAODGammaConvName.Data());
1082
1083 return;
1084 }
1085 }
1086
1087 //Get shower shape information of clusters
1088 TObjArray *clusters = 0;
1089 if (fCalorimeter=="EMCAL") clusters = GetEMCALClusters();
1090 else if(fCalorimeter=="PHOS") clusters = GetPHOSClusters() ;
1091
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);
1096 return;
1097 }
1098
1099 if(GetDebug() > 1)
1100 printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - Number of conversion photons %d\n",nCTS);
1101
1102 // Do the loop, first calo, second CTS
477d6cee 1103 for(Int_t iphoton = 0; iphoton < GetInputAODBranch()->GetEntriesFast(); iphoton++){
1104 AliAODPWG4Particle * photon1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));
1105 mom1 = *(photon1->Momentum());
1106
1db06135 1107 //Get original cluster, to recover some information
1108 Int_t iclus = -1;
1109 AliVCluster *cluster = FindCluster(clusters,photon1->GetCaloLabel(0),iclus);
1110
1111 for(Int_t jphoton = 0; jphoton < nCTS; jphoton++){
1112 AliAODPWG4Particle * photon2 = (AliAODPWG4Particle*) (inputAODGammaConv->At(jphoton));
5025c139 1113 if(GetMixedEvent())
1114 evtIndex = GetMixedEvent()->EventIndexForCaloCluster(photon2->GetCaloLabel(0)) ;
1115 if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ; //vertex cut
1116
477d6cee 1117 mom2 = *(photon2->Momentum());
57b97dc6 1118
b5dbb99b 1119 //Play with the MC stack if available
1120 if(IsDataMC())
1121 {
1122 Int_t label2 = photon2->GetLabel();
1123 if(label2 >= 0 )photon2->SetTag(GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), photon2->GetInputFileIndex()));
1124
1125 HasPairSameMCMother(photon1, photon2, label, tag) ;
1126 }
1127
477d6cee 1128 //Select good pair (good phi, pt cuts, aperture and invariant mass)
b5dbb99b 1129 if(GetNeutralMesonSelection()->SelectPair(mom1, mom2,fCalorimeter))
1130 {
57b97dc6 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());
1132
1db06135 1133 //Fill some histograms about shower shape
b5dbb99b 1134 if(cluster && GetReader()->GetDataType()!=AliCaloTrackReader::kMC)
1135 {
1136 FillSelectedClusterHistograms(cluster, photon1->GetTag());
1db06135 1137 }
803d06a8 1138
1139 // Tag both photons as decay
1140 photon1->SetTagged(kTRUE);
1141 photon2->SetTagged(kTRUE);
1db06135 1142
09273901 1143 fhPtDecay->Fill(photon1->Pt());
1144 fhEDecay ->Fill(photon1->E() );
1145
1146 //fhPtDecay->Fill(photon2->Pt());
1147 //fhEDecay ->Fill(photon2->E() );
1148
57b97dc6 1149 //Create AOD for analysis
b5dbb99b 1150
57b97dc6 1151 mom = mom1+mom2;
b5dbb99b 1152
57b97dc6 1153 AliAODPWG4Particle pi0 = AliAODPWG4Particle(mom);
b5dbb99b 1154
21a4b1c0 1155 pi0.SetIdentifiedParticleType(AliCaloPID::kPi0);
57b97dc6 1156 pi0.SetDetector(photon1->GetDetector());
b5dbb99b 1157
1158 // MC
1159 pi0.SetLabel(label);
57b97dc6 1160 pi0.SetTag(tag);
b5dbb99b 1161
57b97dc6 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));
f8006433 1165 //pi0.SetInputFileIndex(input);
b5dbb99b 1166
57b97dc6 1167 AddAODParticle(pi0);
b5dbb99b 1168
477d6cee 1169 }//pi0
1170 }//2n photon loop
1171
1172 }//1st photon loop
1173
a3aebfff 1174 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS() - End fill AODs \n");
477d6cee 1175
1176}
1177
1178
e7fd282f 1179//_________________________________________________
477d6cee 1180void AliAnaPi0EbE::MakeShowerShapeIdentification()
1181{
1182 //Search for pi0 in fCalorimeter with shower shape analysis
1183
4a745797 1184 TObjArray * pl = 0x0;
5ae09196 1185 //Select the Calorimeter of the photon
b5dbb99b 1186 if (fCalorimeter == "PHOS" )
be518ab0 1187 pl = GetPHOSClusters();
5ae09196 1188 else if (fCalorimeter == "EMCAL")
be518ab0 1189 pl = GetEMCALClusters();
57b97dc6 1190
5ae09196 1191 if(!pl) {
1192 Info("MakeShowerShapeIdentification","TObjArray with %s clusters is NULL!\n",fCalorimeter.Data());
1193 return;
1194 }
233e0df8 1195
477d6cee 1196 TLorentzVector mom ;
b5dbb99b 1197 for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++)
1198 {
0ae57829 1199 AliVCluster * calo = (AliVCluster*) (pl->At(icalo));
477d6cee 1200
f8006433 1201 Int_t evtIndex = 0 ;
b5dbb99b 1202 if (GetMixedEvent())
1203 {
f8006433 1204 evtIndex=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
1205 }
5025c139 1206 if(TMath::Abs(GetVertex(evtIndex)[2]) > GetZvertexCut()) continue ; //vertex cut
521636d2 1207
57b97dc6 1208 //Get Momentum vector,
f8006433 1209 if(GetReader()->GetDataType() != AliCaloTrackReader::kMC){
1210 calo->GetMomentum(mom,GetVertex(evtIndex)) ;}//Assume that come from vertex in straight line
1211 else{
1212 Double_t vertex[]={0,0,0};
1213 calo->GetMomentum(mom,vertex) ;
1214 }
233e0df8 1215
57b97dc6 1216 //If too small or big pt, skip it
477d6cee 1217 if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ;
1218 //Check acceptance selection
b5dbb99b 1219 if(IsFiducialCutOn())
1220 {
ff45398a 1221 Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
477d6cee 1222 if(! in ) continue ;
1223 }
1224
1225 //Create AOD for analysis
1226 AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);
c8fe2783 1227 aodpi0.SetLabel(calo->GetLabel());
477d6cee 1228 //Set the indeces of the original caloclusters
1229 aodpi0.SetCaloLabel(calo->GetID(),-1);
1230 aodpi0.SetDetector(fCalorimeter);
1231 if(GetDebug() > 1)
ff45398a 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());
477d6cee 1233
1234 //Check Distance to Bad channel, set bit.
c8fe2783 1235 Double_t distBad=calo->GetDistanceToBadChannel() ; //Distance to bad channel
477d6cee 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)
1238 continue ;
1239
a3aebfff 1240 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - FillAOD: Bad channel cut passed %4.2f\n",distBad);
477d6cee 1241
1242 if(distBad > fMinDist3) aodpi0.SetDistToBad(2) ;
1243 else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ;
1244 else aodpi0.SetDistToBad(0) ;
1245
1246 //Check PID
1247 //PID selection or bit setting
49b5c49b 1248 if(IsCaloPIDOn()){
477d6cee 1249 //Skip matched clusters with tracks
49b5c49b 1250 if(IsTrackMatched(calo, GetReader()->GetInputEvent())) continue ;
477d6cee 1251
49b5c49b 1252 // Get most probable PID, 2 options check bayesian PID weights or redo PID
1253 // By default, redo PID
1254
1255 aodpi0.SetIdentifiedParticleType(GetCaloPID()->GetIdentifiedParticleType(fCalorimeter,mom,calo));//PID recalculated
477d6cee 1256
21a4b1c0 1257 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PDG of identified particle %d\n",aodpi0.GetIdentifiedParticleType());
477d6cee 1258
1259 //If cluster does not pass pid, not pi0, skip it.
21a4b1c0 1260 if(aodpi0.GetIdentifiedParticleType() != AliCaloPID::kPi0) continue ;
477d6cee 1261
1262 }
b5dbb99b 1263 else
1264 {
49b5c49b 1265 //Set PID bits for later selection
477d6cee 1266 //GetPDG already called in SetPIDBits.
49b5c49b 1267 GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodpi0, GetCaloUtils(), GetReader()->GetInputEvent());
a3aebfff 1268 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - PID Bits set \n");
477d6cee 1269 }
1270
21a4b1c0 1271 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Pi0 selection cuts passed: pT %3.2f, pdg %d\n",aodpi0.Pt(), aodpi0.GetIdentifiedParticleType());
477d6cee 1272
1273 //Play with the MC stack if available
1274 //Check origin of the candidates
1275 if(IsDataMC()){
1276 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
57b97dc6 1277 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
f8006433 1278 //aodpi0.SetInputFileIndex(input);
57b97dc6 1279 Int_t tag =0;
1280 tag = GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(),GetReader(), aodpi0.GetInputFileIndex());
1281 //GetMCAnalysisUtils()->CheckMultipleOrigin(calo->GetLabels(),calo->GetNLabels(), GetReader(), aodpi0.GetInputFileIndex(), tag);
1282 aodpi0.SetTag(tag);
1283 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Origin of candidate %d\n",aodpi0.GetTag());
477d6cee 1284 }
1285 }//Work with stack also
1286
1287 //Add AOD with pi0 object to aod branch
1288 AddAODParticle(aodpi0);
1289
1290 }//loop
1291
a3aebfff 1292 if(GetDebug() > 1) printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - End fill AODs \n");
477d6cee 1293
1294}
e7fd282f 1295//______________________________________________
477d6cee 1296void AliAnaPi0EbE::MakeAnalysisFillHistograms()
691bdd02 1297{
477d6cee 1298 //Do analysis and fill histograms
691bdd02 1299
b5dbb99b 1300 if(!GetOutputAODBranch())
1301 {
a3aebfff 1302 printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - No output pi0 in AOD branch with name < %s >,STOP \n",GetOutputAODName().Data());
477d6cee 1303 abort();
1304 }
1305 //Loop on stored AOD pi0
1306 Int_t naod = GetOutputAODBranch()->GetEntriesFast();
a3aebfff 1307 if(GetDebug() > 0) printf("AliAnaPi0EbE::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
477d6cee 1308
b5dbb99b 1309 for(Int_t iaod = 0; iaod < naod ; iaod++)
1310 {
477d6cee 1311
1312 AliAODPWG4Particle* pi0 = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
21a4b1c0 1313 Int_t pdg = pi0->GetIdentifiedParticleType();
9415d854 1314
1315 if(IsCaloPIDOn() && pdg != AliCaloPID::kPi0) continue;
477d6cee 1316
1317 //Fill pi0 histograms
c4a7d28a 1318 Float_t ener = pi0->E();
1319 Float_t pt = pi0->Pt();
1320 Float_t phi = pi0->Phi();
57b97dc6 1321 if(phi < 0) phi+=TMath::TwoPi();
477d6cee 1322 Float_t eta = pi0->Eta();
1323
09273901 1324 fhPt ->Fill(pt);
1325 fhE ->Fill(ener);
477d6cee 1326
09273901 1327 fhEEta ->Fill(ener,eta);
1328 fhEPhi ->Fill(ener,phi);
1329 fhEtaPhi ->Fill(eta,phi);
7a972c0c 1330
b5dbb99b 1331 if(IsDataMC())
1332 {
477d6cee 1333 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) ||
57b97dc6 1334 GetReader()->GetDataType() != AliCaloTrackReader::kMC){
b5dbb99b 1335 if(GetMCAnalysisUtils()->CheckTagBit(pi0->GetTag(), AliMCAnalysisUtils::kMCPi0))
1336 {
09273901 1337 fhPtMC ->Fill(pt);
1338 fhPhiMC ->Fill(pt,phi);
1339 fhEtaMC ->Fill(pt,eta);
57b97dc6 1340 }
b5dbb99b 1341 else
1342 {
09273901 1343 fhPtMCNo ->Fill(pt);
1344 fhPhiMCNo ->Fill(pt,phi);
1345 fhEtaMCNo ->Fill(pt,eta);
57b97dc6 1346 }
477d6cee 1347 }
1348 }//Histograms with MC
1349
1350 }// aod loop
1351
1352}
1353
477d6cee 1354//__________________________________________________________________
1355void AliAnaPi0EbE::Print(const Option_t * opt) const
1356{
1357 //Print some relevant parameters set for the analysis
1358 if(! opt)
1359 return;
1360
1361 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
745913ae 1362 AliAnaCaloTrackCorrBaseClass::Print("");
477d6cee 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);
1369 }
1370 printf(" \n") ;
1371
1372}
78a28af3 1373
1374//___________________________________________________________________________________
1375void AliAnaPi0EbE::RecalibrateCellAmplitude(Float_t & amp, const Int_t id)
1376{
1377 //Recaculate cell energy if recalibration factor
1378
1379 Int_t icol = -1; Int_t irow = -1; Int_t iRCU = -1;
1380 Int_t nModule = GetModuleNumberCellIndexes(id,fCalorimeter, icol, irow, iRCU);
1381
b5dbb99b 1382 if (GetCaloUtils()->IsRecalibrationOn())
1383 {
1384 if(fCalorimeter == "PHOS")
1385 {
78a28af3 1386 amp *= GetCaloUtils()->GetPHOSChannelRecalibrationFactor(nModule,icol,irow);
1387 }
b5dbb99b 1388 else
1389 {
78a28af3 1390 amp *= GetCaloUtils()->GetEMCALChannelRecalibrationFactor(nModule,icol,irow);
1391 }
1392 }
1393}
1394
78a28af3 1395