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 **************************************************************************/
17 //_________________________________________________________________________
18 // Class to collect two-photon invariant mass distributions for
19 // extractin raw pi0 yield.
21 //-- Author: Dmitri Peressounko (RRC "KI")
22 //-- Adapted to PartCorr frame by Lamia Benhabib (SUBATECH)
23 //-- and Gustavo Conesa (INFN-Frascati)
24 //_________________________________________________________________________
27 // --- ROOT system ---
30 //#include "Riostream.h"
34 #include "TClonesArray.h"
35 //#include "TObjString.h"
37 //---- AliRoot system ----
38 #include "AliAnaPi0.h"
39 #include "AliCaloTrackReader.h"
40 #include "AliCaloPID.h"
42 #include "AliFiducialCut.h"
43 #include "TParticle.h"
44 #include "AliAODCaloCluster.h"
45 #include "AliVEvent.h"
46 #include "AliESDCaloCluster.h"
47 #include "AliESDEvent.h"
48 #include "AliAODEvent.h"
49 #include "AliNeutralMesonSelection.h"
53 //________________________________________________________________________________________________________________________________________________
54 AliAnaPi0::AliAnaPi0() : AliAnaPartCorrBaseClass(),
55 fNCentrBin(0),fNZvertBin(0),fNrpBin(0),
56 fNPID(0),fNmaxMixEv(0), fZvtxCut(0.),fCalorimeter(""),
57 fNModules(12), fUseAngleCut(kFALSE), fEventsList(0x0), //fhEtalon(0x0),
58 fhReMod(0x0), fhRe1(0x0),fhMi1(0x0),fhRe2(0x0),fhMi2(0x0),fhRe3(0x0),fhMi3(0x0),fhEvents(0x0),
59 fhRealOpeningAngle(0x0),fhRealCosOpeningAngle(0x0),
60 fhPrimPt(0x0), fhPrimAccPt(0x0), fhPrimY(0x0), fhPrimAccY(0x0), fhPrimPhi(0x0), fhPrimAccPhi(0x0),
61 fhPrimOpeningAngle(0x0),fhPrimCosOpeningAngle(0x0)
68 //________________________________________________________________________________________________________________________________________________
69 AliAnaPi0::AliAnaPi0(const AliAnaPi0 & ex) : AliAnaPartCorrBaseClass(ex),
70 fNCentrBin(ex.fNCentrBin),fNZvertBin(ex.fNZvertBin),fNrpBin(ex.fNrpBin),
71 fNPID(ex.fNPID),fNmaxMixEv(ex.fNmaxMixEv),fZvtxCut(ex.fZvtxCut), fCalorimeter(ex.fCalorimeter),
72 fNModules(ex.fNModules), fUseAngleCut(ex.fUseAngleCut), fEventsList(0x0), //fhEtalon(ex.fhEtalon),
73 fhReMod(ex.fhReMod), fhRe1(ex.fhRe1),fhMi1(ex.fhMi1),fhRe2(ex.fhRe2),fhMi2(ex.fhMi2),
74 fhRe3(ex.fhRe3),fhMi3(ex.fhMi3),fhEvents(ex.fhEvents),
75 fhRealOpeningAngle(ex.fhRealOpeningAngle),fhRealCosOpeningAngle(ex.fhRealCosOpeningAngle),
76 fhPrimPt(ex.fhPrimPt), fhPrimAccPt(ex.fhPrimAccPt), fhPrimY(ex.fhPrimY),
77 fhPrimAccY(ex.fhPrimAccY), fhPrimPhi(ex.fhPrimPhi), fhPrimAccPhi(ex.fhPrimAccPhi),
78 fhPrimOpeningAngle(ex.fhPrimOpeningAngle),fhPrimCosOpeningAngle(ex.fhPrimCosOpeningAngle)
85 ////________________________________________________________________________________________________________________________________________________
86 //AliAnaPi0 & AliAnaPi0::operator = (const AliAnaPi0 & ex)
88 // // assignment operator
90 // if(this == &ex)return *this;
91 // ((AliAnaPartCorrBaseClass *)this)->operator=(ex);
93 // fNCentrBin = ex.fNCentrBin ; fNZvertBin = ex.fNZvertBin ; fNrpBin = ex.fNrpBin ;
94 // fNPID = ex.fNPID ; fNmaxMixEv = ex.fNmaxMixEv ; fZvtxCut = ex.fZvtxCut ; fCalorimeter = ex.fCalorimeter ;
95 // fNModules = ex.fNModules; fEventsList = ex.fEventsList ; //fhEtalon = ex.fhEtalon ;
96 // fhRe1 = ex.fhRe1 ; fhMi1 = ex.fhMi1 ; fhRe2 = ex.fhRe2 ; fhMi2 = ex.fhMi2 ; fhReMod = ex.fhReMod;
97 // fhRe3 = ex.fhRe3 ; fhMi3 = ex.fhMi3 ; fhEvents = ex.fhEvents ; fUseAngleCut = ex.fUseAngleCut;
98 // fhPrimPt = ex.fhPrimPt ; fhPrimAccPt = ex.fhPrimAccPt ; fhPrimY = ex.fhPrimY ;
99 // fhPrimAccY = ex.fhPrimAccY ; fhPrimPhi = ex.fhPrimPhi ; fhPrimAccPhi = ex.fhPrimAccPhi ;
100 // fhRealOpeningAngle = ex.fhRealOpeningAngle; fhRealCosOpeningAngle = ex.fhRealCosOpeningAngle;
101 // fhPrimOpeningAngle = ex.fhPrimOpeningAngle; fhPrimCosOpeningAngle = ex.fhPrimCosOpeningAngle;
107 //________________________________________________________________________________________________________________________________________________
108 AliAnaPi0::~AliAnaPi0() {
109 // Remove event containers
111 for(Int_t ic=0; ic<fNCentrBin; ic++){
112 for(Int_t iz=0; iz<fNZvertBin; iz++){
113 for(Int_t irp=0; irp<fNrpBin; irp++){
114 fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp]->Delete() ;
115 delete fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] ;
119 delete[] fEventsList;
125 //________________________________________________________________________________________________________________________________________________
126 void AliAnaPi0::InitParameters()
128 //Init parameters when first called the analysis
129 //Set default parameters
130 SetInputAODName("PWG4Particle");
132 AddToHistogramsName("AnaPi0_");
133 fNModules = 12; // set maximum to maximum number of EMCAL modules
140 fCalorimeter = "PHOS";
141 fUseAngleCut = kFALSE;
144 //________________________________________________________________________________________________________________________________________________
145 //void AliAnaPi0::Init()
147 //Init some data members needed in analysis
149 //Histograms binning and range
150 // if(!fhEtalon){ // p_T alpha d m_gg
151 // fhEtalon = new TH3D("hEtalon","Histo with binning parameters",50,0.,25.,10,0.,1.,200,0.,1.) ;
152 // fhEtalon->SetXTitle("P_{T} (GeV)") ;
153 // fhEtalon->SetYTitle("#alpha") ;
154 // fhEtalon->SetZTitle("m_{#gamma#gamma} (GeV)") ;
159 //________________________________________________________________________________________________________________________________________________
160 TList * AliAnaPi0::GetCreateOutputObjects()
162 // Create histograms to be saved in output file and
163 // store them in fOutputContainer
165 //create event containers
166 fEventsList = new TList*[fNCentrBin*fNZvertBin*fNrpBin] ;
168 for(Int_t ic=0; ic<fNCentrBin; ic++){
169 for(Int_t iz=0; iz<fNZvertBin; iz++){
170 for(Int_t irp=0; irp<fNrpBin; irp++){
171 fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] = new TList() ;
176 TList * outputContainer = new TList() ;
177 outputContainer->SetName(GetName());
179 fhReMod = new TH3D*[fNModules] ;
180 fhRe1 = new TH3D*[fNCentrBin*fNPID] ;
181 fhRe2 = new TH3D*[fNCentrBin*fNPID] ;
182 fhRe3 = new TH3D*[fNCentrBin*fNPID] ;
183 fhMi1 = new TH3D*[fNCentrBin*fNPID] ;
184 fhMi2 = new TH3D*[fNCentrBin*fNPID] ;
185 fhMi3 = new TH3D*[fNCentrBin*fNPID] ;
189 Int_t nptbins = GetHistoPtBins();
190 Int_t nphibins = GetHistoPhiBins();
191 Int_t netabins = GetHistoEtaBins();
192 Float_t ptmax = GetHistoPtMax();
193 Float_t phimax = GetHistoPhiMax();
194 Float_t etamax = GetHistoEtaMax();
195 Float_t ptmin = GetHistoPtMin();
196 Float_t phimin = GetHistoPhiMin();
197 Float_t etamin = GetHistoEtaMin();
199 Int_t nmassbins = GetHistoMassBins();
200 Int_t nasymbins = GetHistoAsymmetryBins();
201 Float_t massmax = GetHistoMassMax();
202 Float_t asymmax = GetHistoAsymmetryMax();
203 Float_t massmin = GetHistoMassMin();
204 Float_t asymmin = GetHistoAsymmetryMin();
206 for(Int_t ic=0; ic<fNCentrBin; ic++){
207 for(Int_t ipid=0; ipid<fNPID; ipid++){
209 //Distance to bad module 1
210 sprintf(key,"hRe_cen%d_pid%d_dist1",ic,ipid) ;
211 sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
213 //fhEtalon->Clone(key);
214 //fhRe1[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
215 //fhRe1[ic*fNPID+ipid]->SetName(key) ;
216 //fhRe1[ic*fNPID+ipid]->SetTitle(title) ;
217 fhRe1[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ;
218 outputContainer->Add(fhRe1[ic*fNPID+ipid]) ;
220 sprintf(key,"hMi_cen%d_pid%d_dist1",ic,ipid) ;
221 sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
222 //fhMi1[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
223 //fhMi1[ic*fNPID+ipid]->SetName(key) ;
224 //fhMi1[ic*fNPID+ipid]->SetTitle(title) ;
225 fhMi1[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ;
226 outputContainer->Add(fhMi1[ic*fNPID+ipid]) ;
228 //Distance to bad module 2
229 sprintf(key,"hRe_cen%d_pid%d_dist2",ic,ipid) ;
230 sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
231 //fhRe2[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
232 //fhRe2[ic*fNPID+ipid]->SetName(key) ;
233 //fhRe2[ic*fNPID+ipid]->SetTitle(title) ;
234 fhRe2[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ;
235 outputContainer->Add(fhRe2[ic*fNPID+ipid]) ;
237 sprintf(key,"hMi_cen%d_pid%d_dist2",ic,ipid) ;
238 sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
239 //fhMi2[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
240 //fhMi2[ic*fNPID+ipid]->SetName(key) ;
241 //fhMi2[ic*fNPID+ipid]->SetTitle(title) ;
242 fhMi2[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ;
243 outputContainer->Add(fhMi2[ic*fNPID+ipid]) ;
245 //Distance to bad module 3
246 sprintf(key,"hRe_cen%d_pid%d_dist3",ic,ipid) ;
247 sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
248 //fhRe3[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
249 //fhRe3[ic*fNPID+ipid]->SetName(key) ;
250 //fhRe3[ic*fNPID+ipid]->SetTitle(title) ;
251 fhRe3[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ;
252 outputContainer->Add(fhRe3[ic*fNPID+ipid]) ;
254 sprintf(key,"hMi_cen%d_pid%d_dist3",ic,ipid) ;
255 sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
256 //fhMi3[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
257 //fhMi3[ic*fNPID+ipid]->SetName(key) ;
258 //fhMi3[ic*fNPID+ipid]->SetTitle(title) ;
259 fhMi3[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ;
260 outputContainer->Add(fhMi3[ic*fNPID+ipid]) ;
265 fhEvents=new TH3D("hEvents","Number of events",fNCentrBin,0.,1.*fNCentrBin,
266 fNZvertBin,0.,1.*fNZvertBin,fNrpBin,0.,1.*fNrpBin) ;
267 outputContainer->Add(fhEvents) ;
270 fhRealOpeningAngle = new TH2D
271 ("hRealOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,200,0,0.5);
272 fhRealOpeningAngle->SetYTitle("#theta(rad)");
273 fhRealOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
274 outputContainer->Add(fhRealOpeningAngle) ;
276 fhRealCosOpeningAngle = new TH2D
277 ("hRealCosOpeningAngle","Cosinus of angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,200,-1,1);
278 fhRealCosOpeningAngle->SetYTitle("cos (#theta) ");
279 fhRealCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
280 outputContainer->Add(fhRealCosOpeningAngle) ;
283 //Histograms filled only if MC data is requested
284 if(IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC) ){
285 // if(fhEtalon->GetXaxis()->GetXbins() && fhEtalon->GetXaxis()->GetXbins()->GetSize()){ //Variable bin size
286 // fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXbins()->GetArray()) ;
287 // fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance",fhEtalon->GetXaxis()->GetNbins(),
288 // fhEtalon->GetXaxis()->GetXbins()->GetArray()) ;
291 // fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXmin(),fhEtalon->GetXaxis()->GetXmax()) ;
292 // fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance",
293 // fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXmin(),fhEtalon->GetXaxis()->GetXmax()) ;
296 fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",nptbins,ptmin,ptmax) ;
297 fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance",nptbins,ptmin,ptmax) ;
298 outputContainer->Add(fhPrimPt) ;
299 outputContainer->Add(fhPrimAccPt) ;
301 fhPrimY = new TH1D("hPrimaryRapidity","Rapidity of primary pi0",netabins,etamin,etamax) ;
302 outputContainer->Add(fhPrimY) ;
304 fhPrimAccY = new TH1D("hPrimAccRapidity","Rapidity of primary pi0",netabins,etamin,etamax) ;
305 outputContainer->Add(fhPrimAccY) ;
307 fhPrimPhi = new TH1D("hPrimaryPhi","Azimithal of primary pi0",nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ;
308 outputContainer->Add(fhPrimPhi) ;
310 fhPrimAccPhi = new TH1D("hPrimAccPhi","Azimithal of primary pi0 with accepted daughters",nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ;
311 outputContainer->Add(fhPrimAccPhi) ;
314 fhPrimOpeningAngle = new TH2D
315 ("hPrimOpeningAngle","Angle between all primary #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,0,0.5);
316 fhPrimOpeningAngle->SetYTitle("#theta(rad)");
317 fhPrimOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
318 outputContainer->Add(fhPrimOpeningAngle) ;
320 fhPrimCosOpeningAngle = new TH2D
321 ("hPrimCosOpeningAngle","Cosinus of angle between all primary #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,-1,1);
322 fhPrimCosOpeningAngle->SetYTitle("cos (#theta) ");
323 fhPrimCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)");
324 outputContainer->Add(fhPrimCosOpeningAngle) ;
328 for(Int_t imod=0; imod<fNModules; imod++){
329 //Module dependent invariant mass
330 sprintf(key,"hReMod_%d",imod) ;
331 sprintf(title,"Real m_{#gamma#gamma} distr. for Module %d",imod) ;
332 //fhEtalon->Clone(key);
333 //fhReMod[imod]=(TH3D*)fhEtalon->Clone(key) ;
334 //fhReMod[imod]->SetName(key) ;
335 //fhReMod[imod]->SetTitle(title) ;
336 fhReMod[imod] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ;
337 outputContainer->Add(fhReMod[imod]) ;
341 // //Save parameters used for analysis
342 // TString parList ; //this will be list of parameters used for this analysis.
343 // char onePar[255] ;
344 // sprintf(onePar,"--- AliAnaPi0 ---\n") ;
346 // sprintf(onePar,"Number of bins in Centrality: %d \n",fNCentrBin) ;
348 // sprintf(onePar,"Number of bins in Z vert. pos: %d \n",fNZvertBin) ;
350 // sprintf(onePar,"Number of bins in Reac. Plain: %d \n",fNrpBin) ;
352 // sprintf(onePar,"Depth of event buffer: %d \n",fNmaxMixEv) ;
354 // sprintf(onePar,"Number of different PID used: %d \n",fNPID) ;
356 // sprintf(onePar,"Cuts: \n") ;
358 // sprintf(onePar,"Z vertex position: -%f < z < %f \n",fZvtxCut,fZvtxCut) ;
360 // sprintf(onePar,"Calorimeter: %s \n",fCalorimeter.Data()) ;
362 // sprintf(onePar,"Number of modules: %d \n",fNModules) ;
365 // TObjString *oString= new TObjString(parList) ;
366 // outputContainer->Add(oString);
368 return outputContainer;
371 //_________________________________________________________________________________________________________________________________________________
372 void AliAnaPi0::Print(const Option_t * /*opt*/) const
374 //Print some relevant parameters set for the analysis
375 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
376 AliAnaPartCorrBaseClass::Print(" ");
378 printf("Number of bins in Centrality: %d \n",fNCentrBin) ;
379 printf("Number of bins in Z vert. pos: %d \n",fNZvertBin) ;
380 printf("Number of bins in Reac. Plain: %d \n",fNrpBin) ;
381 printf("Depth of event buffer: %d \n",fNmaxMixEv) ;
382 printf("Number of different PID used: %d \n",fNPID) ;
384 printf("Z vertex position: -%2.3f < z < %2.3f \n",fZvtxCut,fZvtxCut) ;
385 printf("Number of modules: %d \n",fNModules) ;
386 printf("Select pairs with their angle: %d \n",fUseAngleCut) ;
387 printf("------------------------------------------------------\n") ;
391 //____________________________________________________________________________________________________________________________________________________
392 void AliAnaPi0::MakeAnalysisFillHistograms()
394 //Process one event and extract photons from AOD branch
395 // filled with AliAnaPhoton and fill histos with invariant mass
397 //Apply some cuts on event: vertex position and centrality range
398 Int_t iRun=(GetReader()->GetInputEvent())->GetRunNumber() ;
399 if(IsBadRun(iRun)) return ;
401 Double_t vert[]={0,0,0} ; //vertex ;
402 GetReader()->GetVertex(vert);
403 if(vert[2]<-fZvtxCut || vert[2]> fZvtxCut) return ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
405 //Get Centrality and calculate centrality bin
406 //Does not exist in ESD yet???????
407 Int_t curCentrBin=0 ;
409 //Get Reaction Plain position and calculate RP bin
410 //does not exist in ESD yet????
413 Int_t curZvertBin=(Int_t)(0.5*fNZvertBin*(vert[2]+fZvtxCut)/fZvtxCut) ;
415 fhEvents->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ;
417 Int_t nPhot = GetInputAODBranch()->GetEntriesFast() ;
418 if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Photon entries %d\n", nPhot);
421 for(Int_t i1=0; i1<nPhot-1; i1++){
422 AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
423 TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E());
425 module1 = GetModuleNumber(p1);
426 for(Int_t i2=i1+1; i2<nPhot; i2++){
427 AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i2)) ;
428 TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E());
430 module2 = GetModuleNumber(p2);
431 Double_t m = (photon1 + photon2).M() ;
432 Double_t pt = (photon1 + photon2).Pt();
433 Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ;
435 printf("AliAnaPi0::MakeAnalysisFillHistograms() - Current Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n",
436 p1->Pt(), p2->Pt(), pt,m,a);
438 //Check if opening angle is too large or too small compared to what is expected
439 Double_t angle = photon1.Angle(photon2.Vect());
440 //if(fUseAngleCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle)) continue;
441 //printf("angle %f\n",angle);
442 if(fUseAngleCut && angle < 0.1) continue;
443 fhRealOpeningAngle ->Fill(pt,angle);
444 fhRealCosOpeningAngle->Fill(pt,TMath::Cos(angle));
446 //Fill module dependent histograms
447 //if(module1==module2) printf("mod1 %d\n",module1);
448 if(module1==module2 && module1 >=0 && module1<fNModules)
449 fhReMod[module1]->Fill(pt,a,m) ;
451 for(Int_t ipid=0; ipid<fNPID; ipid++)
453 if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){
454 fhRe1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
455 if(p1->DistToBad()>0 && p2->DistToBad()>0){
456 fhRe2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
457 if(p1->DistToBad()>1 && p2->DistToBad()>1){
458 fhRe3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
468 TList * evMixList=fEventsList[curCentrBin*fNZvertBin*fNrpBin+curZvertBin*fNrpBin+curRPBin] ;
469 Int_t nMixed = evMixList->GetSize() ;
470 for(Int_t ii=0; ii<nMixed; ii++){
471 TClonesArray* ev2= (TClonesArray*) (evMixList->At(ii));
472 Int_t nPhot2=ev2->GetEntriesFast() ;
474 if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d\n", ii, nPhot);
476 for(Int_t i1=0; i1<nPhot; i1++){
477 AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
478 TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E());
479 for(Int_t i2=0; i2<nPhot2; i2++){
480 AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (ev2->At(i2)) ;
482 TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E());
483 m = (photon1+photon2).M() ;
484 Double_t pt = (photon1 + photon2).Pt();
485 Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ;
487 //Check if opening angle is too large or too small compared to what is expected
488 Double_t angle = photon1.Angle(photon2.Vect());
489 //if(fUseAngleCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle)) continue;
490 if(fUseAngleCut && angle < 0.1) continue;
493 printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n",
494 p1->Pt(), p2->Pt(), pt,m,a);
495 for(Int_t ipid=0; ipid<fNPID; ipid++){
496 if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){
497 fhMi1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
498 if(p1->DistToBad()>0 && p2->DistToBad()>0){
499 fhMi2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
500 if(p1->DistToBad()>1 && p2->DistToBad()>1){
501 fhMi3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
511 TClonesArray *currentEvent = new TClonesArray(*GetInputAODBranch());
512 //Add current event to buffer and Remove redandant events
513 if(currentEvent->GetEntriesFast()>0){
514 evMixList->AddFirst(currentEvent) ;
515 currentEvent=0 ; //Now list of particles belongs to buffer and it will be deleted with buffer
516 if(evMixList->GetSize()>=fNmaxMixEv)
518 TClonesArray * tmp = (TClonesArray*) (evMixList->Last()) ;
519 evMixList->RemoveLast() ;
524 delete currentEvent ;
529 if(IsDataMC() && GetReader()->ReadStack()){
530 AliStack * stack = GetMCStack();
531 if(stack && (IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC)) ){
532 for(Int_t i=0 ; i<stack->GetNprimary(); i++){
533 TParticle * prim = stack->Particle(i) ;
534 if(prim->GetPdgCode() == 111){
535 Double_t pi0Pt = prim->Pt() ;
536 //printf("pi0, pt %2.2f\n",pi0Pt);
537 if(prim->Energy() == TMath::Abs(prim->Pz())) continue ; //Protection against floating point exception
538 Double_t pi0Y = 0.5*TMath::Log((prim->Energy()-prim->Pz())/(prim->Energy()+prim->Pz())) ;
539 Double_t phi = TMath::RadToDeg()*prim->Phi() ;
540 if(TMath::Abs(pi0Y) < 0.5){
541 fhPrimPt->Fill(pi0Pt) ;
543 fhPrimY ->Fill(pi0Y) ;
544 fhPrimPhi->Fill(phi) ;
546 //Check if both photons hit Calorimeter
547 Int_t iphot1=prim->GetFirstDaughter() ;
548 Int_t iphot2=prim->GetLastDaughter() ;
549 if(iphot1>-1 && iphot1<stack->GetNtrack() && iphot2>-1 && iphot2<stack->GetNtrack()){
550 TParticle * phot1 = stack->Particle(iphot1) ;
551 TParticle * phot2 = stack->Particle(iphot2) ;
552 if(phot1 && phot2 && phot1->GetPdgCode()==22 && phot2->GetPdgCode()==22){
553 //printf("2 photons: photon 1: pt %2.2f, phi %3.2f, eta %1.2f; photon 2: pt %2.2f, phi %3.2f, eta %1.2f\n",
554 // phot1->Pt(), phot1->Phi()*180./3.1415, phot1->Eta(), phot2->Pt(), phot2->Phi()*180./3.1415, phot2->Eta());
556 TLorentzVector lv1, lv2;
557 phot1->Momentum(lv1);
558 phot2->Momentum(lv2);
560 Bool_t inacceptance = kFALSE;
561 if(fCalorimeter == "PHOS"){
562 if(GetPHOSGeometry() && GetCaloUtils()->IsPHOSGeoMatrixSet()){
565 if(GetPHOSGeometry()->ImpactOnEmc(phot1,mod,z,x) && GetPHOSGeometry()->ImpactOnEmc(phot2,mod,z,x))
566 inacceptance = kTRUE;
567 if(GetDebug() > 2) printf("In %s Real acceptance? %d\n",fCalorimeter.Data(),inacceptance);
571 if(GetFiducialCut()->IsInFiducialCut(lv1,fCalorimeter) && GetFiducialCut()->IsInFiducialCut(lv2,fCalorimeter))
572 inacceptance = kTRUE ;
573 if(GetDebug() > 2) printf("In %s fiducial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance);
577 else if(fCalorimeter == "EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){
578 if(GetEMCALGeometry()){
579 if(GetEMCALGeometry()->Impact(phot1) && GetEMCALGeometry()->Impact(phot2))
580 inacceptance = kTRUE;
581 if(GetDebug() > 2) printf("In %s Real acceptance? %d\n",fCalorimeter.Data(),inacceptance);
584 if(GetFiducialCut()->IsInFiducialCut(lv1,fCalorimeter) && GetFiducialCut()->IsInFiducialCut(lv2,fCalorimeter))
585 inacceptance = kTRUE ;
586 if(GetDebug() > 2) printf("In %s fiducial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance);
592 fhPrimAccPt->Fill(pi0Pt) ;
593 fhPrimAccPhi->Fill(phi) ;
594 fhPrimAccY->Fill(pi0Y) ;
595 Double_t angle = lv1.Angle(lv2.Vect());
596 fhPrimOpeningAngle ->Fill(pi0Pt,angle);
597 fhPrimCosOpeningAngle->Fill(pi0Pt,TMath::Cos(angle));
601 }//Check daughters exist
604 }//stack exists and data is MC
606 else if(GetReader()->ReadAODMCParticles()){
607 if(GetDebug() >= 0) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Acceptance calculation with MCParticles not implemented yet\n");
612 //________________________________________________________________________
613 void AliAnaPi0::ReadHistograms(TList* outputList)
615 // Needed when Terminate is executed in distributed environment
616 // Refill analysis histograms of this class with corresponding histograms in output list.
618 // Histograms of this analsys are kept in the same list as other analysis, recover the position of
619 // the first one and then add the next.
620 Int_t index = outputList->IndexOf(outputList->FindObject(GetAddedHistogramsStringToName()+"hRe_cen0_pid0_dist1"));
622 if(!fhRe1) fhRe1 = new TH3D*[fNCentrBin*fNPID] ;
623 if(!fhRe2) fhRe2 = new TH3D*[fNCentrBin*fNPID] ;
624 if(!fhRe3) fhRe3 = new TH3D*[fNCentrBin*fNPID] ;
625 if(!fhMi1) fhMi1 = new TH3D*[fNCentrBin*fNPID] ;
626 if(!fhMi2) fhMi2 = new TH3D*[fNCentrBin*fNPID] ;
627 if(!fhMi3) fhMi3 = new TH3D*[fNCentrBin*fNPID] ;
628 if(!fhReMod) fhReMod = new TH3D*[fNModules] ;
630 for(Int_t ic=0; ic<fNCentrBin; ic++){
631 for(Int_t ipid=0; ipid<fNPID; ipid++){
632 fhRe1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
633 fhMi1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
634 fhRe2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
635 fhMi2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
636 fhRe3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
637 fhMi3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
641 fhEvents = (TH3D *) outputList->At(index++);
643 //Histograms filled only if MC data is requested
644 if(IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC) ){
645 fhPrimPt = (TH1D*) outputList->At(index++);
646 fhPrimAccPt = (TH1D*) outputList->At(index++);
647 fhPrimY = (TH1D*) outputList->At(index++);
648 fhPrimAccY = (TH1D*) outputList->At(index++);
649 fhPrimPhi = (TH1D*) outputList->At(index++);
650 fhPrimAccPhi = (TH1D*) outputList->At(index++);
653 for(Int_t imod=0; imod < fNModules; imod++)
654 fhReMod[imod] = (TH3D*) outputList->At(index++);
659 //____________________________________________________________________________________________________________________________________________________
660 void AliAnaPi0::Terminate(TList* outputList)
662 //Do some calculations and plots from the final histograms.
664 printf(" *** %s Terminate:\n", GetName()) ;
666 //Recover histograms from output histograms list, needed for distributed analysis.
667 ReadHistograms(outputList);
670 printf("AliAnaPi0::Terminate() - Error: Remote output histograms not imported in AliAnaPi0 object");
674 printf("AliAnaPi0::Terminate() Mgg Real : %5.3f , RMS : %5.3f \n", fhRe1[0]->GetMean(), fhRe1[0]->GetRMS() ) ;
677 sprintf(nameIM,"AliAnaPi0_%s_cPt",fCalorimeter.Data());
678 TCanvas * cIM = new TCanvas(nameIM, "", 400, 10, 600, 700) ;
683 TH1D * hIMAllPt = (TH1D*) fhRe1[0]->ProjectionZ(Form("IMPtAll_%s",fCalorimeter.Data()));
684 hIMAllPt->SetLineColor(2);
685 hIMAllPt->SetTitle("No cut on p_{T, #gamma#gamma} ");
689 TH3F * hRe1Pt5 = (TH3F*)fhRe1[0]->Clone(Form("IMPt5_%s",fCalorimeter.Data()));
690 hRe1Pt5->GetXaxis()->SetRangeUser(0,5);
691 TH1D * hIMPt5 = (TH1D*) hRe1Pt5->Project3D(Form("IMPt5_%s_pz",fCalorimeter.Data()));
692 hIMPt5->SetLineColor(2);
693 hIMPt5->SetTitle("0 < p_{T, #gamma#gamma} < 5 GeV/c");
697 TH3F * hRe1Pt10 = (TH3F*)fhRe1[0]->Clone(Form("IMPt10_%s",fCalorimeter.Data()));
698 hRe1Pt10->GetXaxis()->SetRangeUser(5,10);
699 TH1D * hIMPt10 = (TH1D*) hRe1Pt10->Project3D(Form("IMPt10_%s_pz",fCalorimeter.Data()));
700 hIMPt10->SetLineColor(2);
701 hIMPt10->SetTitle("5 < p_{T, #gamma#gamma} < 10 GeV/c");
705 TH3F * hRe1Pt20 = (TH3F*)fhRe1[0]->Clone(Form("IMPt20_%s",fCalorimeter.Data()));
706 hRe1Pt20->GetXaxis()->SetRangeUser(10,20);
707 TH1D * hIMPt20 = (TH1D*) hRe1Pt20->Project3D(Form("IMPt20_%s_pz",fCalorimeter.Data()));
708 hIMPt20->SetLineColor(2);
709 hIMPt20->SetTitle("10 < p_{T, #gamma#gamma} < 20 GeV/c");
713 sprintf(nameIMF,"AliAnaPi0_%s_Mgg.eps",fCalorimeter.Data());
717 sprintf(namePt,"AliAnaPi0_%s_cPt",fCalorimeter.Data());
718 TCanvas * cPt = new TCanvas(namePt, "", 400, 10, 600, 700) ;
723 TH1D * hPt = (TH1D*) fhRe1[0]->Project3D("x");
724 hPt->SetLineColor(2);
725 hPt->SetTitle("No cut on M_{#gamma#gamma} ");
729 TH3F * hRe1IM1 = (TH3F*)fhRe1[0]->Clone(Form("Pt1_%s",fCalorimeter.Data()));
730 hRe1IM1->GetZaxis()->SetRangeUser(0.05,0.21);
731 TH1D * hPtIM1 = (TH1D*) hRe1IM1->Project3D("x");
732 hPtIM1->SetLineColor(2);
733 hPtIM1->SetTitle("0.05 < M_{#gamma#gamma} < 0.21 GeV/c^{2}");
737 TH3F * hRe1IM2 = (TH3F*)fhRe1[0]->Clone(Form("Pt2_%s",fCalorimeter.Data()));
738 hRe1IM2->GetZaxis()->SetRangeUser(0.09,0.17);
739 TH1D * hPtIM2 = (TH1D*) hRe1IM2->Project3D("x");
740 hPtIM2->SetLineColor(2);
741 hPtIM2->SetTitle("0.09 < M_{#gamma#gamma} < 0.17 GeV/c^{2}");
745 TH3F * hRe1IM3 = (TH3F*)fhRe1[0]->Clone(Form("Pt3_%s",fCalorimeter.Data()));
746 hRe1IM3->GetZaxis()->SetRangeUser(0.11,0.15);
747 TH1D * hPtIM3 = (TH1D*) hRe1IM1->Project3D("x");
748 hPtIM3->SetLineColor(2);
749 hPtIM3->SetTitle("0.11 < M_{#gamma#gamma} < 0.15 GeV/c^{2}");
753 sprintf(namePtF,"AliAnaPi0_%s_Pt.eps",fCalorimeter.Data());
758 sprintf(line, ".!tar -zcf %s_%s.tar.gz *.eps", GetName(),fCalorimeter.Data()) ;
759 gROOT->ProcessLine(line);
760 sprintf(line, ".!rm -fR AliAnaPi0_%s*.eps",fCalorimeter.Data());
761 gROOT->ProcessLine(line);
763 printf(" AliAnaPi0::Terminate() - !! All the eps files are in %s_%s.tar.gz !!!\n", GetName(), fCalorimeter.Data());