1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 /* $Id: AliAnaPhoton.cxx 28688 2008-09-11 15:04:07Z gconesab $ */
17 //_________________________________________________________________________
19 // Class for the photon identification.
20 // Clusters from calorimeters are identified as photons
21 // and kept in the AOD. Few histograms produced.
23 // -- Author: Gustavo Conesa (LNF-INFN)
24 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
29 #include <TClonesArray.h>
30 #include <TObjString.h>
31 //#include <Riostream.h>
32 #include "TParticle.h"
34 // --- Analysis system ---
35 #include "AliAnaPhoton.h"
36 #include "AliCaloTrackReader.h"
38 #include "AliCaloPID.h"
39 #include "AliMCAnalysisUtils.h"
40 #include "AliFidutialCut.h"
41 #include "AliAODCaloCluster.h"
43 ClassImp(AliAnaPhoton)
45 //____________________________________________________________________________
46 AliAnaPhoton::AliAnaPhoton() :
47 AliAnaPartCorrBaseClass(), fCalorimeter(""),
48 fMinDist(0.),fMinDist2(0.),fMinDist3(0.),fRejectTrackMatch(0),
49 fhPtPhoton(0),fhPhiPhoton(0),fhEtaPhoton(0),
51 fhDeltaE(0), fhDeltaPt(0),fhRatioE(0), fhRatioPt(0),fh2E(0),fh2Pt(0),
52 fhPtPrompt(0),fhPhiPrompt(0),fhEtaPrompt(0),
53 fhPtFragmentation(0),fhPhiFragmentation(0),fhEtaFragmentation(0),
54 fhPtISR(0),fhPhiISR(0),fhEtaISR(0),
55 fhPtPi0Decay(0),fhPhiPi0Decay(0),fhEtaPi0Decay(0),
56 fhPtOtherDecay(0),fhPhiOtherDecay(0),fhEtaOtherDecay(0),
57 fhPtConversion(0),fhPhiConversion(0),fhEtaConversion(0),
58 fhPtUnknown(0),fhPhiUnknown(0),fhEtaUnknown(0)
62 //Initialize parameters
67 //____________________________________________________________________________
68 AliAnaPhoton::AliAnaPhoton(const AliAnaPhoton & g) :
69 AliAnaPartCorrBaseClass(g), fCalorimeter(g.fCalorimeter),
70 fMinDist(g.fMinDist),fMinDist2(g.fMinDist2), fMinDist3(g.fMinDist3),
71 fRejectTrackMatch(g.fRejectTrackMatch),
72 fhPtPhoton(g.fhPtPhoton),fhPhiPhoton(g.fhPhiPhoton),fhEtaPhoton(g.fhEtaPhoton),
74 fhDeltaE(g.fhDeltaE), fhDeltaPt(g.fhDeltaPt),
75 fhRatioE(g.fhRatioE), fhRatioPt(g.fhRatioPt),
76 fh2E(g.fh2E), fh2Pt(g.fh2Pt),
77 fhPtPrompt(g.fhPtPrompt),fhPhiPrompt(g.fhPhiPrompt),fhEtaPrompt(g.fhEtaPrompt),
78 fhPtFragmentation(g.fhPtFragmentation),fhPhiFragmentation(g.fhPhiFragmentation),fhEtaFragmentation(g.fhEtaFragmentation),
79 fhPtISR(g.fhPtISR),fhPhiISR(g.fhPhiISR),fhEtaISR(g.fhEtaISR),
80 fhPtPi0Decay(g.fhPtPi0Decay),fhPhiPi0Decay(g.fhPhiPi0Decay),fhEtaPi0Decay(g.fhEtaPi0Decay),
81 fhPtOtherDecay(g.fhPtOtherDecay),fhPhiOtherDecay(g.fhPhiOtherDecay),fhEtaOtherDecay(g.fhEtaOtherDecay),
82 fhPtConversion(g. fhPtConversion),fhPhiConversion(g.fhPhiConversion),fhEtaConversion(g.fhEtaConversion),
83 fhPtUnknown(g.fhPtUnknown),fhPhiUnknown(g.fhPhiUnknown),fhEtaUnknown(g.fhEtaUnknown)
90 //_________________________________________________________________________
91 AliAnaPhoton & AliAnaPhoton::operator = (const AliAnaPhoton & g)
93 // assignment operator
95 if(&g == this) return *this;
97 fCalorimeter = g.fCalorimeter ;
98 fMinDist = g.fMinDist;
99 fMinDist2 = g.fMinDist2;
100 fMinDist3 = g.fMinDist3;
101 fRejectTrackMatch = g.fRejectTrackMatch;
103 fhPtPhoton = g.fhPtPhoton ;
104 fhPhiPhoton = g.fhPhiPhoton ;
105 fhEtaPhoton = g.fhEtaPhoton ;
107 fhDeltaE = g.fhDeltaE;
108 fhDeltaPt = g.fhDeltaPt;
109 fhRatioE = g.fhRatioE;
110 fhRatioPt = g.fhRatioPt;
114 fhPtPrompt = g.fhPtPrompt;
115 fhPhiPrompt = g.fhPhiPrompt;
116 fhEtaPrompt = g.fhEtaPrompt;
117 fhPtFragmentation = g.fhPtFragmentation;
118 fhPhiFragmentation = g.fhPhiFragmentation;
119 fhEtaFragmentation = g.fhEtaFragmentation;
121 fhPhiISR = g.fhPhiISR;
122 fhEtaISR = g.fhEtaISR;
123 fhPtPi0Decay = g.fhPtPi0Decay;
124 fhPhiPi0Decay = g.fhPhiPi0Decay;
125 fhEtaPi0Decay = g.fhEtaPi0Decay;
126 fhPtOtherDecay = g.fhPtOtherDecay;
127 fhPhiOtherDecay = g.fhPhiOtherDecay;
128 fhEtaOtherDecay = g.fhEtaOtherDecay;
129 fhPtConversion = g. fhPtConversion;
130 fhPhiConversion = g.fhPhiConversion;
131 fhEtaConversion = g.fhEtaConversion;
132 fhPtUnknown = g.fhPtUnknown;
133 fhPhiUnknown = g.fhPhiUnknown;
134 fhEtaUnknown = g.fhEtaUnknown;
140 //____________________________________________________________________________
141 AliAnaPhoton::~AliAnaPhoton()
148 //________________________________________________________________________
149 TList * AliAnaPhoton::GetCreateOutputObjects()
151 // Create histograms to be saved in output file and
152 // store them in outputContainer
153 TList * outputContainer = new TList() ;
154 outputContainer->SetName("PhotonHistos") ;
156 Int_t nptbins = GetHistoNPtBins();
157 Int_t nphibins = GetHistoNPhiBins();
158 Int_t netabins = GetHistoNEtaBins();
159 Float_t ptmax = GetHistoPtMax();
160 Float_t phimax = GetHistoPhiMax();
161 Float_t etamax = GetHistoEtaMax();
162 Float_t ptmin = GetHistoPtMin();
163 Float_t phimin = GetHistoPhiMin();
164 Float_t etamin = GetHistoEtaMin();
166 //Histograms of highest Photon identified in Event
167 fhPtPhoton = new TH1F("hPtPhoton","Number of #gamma over calorimeter",nptbins,ptmin,ptmax);
168 fhPtPhoton->SetYTitle("N");
169 fhPtPhoton->SetXTitle("p_{T #gamma}(GeV/c)");
170 outputContainer->Add(fhPtPhoton) ;
172 fhPhiPhoton = new TH2F
173 ("hPhiPhoton","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
174 fhPhiPhoton->SetYTitle("#phi");
175 fhPhiPhoton->SetXTitle("p_{T #gamma} (GeV/c)");
176 outputContainer->Add(fhPhiPhoton) ;
178 fhEtaPhoton = new TH2F
179 ("hEtaPhoton","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax);
180 fhEtaPhoton->SetYTitle("#eta");
181 fhEtaPhoton->SetXTitle("p_{T #gamma} (GeV/c)");
182 outputContainer->Add(fhEtaPhoton) ;
185 fhDeltaE = new TH1F ("hDeltaE","MC - Reco E ", 200,-50,50);
186 fhDeltaE->SetXTitle("#Delta E (GeV)");
187 outputContainer->Add(fhDeltaE);
189 fhDeltaPt = new TH1F ("hDeltaPt","MC - Reco p_{T} ", 200,-50,50);
190 fhDeltaPt->SetXTitle("#Delta p_{T} (GeV/c)");
191 outputContainer->Add(fhDeltaPt);
193 fhRatioE = new TH1F ("hRatioE","Reco/MC E ", 200,0,2);
194 fhRatioE->SetXTitle("E_{reco}/E_{gen}");
195 outputContainer->Add(fhRatioE);
197 fhRatioPt = new TH1F ("hRatioPt","Reco/MC p_{T} ", 200,0,2);
198 fhRatioPt->SetXTitle("p_{T, reco}/p_{T, gen}");
199 outputContainer->Add(fhRatioPt);
201 fh2E = new TH2F ("h2E","E distribution, reconstructed vs generated", nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
202 fh2E->SetYTitle("E_{rec} (GeV)");
203 fh2E->SetXTitle("E_{gen} (GeV)");
204 outputContainer->Add(fh2E);
206 fh2Pt = new TH2F ("h2Pt","p_T distribution, reconstructed vs generated", nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
207 fh2Pt->SetYTitle("p_{T,rec} (GeV/c)");
208 fh2Pt->SetXTitle("p_{T,gen} (GeV/c)");
209 outputContainer->Add(fh2Pt);
211 fhPtPrompt = new TH1F("hPtMCPrompt","Number of #gamma over calorimeter",nptbins,ptmin,ptmax);
212 fhPtPrompt->SetYTitle("N");
213 fhPtPrompt->SetXTitle("p_{T #gamma}(GeV/c)");
214 outputContainer->Add(fhPtPrompt) ;
216 fhPhiPrompt = new TH2F
217 ("hPhiMCPrompt","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
218 fhPhiPrompt->SetYTitle("#phi");
219 fhPhiPrompt->SetXTitle("p_{T #gamma} (GeV/c)");
220 outputContainer->Add(fhPhiPrompt) ;
222 fhEtaPrompt = new TH2F
223 ("hEtaMCPrompt","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax);
224 fhEtaPrompt->SetYTitle("#eta");
225 fhEtaPrompt->SetXTitle("p_{T #gamma} (GeV/c)");
226 outputContainer->Add(fhEtaPrompt) ;
228 fhPtFragmentation = new TH1F("hPtMCFragmentation","Number of #gamma over calorimeter",nptbins,ptmin,ptmax);
229 fhPtFragmentation->SetYTitle("N");
230 fhPtFragmentation->SetXTitle("p_{T #gamma}(GeV/c)");
231 outputContainer->Add(fhPtFragmentation) ;
233 fhPhiFragmentation = new TH2F
234 ("hPhiMCFragmentation","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
235 fhPhiFragmentation->SetYTitle("#phi");
236 fhPhiFragmentation->SetXTitle("p_{T #gamma} (GeV/c)");
237 outputContainer->Add(fhPhiFragmentation) ;
239 fhEtaFragmentation = new TH2F
240 ("hEtaMCFragmentation","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax);
241 fhEtaFragmentation->SetYTitle("#eta");
242 fhEtaFragmentation->SetXTitle("p_{T #gamma} (GeV/c)");
243 outputContainer->Add(fhEtaFragmentation) ;
245 fhPtISR = new TH1F("hPtMCISR","Number of initial state radiation #gamma over calorimeter",nptbins,ptmin,ptmax);
246 fhPtISR->SetYTitle("N");
247 fhPtISR->SetXTitle("p_{T #gamma}(GeV/c)");
248 outputContainer->Add(fhPtISR) ;
251 ("hPhiMCISR","#phi_{#gamma} initial state radiation",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
252 fhPhiISR->SetYTitle("#phi");
253 fhPhiISR->SetXTitle("p_{T #gamma} (GeV/c)");
254 outputContainer->Add(fhPhiISR) ;
257 ("hEtaMCISR","#phi_{#gamma} initial state radiation",nptbins,ptmin,ptmax,netabins,etamin,etamax);
258 fhEtaISR->SetYTitle("#eta");
259 fhEtaISR->SetXTitle("p_{T #gamma} (GeV/c)");
260 outputContainer->Add(fhEtaISR) ;
262 fhPtPi0Decay = new TH1F("hPtPi0Decay","Number of #gamma over calorimeter",nptbins,ptmin,ptmax);
263 fhPtPi0Decay->SetYTitle("N");
264 fhPtPi0Decay->SetXTitle("p_{T #gamma}(GeV/c)");
265 outputContainer->Add(fhPtPi0Decay) ;
267 fhPhiPi0Decay = new TH2F
268 ("hPhiMCPi0Decay","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
269 fhPhiPi0Decay->SetYTitle("#phi");
270 fhPhiPi0Decay->SetXTitle("p_{T #gamma} (GeV/c)");
271 outputContainer->Add(fhPhiPi0Decay) ;
273 fhEtaPi0Decay = new TH2F
274 ("hEtaMCPi0Decay","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax);
275 fhEtaPi0Decay->SetYTitle("#eta");
276 fhEtaPi0Decay->SetXTitle("p_{T #gamma} (GeV/c)");
277 outputContainer->Add(fhEtaPi0Decay) ;
279 fhPtOtherDecay = new TH1F("hPtMCOtherDecay","Number of #gamma over calorimeter",nptbins,ptmin,ptmax);
280 fhPtOtherDecay->SetYTitle("N");
281 fhPtOtherDecay->SetXTitle("p_{T #gamma}(GeV/c)");
282 outputContainer->Add(fhPtOtherDecay) ;
284 fhPhiOtherDecay = new TH2F
285 ("hPhiMCOtherDecay","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
286 fhPhiOtherDecay->SetYTitle("#phi");
287 fhPhiOtherDecay->SetXTitle("p_{T #gamma} (GeV/c)");
288 outputContainer->Add(fhPhiOtherDecay) ;
290 fhEtaOtherDecay = new TH2F
291 ("hEtaMCOtherDecay","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax);
292 fhEtaOtherDecay->SetYTitle("#eta");
293 fhEtaOtherDecay->SetXTitle("p_{T #gamma} (GeV/c)");
294 outputContainer->Add(fhEtaOtherDecay) ;
296 fhPtConversion = new TH1F("hPtMCConversion","Number of #gamma over calorimeter",nptbins,ptmin,ptmax);
297 fhPtConversion->SetYTitle("N");
298 fhPtConversion->SetXTitle("p_{T #gamma}(GeV/c)");
299 outputContainer->Add(fhPtConversion) ;
301 fhPhiConversion = new TH2F
302 ("hPhiMCConversion","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
303 fhPhiConversion->SetYTitle("#phi");
304 fhPhiConversion->SetXTitle("p_{T #gamma} (GeV/c)");
305 outputContainer->Add(fhPhiConversion) ;
307 fhEtaConversion = new TH2F
308 ("hEtaMCConversion","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax);
309 fhEtaConversion->SetYTitle("#eta");
310 fhEtaConversion->SetXTitle("p_{T #gamma} (GeV/c)");
311 outputContainer->Add(fhEtaConversion) ;
313 fhPtUnknown = new TH1F("hPtMCUnknown","Number of #gamma over calorimeter",nptbins,ptmin,ptmax);
314 fhPtUnknown->SetYTitle("N");
315 fhPtUnknown->SetXTitle("p_{T #gamma}(GeV/c)");
316 outputContainer->Add(fhPtUnknown) ;
318 fhPhiUnknown = new TH2F
319 ("hPhiMCUnknown","#phi_{#gamma}",nptbins,ptmin,ptmax,nphibins,phimin,phimax);
320 fhPhiUnknown->SetYTitle("#phi");
321 fhPhiUnknown->SetXTitle("p_{T #gamma} (GeV/c)");
322 outputContainer->Add(fhPhiUnknown) ;
324 fhEtaUnknown = new TH2F
325 ("hEtaMCUnknown","#phi_{#gamma}",nptbins,ptmin,ptmax,netabins,etamin,etamax);
326 fhEtaUnknown->SetYTitle("#eta");
327 fhEtaUnknown->SetXTitle("p_{T #gamma} (GeV/c)");
328 outputContainer->Add(fhEtaUnknown) ;
332 //Save parameters used for analysis
333 TString parList ; //this will be list of parameters used for this analysis.
336 sprintf(onePar,"--- AliAnaPhoton ---\n") ;
338 sprintf(onePar,"Calorimeter: %s\n",fCalorimeter.Data()) ;
340 sprintf(onePar,"fMinDist =%2.2f (Minimal distance to bad channel to accept cluster) \n",fMinDist) ;
342 sprintf(onePar,"fMinDist2=%2.2f (Cuts on Minimal distance to study acceptance evaluation) \n",fMinDist2) ;
344 sprintf(onePar,"fMinDist3=%2.2f (One more cut on distance used for acceptance-efficiency study) \n",fMinDist3) ;
346 sprintf(onePar,"fRejectTrackMatch: %d\n",fRejectTrackMatch) ;
349 //Get parameters set in base class.
350 parList += GetBaseParametersList() ;
352 //Get parameters set in PID class.
353 parList += GetCaloPID()->GetPIDParametersList() ;
355 //Get parameters set in FidutialCut class (not available yet)
356 //parlist += GetFidCut()->GetFidCutParametersList()
358 TObjString *oString= new TObjString(parList) ;
359 outputContainer->Add(oString);
361 return outputContainer ;
365 //____________________________________________________________________________
366 void AliAnaPhoton::Init()
371 if(fCalorimeter == "PHOS" && !GetReader()->IsPHOSSwitchedOn()){
372 printf("AliAnaPhoton::Init() - !!ABORT: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
375 else if(fCalorimeter == "EMCAL" && !GetReader()->IsEMCALSwitchedOn()){
376 printf("AliAnaPhoton::Init() - !!ABORT: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
383 //____________________________________________________________________________
384 void AliAnaPhoton::InitParameters()
387 //Initialize the parameters of the analysis.
388 SetOutputAODClassName("AliAODPWG4Particle");
389 SetOutputAODName("PWG4Particle");
391 AddToHistogramsName("AnaPhoton_");
393 fCalorimeter = "PHOS" ;
397 fRejectTrackMatch = kTRUE ;
400 //__________________________________________________________________
401 void AliAnaPhoton::MakeAnalysisFillAOD()
403 //Do analysis and fill aods
404 //Search for photons in fCalorimeter
405 TRefArray * pl = new TRefArray();
407 //Get vertex for photon momentum calculation
408 Double_t vertex[]={0,0,0} ; //vertex ;
409 if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex);
410 //Select the Calorimeter of the photon
411 if(fCalorimeter == "PHOS")
413 else if (fCalorimeter == "EMCAL")
416 //Fill AODCaloClusters and AODParticle with PHOS aods
419 for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++){
420 AliAODCaloCluster * calo = (AliAODCaloCluster*) (pl->At(icalo));
421 //Cluster selection, not charged, with photon id and in fidutial cut
422 //Get Momentum vector,
423 calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line
424 //If too small or big pt, skip it
425 if(mom.Pt() < GetMinPt() || mom.Pt() > GetMaxPt() ) continue ;
426 //Check acceptance selection
427 if(IsFidutialCutOn()){
428 Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,fCalorimeter) ;
432 //Create AOD for analysis
433 AliAODPWG4Particle aodph = AliAODPWG4Particle(mom);
434 aodph.SetLabel(calo->GetLabel(0));
435 //printf("Index %d, Id %d\n",icalo, calo->GetID());
436 //Set the indeces of the original caloclusters
437 aodph.SetCaloLabel(calo->GetID(),-1);
438 aodph.SetDetector(fCalorimeter);
440 printf("AliAnaPhoton::MakeAnalysisFillAOD() - Min pt cut and fidutial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodph.Pt(),aodph.Phi(),aodph.Eta());
442 //Check Distance to Bad channel, set bit.
443 Double_t distBad=calo->GetDistToBadChannel() ; //Distance to bad channel
444 if(distBad < 0.) distBad=9999. ; //workout strange convension dist = -1. ;
445 if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm)
448 if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - Bad channel cut passed %4.2f\n",distBad);
450 if(distBad > fMinDist3) aodph.SetDistToBad(2) ;
451 else if(distBad > fMinDist2) aodph.SetDistToBad(1) ;
452 else aodph.SetDistToBad(0) ;
455 //PID selection or bit setting
456 if(GetReader()->GetDataType() == AliCaloTrackReader::kMC){
457 //Get most probable PID, check PID weights (in MC this option is mandatory)
458 aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights
459 if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PDG of identified particle %d\n",aodph.GetPdg());
460 //If primary is not photon, skip it.
461 if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ;
463 else if(IsCaloPIDOn()){
464 //Skip matched clusters with tracks
465 if(fRejectTrackMatch && calo->GetNTracksMatched() > 0) continue ;
467 //Get most probable PID, 2 options check PID weights
468 //or redo PID, recommended option for EMCal.
469 if(!IsCaloPIDRecalculationOn())
470 aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights
472 aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated
474 if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PDG of identified particle %d\n",aodph.GetPdg());
476 //If cluster does not pass pid, not photon, skip it.
477 if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ;
481 //Set PID bits for later selection (AliAnaPi0 for example)
482 //GetPDG already called in SetPIDBits.
483 GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph);
484 if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - PID Bits set \n");
487 if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() - Photon selection cuts passed: pT %3.2f, pdg %d\n",aodph.Pt(), aodph.GetPdg());
489 //Play with the MC stack if available
490 //Check origin of the candidates
492 aodph.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetMCStack()));
493 if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillAOD() - Origin of candidate %d\n",aodph.GetTag());
494 }//Work with stack also
496 //Add AOD with photon object to aod branch
497 AddAODParticle(aodph);
501 if(GetDebug() > 1) printf("AliAnaPhoton::MakeAnalysisFillAOD() End fill AODs \n");
505 //__________________________________________________________________
506 void AliAnaPhoton::MakeAnalysisFillHistograms()
508 //Do analysis and fill histograms
510 // Access MC information in stack if requested, check that it exists.
511 AliStack * stack = 0x0;
512 TParticle * primary = 0x0;
514 stack = GetMCStack() ;
516 printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
521 //Loop on stored AOD photons
522 Int_t naod = GetOutputAODBranch()->GetEntriesFast();
523 if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
525 for(Int_t iaod = 0; iaod < naod ; iaod++){
526 AliAODPWG4Particle* ph = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
527 Int_t pdg = ph->GetPdg();
530 printf("AliAnaPhoton::MakeAnalysisFillHistograms() - PDG %d, MC TAG %d, Calorimeter %s\n", ph->GetPdg(),ph->GetTag(), (ph->GetDetector()).Data()) ;
532 //If PID used, fill histos with photons in Calorimeter fCalorimeter
533 if(IsCaloPIDOn() && pdg != AliCaloPID::kPhoton) continue;
534 if(ph->GetDetector() != fCalorimeter) continue;
537 printf("AliAnaPhoton::MakeAnalysisFillHistograms() - ID Photon: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ;
539 //Fill photon histograms
540 Float_t ptcluster = ph->Pt();
541 Float_t phicluster = ph->Phi();
542 Float_t etacluster = ph->Eta();
543 Float_t ecluster = ph->E();
545 fhPtPhoton ->Fill(ptcluster);
546 fhPhiPhoton ->Fill(ptcluster,phicluster);
547 fhEtaPhoton ->Fill(ptcluster,etacluster);
549 //Play with the MC stack if available
552 Int_t tag =ph->GetTag();
553 if(tag == AliMCAnalysisUtils::kMCPrompt){
554 fhPtPrompt ->Fill(ptcluster);
555 fhPhiPrompt ->Fill(ptcluster,phicluster);
556 fhEtaPrompt ->Fill(ptcluster,etacluster);
558 else if(tag==AliMCAnalysisUtils::kMCFragmentation)
560 fhPtFragmentation ->Fill(ptcluster);
561 fhPhiFragmentation ->Fill(ptcluster,phicluster);
562 fhEtaFragmentation ->Fill(ptcluster,etacluster);
564 else if(tag==AliMCAnalysisUtils::kMCISR)
566 fhPtISR ->Fill(ptcluster);
567 fhPhiISR ->Fill(ptcluster,phicluster);
568 fhEtaISR ->Fill(ptcluster,etacluster);
570 else if(tag==AliMCAnalysisUtils::kMCPi0Decay)
572 fhPtPi0Decay ->Fill(ptcluster);
573 fhPhiPi0Decay ->Fill(ptcluster,phicluster);
574 fhEtaPi0Decay ->Fill(ptcluster,etacluster);
576 else if(tag==AliMCAnalysisUtils::kMCEtaDecay || tag==AliMCAnalysisUtils::kMCOtherDecay)
578 fhPtOtherDecay ->Fill(ptcluster);
579 fhPhiOtherDecay ->Fill(ptcluster,phicluster);
580 fhEtaOtherDecay ->Fill(ptcluster,etacluster);
582 else if(tag==AliMCAnalysisUtils::kMCConversion)
584 fhPtConversion ->Fill(ptcluster);
585 fhPhiConversion ->Fill(ptcluster,phicluster);
586 fhEtaConversion ->Fill(ptcluster,etacluster);
590 fhPtUnknown ->Fill(ptcluster);
591 fhPhiUnknown ->Fill(ptcluster,phicluster);
592 fhEtaUnknown ->Fill(ptcluster,etacluster);
595 Int_t label =ph->GetLabel();
597 printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() *** bad label ***: label %d \n", label);
601 if(label >= stack->GetNtrack()) {
602 if(GetDebug() > 2) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() *** large label ***: label %d, n tracks %d \n", label, stack->GetNtrack());
606 primary = stack->Particle(label);
608 printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() *** no primary ***: label %d \n", label);
612 fh2E->Fill(primary->Energy(),ecluster);
613 fh2Pt->Fill(primary->Pt(), ptcluster);
614 fhDeltaE->Fill(primary->Energy()-ecluster);
615 fhDeltaPt->Fill(primary->Pt()-ptcluster);
616 if(primary->Energy()!=0) fhRatioE ->Fill(ecluster/primary->Energy());
617 if(primary->Pt()!=0) fhRatioPt ->Fill(ptcluster/primary->Pt());
619 }//Histograms with MC
626 //__________________________________________________________________
627 void AliAnaPhoton::Print(const Option_t * opt) const
629 //Print some relevant parameters set for the analysis
634 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
635 AliAnaPartCorrBaseClass::Print(" ");
637 printf("Calorimeter = %s\n", fCalorimeter.Data()) ;
638 printf("Min Distance to Bad Channel = %2.1f\n",fMinDist);
639 printf("Min Distance to Bad Channel 2 = %2.1f\n",fMinDist2);
640 printf("Min Distance to Bad Channel 3 = %2.1f\n",fMinDist3);
641 printf("Reject clusters with a track matched = %d\n",fRejectTrackMatch);