1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //_________________________________________________________________________
19 // Analysis for Tagged Photons
20 // Prepares all necessary histograms for calculation of
21 // the yield of pi0 decay photon in calorimeter:
22 // Marks photons which makes pi0 with some other and
23 // fill invariant mass distributions for estimate background below pi0
24 // peak so that estimate proportion of fake pairs.
25 // Fills as well controll MC histograms with clasification of the photon origin
26 // and check of the proportion of truly tagged photons.
29 //*-- Dmitry Blau, Dmitri Peresunko
30 //////////////////////////////////////////////////////////////////////////////
35 #include <THashList.h>
39 #include "AliAnalysisTaskTaggedPhotons.h"
40 #include "AliAnalysisManager.h"
41 #include "AliAODEvent.h"
42 #include "AliAODEvent.h"
43 #include "AliVCluster.h"
44 #include "AliCaloPhoton.h"
45 #include "AliAODMCParticle.h"
46 #include "AliAnalysisManager.h"
48 #include "TGeoManager.h"
49 #include "AliMCEventHandler.h"
50 #include "AliMCEvent.h"
52 #include "AliPHOSGeometry.h"
53 #include "AliTriggerAnalysis.h"
54 #include "AliEMCALGeometry.h"
55 #include "AliAnalysisUtils.h"
56 #include "AliOADBContainer.h"
57 #include "AliAODMCHeader.h"
59 ClassImp(AliAnalysisTaskTaggedPhotons)
61 //______________________________________________________________________________
62 AliAnalysisTaskTaggedPhotons::AliAnalysisTaskTaggedPhotons() :
65 fOutputContainer(0x0),
69 fCurrentMixedList(0x0),
70 fTriggerAnalysis(0x0),
84 //no memory allocations
85 for(Int_t i=0;i<10;i++)
86 for(Int_t j=0;j<2;j++)
87 fPHOSEvents[i][j]=0x0 ; //Container for PHOS photons
88 for(Int_t i=0;i<6;i++)
91 //______________________________________________________________________________
92 AliAnalysisTaskTaggedPhotons::AliAnalysisTaskTaggedPhotons(const char *name) :
93 AliAnalysisTaskSE(name),
95 fOutputContainer(0x0),
99 fCurrentMixedList(0x0),
100 fTriggerAnalysis(new AliTriggerAnalysis),
115 // Output slots #0 write into a TH1 container
116 DefineOutput(1,THashList::Class());
117 // Set bad channel map (empty so far)
118 for(Int_t i=0;i<1;i++)
119 for(Int_t j=0;j<5;j++)
120 fPHOSEvents[i][j]=0x0 ; //Container for PHOS photons
121 for(Int_t i=0;i<6;i++)
127 //____________________________________________________________________________
128 AliAnalysisTaskTaggedPhotons::AliAnalysisTaskTaggedPhotons(const AliAnalysisTaskTaggedPhotons& ap) :
129 AliAnalysisTaskSE(ap.GetName()),
131 fOutputContainer(0x0),
135 fCurrentMixedList(0x0),
136 fTriggerAnalysis(new AliTriggerAnalysis),
154 for(Int_t i=0;i<1;i++)
155 for(Int_t j=0;j<5;j++)
156 fPHOSEvents[i][j]=0x0 ; //Container for PHOS photons
157 for(Int_t i=0;i<6;i++)
162 //_____________________________________________________________________________
163 AliAnalysisTaskTaggedPhotons& AliAnalysisTaskTaggedPhotons::operator = (const AliAnalysisTaskTaggedPhotons& ap)
165 // assignment operator
167 this->~AliAnalysisTaskTaggedPhotons();
168 new(this) AliAnalysisTaskTaggedPhotons(ap);
172 //______________________________________________________________________________
173 AliAnalysisTaskTaggedPhotons::~AliAnalysisTaskTaggedPhotons()
176 if(fOutputContainer && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
177 fOutputContainer->Clear() ;
178 delete fOutputContainer ;
180 for(Int_t i=0;i<10;i++)
181 for(Int_t j=0;j<2;j++)
182 if(fPHOSEvents[i][j]){
183 delete fPHOSEvents[i][j] ;
184 fPHOSEvents[i][j]=0x0 ;
187 //________________________________________________________________________
188 void AliAnalysisTaskTaggedPhotons::UserCreateOutputObjects()
192 // Create the outputs containers
193 if(fOutputContainer != NULL){
194 delete fOutputContainer;
196 fOutputContainer = new THashList();
197 fOutputContainer->SetOwner(kTRUE);
198 fOutputContainer->SetName(GetName()) ;
201 fOutputContainer->Add(new TH1F("hSelEvents","Event selection", 10,0.,10.)) ;
203 //vertex distribution
204 fOutputContainer->Add(new TH1F("hNvertexTracks","N of primary tracks from the primary vertex",150,0.,150.));
205 fOutputContainer->Add(new TH1F("hZvertex","Z vertex",200,-50.,+50.));
206 fOutputContainer->Add(new TH2F("hTrackMult","Charged track multiplicity",100,0.,100.,250,0.,500.));
207 fOutputContainer->Add(new TH2F("hTrackEtaPhi","Charged track eta vs phi distribution",200,-2.,2.,200,0.,TMath::TwoPi()));
208 fOutputContainer->Add(new TH2F("hTrackEtaPt","Charged track eta vs pt distribution",200,-2.,2.,200,0.,50.));
211 fOutputContainer->Add(new TH1F("hCentrality","Ccentrality",100,0.,100.));
212 fOutputContainer->Add(new TH2F("hPHOSCentrality","PHOS vs centrality",100,0.,100.,100,0.,100.));
213 fOutputContainer->Add(new TH2F("hTOF","cluster TOF",200,0.,20.,300,-3.e-6,6.e-6));
215 fOutputContainer->Add(new TH2F("hCluNXZM1","Clu (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
216 fOutputContainer->Add(new TH2F("hCluNXZM2","Clu (X,Z), M2" ,64,0.5,64.5, 56,0.5,56.5));
217 fOutputContainer->Add(new TH2F("hCluNXZM3","Clu (X,Z), M3" ,64,0.5,64.5, 56,0.5,56.5));
218 fOutputContainer->Add(new TH2F("hCluEXZM1","Clu E(X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
219 fOutputContainer->Add(new TH2F("hCluEXZM2","Clu E(X,Z), M2" ,64,0.5,64.5, 56,0.5,56.5));
220 fOutputContainer->Add(new TH2F("hCluEXZM3","Clu E(X,Z), M3" ,64,0.5,64.5, 56,0.5,56.5));
222 fOutputContainer->Add(new TH2F("hCluArea2M1","Clu (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
223 fOutputContainer->Add(new TH2F("hCluArea2M2","Clu (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
224 fOutputContainer->Add(new TH2F("hCluArea2M3","Clu (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
225 fOutputContainer->Add(new TH2F("hCluArea3M1","Clu (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
226 fOutputContainer->Add(new TH2F("hCluArea3M2","Clu (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
227 fOutputContainer->Add(new TH2F("hCluArea3M3","Clu (X,Z), M1" ,64,0.5,64.5, 56,0.5,56.5));
229 fOutputContainer->Add(new TH2F("hTofM1","TOF in mod1",200,-1.e-6,1.e-6,200,0.,20.)) ;
230 fOutputContainer->Add(new TH2F("hTofM2","TOF in mod2",200,-1.e-6,1.e-6,200,0.,20.)) ;
231 fOutputContainer->Add(new TH2F("hTofM3","TOF in mod3",200,-1.e-6,1.e-6,200,0.,20.)) ;
234 snprintf(cPID[0],5,"All") ;
235 snprintf(cPID[1],5,"Disp");
236 snprintf(cPID[2],5,"CPV") ;
237 snprintf(cPID[3],5,"Both");
240 const Int_t nPt=500 ;
241 const Double_t ptMax=50. ;
243 const Double_t mMax=1. ;
246 for(Int_t iPID=0; iPID<4; iPID++){
247 fOutputContainer->Add(new TH1F(Form("hPhotM1_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M1",nPt,0.,ptMax)) ;
248 fOutputContainer->Add(new TH1F(Form("hPhotM2_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M2",nPt,0.,ptMax)) ;
249 fOutputContainer->Add(new TH1F(Form("hPhotM3_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M3",nPt,0.,ptMax)) ;
250 fOutputContainer->Add(new TH1F(Form("hPhotM1A2_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M1",nPt,0.,ptMax)) ;
251 fOutputContainer->Add(new TH1F(Form("hPhotM2A2_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M2",nPt,0.,ptMax)) ;
252 fOutputContainer->Add(new TH1F(Form("hPhotM3A2_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M3",nPt,0.,ptMax)) ;
253 fOutputContainer->Add(new TH1F(Form("hPhotM1A3_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M1",nPt,0.,ptMax)) ;
254 fOutputContainer->Add(new TH1F(Form("hPhotM2A3_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M2",nPt,0.,ptMax)) ;
255 fOutputContainer->Add(new TH1F(Form("hPhotM3A3_%s",cPID[iPID]),"Spectrum of all reconstructed particles, M3",nPt,0.,ptMax)) ;
259 const Int_t nCenBin=5;
260 for(Int_t cen=0; cen<nCenBin; cen++){
262 for(Int_t iPID=0; iPID<4; iPID++){
265 fOutputContainer->Add(new TH1F(Form("hPhot_%s_cent%d",cPID[iPID],cen),"Spectrum of all reconstructed particles",nPt,0.,ptMax)) ;
266 fOutputContainer->Add(new TH1F(Form("hPhot_Dist2_%s_cent%d",cPID[iPID],cen),"Spectrum of all reconstructed particles",nPt,0.,ptMax)) ;
267 fOutputContainer->Add(new TH1F(Form("hPhot_Dist3_%s_cent%d",cPID[iPID],cen),"Spectrum of all reconstructed particles",nPt,0.,ptMax)) ;
269 fOutputContainer->Add(new TH1F(Form("hPhot_Area1_%s_cent%d",cPID[iPID],cen),"Spectrum of all reconstructed particles",nPt,0.,ptMax)) ;
270 fOutputContainer->Add(new TH1F(Form("hPhot_Area2_%s_cent%d",cPID[iPID],cen),"Spectrum of all reconstructed particles",nPt,0.,ptMax)) ;
271 fOutputContainer->Add(new TH1F(Form("hPhot_Area3_%s_cent%d",cPID[iPID],cen),"Spectrum of all reconstructed particles",nPt,0.,ptMax)) ;
273 for(Int_t itag=0; itag<18; itag++){
274 fOutputContainer->Add(new TH1F(Form("hPhot_TaggedMult%d_Area1_%s_cent%d",itag,cPID[iPID],cen),"Spectrum of multiply tagged photons",nPt,0.,ptMax)) ;
275 fOutputContainer->Add(new TH1F(Form("hPhot_TaggedMult%d_Area2_%s_cent%d",itag,cPID[iPID],cen),"Spectrum of multiply tagged photons",nPt,0.,ptMax)) ;
276 fOutputContainer->Add(new TH1F(Form("hPhot_TaggedMult%d_Area3_%s_cent%d",itag,cPID[iPID],cen),"Spectrum of multiply tagged photons",nPt,0.,ptMax)) ;
277 fOutputContainer->Add(new TH1F(Form("hPhot_Tagged%d_Area1_%s_cent%d",itag,cPID[iPID],cen),"Spectrum of all reconstructed particles, no PID",nPt,0.,ptMax)) ;
278 fOutputContainer->Add(new TH1F(Form("hPhot_Tagged%d_Area2_%s_cent%d",itag,cPID[iPID],cen),"Spectrum of all reconstructed particles, no PID",nPt,0.,ptMax)) ;
279 fOutputContainer->Add(new TH1F(Form("hPhot_Tagged%d_Area3_%s_cent%d",itag,cPID[iPID],cen),"Spectrum of all reconstructed particles, no PID",nPt,0.,ptMax)) ;
281 fOutputContainer->Add(new TH1F(Form("hPhot_TrueTagged%d_%s_cent%d",itag,cPID[iPID],cen),"Spectrum of all tagged particles",nPt,0.,ptMax)) ;
283 for(Int_t kind=1; kind<33; kind*=2){
284 fOutputContainer->Add(new TH1F(Form("hPhot_Isolation%d_%s_cent%d",kind,cPID[iPID],cen),"Spectrum of all reconstructed particles, no PID",nPt,0.,ptMax)) ;
285 fOutputContainer->Add(new TH1F(Form("hPhot_Isolation%d_Area1_%s_cent%d",kind,cPID[iPID],cen),"Spectrum of all reconstructed particles, no PID",nPt,0.,ptMax)) ;
286 fOutputContainer->Add(new TH1F(Form("hPhot_nTagged_Isolation%d_Area1_%s_cent%d",kind,cPID[iPID],cen),"Spectrum of all reconstructed particles, no PID",nPt,0.,ptMax)) ;
289 for(Int_t kind=1; kind<33; kind*=2){
290 fOutputContainer->Add(new TH1F(Form("hPi_Isolation%d_cent%d",kind,cen),"Spectrum of all reconstructed particles, no PID",nPt,0.,ptMax)) ;
295 //Invariant mass distributions for fake corrections
297 for(Int_t iPID=0; iPID<4; iPID++){
298 fOutputContainer->Add(new TH2F(Form("hInvM_Re_Emin1_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
299 fOutputContainer->Add(new TH2F(Form("hInvM_Re_Emin2_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
300 fOutputContainer->Add(new TH2F(Form("hInvM_Re_Emin3_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
301 fOutputContainer->Add(new TH2F(Form("hInvM_Mi_Emin1_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
302 fOutputContainer->Add(new TH2F(Form("hInvM_Mi_Emin2_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
303 fOutputContainer->Add(new TH2F(Form("hInvM_Mi_Emin3_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
305 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Re_Emin1_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
306 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Re_Emin2_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
307 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Re_Emin3_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
308 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Re_Emin1_Strict_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
309 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Re_Emin2_Strict_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
310 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Re_Emin3_Strict_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
312 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Mi_Emin1_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
313 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Mi_Emin2_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
314 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Mi_Emin3_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
315 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Mi_Emin1_Strict_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
316 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Mi_Emin2_Strict_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
317 fOutputContainer->Add(new TH2F(Form("hSingleInvM_Mi_Emin3_Strict_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
324 fOutputContainer->Add(new TH2F(Form("QA_Cone1_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
325 fOutputContainer->Add(new TH2F(Form("QA_Cone2_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
326 fOutputContainer->Add(new TH2F(Form("QA_Cone3_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
327 fOutputContainer->Add(new TH2F(Form("QA_PCone1_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
328 fOutputContainer->Add(new TH2F(Form("QA_PCone2_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
329 fOutputContainer->Add(new TH2F(Form("QA_PCone3_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
330 fOutputContainer->Add(new TH2F(Form("QA_Pi0Cone1_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
331 fOutputContainer->Add(new TH2F(Form("QA_Pi0Cone2_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
332 fOutputContainer->Add(new TH2F(Form("QA_Pi0Cone3_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
333 fOutputContainer->Add(new TH2F(Form("QA_Pi0PCone1_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
334 fOutputContainer->Add(new TH2F(Form("QA_Pi0PCone2_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
335 fOutputContainer->Add(new TH2F(Form("QA_Pi0PCone3_Tracks_cent%d",cen),"Two-photon inv. mass vs first photon pt",50,0.,50.,200,0.,100.)) ;
339 char partName[15][10] ;
340 snprintf(partName[0],10,"gamma") ;
341 snprintf(partName[1],10,"pi0");
342 snprintf(partName[2],10,"eta") ;
343 snprintf(partName[3],10,"omega");
344 snprintf(partName[4],10,"K0s");
345 snprintf(partName[5],10,"Kpm");
346 snprintf(partName[6],10,"pipm");
347 snprintf(partName[7],10,"n");
348 snprintf(partName[8],10,"nbar");
349 snprintf(partName[9],10,"p");
350 snprintf(partName[10],10,"pbar");
355 fOutputContainer->Add(new TH1F("hMCConversionRadius","Clusters without label",600,0.,600.)) ;
356 fOutputContainer->Add(new TH2F("hMCRecPi0Vtx","Secondary pi0s",100,0.,10.,600,0.,600.)) ;
357 fOutputContainer->Add(new TH2F("hMCRecEtaVtx","Secondary etas",100,0.,10.,600,0.,600.)) ;
358 fOutputContainer->Add(new TH2F("hMCRecOmegaVtx","Secondary etas",100,0.,10.,600,0.,600.)) ;
359 fOutputContainer->Add(new TH2F("hMCRecEtaprVtx","Secondary etas",100,0.,10.,600,0.,600.)) ;
360 fOutputContainer->Add(new TH2F("hMCRecK0sVtx","Secondary K0s",100,0.,10.,600,0.,600.)) ;
361 fOutputContainer->Add(new TH2F("hMCRecK0lVtx","Secondary K0l",100,0.,10.,600,0.,600.)) ;
362 fOutputContainer->Add(new TH2F("hMCGammaPi0MisConvR","Converted photons",400,0.,40.,600,0.,600.)) ;
364 for(Int_t ipart=0; ipart<11; ipart++){
365 fOutputContainer->Add(new TH2F(Form("hMC%s_ptrap",partName[ipart]),"Spectrum of primary photons",100,0.,10.,200,-1.,1.)) ;
366 fOutputContainer->Add(new TH2F(Form("hMC%s_ptphi",partName[ipart]),"Spectrum of primary photons",100,0.,10.,100,0.,TMath::TwoPi())) ;
367 fOutputContainer->Add(new TH2F(Form("hMC_%s_vertex",partName[ipart]),"vertex",nPt,0.,ptMax,150,0.,600.)) ;
368 for(Int_t cen=0; cen<nCenBin; cen++){
369 fOutputContainer->Add(new TH1F(Form("hMC_all_%s_cent%d",partName[ipart],cen),"Spectum (full rapifity)",nPt,0.,ptMax)) ;
370 fOutputContainer->Add(new TH1F(Form("hMC_unitEta_%s_cent%d",partName[ipart],cen),"Spectum, |y|<0.15",nPt,0.,ptMax)) ;
371 fOutputContainer->Add(new TH1F(Form("hMC_rap_%s_cent%d",partName[ipart],cen),"Rapidity",100,-5.,5.)) ;
372 fOutputContainer->Add(new TH1F(Form("hMC_phi_%s_cent%d",partName[ipart],cen),"Azimuthal angle",100,0.,TMath::TwoPi())) ;
375 for(Int_t cen=0; cen<nCenBin; cen++){
376 fOutputContainer->Add(new TH1F(Form("hMC_unitEta_GammaPi0_cent%d",cen),"Spectum, |y|<0.15",nPt,0.,ptMax)) ;
379 for(Int_t cen=0; cen<nCenBin; cen++){
381 fOutputContainer->Add(new TH2F(Form("LabelsNPrim_cent%d",cen),"vertex",nPt,0.,ptMax,20,0.,20.)) ;
382 fOutputContainer->Add(new TH1F(Form("LabelsGamma_cent%d",cen),"vertex",nPt,0.,ptMax)) ;
383 fOutputContainer->Add(new TH2F(Form("LabelsGammaE_cent%d",cen),"vertex",nPt,0.,ptMax,100,0.,2.)) ;
386 //Sort registered particles spectra according MC information
387 for(Int_t iPID=0; iPID<4; iPID++){
388 fOutputContainer->Add(new TH1F(Form("hMCRecPhoton_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
389 fOutputContainer->Add(new TH1F(Form("hMCRecPhoton_Area1_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
390 fOutputContainer->Add(new TH1F(Form("hMCRecPhoton_Area2_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
391 fOutputContainer->Add(new TH1F(Form("hMCRecPhoton_Area3_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
392 fOutputContainer->Add(new TH1F(Form("hMCRecE_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
393 fOutputContainer->Add(new TH1F(Form("hMCRecPbar_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
394 fOutputContainer->Add(new TH1F(Form("hMCRecNbar_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
395 fOutputContainer->Add(new TH1F(Form("hMCRecP_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
396 fOutputContainer->Add(new TH1F(Form("hMCRecPipm_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
397 fOutputContainer->Add(new TH1F(Form("hMCRecKpm_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
398 fOutputContainer->Add(new TH1F(Form("hMCRecN_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
399 fOutputContainer->Add(new TH1F(Form("hMCRecCharg_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
400 fOutputContainer->Add(new TH1F(Form("hMCRecNeutral_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
401 fOutputContainer->Add(new TH1F(Form("hMCRecK0s_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
402 fOutputContainer->Add(new TH1F(Form("hMCRecNoPRim_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. electrons", nPt,0.,ptMax )) ;
405 fOutputContainer->Add(new TH1F(Form("hMCRecPhotPi0_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
406 fOutputContainer->Add(new TH1F(Form("hMCRecPhotEta_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
407 fOutputContainer->Add(new TH1F(Form("hMCRecPhotOmega_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
408 fOutputContainer->Add(new TH1F(Form("hMCRecPhotOther_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
409 fOutputContainer->Add(new TH1F(Form("hMCRecPhotNoPrim_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax )) ;
413 //MC tagging: reasons of partner loss etc.
414 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnStack_%s_cent%d",cPID[iPID],cen),"Decay photons with partner not in Stack", nPt,0.,ptMax )) ;
415 for(Int_t iType=0; iType<9; iType++)
416 fOutputContainer->Add(new TH1F(Form("hMCDecWithFoundPartnType%d_%s_cent%d",iType,cPID[iPID],cen),"Decay photon with found partner", nPt,0.,ptMax )) ;
417 fOutputContainer->Add(new TH1F(Form("hMCDecWithWrongMass_%s_cent%d",cPID[iPID],cen),"Decay photon with wrong mass", nPt,0.,ptMax )) ;
418 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAccept_%s_cent%d",cPID[iPID],cen),"Decay photon with parttner not in PHOS acc", nPt,0.,ptMax )) ;
419 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAcceptFA1_%s_cent%d",cPID[iPID],cen),"Decay photons with partner missed due geometry Fid. area. 1", nPt,0.,ptMax )) ;
420 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAcceptFA2_%s_cent%d",cPID[iPID],cen),"Decay photons with partner missed due geometry Fid. area. 2", nPt,0.,ptMax)) ;
421 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAcceptFA3_%s_cent%d",cPID[iPID],cen),"Decay photons with partner missed due geometry Fid. area. 3", nPt,0.,ptMax )) ;
422 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnConv_%s_cent%d",cPID[iPID],cen),"Decay photons with partner missed due to conversion", nPt,0.,ptMax )) ;
423 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnEmin_%s_cent%d",cPID[iPID],cen),"Decay photons with partner missed due to low energy", nPt,0.,ptMax )) ;
424 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnOther_%s_cent%d",cPID[iPID],cen),"Decay photons with partner missed due unknown reason", nPt,0.,ptMax )) ;
425 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAll_%s_cent%d",cPID[iPID],cen),"Decay photons with partner missed due to any reason", nPt,0.,ptMax )) ;
426 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnNPhot_%s_cent%d",cPID[iPID],cen),"pi0 decay photon with non-photon partner", nPt,0.,ptMax )) ;
428 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnCutEmin_%s_cent%d",cPID[iPID],cen),"Decay photons with rec. partner but failed Emin cut", nPt,0.,ptMax )) ;
429 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnCutNcell_%s_cent%d",cPID[iPID],cen),"Decay photons with rec. partner but failed Ncell cut", nPt,0.,ptMax )) ;
430 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnCutEcross_%s_cent%d",cPID[iPID],cen),"Decay photons with rec. partner but failed Ecross cut", nPt,0.,ptMax )) ;
431 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnCutM02_%s_cent%d",cPID[iPID],cen),"Decay photons with rec. partner but failed M02 cut", nPt,0.,ptMax )) ;
432 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnDefCuts_%s_cent%d",cPID[iPID],cen),"Decay photons with rec. partner but failed default cuts", nPt,0.,ptMax )) ;
433 fOutputContainer->Add(new TH1F(Form("hMCDecWRecPartn_%s_cent%d",cPID[iPID],cen),"Decay photons with rec partner", nPt,0.,ptMax )) ;
434 fOutputContainer->Add(new TH1F(Form("hMCDecWRecUniqPartn_%s_cent%d",cPID[iPID],cen),"Decay photons with rec partner", nPt,0.,ptMax )) ;
436 fOutputContainer->Add(new TH1F(Form("hMCDecMerged_%s_cent%d",cPID[iPID],cen),"Decay photons with rec partner", nPt,0.,ptMax )) ;
437 fOutputContainer->Add(new TH1F(Form("hMCDecUnfolded_%s_cent%d",cPID[iPID],cen),"Decay photons with rec partner", nPt,0.,ptMax )) ;
440 fOutputContainer->Add(new TH2F(Form("hMC_InvM_Re_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
441 fOutputContainer->Add(new TH2F(Form("hMC_InvM_Re_Strict_%s_cent%d",cPID[iPID],cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
443 fOutputContainer->Add(new TH2F(Form("hMCmass_cent%d",cen),"Mass with reconstructed decay partner",nM,0.,mMax,nPt,0.,ptMax )) ;
447 fOutputContainer->Add(new TH1F(Form("hMCRecNoLabel_cent%d",cen),"Clusters without label",nPt,0.,ptMax)) ;
448 fOutputContainer->Add(new TH1F(Form("hMCConversionRadius_cent%d",cen),"Clusters without label",600,0.,600.)) ;
449 fOutputContainer->Add(new TH2F(Form("hMCRecPi0Vtx_cent%d",cen),"Secondary pi0s",100,0.,10.,600,0.,600.)) ;
450 fOutputContainer->Add(new TH2F(Form("hMCRecEtaVtx_cent%d",cen),"Secondary etas",100,0.,10.,600,0.,600.)) ;
451 fOutputContainer->Add(new TH2F(Form("hMCRecOmegaVtx_cent%d",cen),"Secondary etas",100,0.,10.,600,0.,600.)) ;
452 fOutputContainer->Add(new TH2F(Form("hMCRecEtaprVtx_cent%d",cen),"Secondary etas",100,0.,10.,600,0.,600.)) ;
453 fOutputContainer->Add(new TH2F(Form("hMCRecK0sVtx_cent%d",cen),"Secondary K0s",100,0.,10.,600,0.,600.)) ;
454 fOutputContainer->Add(new TH2F(Form("hMCRecK0lVtx_cent%d",cen),"Secondary K0l",100,0.,10.,600,0.,600.)) ;
455 fOutputContainer->Add(new TH2F(Form("hMCGammaPi0MisConvR_cent%d",cen),"Converted photons",400,0.,40.,600,0.,600.)) ;
458 fOutputContainer->Add(new TH2F(Form("hMCGammaPi0PrimMgg_cent%d",cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
459 fOutputContainer->Add(new TH2F(Form("hMCGammaPi0RecMgg_cent%d",cen),"Two-photon inv. mass vs first photon pt",nM,0.,mMax,nPt,0.,ptMax)) ;
461 for(Int_t iPID=0; iPID<4; iPID++){
462 fOutputContainer->Add(new TH1F(Form("hMCRecNoPrim_%s_cent%d",cPID[iPID],cen),"Reconstructed particles withour primary",nPt,0.,ptMax)) ;
463 fOutputContainer->Add(new TH1F(Form("hMCRecGamma_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: Gamma",nPt,0.,ptMax)) ;
464 fOutputContainer->Add(new TH1F(Form("hMCRecPhotConv_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: e+-",nPt,0.,ptMax)) ;
465 fOutputContainer->Add(new TH1F(Form("hMCRecPi0_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: pi0",nPt,0.,ptMax)) ;
466 fOutputContainer->Add(new TH1F(Form("hMCRecEta_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: eta",nPt,0.,ptMax)) ;
467 fOutputContainer->Add(new TH1F(Form("hMCRecOmega_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: Gamma",nPt,0.,ptMax)) ;
468 fOutputContainer->Add(new TH1F(Form("hMCRecEtapr_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: eta prime",nPt,0.,ptMax)) ;
469 fOutputContainer->Add(new TH1F(Form("hMCRecPbar_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: bar(p)",nPt,0.,ptMax)) ;
470 fOutputContainer->Add(new TH1F(Form("hMCRecNbar_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: bar(n)",nPt,0.,ptMax)) ;
471 fOutputContainer->Add(new TH1F(Form("hMCRecPipm_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: pipm",nPt,0.,ptMax)) ;
472 fOutputContainer->Add(new TH1F(Form("hMCRecN_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: n",nPt,0.,ptMax)) ;
473 fOutputContainer->Add(new TH1F(Form("hMCRecP_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: p",nPt,0.,ptMax)) ;
474 fOutputContainer->Add(new TH1F(Form("hMCRecKpm_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: K+-",nPt,0.,ptMax)) ;
475 fOutputContainer->Add(new TH1F(Form("hMCRecK0s_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: K0s",nPt,0.,ptMax)) ;
476 fOutputContainer->Add(new TH1F(Form("hMCRecK0l_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: K0l",nPt,0.,ptMax)) ;
477 fOutputContainer->Add(new TH1F(Form("hMCRecUnknownCh_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: K0l",nPt,0.,ptMax)) ;
478 fOutputContainer->Add(new TH1F(Form("hMCRecUnknownNeu_%s_cent%d",cPID[iPID],cen),"Reconstructed particles with primary: K0l",nPt,0.,ptMax)) ;
481 fOutputContainer->Add(new TH1F(Form("hMCRecGammaDir_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, no primary",nPt,0.,ptMax)) ;
482 fOutputContainer->Add(new TH1F(Form("hMCRecGammaPi0_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
483 fOutputContainer->Add(new TH1F(Form("hMCRecGammaEta_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from eta",nPt,0.,ptMax)) ;
484 fOutputContainer->Add(new TH1F(Form("hMCRecGammaOmega_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from omega",nPt,0.,ptMax)) ;
485 fOutputContainer->Add(new TH1F(Form("hMCRecGammaOther_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from other",nPt,0.,ptMax)) ;
486 fOutputContainer->Add(new TH1F(Form("hMCRecPhotNoPrim_%s_cent%d",cPID[iPID],cen),"Spectrum of rec. photons", nPt,0.,ptMax)) ;
490 //MC tagging: reasons of partner loss etc.
491 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnStack_cent%d",cen),"Decay photons with partner not in Stack", nPt,0.,ptMax)) ;
492 fOutputContainer->Add(new TH1F(Form("hMCDecWithFoundPartn_cent%d",cen),"Decay photon with found partner", nPt,0.,ptMax)) ;
493 fOutputContainer->Add(new TH1F(Form("hMCDecWithWrongMass_cent%d",cen),"Decay photon with wrong mass", nPt,0.,ptMax)) ;
494 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAccept_cent%d",cen),"Decay photon with parttner not in PHOS acc", nPt,0.,ptMax)) ;
495 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAcceptFA1_cent%d",cen),"Decay photons with partner missed due geometry Fid. area. 1", nPt,0.,ptMax)) ;
496 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAcceptFA2_cent%d",cen),"Decay photons with partner missed due geometry Fid. area. 2", nPt,0.,ptMax)) ;
497 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAcceptFA3_cent%d",cen),"Decay photons with partner missed due geometry Fid. area. 3", nPt,0.,ptMax)) ;
498 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnConv_cent%d",cen),"Decay photons with partner missed due to conversion", nPt,0.,ptMax)) ;
499 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnEmin_cent%d",cen),"Decay photons with partner missed due to low energy", nPt,0.,ptMax)) ;
500 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnOther_cent%d",cen),"Decay photons with partner missed due unknown reason", nPt,0.,ptMax)) ;
501 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnAll_cent%d",cen),"Decay photons with partner missed due to any reason", nPt,0.,ptMax)) ;
502 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnNPhot_cent%d",cen),"pi0 decay photon with non-photon partner", nPt,0.,ptMax)) ;
505 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnCutEmin_cent%d",cen),"Decay photons with rec. partner but failed Emin cut", nPt,0.,ptMax)) ;
506 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnCutNcell_cent%d",cen),"Decay photons with rec. partner but failed Ncell cut", nPt,0.,ptMax)) ;
507 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnCutEcross_cent%d",cen),"Decay photons with rec. partner but failed Ecross cut", nPt,0.,ptMax)) ;
508 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnCutM02_cent%d",cen),"Decay photons with rec. partner but failed M02 cut", nPt,0.,ptMax)) ;
509 fOutputContainer->Add(new TH1F(Form("hMCDecWMisPartnDefCuts_cent%d",cen),"Decay photons with rec. partner but failed default cuts", nPt,0.,ptMax)) ;
510 fOutputContainer->Add(new TH1F(Form("hMCDecWRecPartn_cent%d",cen),"Decay photons with rec partner", nPt,0.,ptMax)) ;
512 fOutputContainer->Add(new TH2F(Form("hMCmass_cent%d",cen),"Mass with reconstructed decay partner",nM,0.,mMax,nPt,0.,ptMax)) ;
515 fOutputContainer->Add(new TH1F(Form("hMCRecGammaPi0Dalitz_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
516 fOutputContainer->Add(new TH1F(Form("hMCRecGammaPi0NoStack_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
517 fOutputContainer->Add(new TH1F(Form("hMCGammaPi02Gamma_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
518 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0Rec_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
519 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0RecSoft_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
520 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0RecCells_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
522 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0Tagged_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
523 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0FakeTagged_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
524 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0TrueTagged_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
525 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MultyTagged_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
526 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisGeo_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
527 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisGeoFA1_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
528 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisGeoFA2_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
529 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisGeoFA3_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
530 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisConv_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
531 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisEmin_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
532 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisOther_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
533 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisFakePrim_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
534 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisFoundPrim_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
535 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisNPhot_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
537 //all clusters fake tagged
538 fOutputContainer->Add(new TH1F(Form("hMCAllFakeTagged_%s_cent%d",cPID[iPID],cen),"Reconstructed gammas, from pi0",nPt,0.,ptMax)) ;
542 fOutputContainer->Add(new TH1F(Form("hMCGammaPi0MisPartner_cent%d",cen),"Spectrum of missed partners",nPt,0.,ptMax)) ;
543 fOutputContainer->Add(new TH2F(Form("hMCGammaPi0MisPartnerEtaPhi_cent%d",cen),"Spectrum of missed partners",100,-0.2,0.2,100,4.5,5.6)) ;
548 //If we work with MC, need to set Sumw2 - we will use weights
550 for(Int_t i=0; i<fOutputContainer->GetSize();i++){
551 ((TH1*)fOutputContainer->At(i))->Sumw2() ;
557 for(Int_t i=0;i<10;i++)
558 for(Int_t j=0;j<5;j++)
559 fPHOSEvents[i][j]=0x0 ; //Container for PHOS photons
562 PostData(1, fOutputContainer);
567 //______________________________________________________________________________
568 void AliAnalysisTaskTaggedPhotons::UserExec(Option_t *)
573 //Fill Tagging histogsms
575 const Double_t kEcrossCut=0.98 ;
576 const Double_t kTOFMaxCut= 100.e-9 ;
577 const Double_t kTOFMinCut=-100.e-9 ;
579 // Event selection flags
580 // FillHistogram("hSelEvents",0) ;
582 AliVEvent* event = (AliVEvent*)InputEvent();
584 AliDebug(1,"No event") ;
585 PostData(1, fOutputContainer);
588 FillHistogram("hSelEvents",1) ;
591 fStack = (TClonesArray*)event->FindListObject(AliAODMCParticle::StdBranchName());
593 //read geometry if not read yet
600 fUtils = new AliAnalysisUtils();
602 Bool_t isMB = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kINT7) ;
603 Bool_t isPHI7 = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kPHI7);
605 if((fIsMB && !isMB) || (!fIsMB && !isPHI7)){
606 PostData(1, fOutputContainer);
610 FillHistogram("hSelEvents",2) ;
612 // Checks if we have a primary vertex
613 // Get primary vertices form AOD
616 vtx5[0] = event->GetPrimaryVertex()->GetX();
617 vtx5[1] = event->GetPrimaryVertex()->GetY();
618 vtx5[2] = event->GetPrimaryVertex()->GetZ();
620 FillHistogram("hNvertexTracks",event->GetPrimaryVertex()->GetNContributors());
621 FillHistogram("hZvertex" ,vtx5[2]);
622 if(fIsFastMC){ //vertex from header
623 AliAODMCHeader *cHeaderAOD = dynamic_cast<AliAODMCHeader*>(event->FindListObject(AliAODMCHeader::StdBranchName()));
625 PostData(1, fOutputContainer);
628 cHeaderAOD->GetVertex(vtx5);
630 if (TMath::Abs(vtx5[2]) > 10. ){
631 PostData(1, fOutputContainer);
634 FillHistogram("hSelEvents",3) ;
636 Int_t zvtx = TMath::Min(9,Int_t((vtx5[2]+10.)/2.)) ;
640 // if (event->IsPileupFromSPD()){
641 // PostData(1, fOutputContainer);
645 if(!fUtils->IsVertexSelected2013pA(event)){
646 PostData(1, fOutputContainer);
650 FillHistogram("hSelEvents",4) ;
652 if(fUtils->IsPileUpEvent(event)){
653 PostData(1, fOutputContainer);
656 FillHistogram("hSelEvents",5) ;
661 AliCentrality *centrality = event->GetCentrality();
663 fCentrality=centrality->GetCentralityPercentile("V0M");
665 AliError("Event has 0x0 centrality");
668 FillHistogram("hCentrality",fCentrality) ;
670 if(fCentrality<0. || fCentrality>=100.){
671 PostData(1, fOutputContainer);
678 fCentBin = (Int_t)(fCentrality/20.) ;
680 FillHistogram("hSelEvents",6) ;
683 //Calculate charged multiplicity
686 fTrackEvent->Clear() ;
688 fTrackEvent = new TClonesArray("AliCaloPhoton",event->GetNumberOfTracks()) ;
690 for (Int_t i=0;i<event->GetNumberOfTracks();++i) {
691 AliAODTrack *track = (AliAODTrack*)event->GetTrack(i) ;
692 if(!track->IsHybridGlobalConstrainedGlobal())
694 if(TMath::Abs(track->Eta())< 0.9){
695 if(trackMult>=fTrackEvent->GetSize())
696 fTrackEvent->Expand(2*trackMult) ;
697 new ((*fTrackEvent)[trackMult]) AliCaloPhoton(track->Px(),track->Py(),track->Pz(),track->P());
699 FillHistogram("hTrackEtaPhi",track->Eta(),track->Phi()) ;
700 FillHistogram("hTrackEtaPt",track->Eta(),track->Pt()) ;
703 FillHistogram("hTrackMult",fCentrality,trackMult+0.5) ;
705 if(!fPHOSEvents[zvtx][fCentBin])
706 fPHOSEvents[zvtx][fCentBin]=new TList() ;
707 fCurrentMixedList = fPHOSEvents[zvtx][fCentBin] ;
709 const Double_t rcut=1. ; //cut on vertex to consider particle as "primary"
711 //---------Select photons-------------------
712 Int_t multClust = event->GetNumberOfCaloClusters();
714 fPHOSEvent = new TClonesArray("AliCaloPhoton",multClust);
716 fPHOSEvent->Clear() ;
717 Int_t inList = 0; //counter of caloClusters
719 for (Int_t i=0; i<multClust; i++) {
720 AliVCluster * clu = event->GetCaloCluster(i);
728 if(clu->GetNCells()<3)
731 if(clu->GetM02()<0.2)
734 if(clu->GetMCEnergyFraction()>kEcrossCut) //Ecross cut, should be filled with Tender
737 if(clu->GetDistanceToBadChannel()<fMinBCDistance)
741 clu->GetPosition(pos) ;
742 Int_t fidArea=GetFiducialArea(pos) ;
743 // if(fidArea==0) //Bad cell
746 TVector3 global1(pos) ;
748 fPHOSgeom->GlobalPos2RelId(global1,relId) ;
749 Int_t mod = relId[0] ;
750 Int_t cellX = relId[2];
751 Int_t cellZ = relId[3] ;
753 FillHistogram("hTOF",clu->E(),clu->GetTOF()) ;
754 FillHistogram(Form("hTofM%d",mod),clu->GetTOF(),clu->E()) ;
755 if((!fIsMC) && (clu->GetTOF() < kTOFMinCut || clu->GetTOF() > kTOFMaxCut))
758 // if(clu->GetDistanceToBadChannel()<2.5)
762 FillHistogram(Form("hCluNXZM%d",mod),cellX,cellZ,1.);
763 FillHistogram(Form("hCluEXZM%d",mod),cellX,cellZ,clu->E());
765 FillHistogram(Form("hCluArea2M%d",mod),cellX,cellZ,1.);
767 FillHistogram(Form("hCluArea3M%d",mod),cellX,cellZ,1.);
771 TLorentzVector momentum ;
772 clu->GetMomentum(momentum, vtx5);
774 AliCaloPhoton *p = new ((*fPHOSEvent)[inList]) AliCaloPhoton(momentum.Px(),momentum.Py(),momentum.Pz(),clu->E() );
775 // momentum*= clu->GetCoreEnergy()/momentum.E() ;
776 // AliCaloPhoton *p = new ((*fPHOSEvent)[inList]) AliCaloPhoton(momentum.Px(),momentum.Py(),momentum.Pz(),clu->GetCoreEnergy() );
779 Int_t isolation = EvalIsolation(&momentum,kTRUE) ;
780 p->SetIsolationTag(isolation) ;
782 p->SetDistToBad((Int_t)(1.+clu->GetDistanceToBadChannel()/2.2));
783 p->SetBC(i) ; //reference to CaloCluster
784 p->SetTagInfo(0); //No pi0 partners found so far
785 p->SetTagged(kFALSE); //Reconstructed pairs found
787 p->SetFiducialArea(fidArea) ;
790 //This is primary entered PHOS
791 FillHistogram(Form("LabelsNPrim_cent%d",fCentBin),clu->E(),float(clu->GetNLabels())) ;
792 Int_t primLabel=clu->GetLabelAt(0) ; //FindPrimary(clu,sure) ;
793 //Look what particle left vertex
795 AliAODMCParticle * prim = (AliAODMCParticle*)fStack->At(primLabel) ;
796 Int_t iparent=primLabel;
797 AliAODMCParticle * parent = prim;
798 Double_t r2=prim->Xv()*prim->Xv()+prim->Yv()*prim->Yv() ;
799 while((r2 > rcut*rcut) && (iparent>-1)){
800 iparent=parent->GetMother();
801 parent=(AliAODMCParticle*)fStack->At(iparent);
802 r2=parent->Xv()*parent->Xv()+parent->Yv()*parent->Yv() ;
804 p->SetPrimary(primLabel) ;
805 p->SetPrimaryAtVertex(iparent) ;
806 p->SetWeight(PrimaryParticleWeight(parent)) ;
809 p->SetPrimary(-1); //Primary index
810 p->SetPrimaryAtVertex(-1) ;
815 p->SetPrimary(-1); //Primary index
816 p->SetPrimaryAtVertex(-1) ;
820 // Cut on Core Lambdas
821 p->SetDispBit(clu->Chi2()<2.5*2.5) ;
823 // p->SetDispBit(clu->GetDispersion()<2.5*2.5) ;
824 p->SetTOFBit(TestTOF(clu->GetTOF(),clu->E())) ;
825 p->SetCPVBit(clu->GetEmcCpvDistance()>2.5) ;
827 FillHistogram(Form("hPhotM%d_All",mod),p->Pt()) ;
829 FillHistogram(Form("hPhotM%dA2_All",mod),p->Pt()) ;
831 FillHistogram(Form("hPhotM%dA3_All",mod),p->Pt()) ;
835 FillHistogram(Form("hPhotM%d_Disp",mod),p->Pt()) ;
837 FillHistogram(Form("hPhotM%dA2_Disp",mod),p->Pt()) ;
839 FillHistogram(Form("hPhotM%dA3_Disp",mod),p->Pt()) ;
843 FillHistogram(Form("hPhotM%d_Both",mod),p->Pt()) ;
845 FillHistogram(Form("hPhotM%dA2_Both",mod),p->Pt()) ;
847 FillHistogram(Form("hPhotM%dA3_Both",mod),p->Pt()) ;
853 FillHistogram(Form("hPhotM%d_CPV",mod),p->Pt()) ;
855 FillHistogram(Form("hPhotM%dA2_CPV",mod),p->Pt()) ;
857 FillHistogram(Form("hPhotM%dA3_CPV",mod),p->Pt()) ;
862 FillHistogram("hPHOSCentrality",fCentrality,inList+0.5) ;
866 FillTaggingHistos() ;
869 fCurrentMixedList->AddFirst(fPHOSEvent);
871 if(fCurrentMixedList->GetSize() > 10){
872 TClonesArray *tmp = static_cast <TClonesArray*> (fCurrentMixedList->Last());
873 fCurrentMixedList->Remove(tmp);
877 PostData(1, fOutputContainer);
880 //________________________________________________
881 void AliAnalysisTaskTaggedPhotons::FillMCHistos(){
883 //MC info about this particle
886 const Double_t rcut=1. ; //cut on vertex to consider particle as "primary"
887 const Double_t phiMin=260.*TMath::Pi()/180. ;
888 const Double_t phiMax=320.*TMath::Pi()/180. ;
890 AliVEvent* event = (AliVEvent*)InputEvent();
892 Int_t nPrim = fStack->GetEntriesFast() ;
893 //Fill Primary particl yields
895 for(Int_t i=0;i<nPrim;i++){
896 AliAODMCParticle * prim = (AliAODMCParticle*)fStack->At(i) ;
897 Double_t r2=prim->Xv()*prim->Xv()+prim->Yv()*prim->Yv() ;
901 Int_t pdg=prim->GetPdgCode() ;
904 snprintf(partName,30,"pi0") ;
907 snprintf(partName,30,"eta") ;
910 snprintf(partName,30,"gamma") ;
913 snprintf(partName,30,"K0s") ;
916 snprintf(partName,30,"Kpm") ;
919 snprintf(partName,30,"pipm") ;
922 snprintf(partName,30,"p") ;
925 snprintf(partName,30,"pbar") ;
928 snprintf(partName,30,"n") ;
931 snprintf(partName,30,"nbar") ;
936 Double_t phi=prim->Phi() ;
937 while(phi<0.)phi+=TMath::TwoPi() ;
938 while(phi>TMath::TwoPi())phi-=TMath::TwoPi() ;
939 Double_t pt=prim->Pt() ;
941 //Total number of pi0 with creation radius <1 cm
942 Double_t w = PrimaryParticleWeight(prim) ;
943 FillHistogram(Form("hMC_all_%s_cent%d",partName,fCentBin),pt,w) ;
944 if(TMath::Abs(prim->Y())<0.13){
945 FillHistogram(Form("hMC_phi_%s_cent%d",partName,fCentBin),phi,w) ;
946 if(phi>phiMin && phi<phiMax){
947 FillHistogram(Form("hMC_unitEta_%s_cent%d",partName,fCentBin),pt,w) ;
948 if(prim->GetMother()>-1){
949 AliAODMCParticle * primGM = (AliAODMCParticle*)fStack->At(prim->GetMother()) ;
950 if(primGM->GetPdgCode()==111)
951 FillHistogram(Form("hMC_unitEta_GammaPi0_cent%d",fCentBin),pt,w) ;
956 FillHistogram(Form("hMC_rap_%s_cent%d",partName,fCentBin),prim->Y(),w) ;
959 FillHistogram("hMCpi0_ptrap",pt,prim->Y(),w) ;
960 FillHistogram("hMCpi0_ptphi",pt,phi,w) ;
963 FillHistogram("hMCgamma_ptrap",pt,prim->Y(),w) ;
964 FillHistogram("hMCgamma_ptphi",pt,phi,w) ;
971 //Clussify reconstructed clusters
972 //First - photons (from vertex) and contaminations
973 //Second - photons from different sources
974 //Third - photons from pi0s - missed for different reasons
976 const Int_t n=fPHOSEvent->GetEntriesFast() ;
977 for(Int_t i=0;i<n;i++){
978 AliCaloPhoton *p = static_cast<AliCaloPhoton*>(fPHOSEvent->At(i));
979 Int_t label=p->GetPrimary() ;
980 if(label<0){ //No label!
981 FillHistogram("hMCRecNoLabel",p->Pt(),p->GetWeight());
986 AliAODMCParticle * prim = (AliAODMCParticle*)fStack->At(p->GetPrimary()) ;
987 //Look what particle left virtex
988 Int_t iparent=p->GetPrimary();
989 AliAODMCParticle * parent = prim;
990 while(parent->Xv()*parent->Xv()+parent->Yv()*parent->Yv() > rcut*rcut){
991 iparent=parent->GetMother();
994 parent = (AliAODMCParticle*)fStack->At(iparent) ;
996 Int_t parentPDG=parent->GetPdgCode() ;
997 Int_t iFidArea=p->GetFiducialArea();
999 case 22: //electron/positron conversion
1000 FillPIDHistograms("hMCRecPhoton",p); //Reconstructed with photon from conversion primary
1002 FillPIDHistograms("hMCRecPhoton_Area1",p);
1004 FillPIDHistograms("hMCRecPhoton_Area2",p);
1006 FillPIDHistograms("hMCRecPhoton_Area3",p);
1012 case -11: //electron/positron conversion
1013 FillPIDHistograms("hMCRecE",p); //Reconstructed with photon from conversion primary
1016 FillPIDHistograms("hMCRecPbar",p); //Reconstructed with photon from antibaryon annihilation
1018 case -2112: //antineutron & antiproton conversion
1019 FillPIDHistograms("hMCRecNbar",p); //Reconstructed with photon from antibaryon annihilation
1023 FillPIDHistograms("hMCRecPipm",p); //Reconstructed with photon from antibaryon annihilation
1026 FillPIDHistograms("hMCRecP",p); //Reconstructed with photon from antibaryon annihilation
1030 FillPIDHistograms("hMCRecKpm",p); //Reconstructed with photon from conversion primary
1033 FillPIDHistograms("hMCRecK0s",p); //Reconstructed with photon from conversion primary
1035 case 2112: //antineutron & antiproton conversion
1036 FillPIDHistograms("hMCRecN",p); //Reconstructed with photon from antibaryon annihilation
1038 case -1: //direct photon or no primary
1039 FillPIDHistograms("hMCRecNoPRim",p);
1042 if(parent->Charge()!=0)
1043 FillPIDHistograms("hMCRecCharg",p); //Reconstructed with photon from antibaryon annihilation
1045 FillPIDHistograms("hMCRecNeutral",p); //Reconstructed with photon from antibaryon annihilation
1049 //Now classify decay photon
1051 Int_t iGrandParent=parent->GetMother();
1052 if(iGrandParent<0 || iGrandParent>=fStack->GetEntriesFast()){
1053 FillPIDHistograms("hMCRecPhotNoPrim",p);
1056 AliAODMCParticle * grandParent = (AliAODMCParticle*)fStack->At(iGrandParent) ;
1057 Int_t grandParentPDG=grandParent->GetPdgCode() ;
1058 switch(grandParentPDG){
1060 FillPIDHistograms("hMCRecPhotPi0",p);
1062 case 221: //eta decay
1063 FillPIDHistograms("hMCRecPhotEta",p);
1065 case 223: //omega meson decay
1066 FillPIDHistograms("hMCRecPhotOmega",p);
1069 FillPIDHistograms("hMCRecPhotOther",p);
1071 //--------consider pi0 decays--------------------
1072 if(grandParentPDG==111){
1073 //First find which daughter is our cluster
1074 //iparent - index of curent photon
1075 Int_t ipartner=grandParent->GetDaughter(0) ;
1076 if(ipartner==iparent){//look for other
1077 if(grandParent->GetNDaughters()>1){
1078 ipartner=grandParent->GetDaughter(1);
1084 //There is no partner in stack
1086 FillPIDHistograms("hMCDecWMisPartnStack",p) ;
1089 AliAODMCParticle * partner = (AliAODMCParticle *)fStack->At(ipartner);
1090 //Check if partner is registered and made correct mass
1091 //If not - trace the reason
1092 AliCaloPhoton *pp = 0x0 ;
1094 for(Int_t ii=0;ii<n;ii++){
1096 AliCaloPhoton * tmp = static_cast<AliCaloPhoton*>(fPHOSEvent->At(ii));
1097 Int_t ipartnPrim = tmp->GetPrimary() ;
1098 while(ipartnPrim>-1){
1099 if(ipartnPrim==ipartner){
1102 ipartnPrim = ((AliAODMCParticle *)fStack->At(ipartnPrim))->GetMother();
1104 if(ipartnPrim==ipartner){
1110 //Partner reconstructed, but did not pass cuts
1111 FillPIDHistograms("hMCDecWRecUniqPartn",p) ;
1113 //Partner not found. Check if it is not dominant contributor?
1115 for(Int_t ii=0;(ii<n) && (!pp);ii++){
1117 AliCaloPhoton * tmp = static_cast<AliCaloPhoton*>(fPHOSEvent->At(ii));
1118 Int_t iCaloCluster=tmp->GetBC();//index of AODCaloCluster
1119 AliVCluster * clu = event->GetCaloCluster(iCaloCluster);
1120 Int_t nCluPrimaries = clu->GetNLabels() ;
1121 for(Int_t iAODLabel=0; (iAODLabel<nCluPrimaries) && (!pp); iAODLabel++){
1122 Int_t ipartnPrim = clu->GetLabelAt(iAODLabel) ;
1123 while(ipartnPrim>-1){
1124 if(ipartnPrim==ipartner){
1127 ipartnPrim = ((AliAODMCParticle *)fStack->At(ipartnPrim))->GetMother();
1129 if(ipartnPrim==ipartner){
1136 //If partner still not found, check if it is in same cluster
1138 Int_t iCaloCluster=p->GetBC();//index of AODCaloCluster
1139 AliVCluster * clu = event->GetCaloCluster(iCaloCluster);
1140 Int_t nCluPrimaries = clu->GetNLabels() ;
1141 for(Int_t iAODLabel=0; iAODLabel<nCluPrimaries ; iAODLabel++){
1142 Int_t ipartnPrim = clu->GetLabelAt(iAODLabel) ;
1143 while(ipartnPrim>-1){
1144 if(ipartnPrim==ipartner){
1147 ipartnPrim = ((AliAODMCParticle *)fStack->At(ipartnPrim))->GetMother();
1149 if(ipartnPrim==ipartner){ //yes, this cluster contains both primary
1150 if(clu->GetNExMax()<2){ //was not unfolded
1151 FillPIDHistograms("hMCDecMerged",p) ;
1154 FillPIDHistograms("hMCDecUnfolded",p) ;
1161 //Partner reconstructed, but did not pass cuts
1162 FillPIDHistograms("hMCDecWRecPartn",p) ;
1163 Double_t invMass=(*p+ *pp).M() ;
1164 FillHistogram(Form("hMCmass_cent%d",fCentBin),invMass,p->Pt(),p->GetWeight()) ;
1165 Double_t nSigma=InPi0Band(invMass,p->Pt()) ;
1167 for(Int_t eminType=0; eminType<3; eminType++){
1168 if(pp->E()>0.1*(eminType+1)){
1169 for(Int_t isigma=0; isigma<3; isigma++){
1170 if(nSigma<1.+isigma){
1171 Int_t iType=3*eminType+isigma ;
1172 FillPIDHistograms(Form("hMCDecWithFoundPartnType%d",iType),p) ;
1178 FillPIDHistograms("hMCDecWithWrongMass",p) ;
1181 else{//Partner not reconstructed
1182 if(partner->GetPdgCode()==22){
1183 Bool_t isPartnerLost=kFALSE; //If partner is lost for some reason
1185 //Check if partner miss PHOS
1187 Double_t ztmp=0.,xtmp=0. ;
1188 Double_t vtx[3]={partner->Xv(),partner->Yv(),partner->Zv()} ;
1189 Bool_t impact=fPHOSgeom->ImpactOnEmc(vtx,partner->Theta(),partner->Phi(),modulenum,ztmp,xtmp) ;
1191 if(impact){//still check bad map
1193 fPHOSgeom->RelPosToRelId(modulenum,xtmp,ztmp,relId) ;
1194 if ( !IsGoodChannel(modulenum,relId[2],relId[3]) ) {
1199 if(!impact){ //this photon cannot hit PHOS
1200 FillPIDHistograms("hMCDecWMisPartnAccept",p) ; //Spectrum of tagged with missed partner
1202 FillPIDHistograms("hMCDecWMisPartnAcceptFA1",p) ; //Spectrum of tagged with missed partner
1204 FillPIDHistograms("hMCDecWMisPartnAcceptFA2",p) ; //Spectrum of tagged with missed partner
1206 FillPIDHistograms("hMCDecWMisPartnAcceptFA3",p) ; //Spectrum of tagged with missed partner
1210 isPartnerLost=kTRUE;
1214 //this photon is converted before it is registered
1215 if(partner->GetNDaughters()>0){
1216 AliAODMCParticle* tmpP=(AliAODMCParticle*)fStack->At(partner->GetDaughter(0));
1217 if(tmpP->Xv()*tmpP->Xv()+tmpP->Yv()*tmpP->Yv()<450.*450.){
1218 FillPIDHistograms("hMCDecWMisPartnConv",p) ; //Spectrum of tagged with missed partner
1219 isPartnerLost=kTRUE;
1223 if(!isPartnerLost &&
1224 partner->E()<0.3){ //energy is not enough to be registered by PHOS
1225 FillPIDHistograms("hMCDecWMisPartnEmin",p) ; //Spectrum of tagged with missed partner
1226 isPartnerLost=kTRUE;
1228 if(!isPartnerLost){ //Reason not found!!!!!
1229 FillPIDHistograms("hMCDecWMisPartnOther",p);
1230 Int_t multClust = event->GetNumberOfCaloClusters();
1231 for (Int_t iclu=0; (iclu<multClust) && (!isPartnerLost); iclu++) {
1232 AliVCluster * clu = event->GetCaloCluster(iclu);
1235 if(clu->E()==p->E()) //same cluster as current
1237 Int_t nCluPrimaries = clu->GetNLabels() ;
1238 for(Int_t iAODLabel=0; (iAODLabel<nCluPrimaries) && (!isPartnerLost); iAODLabel++){
1239 Int_t ipartnPrim = clu->GetLabelAt(iAODLabel) ;
1240 while(ipartnPrim>-1){
1241 if(ipartnPrim==ipartner)
1243 ipartnPrim = ((AliAODMCParticle *)fStack->At(ipartnPrim))->GetMother();
1245 if(ipartnPrim==ipartner){
1246 isPartnerLost=kTRUE;
1251 if(isPartnerLost){//Did not pass default cuts
1252 FillPIDHistograms("hMCDecWMisPartnDefCuts",p);
1255 else{//Sum of all missed partners
1256 FillPIDHistograms("hMCDecWMisPartnAll",p);
1259 else{//partner not photon
1260 FillPIDHistograms("hMCDecWMisPartnNPhot",p);
1263 }//Partner not reconstructed
1265 }//photon from pi0 decay
1271 //________________________________________________
1272 void AliAnalysisTaskTaggedPhotons::FillTaggingHistos(){
1273 //Fill all necessary histograms
1276 //First fill invariant mass distrubutions and mark tagged photons
1277 //Invariant Mass analysis
1278 const Int_t n=fPHOSEvent->GetEntriesFast() ;
1279 for(Int_t i=0;i<n-1;i++){
1280 AliCaloPhoton *p1 = static_cast<AliCaloPhoton*>(fPHOSEvent->At(i));
1281 for(Int_t j = i+1 ; j < n ; j++) {
1282 AliCaloPhoton * p2 = static_cast<AliCaloPhoton*>(fPHOSEvent->At(j));
1284 Double_t invMass = (*p1 + *p2).M();
1286 Double_t nsigma1 = InPi0Band(invMass,p1->Pt()) ; //in band with n sigmas
1287 Double_t nsigma2 = InPi0Band(invMass,p2->Pt()) ; //in band with n sigmas
1289 if((p1->E()>0.1) && (p2->E()>0.1)){
1290 FillPIDHistograms("hInvM_Re_Emin1",p1,p2,invMass,kTRUE) ;
1291 if((p1->E()>0.2) && (p2->E()>0.2)){
1292 FillPIDHistograms("hInvM_Re_Emin2",p1,p2,invMass,kTRUE) ;
1293 if((p1->E()>0.3) && (p2->E()>0.3)){
1294 FillPIDHistograms("hInvM_Re_Emin3",p1,p2,invMass,kTRUE) ;
1296 //Fill izolated pi0s
1297 if(nsigma1<2 || nsigma2<2){ //2 sigma band
1298 TLorentzVector pi0=*p1+*p2 ;
1299 Int_t isolation=EvalIsolation(&pi0,0) ;
1300 for(Int_t kind=1; kind<33; kind*=2){
1301 if((isolation&kind)){
1302 FillHistogram(Form("hPi_Isolation%d_cent%d",kind,fCentBin),pi0.Pt()) ;
1313 FillPIDHistograms("hSingleInvM_Re_Emin1",p1,invMass) ;
1315 FillPIDHistograms("hSingleInvM_Re_Emin2",p1,invMass) ;
1317 FillPIDHistograms("hSingleInvM_Re_Emin3",p1,invMass) ;
1323 FillPIDHistograms("hSingleInvM_Re_Emin1",p2,invMass) ;
1325 FillPIDHistograms("hSingleInvM_Re_Emin2",p2,invMass) ;
1327 FillPIDHistograms("hSingleInvM_Re_Emin3",p2,invMass) ;
1333 FillPIDHistograms("hSingleInvM_Re_Emin1_Strict",p1,invMass) ;
1335 FillPIDHistograms("hSingleInvM_Re_Emin2_Strict",p1,invMass) ;
1337 FillPIDHistograms("hSingleInvM_Re_Emin3_Strict",p1,invMass) ;
1344 FillPIDHistograms("hSingleInvM_Re_Emin1_Strict",p2,invMass) ;
1346 FillPIDHistograms("hSingleInvM_Re_Emin2_Strict",p2,invMass) ;
1348 FillPIDHistograms("hSingleInvM_Re_Emin3_Strict",p2,invMass) ;
1353 if(IsSameParent(p1,p2)==111){
1354 FillPIDHistograms("hMC_InvM_Re",p1,invMass) ;
1355 FillPIDHistograms("hMC_InvM_Re",p2,invMass) ;
1357 FillPIDHistograms("hMC_InvM_Re_Strict",p1,invMass) ;
1360 FillPIDHistograms("hMC_InvM_Re_Strict",p2,invMass) ;
1364 //Tagging: 1,2,3 sigma
1365 //Emin=100,200,300 Mev
1366 //InPi0Band(mass, Ptphoton, type Emin cut
1367 //Set Bits to 1 if tagged
1369 for(Int_t eminType=0; eminType<3; eminType++){
1370 if(p2->E()>0.1*(eminType+1)){
1371 //Set corresponding bit
1372 for(Int_t isigma=0; isigma<3; isigma++){
1373 if(nsigma1<1+isigma){
1374 tag1|= (1 << (3*eminType+isigma)) ;
1376 tag1|= (1 << (3*eminType+isigma+9)) ;
1381 Int_t oldTag1=p1->GetTagInfo() ;
1382 for(Int_t ibit=0; ibit<18; ibit++){
1383 if(((oldTag1 & (1<<ibit))!=0) && //Already tagged
1384 ((tag1 & (1<<ibit))!=0)){//Multiple tagging
1385 Int_t iFidArea = p1->GetFiducialArea();
1387 FillPIDHistograms(Form("hPhot_TaggedMult%d_Area1",ibit),p1) ;
1389 FillPIDHistograms(Form("hPhot_TaggedMult%d_Area2",ibit),p1) ;
1391 FillPIDHistograms(Form("hPhot_TaggedMult%d_Area3",ibit),p1) ;
1398 p1->SetTagInfo(tag1) ;
1400 for(Int_t eminType=0; eminType<3; eminType++){
1401 if(p1->E()>0.1*(eminType+1)){
1402 //Set corresponding bit
1403 for(Int_t isigma=0; isigma<3; isigma++){
1404 if(nsigma2<1+isigma){
1405 tag2|= (1 << (3*eminType+isigma)) ;
1407 tag2|= (1 << (3*eminType+isigma+9)) ;
1412 Int_t oldTag2=p2->GetTagInfo() ;
1413 for(Int_t ibit=0; ibit<18; ibit++){
1414 if(((oldTag2 & (1<<ibit))!=0) && //Already tagged
1415 ((tag2 & (1<<ibit))!=0)){//Multiple tagging
1416 Int_t iFidArea = p2->GetFiducialArea();
1418 FillPIDHistograms(Form("hPhot_TaggedMult%d_Area1",ibit),p2) ;
1420 FillPIDHistograms(Form("hPhot_TaggedMult%d_Area2",ibit),p2) ;
1422 FillPIDHistograms(Form("hPhot_TaggedMult%d_Area3",ibit),p2) ;
1429 p2->SetTagInfo(tag2) ;
1431 Bool_t trueTag=(IsSameParent(p1,p2)==111); //true tag
1432 p1->SetUnfolded(p1->IsntUnfolded()|trueTag) ;
1433 p2->SetUnfolded(p2->IsntUnfolded()|trueTag) ;
1440 //Single particle histgams
1441 for(Int_t i=0;i<n;i++){
1442 AliCaloPhoton *p = static_cast<AliCaloPhoton*>(fPHOSEvent->At(i));
1444 Int_t isolation = p->GetIsolationTag();
1447 FillPIDHistograms("hPhot",p) ;
1449 if(p->DistToBad()>1){
1450 FillPIDHistograms("hPhot_Dist2",p) ;
1451 if(p->DistToBad()>2){
1452 FillPIDHistograms("hPhot_Dist3",p) ;
1457 for(Int_t kind=1; kind<33; kind*=2){
1458 if((isolation&kind)){
1459 FillPIDHistograms(Form("hPhot_Isolation%d",kind),p) ;
1463 Int_t iFidArea = p->GetFiducialArea();
1465 FillPIDHistograms("hPhot_Area1",p) ;
1466 for(Int_t kind=1; kind<33; kind*=2){
1467 if((isolation&kind)){
1468 FillPIDHistograms(Form("hPhot_Isolation%d_Area1",kind),p) ;
1472 //Fill taggings with
1474 //Default Emin, 1,2,3 sigmas
1475 //strict and loose PID cut on partner
1476 Int_t tag=p->GetTagInfo() ;
1477 for(Int_t ibit=0; ibit<18; ibit++){
1478 if((tag & (1<<ibit))!=0){
1479 FillPIDHistograms(Form("hPhot_Tagged%d_Area1",ibit),p) ;
1480 if(p->IsntUnfolded()) //true tag
1481 FillPIDHistograms(Form("hPhot_TrueTagged%d",ibit),p) ;
1487 FillPIDHistograms("hPhot_Area2",p) ;
1488 for(Int_t ibit=0; ibit<18; ibit++){
1489 if((tag & (1<<ibit))!=0){
1490 FillPIDHistograms(Form("hPhot_Tagged%d_Area2",ibit),p) ;
1494 FillPIDHistograms("hPhot_Area3",p) ;
1495 for(Int_t ibit=0; ibit<18; ibit++){
1496 if((tag & (1<<ibit))!=0){
1497 FillPIDHistograms(Form("hPhot_Tagged%d_Area3",ibit),p) ;
1505 //Fill Mixed InvMass distributions:
1506 TIter nextEv(fCurrentMixedList) ;
1507 for(Int_t i=0;i<n;i++){
1508 AliCaloPhoton *p1 = static_cast<AliCaloPhoton*>(fPHOSEvent->At(i));
1509 while(TClonesArray * event2 = static_cast<TClonesArray*>(nextEv())){
1510 Int_t nPhotons2 = event2->GetEntriesFast() ;
1511 for(Int_t j=0; j < nPhotons2 ; j++){
1512 AliCaloPhoton * p2 = static_cast<AliCaloPhoton*>(event2->At(j)) ;
1513 Double_t invMass = (*p1 + *p2).M();
1515 if((p1->E()>0.1) && (p2->E()>0.1)){
1516 FillPIDHistograms("hInvM_Mi_Emin1",p1,p2,invMass,kFALSE) ;
1517 if((p1->E())>0.2 && (p2->E()>0.2)){
1518 FillPIDHistograms("hInvM_Mi_Emin2",p1,p2,invMass,kFALSE) ;
1519 if((p1->E())>0.3 && (p2->E()>0.3)){
1520 FillPIDHistograms("hInvM_Mi_Emin3",p1,p2,invMass,kFALSE) ;
1527 FillPIDHistograms("hSingleInvM_Mi_Emin1",p1,invMass) ;
1529 FillPIDHistograms("hSingleInvM_Mi_Emin2",p1,invMass) ;
1531 FillPIDHistograms("hSingleInvM_Mi_Emin3",p1,invMass) ;
1537 FillPIDHistograms("hSingleInvM_Mi_Emin1_Strict",p1,invMass) ;
1539 FillPIDHistograms("hSingleInvM_Mi_Emin2_Strict",p1,invMass) ;
1541 FillPIDHistograms("hSingleInvM_Mi_Emin3_Strict",p1,invMass) ;
1548 FillPIDHistograms("hSingleInvM_Mi_Emin1",p2,invMass) ;
1550 FillPIDHistograms("hSingleInvM_Mi_Emin2",p2,invMass) ;
1552 FillPIDHistograms("hSingleInvM_Mi_Emin3",p2,invMass) ;
1558 FillPIDHistograms("hSingleInvM_Mi_Emin1_Strict",p2,invMass) ;
1560 FillPIDHistograms("hSingleInvM_Mi_Emin2_Strict",p2,invMass) ;
1562 FillPIDHistograms("hSingleInvM_Mi_Emin3_Strict",p2,invMass) ;
1573 //______________________________________________________________________________
1574 void AliAnalysisTaskTaggedPhotons::Init()
1576 // Intialisation of parameters
1579 //______________________________________________________________________________
1580 void AliAnalysisTaskTaggedPhotons::Terminate(Option_t *)
1582 // Processing when the event loop is ended
1583 if (fDebug > 1) Printf("Terminate()");
1585 //______________________________________________________________________________
1586 Double_t AliAnalysisTaskTaggedPhotons::InPi0Band(Double_t m, Double_t pt)const
1588 //Parameterization of the pi0 peak region
1590 // Double_t mpi0mean = 0.13447 - 1.41259e-03 * TMath::Exp(-pt/1.30044) ;
1591 //Parameterization of data 30.08.2014
1592 Double_t mpi0mean = 0.135 ;
1594 //Double_t mpi0sigma=TMath::Sqrt(5.22245e-03*5.22245e-03 +2.86851e-03*2.86851e-03/pt) + 9.09932e-05*pt ;
1595 //Parameterization of data 30.08.2014
1596 Double_t mpi0sigma=TMath::Sqrt(4.67491e-03*4.67491e-03 +3.42884e-03*3.42884e-03/pt) + 1.24324e-04*pt ;
1598 return TMath::Abs(m-mpi0mean)/mpi0sigma ;
1600 //______________________________________________________________________________
1601 Int_t AliAnalysisTaskTaggedPhotons::IsSameParent(const AliCaloPhoton *p1, const AliCaloPhoton *p2)const{
1602 //Looks through parents and finds if there was commont pi0 among ancestors
1605 return 0 ; //can not say anything
1607 Int_t prim1 = p1->GetPrimary();
1609 Int_t prim2 = p2->GetPrimary();
1613 return ((AliAODMCParticle*)fStack->At(prim1))->GetPdgCode() ;
1615 prim2=((AliAODMCParticle*)fStack->At(prim2))->GetMother() ;
1617 prim1=((AliAODMCParticle*)fStack->At(prim1))->GetMother() ;
1621 //______________________________________________________________________________
1622 Int_t AliAnalysisTaskTaggedPhotons::GetFiducialArea(const Float_t * position)const{
1623 //calculates in which kind of fiducial area photon hit
1625 TVector3 global1(position) ;
1627 fPHOSgeom->GlobalPos2RelId(global1,relId) ;
1628 // Int_t mod = relId[0] ;
1629 Int_t cellX = relId[2];
1630 Int_t cellZ = relId[3] ;
1632 //New we are in good channel,
1633 //calculate distance to the closest group of bad channels
1634 const Int_t cut1=10;
1635 const Int_t cut2=15;
1636 //For 3-mod configuration
1637 // if((mod==3 && cellX<=cut1) || (mod==1 && cellX>=65-cut1) || cellZ<=cut1 || cellZ>=57-cut1)
1638 //For 1+3 configuraion
1639 if( cellX<=cut1 || cellX>=65-cut1 || cellZ<=cut1 || cellZ>=57-cut1)
1641 // //and from large dead area
1642 //Full configuration
1643 // if((mod==3 && cellX<=cut2) || (mod==1 && cellX>=65-cut2) || cellZ<=cut2 || cellZ>=57-cut2)
1645 if( cellX<=cut2 || cellX>=65-cut2 || cellZ<=cut2 || cellZ>=57-cut2)
1651 //______________________________________________________________________________^M
1652 void AliAnalysisTaskTaggedPhotons::InitGeometry(){
1653 //Rotation matrixes are set with Tender
1655 if(fPHOSgeom) return ;
1658 fPHOSgeom = AliPHOSGeometry::GetInstance() ;
1660 if(!fPHOSgeom){ //Geometry not yet constructed with Tender
1661 fPHOSgeom = AliPHOSGeometry::GetInstance("IHEP","");
1663 AliOADBContainer geomContainer("phosGeo");
1664 geomContainer.InitFromFile("$ALICE_ROOT/OADB/PHOS/PHOSGeometry.root","PHOSRotationMatrixes");
1665 TObjArray *matrixes = (TObjArray*)geomContainer.GetObject(170000,"PHOSRotationMatrixes");
1666 for(Int_t mod=0; mod<5; mod++) {
1667 if(!matrixes->At(mod)) continue;
1668 fPHOSgeom->SetMisalMatrix(((TGeoHMatrix*)matrixes->At(mod)),mod) ;
1672 //Read BadMap for MC simulations
1673 Int_t runNumber=196208 ; //LHC13bcdef
1674 AliOADBContainer badmapContainer(Form("phosBadMap"));
1675 badmapContainer.InitFromFile("$ALICE_ROOT/OADB/PHOS/PHOSBadMaps.root","phosBadMap");
1676 TObjArray *maps = (TObjArray*)badmapContainer.GetObject(runNumber,"phosBadMap");
1678 AliError("TaggedPhotons: Can not read Bad map\n") ;
1681 AliInfo(Form("TaggedPhotons: Setting PHOS bad map with name %s \n",maps->GetName())) ;
1682 for(Int_t mod=0; mod<5;mod++){
1683 if(fPHOSBadMap[mod])
1684 delete fPHOSBadMap[mod] ;
1685 TH2I * h = (TH2I*)maps->At(mod) ;
1687 fPHOSBadMap[mod]=new TH2I(*h) ;
1691 //_____________________________________________________________________________
1692 void AliAnalysisTaskTaggedPhotons::FillHistogram(const char * key,Double_t x)const{
1694 TH1I * tmpI = dynamic_cast<TH1I*>(fOutputContainer->FindObject(key)) ;
1699 TH1F * tmpF = dynamic_cast<TH1F*>(fOutputContainer->FindObject(key)) ;
1704 TH1D * tmpD = dynamic_cast<TH1D*>(fOutputContainer->FindObject(key)) ;
1709 AliInfo(Form("can not find histogram <%s> ",key)) ;
1711 //_____________________________________________________________________________
1712 void AliAnalysisTaskTaggedPhotons::FillHistogram(const char * key,Double_t x,Double_t y)const{
1714 TObject * tmp = fOutputContainer->FindObject(key) ;
1716 AliInfo(Form("can not find histogram <%s> ",key)) ;
1719 if(tmp->IsA() == TClass::GetClass("TH1F")){
1720 ((TH1F*)tmp)->Fill(x,y) ;
1723 if(tmp->IsA() == TClass::GetClass("TH2F")){
1724 ((TH2F*)tmp)->Fill(x,y) ;
1727 AliError(Form("Calling FillHistogram with 2 parameters for histo <%s> of type %s",key,tmp->IsA()->GetName())) ;
1730 //_____________________________________________________________________________
1731 void AliAnalysisTaskTaggedPhotons::FillHistogram(const char * key,Double_t x,Double_t y, Double_t z) const{
1732 //Fills 1D histograms with key
1733 TObject * tmp = fOutputContainer->FindObject(key) ;
1735 AliInfo(Form("can not find histogram <%s> ",key)) ;
1738 if(tmp->IsA() == TClass::GetClass("TH2F")){
1739 ((TH2F*)tmp)->Fill(x,y,z) ;
1742 if(tmp->IsA() == TClass::GetClass("TH3F")){
1743 ((TH3F*)tmp)->Fill(x,y,z) ;
1747 //_____________________________________________________________________________
1748 void AliAnalysisTaskTaggedPhotons::FillPIDHistograms(const char * name, const AliCaloPhoton * p) const{
1750 FillHistogram(Form("%s_All_cent%d",name,fCentBin),p->Pt(),p->GetWeight()) ;
1752 FillHistogram(Form("%s_Disp_cent%d",name,fCentBin),p->Pt(),p->GetWeight()) ;
1754 FillHistogram(Form("%s_CPV_cent%d",name,fCentBin),p->Pt(),p->GetWeight()) ;
1755 if(p->IsDispOK() && p->IsCPVOK())
1756 FillHistogram(Form("%s_Both_cent%d",name,fCentBin),p->Pt(),p->GetWeight()) ;
1759 //_____________________________________________________________________________
1760 void AliAnalysisTaskTaggedPhotons::FillPIDHistograms(const char * name, const AliCaloPhoton * p,Double_t x) const{
1762 FillHistogram(Form("%s_All_cent%d",name,fCentBin),x,p->Pt(),p->GetWeight()) ;
1764 FillHistogram(Form("%s_Disp_cent%d",name,fCentBin),x,p->Pt(),p->GetWeight()) ;
1766 FillHistogram(Form("%s_CPV_cent%d",name,fCentBin),x,p->Pt(),p->GetWeight()) ;
1767 if(p->IsDispOK() && p->IsCPVOK())
1768 FillHistogram(Form("%s_Both_cent%d",name,fCentBin),x,p->Pt(),p->GetWeight()) ;
1771 //_____________________________________________________________________________
1772 void AliAnalysisTaskTaggedPhotons::FillPIDHistograms(const char * name, const AliCaloPhoton * p1,const AliCaloPhoton * p2,Double_t x, Bool_t /*isRe*/) const{
1774 Double_t ptPi = (*p1 + *p2).Pt() ;
1775 Double_t w=TMath::Sqrt(p1->GetWeight()*p2->GetWeight()) ;
1777 // Int_t pdg=IsSameParent(p1,p2) ;
1779 // w=p1->GetWeight() ;
1781 FillHistogram(Form("%s_All_cent%d",name,fCentBin),x,ptPi,w) ;
1782 if(p1->IsDispOK() && p2->IsDispOK())
1783 FillHistogram(Form("%s_Disp_cent%d",name,fCentBin),x,ptPi,w) ;
1784 if(p1->IsCPVOK() && p2->IsCPVOK())
1785 FillHistogram(Form("%s_CPV_cent%d",name,fCentBin),x,ptPi,w) ;
1786 if(p1->IsDispOK() && p1->IsCPVOK() && p2->IsDispOK() && p2->IsCPVOK())
1787 FillHistogram(Form("%s_Both_cent%d",name,fCentBin),x,ptPi,w) ;
1790 //_____________________________________________________________________________
1791 Bool_t AliAnalysisTaskTaggedPhotons::TestLambda(Double_t pt,Double_t l1,Double_t l2){
1793 Double_t l2Mean = 1.53126+9.50835e+06/(1.+1.08728e+07*pt+1.73420e+06*pt*pt) ;
1794 Double_t l1Mean = 1.12365+0.123770*TMath::Exp(-pt*0.246551)+5.30000e-03*pt ;
1795 Double_t l2Sigma = 6.48260e-02+7.60261e+10/(1.+1.53012e+11*pt+5.01265e+05*pt*pt)+9.00000e-03*pt;
1796 Double_t l1Sigma = 4.44719e-04+6.99839e-01/(1.+1.22497e+00*pt+6.78604e-07*pt*pt)+9.00000e-03*pt;
1797 Double_t c=-0.35-0.550*TMath::Exp(-0.390730*pt) ;
1798 Double_t R2=0.5*(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma +
1799 0.5*(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
1800 0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
1801 return (R2<2.5*2.5) ;
1804 //_________________________________________________________________________________
1805 Int_t AliAnalysisTaskTaggedPhotons::EvalIsolation(TLorentzVector * ph, Bool_t isPhoton){
1807 // Check if this particle is isolated.
1808 //We use several cone radii and epsilons.
1809 //As well we look at charged particles and EMCAL ones
1811 const Double_t coneR1=0.3 ;
1812 const Double_t coneR2=0.4 ;
1813 const Double_t coneR3=0.5 ;
1815 const Double_t cutEcone1=3. ;
1816 const Double_t cutEcone2=4.5 ;
1817 const Double_t cutEcone3=6.5 ;
1821 //Sum of energies in cones, tracks and clusters in EMCAL
1822 Double_t eCone1 = 0;
1823 Double_t eCone2 = 0;
1824 Double_t eCone3 = 0;
1825 //Cross-check, energy in cone perpr to photon
1826 Double_t eP1Cone1 = 0;
1827 Double_t eP1Cone2 = 0;
1828 Double_t eP1Cone3 = 0;
1829 Double_t eP2Cone1 = 0;
1830 Double_t eP2Cone2 = 0;
1831 Double_t eP2Cone3 = 0;
1834 Double_t phiTrig = ph->Phi();
1835 Double_t etaTrig = ph->Eta();
1837 Int_t n=fTrackEvent->GetEntriesFast() ;
1838 for(Int_t itr=0; itr<n; itr++){
1839 AliCaloPhoton * track = (AliCaloPhoton*)fTrackEvent->At(itr) ;
1841 Double_t deleta = etaTrig - track->Eta() ;
1842 Double_t delphi = phiTrig - track->Phi() ;
1843 while(delphi<-TMath::Pi()) delphi+=TMath::TwoPi() ;
1844 while(delphi>TMath::Pi()) delphi-=TMath::TwoPi() ;
1847 Double_t delphiP1 = phiTrig +TMath::PiOver2()- track->Phi() ;
1848 while(delphiP1<-TMath::Pi()) delphiP1+=TMath::TwoPi() ;
1849 while(delphiP1>TMath::Pi()) delphiP1-=TMath::TwoPi() ;
1850 Double_t delphiP2 = phiTrig -TMath::PiOver2()- track->Phi() ;
1851 while(delphiP2<-TMath::Pi()) delphiP2+=TMath::TwoPi() ;
1852 while(delphiP2>TMath::Pi()) delphiP2-=TMath::TwoPi() ;
1855 Double_t dr = TMath::Sqrt(deleta * deleta + delphi * delphi);
1856 Double_t drP1 = TMath::Sqrt(deleta * deleta + delphiP1 * delphiP1);
1857 Double_t drP2 = TMath::Sqrt(deleta * deleta + delphiP2 * delphiP2);
1860 eCone3+=track->Pt() ;
1862 eCone2+=track->Pt() ;
1864 eCone1+=track->Pt() ;
1870 eP1Cone3+=track->Pt() ;
1872 eP1Cone2+=track->Pt() ;
1874 eP1Cone1+=track->Pt() ;
1880 eP2Cone3+=track->Pt() ;
1882 eP2Cone2+=track->Pt() ;
1884 eP2Cone1+=track->Pt() ;
1891 Double_t ptTrig=ph->Pt() ;
1893 FillHistogram(Form("QA_Cone1_Tracks_cent%d",fCentBin),ptTrig,eCone1) ;
1894 FillHistogram(Form("QA_Cone2_Tracks_cent%d",fCentBin),ptTrig,eCone2) ;
1895 FillHistogram(Form("QA_Cone3_Tracks_cent%d",fCentBin),ptTrig,eCone3) ;
1896 FillHistogram(Form("QA_PCone1_Tracks_cent%d",fCentBin),ptTrig,eP1Cone1) ;
1897 FillHistogram(Form("QA_PCone2_Tracks_cent%d",fCentBin),ptTrig,eP1Cone2) ;
1898 FillHistogram(Form("QA_PCone3_Tracks_cent%d",fCentBin),ptTrig,eP1Cone3) ;
1899 FillHistogram(Form("QA_PCone1_Tracks_cent%d",fCentBin),ptTrig,eP2Cone1) ;
1900 FillHistogram(Form("QA_PCone2_Tracks_cent%d",fCentBin),ptTrig,eP2Cone2) ;
1901 FillHistogram(Form("QA_PCone3_Tracks_cent%d",fCentBin),ptTrig,eP2Cone3) ;
1904 FillHistogram(Form("QA_Pi0Cone1_Tracks_cent%d",fCentBin),ptTrig,eCone1) ;
1905 FillHistogram(Form("QA_Pi0Cone2_Tracks_cent%d",fCentBin),ptTrig,eCone2) ;
1906 FillHistogram(Form("QA_Pi0Cone3_Tracks_cent%d",fCentBin),ptTrig,eCone3) ;
1907 FillHistogram(Form("QA_Pi0PCone1_Tracks_cent%d",fCentBin),ptTrig,eP1Cone1) ;
1908 FillHistogram(Form("QA_Pi0PCone2_Tracks_cent%d",fCentBin),ptTrig,eP1Cone2) ;
1909 FillHistogram(Form("QA_Pi0PCone3_Tracks_cent%d",fCentBin),ptTrig,eP1Cone3) ;
1910 FillHistogram(Form("QA_Pi0PCone1_Tracks_cent%d",fCentBin),ptTrig,eP2Cone1) ;
1911 FillHistogram(Form("QA_Pi0PCone2_Tracks_cent%d",fCentBin),ptTrig,eP2Cone2) ;
1912 FillHistogram(Form("QA_Pi0PCone3_Tracks_cent%d",fCentBin),ptTrig,eP2Cone3) ;
1917 Int_t iCone1E1 = (cutEcone1 > eCone1) ;
1918 Int_t iCone2E1 = (cutEcone2 > eCone2) ;
1919 Int_t iCone3E1 = (cutEcone3 > eCone3) ;
1921 Int_t iCone1E2 = (1.5*cutEcone1 > eCone1) ;
1922 Int_t iCone2E2 = (1.5*cutEcone2 > eCone2) ;
1923 Int_t iCone3E2 = (1.5*cutEcone3 > eCone3) ;
1926 Int_t isolation= iCone1E1+ 2*iCone2E1 +4*iCone3E1+
1927 8*iCone1E2 +16*iCone2E2 +32*iCone3E2 ;
1930 //_________________________________________________________________________________
1931 Bool_t AliAnalysisTaskTaggedPhotons::TestPID(Int_t iPID, AliCaloPhoton* part){
1932 // //Checks PID of particle
1934 if(!part) return kFALSE ;
1935 if(iPID==0) return kTRUE ;
1936 if(iPID==1) return part->IsDispOK() ;
1937 if(iPID==2) return part->IsCPVOK() ;
1938 if(iPID==3) return part->IsDispOK() && part->IsCPVOK() ;
1942 //_________________________________________________________________________________
1943 Double_t AliAnalysisTaskTaggedPhotons::PrimaryParticleWeight(AliAODMCParticle * particle){
1944 if(!fIsMC) //This is real data
1946 //Classify parent at vertex
1947 //Introduce for eta and pi0 weights
1949 Double_t r2=particle->Xv()*particle->Xv()+particle->Yv()*particle->Yv() ;
1950 Int_t mother = particle->GetMother() ;
1954 particle = (AliAODMCParticle*) fStack->At(mother);
1955 mother = particle->GetMother() ;
1956 r2=particle->Xv()*particle->Xv()+particle->Yv()*particle->Yv() ;
1959 //Particle within 1 cm from the virtex
1960 Int_t pdg = particle->GetPdgCode() ;
1961 Double_t x = particle->Pt() ;
1962 mother = particle->GetMother() ;
1963 while(TMath::Abs(pdg)<100){//gamma, electrons, muons
1965 AliAODMCParticle * tmpP=(AliAODMCParticle*)fStack->At(mother) ;
1966 pdg=tmpP->GetPdgCode() ;
1968 mother = tmpP->GetMother() ;
1970 else{ //direct photon/electron....
1977 else return fWeightParamPi0[0]*(TMath::Power(x,fWeightParamPi0[1])*
1978 (1.+fWeightParamPi0[2]*x+fWeightParamPi0[3]*x*x)/
1979 (1.+fWeightParamPi0[4]*x+fWeightParamPi0[5]*x*x) +fWeightParamPi0[6]) ;
1982 //Eta - same same shape, but yield 0.48 and Br(eta->2gamma)
1983 Double_t norm=0.48 * 0.3943;
1984 if(x<1) return norm ;
1985 else return norm*fWeightParamPi0[0]*(TMath::Power(x,fWeightParamPi0[1])*
1986 (1.+fWeightParamPi0[2]*x+fWeightParamPi0[3]*x*x)/
1987 (1.+fWeightParamPi0[4]*x+fWeightParamPi0[5]*x*x) +fWeightParamPi0[6]) ;
1991 //_________________________________________________________________________________
1992 void AliAnalysisTaskTaggedPhotons::SetPi0WeightParameters(TArrayD * ar){
1994 for(Int_t i=0; i<7; i++){ //Array range
1995 if(ar->GetSize()>i) fWeightParamPi0[i]=ar->At(i) ;
1996 else fWeightParamPi0[i]=0.;
1998 //normalize to obtain smooth transition at 1 GeV
2000 fWeightParamPi0[0]=1./(TMath::Power(x,fWeightParamPi0[1])*
2001 (1.+fWeightParamPi0[2]*x+fWeightParamPi0[3]*x*x)/
2002 (1.+fWeightParamPi0[4]*x+fWeightParamPi0[5]*x*x) +fWeightParamPi0[6]) ;
2006 //___________________________________________________________________________
2007 Int_t AliAnalysisTaskTaggedPhotons::FindPrimary(AliVCluster*clu, Bool_t&sure){
2008 //Finds primary and estimates if it unique one?
2009 //First check can it be photon/electron
2010 const Double_t emFraction=0.9; //part of energy of cluster to be assigned to EM particle
2011 Int_t n=clu->GetNLabels() ;
2012 FillHistogram(Form("LabelsNPrim_cent%d",fCentBin),clu->E(),n) ;
2015 return clu->GetLabelAt(0) ;
2017 //Number of clusters with one or more photons
2018 Bool_t hasGamma=kFALSE ;
2020 for(Int_t i=0; i<n; i++){
2021 AliAODMCParticle* p= (AliAODMCParticle*)fStack->At(clu->GetLabelAt(i)) ;
2022 Int_t pdg = p->GetPdgCode() ;
2031 FillHistogram(Form("LabelsGamma_cent%d",fCentBin),clu->E()) ;
2032 FillHistogram(Form("LabelsGammaE_cent%d",fCentBin),clu->E(),eMax/clu->E()) ;
2035 for(Int_t i=0; i<n; i++){
2036 AliAODMCParticle* p= (AliAODMCParticle*) fStack->At(clu->GetLabelAt(i)) ;
2037 Int_t pdg = p->GetPdgCode() ;
2038 if(pdg==22 || pdg==11 || pdg == -11){
2039 if(p->E()>emFraction*clu->E()){
2041 return clu->GetLabelAt(i);
2046 Double_t* Ekin= new Double_t[n] ;
2047 for(Int_t i=0; i<n; i++){
2048 AliAODMCParticle* p=(AliAODMCParticle*) fStack->At(clu->GetLabelAt(i)) ;
2049 Ekin[i]=p->P() ; // estimate of kinetic energy
2050 if(p->GetPdgCode()==-2212 || p->GetPdgCode()==-2112){
2051 Ekin[i]+=1.8 ; //due to annihilation
2055 Double_t eSubMax=0. ;
2057 for(Int_t i=0; i<n; i++){
2064 if(eSubMax>0.8*eMax)//not obvious primary
2069 return clu->GetLabelAt(iMax) ;
2071 //___________________________________________________________________________
2072 Bool_t AliAnalysisTaskTaggedPhotons::IsGoodChannel(Int_t mod, Int_t ix, Int_t iz)
2074 //Check if this channel belogs to the good ones
2079 if(!fPHOSBadMap[mod]){
2082 if(fPHOSBadMap[mod]->GetBinContent(ix,iz)>0)