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 ---
29 //#include "Riostream.h"
33 #include "TClonesArray.h"
34 #include "TObjString.h"
36 //---- AliRoot system ----
37 #include "AliAnaPi0.h"
38 #include "AliCaloTrackReader.h"
39 #include "AliCaloPID.h"
41 #include "AliFidutialCut.h"
42 #include "TParticle.h"
43 #include "AliAODCaloCluster.h"
44 #include "AliVEvent.h"
47 #include "AliPHOSGeoUtils.h"
51 #include "AliEMCALGeoUtils.h"
56 //________________________________________________________________________________________________________________________________________________
57 AliAnaPi0::AliAnaPi0() : AliAnaPartCorrBaseClass(),
58 fNCentrBin(0),fNZvertBin(0),fNrpBin(0),
59 fNPID(0),fNmaxMixEv(0), fZvtxCut(0.),fCalorimeter(""),
60 fEventsList(0x0), fhEtalon(0x0),
61 fhRe1(0x0),fhMi1(0x0),fhRe2(0x0),fhMi2(0x0),fhRe3(0x0),fhMi3(0x0),fhEvents(0x0),
62 fhPrimPt(0x0), fhPrimAccPt(0x0), fhPrimY(0x0), fhPrimAccY(0x0), fhPrimPhi(0x0), fhPrimAccPhi(0x0)
76 //________________________________________________________________________________________________________________________________________________
77 AliAnaPi0::AliAnaPi0(const AliAnaPi0 & ex) : AliAnaPartCorrBaseClass(ex),
78 fNCentrBin(ex.fNCentrBin),fNZvertBin(ex.fNZvertBin),fNrpBin(ex.fNrpBin),
79 fNPID(ex.fNPID),fNmaxMixEv(ex.fNmaxMixEv),fZvtxCut(ex.fZvtxCut), fCalorimeter(ex.fCalorimeter),
80 fEventsList(ex.fEventsList), fhEtalon(ex.fhEtalon),
81 fhRe1(ex.fhRe1),fhMi1(ex.fhMi1),fhRe2(ex.fhRe2),fhMi2(ex.fhMi2),fhRe3(ex.fhRe3),fhMi3(ex.fhMi3),fhEvents(ex.fhEvents),
82 fhPrimPt(ex.fhPrimPt), fhPrimAccPt(ex.fhPrimAccPt), fhPrimY(ex.fhPrimY),
83 fhPrimAccY(ex.fhPrimAccY), fhPrimPhi(ex.fhPrimPhi), fhPrimAccPhi(ex.fhPrimAccPhi)
85 ,fPHOSGeo(ex.fPHOSGeo)
88 ,fEMCALGeo(ex.fEMCALGeo)
95 //________________________________________________________________________________________________________________________________________________
96 AliAnaPi0 & AliAnaPi0::operator = (const AliAnaPi0 & ex)
98 // assignment operator
100 if(this == &ex)return *this;
101 ((AliAnaPartCorrBaseClass *)this)->operator=(ex);
103 fNCentrBin = ex.fNCentrBin ; fNZvertBin = ex.fNZvertBin ; fNrpBin = ex.fNrpBin ;
104 fNPID = ex.fNPID ; fNmaxMixEv = ex.fNmaxMixEv ; fZvtxCut = ex.fZvtxCut ; fCalorimeter = ex.fCalorimeter ;
105 fEventsList = ex.fEventsList ; fhEtalon = ex.fhEtalon ;
106 fhRe1 = ex.fhRe1 ; fhMi1 = ex.fhMi1 ; fhRe2 = ex.fhRe2 ; fhMi2 = ex.fhMi2 ;
107 fhRe3 = ex.fhRe3 ; fhMi3 = ex.fhMi3 ; fhEvents = ex.fhEvents ;
108 fhPrimPt = ex.fhPrimPt ; fhPrimAccPt = ex.fhPrimAccPt ; fhPrimY = ex.fhPrimY ;
109 fhPrimAccY = ex.fhPrimAccY ; fhPrimPhi = ex.fhPrimPhi ; fhPrimAccPhi = ex.fhPrimAccPhi ;
115 //________________________________________________________________________________________________________________________________________________
116 AliAnaPi0::~AliAnaPi0() {
117 // Remove event containers
119 for(Int_t ic=0; ic<fNCentrBin; ic++){
120 for(Int_t iz=0; iz<fNZvertBin; iz++){
121 for(Int_t irp=0; irp<fNrpBin; irp++){
122 fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp]->Delete() ;
123 delete fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] ;
127 delete[] fEventsList;
132 if(fPHOSGeo) delete fPHOSGeo ;
136 if(fEMCALGeo) delete fEMCALGeo ;
141 //________________________________________________________________________________________________________________________________________________
142 void AliAnaPi0::InitParameters()
144 //Init parameters when first called the analysis
145 //Set default parameters
146 SetInputAODName("PWG4Particle");
148 AddToHistogramsName("AnaPi0_");
156 fCalorimeter = "PHOS";
158 //________________________________________________________________________________________________________________________________________________
159 void AliAnaPi0::Init()
161 //Init some data members needed in analysis
163 //Histograms binning and range
164 if(!fhEtalon){ // p_T alpha d m_gg
165 fhEtalon = new TH3D("hEtalon","Histo with binning parameters",50,0.,25.,10,0.,1.,200,0.,1.) ;
166 fhEtalon->SetXTitle("P_{T} (GeV)") ;
167 fhEtalon->SetYTitle("#alpha") ;
168 fhEtalon->SetZTitle("m_{#gamma#gamma} (GeV)") ;
173 //________________________________________________________________________________________________________________________________________________
174 TList * AliAnaPi0::GetCreateOutputObjects()
176 // Create histograms to be saved in output file and
177 // store them in fOutputContainer
179 //create event containers
180 fEventsList = new TList*[fNCentrBin*fNZvertBin*fNrpBin] ;
182 for(Int_t ic=0; ic<fNCentrBin; ic++){
183 for(Int_t iz=0; iz<fNZvertBin; iz++){
184 for(Int_t irp=0; irp<fNrpBin; irp++){
185 fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] = new TList() ;
190 //If Geometry library loaded, do geometry selection during analysis.
192 printf("AliAnaPi0::GetCreateOutputObjects() - PHOS geometry initialized!\n");
193 fPHOSGeo = new AliPHOSGeoUtils("PHOSgeo") ;
197 printf("AliAnaPi0::GetCreateOutputObjects() - EMCAL geometry initialized!\n");
198 fEMCALGeo = new AliEMCALGeoUtils("EMCALgeo") ;
201 TList * outputContainer = new TList() ;
202 outputContainer->SetName(GetName());
204 fhRe1 = new TH3D*[fNCentrBin*fNPID] ;
205 fhRe2 = new TH3D*[fNCentrBin*fNPID] ;
206 fhRe3 = new TH3D*[fNCentrBin*fNPID] ;
207 fhMi1 = new TH3D*[fNCentrBin*fNPID] ;
208 fhMi2 = new TH3D*[fNCentrBin*fNPID] ;
209 fhMi3 = new TH3D*[fNCentrBin*fNPID] ;
214 for(Int_t ic=0; ic<fNCentrBin; ic++){
215 for(Int_t ipid=0; ipid<fNPID; ipid++){
217 //Distance to bad module 1
218 sprintf(key,"hRe_cen%d_pid%d_dist1",ic,ipid) ;
219 sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
221 fhEtalon->Clone(key);
222 fhRe1[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
223 fhRe1[ic*fNPID+ipid]->SetName(key) ;
224 fhRe1[ic*fNPID+ipid]->SetTitle(title) ;
225 outputContainer->Add(fhRe1[ic*fNPID+ipid]) ;
227 sprintf(key,"hMi_cen%d_pid%d_dist1",ic,ipid) ;
228 sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
229 fhMi1[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
230 fhMi1[ic*fNPID+ipid]->SetName(key) ;
231 fhMi1[ic*fNPID+ipid]->SetTitle(title) ;
232 outputContainer->Add(fhMi1[ic*fNPID+ipid]) ;
234 //Distance to bad module 2
235 sprintf(key,"hRe_cen%d_pid%d_dist2",ic,ipid) ;
236 sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
237 fhRe2[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
238 fhRe2[ic*fNPID+ipid]->SetName(key) ;
239 fhRe2[ic*fNPID+ipid]->SetTitle(title) ;
240 outputContainer->Add(fhRe2[ic*fNPID+ipid]) ;
242 sprintf(key,"hMi_cen%d_pid%d_dist2",ic,ipid) ;
243 sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
244 fhMi2[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
245 fhMi2[ic*fNPID+ipid]->SetName(key) ;
246 fhMi2[ic*fNPID+ipid]->SetTitle(title) ;
247 outputContainer->Add(fhMi2[ic*fNPID+ipid]) ;
249 //Distance to bad module 3
250 sprintf(key,"hRe_cen%d_pid%d_dist3",ic,ipid) ;
251 sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
252 fhRe3[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
253 fhRe3[ic*fNPID+ipid]->SetName(key) ;
254 fhRe3[ic*fNPID+ipid]->SetTitle(title) ;
255 outputContainer->Add(fhRe3[ic*fNPID+ipid]) ;
257 sprintf(key,"hMi_cen%d_pid%d_dist3",ic,ipid) ;
258 sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ;
259 fhMi3[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ;
260 fhMi3[ic*fNPID+ipid]->SetName(key) ;
261 fhMi3[ic*fNPID+ipid]->SetTitle(title) ;
262 outputContainer->Add(fhMi3[ic*fNPID+ipid]) ;
267 fhEvents=new TH3D("hEvents","Number of events",fNCentrBin,0.,1.*fNCentrBin,
268 fNZvertBin,0.,1.*fNZvertBin,fNrpBin,0.,1.*fNrpBin) ;
269 outputContainer->Add(fhEvents) ;
271 //Histograms filled only if MC data is requested
272 if(IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC) ){
273 if(fhEtalon->GetXaxis()->GetXbins() && fhEtalon->GetXaxis()->GetXbins()->GetSize()){ //Variable bin size
274 fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXbins()->GetArray()) ;
275 fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance",fhEtalon->GetXaxis()->GetNbins(),
276 fhEtalon->GetXaxis()->GetXbins()->GetArray()) ;
279 fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXmin(),fhEtalon->GetXaxis()->GetXmax()) ;
280 fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance",
281 fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXmin(),fhEtalon->GetXaxis()->GetXmax()) ;
283 outputContainer->Add(fhPrimPt) ;
284 outputContainer->Add(fhPrimAccPt) ;
286 fhPrimY = new TH1D("hPrimaryRapidity","Rapidity of primary pi0",100,-5.,5.) ;
287 outputContainer->Add(fhPrimY) ;
289 fhPrimAccY = new TH1D("hPrimAccRapidity","Rapidity of primary pi0",100,-5.,5.) ;
290 outputContainer->Add(fhPrimAccY) ;
292 fhPrimPhi = new TH1D("hPrimaryPhi","Azimithal of primary pi0",180,0.,360.) ;
293 outputContainer->Add(fhPrimPhi) ;
295 fhPrimAccPhi = new TH1D("hPrimAccPhi","Azimithal of primary pi0 with accepted daughters",180,-0.,360.) ;
296 outputContainer->Add(fhPrimAccPhi) ;
299 //Save parameters used for analysis
300 TString parList ; //this will be list of parameters used for this analysis.
302 sprintf(onePar,"--- AliAnaPi0 ---\n") ;
304 sprintf(onePar,"Number of bins in Centrality: %d \n",fNCentrBin) ;
306 sprintf(onePar,"Number of bins in Z vert. pos: %d \n",fNZvertBin) ;
308 sprintf(onePar,"Number of bins in Reac. Plain: %d \n",fNrpBin) ;
310 sprintf(onePar,"Depth of event buffer: %d \n",fNmaxMixEv) ;
312 sprintf(onePar,"Number of different PID used: %d \n",fNPID) ;
314 sprintf(onePar,"Cuts: \n") ;
316 sprintf(onePar,"Z vertex position: -%f < z < %f \n",fZvtxCut,fZvtxCut) ;
318 sprintf(onePar,"Calorimeter: %s \n",fCalorimeter.Data()) ;
321 TObjString *oString= new TObjString(parList) ;
322 outputContainer->Add(oString);
324 return outputContainer;
327 //_________________________________________________________________________________________________________________________________________________
328 void AliAnaPi0::Print(const Option_t * /*opt*/) const
330 //Print some relevant parameters set for the analysis
331 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
332 AliAnaPartCorrBaseClass::Print(" ");
334 printf("Number of bins in Centrality: %d \n",fNCentrBin) ;
335 printf("Number of bins in Z vert. pos: %d \n",fNZvertBin) ;
336 printf("Number of bins in Reac. Plain: %d \n",fNrpBin) ;
337 printf("Depth of event buffer: %d \n",fNmaxMixEv) ;
338 printf("Number of different PID used: %d \n",fNPID) ;
340 printf("Z vertex position: -%2.3f < z < %2.3f \n",fZvtxCut,fZvtxCut) ;
341 printf("------------------------------------------------------\n") ;
345 //____________________________________________________________________________________________________________________________________________________
346 void AliAnaPi0::MakeAnalysisFillHistograms()
348 //Process one event and extract photons from AOD branch
349 // filled with AliAnaPhoton and fill histos with invariant mass
351 //Apply some cuts on event: vertex position and centrality range
352 Int_t iRun=(GetReader()->GetInputEvent())->GetRunNumber() ;
353 if(IsBadRun(iRun)) return ;
355 Double_t vert[]={0,0,0} ; //vertex ;
356 GetReader()->GetVertex(vert);
357 if(vert[2]<-fZvtxCut || vert[2]> fZvtxCut) return ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
359 //Get Centrality and calculate centrality bin
360 //Does not exist in ESD yet???????
361 Int_t curCentrBin=0 ;
363 //Get Reaction Plain position and calculate RP bin
364 //does not exist in ESD yet????
367 Int_t curZvertBin=(Int_t)(0.5*fNZvertBin*(vert[2]+fZvtxCut)/fZvtxCut) ;
369 fhEvents->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ;
371 Int_t nPhot = GetInputAODBranch()->GetEntriesFast() ;
372 if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Photon entries %d\n", nPhot);
374 for(Int_t i1=0; i1<nPhot-1; i1++){
375 AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
376 TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E());
377 for(Int_t i2=i1+1; i2<nPhot; i2++){
378 AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i2)) ;
379 TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E());
380 Double_t m = (photon1 + photon2).M() ;
381 Double_t pt = (photon1 + photon2).Pt();
382 Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ;
384 printf("AliAnaPi0::MakeAnalysisFillHistograms() - Current Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n",
385 p1->Pt(), p2->Pt(), pt,m,a);
386 for(Int_t ipid=0; ipid<fNPID; ipid++)
388 if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){
389 fhRe1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
390 if(p1->DistToBad()>0 && p2->DistToBad()>0){
391 fhRe2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
392 if(p1->DistToBad()>1 && p2->DistToBad()>1){
393 fhRe3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
403 TList * evMixList=fEventsList[curCentrBin*fNZvertBin*fNrpBin+curZvertBin*fNrpBin+curRPBin] ;
404 Int_t nMixed = evMixList->GetSize() ;
405 for(Int_t ii=0; ii<nMixed; ii++){
406 TClonesArray* ev2= (TClonesArray*) (evMixList->At(ii));
407 Int_t nPhot2=ev2->GetEntriesFast() ;
409 if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d\n", ii, nPhot);
411 for(Int_t i1=0; i1<nPhot; i1++){
412 AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ;
413 TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E());
414 for(Int_t i2=0; i2<nPhot2; i2++){
415 AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (ev2->At(i2)) ;
417 TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E());
418 m = (photon1+photon2).M() ;
419 Double_t pt = (photon1 + photon2).Pt();
420 Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ;
422 printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n",
423 p1->Pt(), p2->Pt(), pt,m,a);
424 for(Int_t ipid=0; ipid<fNPID; ipid++){
425 if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){
426 fhMi1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
427 if(p1->DistToBad()>0 && p2->DistToBad()>0){
428 fhMi2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
429 if(p1->DistToBad()>1 && p2->DistToBad()>1){
430 fhMi3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ;
440 TClonesArray *currentEvent = new TClonesArray(*GetInputAODBranch());
441 //Add current event to buffer and Remove redandant events
442 if(currentEvent->GetEntriesFast()>0){
443 evMixList->AddFirst(currentEvent) ;
444 currentEvent=0 ; //Now list of particles belongs to buffer and it will be deleted with buffer
445 if(evMixList->GetSize()>=fNmaxMixEv)
447 TClonesArray * tmp = (TClonesArray*) (evMixList->Last()) ;
448 evMixList->RemoveLast() ;
453 delete currentEvent ;
458 if(GetReader()->ReadStack()){
459 AliStack * stack = GetMCStack();
460 if(stack && (IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC)) ){
461 for(Int_t i=0 ; i<stack->GetNprimary(); i++){
462 TParticle * prim = stack->Particle(i) ;
463 if(prim->GetPdgCode() == 111){
464 Double_t pi0Pt = prim->Pt() ;
465 //printf("pi0, pt %2.2f\n",pi0Pt);
466 if(prim->Energy() == TMath::Abs(prim->Pz())) continue ; //Protection against floating point exception
467 Double_t pi0Y = 0.5*TMath::Log((prim->Energy()-prim->Pz())/(prim->Energy()+prim->Pz())) ;
468 Double_t phi = TMath::RadToDeg()*prim->Phi() ;
469 if(TMath::Abs(pi0Y) < 0.5){
470 fhPrimPt->Fill(pi0Pt) ;
472 fhPrimY ->Fill(pi0Y) ;
473 fhPrimPhi->Fill(phi) ;
475 //Check if both photons hit Calorimeter
476 Int_t iphot1=prim->GetFirstDaughter() ;
477 Int_t iphot2=prim->GetLastDaughter() ;
478 if(iphot1>-1 && iphot1<stack->GetNtrack() && iphot2>-1 && iphot2<stack->GetNtrack()){
479 TParticle * phot1 = stack->Particle(iphot1) ;
480 TParticle * phot2 = stack->Particle(iphot2) ;
481 if(phot1 && phot2 && phot1->GetPdgCode()==22 && phot2->GetPdgCode()==22){
482 //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",
483 // phot1->Pt(), phot1->Phi()*180./3.1415, phot1->Eta(), phot2->Pt(), phot2->Phi()*180./3.1415, phot2->Eta());
484 Bool_t inacceptance = kFALSE;
486 if(fCalorimeter == "PHOS"){
491 if(fPHOSGeo->ImpactOnEmc(phot1,mod,z,x) && fPHOSGeo->ImpactOnEmc(phot2,mod,z,x))
492 inacceptance = kTRUE;
493 //printf("In REAL PHOS acceptance? %d\n",inacceptance);
495 TLorentzVector lv1, lv2;
496 phot1->Momentum(lv1);
497 phot2->Momentum(lv2);
498 if(GetFidutialCut()->IsInFidutialCut(lv1,fCalorimeter) && GetFidutialCut()->IsInFidutialCut(lv2,fCalorimeter))
499 inacceptance = kTRUE ;
500 if(GetDebug() > 2) printf("In %s fidutial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance);
505 else if(fCalorimeter == "EMCAL"){
508 if(fEMCALGeo->Impact(phot1) && fEMCALGeo->Impact(phot2))
509 inacceptance = kTRUE;
510 if(GetDebug() > 2) printf("In REAL EMCAL acceptance? %d\n",inacceptance);
512 TLorentzVector lv1, lv2;
513 phot1->Momentum(lv1);
514 phot2->Momentum(lv2);
515 if(GetFidutialCut()->IsInFidutialCut(lv1,fCalorimeter) && GetFidutialCut()->IsInFidutialCut(lv2,fCalorimeter))
516 inacceptance = kTRUE ;
517 //printf("In %s fidutial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance);
522 fhPrimAccPt->Fill(pi0Pt) ;
523 fhPrimAccPhi->Fill(phi) ;
524 fhPrimAccY->Fill(pi0Y) ;
527 }//Check daughters exist
530 }//stack exists and data is MC
532 else if(GetReader()->ReadAODMCParticles()){
533 printf("AliAnaPi0::MakeAnalysisFillHistograms() - Acceptance calculation with MCParticles not implemented yet\n");
538 //________________________________________________________________________
539 void AliAnaPi0::ReadHistograms(TList* outputList)
541 // Needed when Terminate is executed in distributed environment
542 // Refill analysis histograms of this class with corresponding histograms in output list.
544 // Histograms of this analsys are kept in the same list as other analysis, recover the position of
545 // the first one and then add the next.
546 Int_t index = outputList->IndexOf(outputList->FindObject(GetAddedHistogramsStringToName()+"hRe_cen0_pid0_dist1"));
548 if(!fhRe1) fhRe1 = new TH3D*[fNCentrBin*fNPID] ;
549 if(!fhRe2) fhRe2 = new TH3D*[fNCentrBin*fNPID] ;
550 if(!fhRe3) fhRe3 = new TH3D*[fNCentrBin*fNPID] ;
551 if(!fhMi1) fhMi1 = new TH3D*[fNCentrBin*fNPID] ;
552 if(!fhMi2) fhMi2 = new TH3D*[fNCentrBin*fNPID] ;
553 if(!fhMi3) fhMi3 = new TH3D*[fNCentrBin*fNPID] ;
555 for(Int_t ic=0; ic<fNCentrBin; ic++){
556 for(Int_t ipid=0; ipid<fNPID; ipid++){
557 fhRe1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
558 fhMi1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
559 fhRe2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
560 fhMi2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
561 fhRe3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
562 fhMi3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++);
566 fhEvents = (TH3D *) outputList->At(index++);
568 //Histograms filled only if MC data is requested
569 if(IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC) ){
570 fhPrimPt = (TH1D*) outputList->At(index++);
571 fhPrimAccPt = (TH1D*) outputList->At(index++);
572 fhPrimY = (TH1D*) outputList->At(index++);
573 fhPrimAccY = (TH1D*) outputList->At(index++);
574 fhPrimPhi = (TH1D*) outputList->At(index++);
575 fhPrimAccPhi = (TH1D*) outputList->At(index);
581 //____________________________________________________________________________________________________________________________________________________
582 void AliAnaPi0::Terminate(TList* outputList)
584 //Do some calculations and plots from the final histograms.
586 printf(" *** %s Terminate:\n", GetName()) ;
588 //Recover histograms from output histograms list, needed for distributed analysis.
589 ReadHistograms(outputList);
592 printf("AliAnaPi0::Terminate() - Error: Remote output histograms not imported in AliAnaPi0 object");
596 printf("AliAnaPi0::Terminate() Mgg Real : %5.3f , RMS : %5.3f \n", fhRe1[0]->GetMean(), fhRe1[0]->GetRMS() ) ;
599 sprintf(nameIM,"AliAnaPi0_%s_cPt",fCalorimeter.Data());
600 TCanvas * cIM = new TCanvas(nameIM, "", 400, 10, 600, 700) ;
605 TH1D * hIMAllPt = (TH1D*) fhRe1[0]->ProjectionZ();
606 hIMAllPt->SetLineColor(2);
607 hIMAllPt->SetTitle("No cut on p_{T, #gamma#gamma} ");
611 TH3F * hRe1Pt5 = (TH3F*)fhRe1[0]->Clone("IMPt5");
612 hRe1Pt5->GetXaxis()->SetRangeUser(0,5);
613 TH1D * hIMPt5 = (TH1D*) hRe1Pt5->Project3D("z");
614 hIMPt5->SetLineColor(2);
615 hIMPt5->SetTitle("0 < p_{T, #gamma#gamma} < 5 GeV/c");
619 TH3F * hRe1Pt10 = (TH3F*)fhRe1[0]->Clone("IMPt10");
620 hRe1Pt10->GetXaxis()->SetRangeUser(5,10);
621 TH1D * hIMPt10 = (TH1D*) hRe1Pt10->Project3D("z");
622 hIMPt10->SetLineColor(2);
623 hIMPt10->SetTitle("5 < p_{T, #gamma#gamma} < 10 GeV/c");
627 TH3F * hRe1Pt20 = (TH3F*)fhRe1[0]->Clone("IMPt20");
628 hRe1Pt20->GetXaxis()->SetRangeUser(10,20);
629 TH1D * hIMPt20 = (TH1D*) hRe1Pt20->Project3D("z");
630 hIMPt20->SetLineColor(2);
631 hIMPt20->SetTitle("10 < p_{T, #gamma#gamma} < 20 GeV/c");
635 sprintf(nameIMF,"AliAnaPi0_%s_Mgg.eps",fCalorimeter.Data());
639 sprintf(namePt,"AliAnaPi0_%s_cPt",fCalorimeter.Data());
640 TCanvas * cPt = new TCanvas(namePt, "", 400, 10, 600, 700) ;
645 TH1D * hPt = (TH1D*) fhRe1[0]->Project3D("x");
646 hPt->SetLineColor(2);
647 hPt->SetTitle("No cut on M_{#gamma#gamma} ");
651 TH3F * hRe1IM1 = (TH3F*)fhRe1[0]->Clone("PtIM1");
652 hRe1IM1->GetZaxis()->SetRangeUser(0.05,0.21);
653 TH1D * hPtIM1 = (TH1D*) hRe1IM1->Project3D("x");
654 hPtIM1->SetLineColor(2);
655 hPtIM1->SetTitle("0.05 < M_{#gamma#gamma} < 0.21 GeV/c^{2}");
659 TH3F * hRe1IM2 = (TH3F*)fhRe1[0]->Clone("PtIM2");
660 hRe1IM2->GetZaxis()->SetRangeUser(0.09,0.17);
661 TH1D * hPtIM2 = (TH1D*) hRe1IM2->Project3D("x");
662 hPtIM2->SetLineColor(2);
663 hPtIM2->SetTitle("0.09 < M_{#gamma#gamma} < 0.17 GeV/c^{2}");
667 TH3F * hRe1IM3 = (TH3F*)fhRe1[0]->Clone("PtIM3");
668 hRe1IM3->GetZaxis()->SetRangeUser(0.11,0.15);
669 TH1D * hPtIM3 = (TH1D*) hRe1IM1->Project3D("x");
670 hPtIM3->SetLineColor(2);
671 hPtIM3->SetTitle("0.11 < M_{#gamma#gamma} < 0.15 GeV/c^{2}");
675 sprintf(namePtF,"AliAnaPi0_%s_Pt.eps",fCalorimeter.Data());
680 sprintf(line, ".!tar -zcf %s_%s.tar.gz *.eps", GetName(),fCalorimeter.Data()) ;
681 gROOT->ProcessLine(line);
682 sprintf(line, ".!rm -fR AliAnaPi0_%s*.eps",fCalorimeter.Data());
683 gROOT->ProcessLine(line);
685 printf(" AliAnaPi0::Terminate() - !! All the eps files are in %s_%s.tar.gz !!!\n", GetName(), fCalorimeter.Data());