]>
Commit | Line | Data |
---|---|---|
1c5acb87 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
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 | **************************************************************************/ | |
15 | /* $Id: $ */ | |
16 | ||
17 | //_________________________________________________________________________ | |
18 | // Class to collect two-photon invariant mass distributions for | |
19 | // extractin raw pi0 yield. | |
20 | // | |
21 | //-- Author: Dmitri Peressounko (RRC "KI") | |
22 | //-- Adapted to PartCorr frame by Lamia Benhabib (SUBATECH) | |
23 | //-- and Gustavo Conesa (INFN-Frascati) | |
24 | //_________________________________________________________________________ | |
25 | ||
26 | ||
27 | // --- ROOT system --- | |
28 | #include "TH3.h" | |
29 | //#include "Riostream.h" | |
6639984f | 30 | #include "TCanvas.h" |
31 | #include "TPad.h" | |
32 | #include "TROOT.h" | |
477d6cee | 33 | #include "TClonesArray.h" |
34 | #include "TObjString.h" | |
1c5acb87 | 35 | |
36 | //---- AliRoot system ---- | |
37 | #include "AliAnaPi0.h" | |
38 | #include "AliCaloTrackReader.h" | |
39 | #include "AliCaloPID.h" | |
6639984f | 40 | #include "AliStack.h" |
477d6cee | 41 | #include "AliFidutialCut.h" |
42 | #include "TParticle.h" | |
43 | #include "AliAODCaloCluster.h" | |
44 | #include "AliVEvent.h" | |
1c5acb87 | 45 | |
46 | #ifdef __PHOSGEO__ | |
47 | #include "AliPHOSGeoUtils.h" | |
48 | #endif | |
49 | ||
50 | ClassImp(AliAnaPi0) | |
51 | ||
52 | //________________________________________________________________________________________________________________________________________________ | |
53 | AliAnaPi0::AliAnaPi0() : AliAnaPartCorrBaseClass(), | |
54 | fNCentrBin(0),fNZvertBin(0),fNrpBin(0), | |
55 | fNPID(0),fNmaxMixEv(0), fZvtxCut(0.),fCalorimeter(""), | |
56 | fEventsList(0x0), fhEtalon(0x0), | |
57 | fhRe1(0x0),fhMi1(0x0),fhRe2(0x0),fhMi2(0x0),fhRe3(0x0),fhMi3(0x0),fhEvents(0x0), | |
58 | fhPrimPt(0x0), fhPrimAccPt(0x0), fhPrimY(0x0), fhPrimAccY(0x0), fhPrimPhi(0x0), fhPrimAccPhi(0x0) | |
59 | { | |
60 | //Default Ctor | |
61 | InitParameters(); | |
62 | ||
63 | } | |
64 | ||
65 | //________________________________________________________________________________________________________________________________________________ | |
66 | AliAnaPi0::AliAnaPi0(const AliAnaPi0 & ex) : AliAnaPartCorrBaseClass(ex), | |
67 | fNCentrBin(ex.fNCentrBin),fNZvertBin(ex.fNZvertBin),fNrpBin(ex.fNrpBin), | |
68 | fNPID(ex.fNPID),fNmaxMixEv(ex.fNmaxMixEv),fZvtxCut(ex.fZvtxCut), fCalorimeter(ex.fCalorimeter), | |
69 | fEventsList(ex.fEventsList), fhEtalon(ex.fhEtalon), | |
70 | fhRe1(ex.fhRe1),fhMi1(ex.fhMi1),fhRe2(ex.fhRe2),fhMi2(ex.fhMi2),fhRe3(ex.fhRe3),fhMi3(ex.fhMi3),fhEvents(ex.fhEvents), | |
71 | fhPrimPt(ex.fhPrimPt), fhPrimAccPt(ex.fhPrimAccPt), fhPrimY(ex.fhPrimY), | |
72 | fhPrimAccY(ex.fhPrimAccY), fhPrimPhi(ex.fhPrimPhi), fhPrimAccPhi(ex.fhPrimAccPhi) | |
73 | { | |
477d6cee | 74 | // cpy ctor |
75 | //Do not need it | |
1c5acb87 | 76 | } |
77 | ||
78 | //________________________________________________________________________________________________________________________________________________ | |
79 | AliAnaPi0 & AliAnaPi0::operator = (const AliAnaPi0 & ex) | |
80 | { | |
477d6cee | 81 | // assignment operator |
82 | ||
83 | if(this == &ex)return *this; | |
84 | ((AliAnaPartCorrBaseClass *)this)->operator=(ex); | |
85 | ||
86 | fNCentrBin = ex.fNCentrBin ; fNZvertBin = ex.fNZvertBin ; fNrpBin = ex.fNrpBin ; | |
87 | fNPID = ex.fNPID ; fNmaxMixEv = ex.fNmaxMixEv ; fZvtxCut = ex.fZvtxCut ; fCalorimeter = ex.fCalorimeter ; | |
88 | fEventsList = ex.fEventsList ; fhEtalon = ex.fhEtalon ; | |
89 | fhRe1 = ex.fhRe1 ; fhMi1 = ex.fhMi1 ; fhRe2 = ex.fhRe2 ; fhMi2 = ex.fhMi2 ; | |
90 | fhRe3 = ex.fhRe3 ; fhMi3 = ex.fhMi3 ; fhEvents = ex.fhEvents ; | |
91 | fhPrimPt = ex.fhPrimPt ; fhPrimAccPt = ex.fhPrimAccPt ; fhPrimY = ex.fhPrimY ; | |
92 | fhPrimAccY = ex.fhPrimAccY ; fhPrimPhi = ex.fhPrimPhi ; fhPrimAccPhi = ex.fhPrimAccPhi ; | |
93 | ||
94 | return *this; | |
95 | ||
1c5acb87 | 96 | } |
97 | ||
98 | //________________________________________________________________________________________________________________________________________________ | |
99 | AliAnaPi0::~AliAnaPi0() { | |
477d6cee | 100 | // Remove event containers |
101 | if(fEventsList){ | |
102 | for(Int_t ic=0; ic<fNCentrBin; ic++){ | |
103 | for(Int_t iz=0; iz<fNZvertBin; iz++){ | |
104 | for(Int_t irp=0; irp<fNrpBin; irp++){ | |
105 | fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp]->Delete() ; | |
106 | delete fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] ; | |
1c5acb87 | 107 | } |
477d6cee | 108 | } |
109 | } | |
110 | delete[] fEventsList; | |
111 | fEventsList=0 ; | |
112 | } | |
113 | ||
1c5acb87 | 114 | #ifdef __PHOSGEO__ |
477d6cee | 115 | if(fPHOSGeo) delete fPHOSGeo ; |
1c5acb87 | 116 | #endif |
117 | } | |
118 | ||
119 | //________________________________________________________________________________________________________________________________________________ | |
120 | void AliAnaPi0::InitParameters() | |
121 | { | |
122 | //Init parameters when first called the analysis | |
123 | //Set default parameters | |
a3aebfff | 124 | SetInputAODName("PWG4Particle"); |
125 | ||
126 | AddToHistogramsName("AnaPi0_"); | |
127 | ||
477d6cee | 128 | fNCentrBin = 1; |
129 | fNZvertBin = 1; | |
130 | fNrpBin = 1; | |
131 | fNPID = 9; | |
132 | fNmaxMixEv = 10; | |
133 | fZvtxCut = 40; | |
134 | fCalorimeter = "PHOS"; | |
1c5acb87 | 135 | } |
136 | //________________________________________________________________________________________________________________________________________________ | |
137 | void AliAnaPi0::Init() | |
138 | { | |
477d6cee | 139 | //Init some data members needed in analysis |
140 | ||
141 | //Histograms binning and range | |
142 | if(!fhEtalon){ // p_T alpha d m_gg | |
143 | fhEtalon = new TH3D("hEtalon","Histo with binning parameters",50,0.,25.,10,0.,1.,200,0.,1.) ; | |
144 | fhEtalon->SetXTitle("P_{T} (GeV)") ; | |
145 | fhEtalon->SetYTitle("#alpha") ; | |
146 | fhEtalon->SetZTitle("m_{#gamma#gamma} (GeV)") ; | |
147 | } | |
148 | ||
2e557d1c | 149 | } |
1c5acb87 | 150 | |
2e557d1c | 151 | //________________________________________________________________________________________________________________________________________________ |
152 | TList * AliAnaPi0::GetCreateOutputObjects() | |
153 | { | |
477d6cee | 154 | // Create histograms to be saved in output file and |
155 | // store them in fOutputContainer | |
156 | ||
157 | //create event containers | |
158 | fEventsList = new TList*[fNCentrBin*fNZvertBin*fNrpBin] ; | |
1c5acb87 | 159 | |
477d6cee | 160 | for(Int_t ic=0; ic<fNCentrBin; ic++){ |
161 | for(Int_t iz=0; iz<fNZvertBin; iz++){ | |
162 | for(Int_t irp=0; irp<fNrpBin; irp++){ | |
163 | fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] = new TList() ; | |
164 | } | |
165 | } | |
166 | } | |
167 | ||
168 | //If Geometry library loaded, do geometry selection during analysis. | |
1c5acb87 | 169 | #ifdef __PHOSGEO__ |
a3aebfff | 170 | printf("AliAnaPi0::GetCreateOutputObjects() - PHOS geometry initialized!\n"); |
477d6cee | 171 | fPHOSGeo = new AliPHOSGeoUtils("PHOSgeo") ; |
1c5acb87 | 172 | #endif |
477d6cee | 173 | |
174 | TList * outputContainer = new TList() ; | |
175 | outputContainer->SetName(GetName()); | |
176 | ||
50305ae9 | 177 | fhRe1 = new TH3D*[fNCentrBin*fNPID] ; |
178 | fhRe2 = new TH3D*[fNCentrBin*fNPID] ; | |
179 | fhRe3 = new TH3D*[fNCentrBin*fNPID] ; | |
180 | fhMi1 = new TH3D*[fNCentrBin*fNPID] ; | |
181 | fhMi2 = new TH3D*[fNCentrBin*fNPID] ; | |
182 | fhMi3 = new TH3D*[fNCentrBin*fNPID] ; | |
477d6cee | 183 | |
184 | char key[255] ; | |
185 | char title[255] ; | |
186 | ||
187 | for(Int_t ic=0; ic<fNCentrBin; ic++){ | |
188 | for(Int_t ipid=0; ipid<fNPID; ipid++){ | |
189 | ||
190 | //Distance to bad module 1 | |
191 | sprintf(key,"hRe_cen%d_pid%d_dist1",ic,ipid) ; | |
192 | sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
193 | ||
194 | fhEtalon->Clone(key); | |
195 | fhRe1[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; | |
196 | fhRe1[ic*fNPID+ipid]->SetName(key) ; | |
197 | fhRe1[ic*fNPID+ipid]->SetTitle(title) ; | |
198 | outputContainer->Add(fhRe1[ic*fNPID+ipid]) ; | |
199 | ||
200 | sprintf(key,"hMi_cen%d_pid%d_dist1",ic,ipid) ; | |
201 | sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
202 | fhMi1[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; | |
203 | fhMi1[ic*fNPID+ipid]->SetName(key) ; | |
204 | fhMi1[ic*fNPID+ipid]->SetTitle(title) ; | |
205 | outputContainer->Add(fhMi1[ic*fNPID+ipid]) ; | |
206 | ||
207 | //Distance to bad module 2 | |
208 | sprintf(key,"hRe_cen%d_pid%d_dist2",ic,ipid) ; | |
209 | sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
210 | fhRe2[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; | |
211 | fhRe2[ic*fNPID+ipid]->SetName(key) ; | |
212 | fhRe2[ic*fNPID+ipid]->SetTitle(title) ; | |
213 | outputContainer->Add(fhRe2[ic*fNPID+ipid]) ; | |
214 | ||
215 | sprintf(key,"hMi_cen%d_pid%d_dist2",ic,ipid) ; | |
216 | sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
217 | fhMi2[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; | |
218 | fhMi2[ic*fNPID+ipid]->SetName(key) ; | |
219 | fhMi2[ic*fNPID+ipid]->SetTitle(title) ; | |
220 | outputContainer->Add(fhMi2[ic*fNPID+ipid]) ; | |
221 | ||
222 | //Distance to bad module 3 | |
223 | sprintf(key,"hRe_cen%d_pid%d_dist3",ic,ipid) ; | |
224 | sprintf(title,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
225 | fhRe3[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; | |
226 | fhRe3[ic*fNPID+ipid]->SetName(key) ; | |
227 | fhRe3[ic*fNPID+ipid]->SetTitle(title) ; | |
228 | outputContainer->Add(fhRe3[ic*fNPID+ipid]) ; | |
229 | ||
230 | sprintf(key,"hMi_cen%d_pid%d_dist3",ic,ipid) ; | |
231 | sprintf(title,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
232 | fhMi3[ic*fNPID+ipid]=(TH3D*)fhEtalon->Clone(key) ; | |
233 | fhMi3[ic*fNPID+ipid]->SetName(key) ; | |
234 | fhMi3[ic*fNPID+ipid]->SetTitle(title) ; | |
235 | outputContainer->Add(fhMi3[ic*fNPID+ipid]) ; | |
1c5acb87 | 236 | } |
477d6cee | 237 | } |
238 | ||
239 | ||
240 | fhEvents=new TH3D("hEvents","Number of events",fNCentrBin,0.,1.*fNCentrBin, | |
241 | fNZvertBin,0.,1.*fNZvertBin,fNrpBin,0.,1.*fNrpBin) ; | |
242 | outputContainer->Add(fhEvents) ; | |
243 | ||
244 | //Histograms filled only if MC data is requested | |
245 | if(IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC) ){ | |
246 | if(fhEtalon->GetXaxis()->GetXbins() && fhEtalon->GetXaxis()->GetXbins()->GetSize()){ //Variable bin size | |
247 | fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXbins()->GetArray()) ; | |
248 | fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance",fhEtalon->GetXaxis()->GetNbins(), | |
249 | fhEtalon->GetXaxis()->GetXbins()->GetArray()) ; | |
250 | } | |
251 | else{ | |
252 | fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXmin(),fhEtalon->GetXaxis()->GetXmax()) ; | |
253 | fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance", | |
254 | fhEtalon->GetXaxis()->GetNbins(),fhEtalon->GetXaxis()->GetXmin(),fhEtalon->GetXaxis()->GetXmax()) ; | |
255 | } | |
256 | outputContainer->Add(fhPrimPt) ; | |
257 | outputContainer->Add(fhPrimAccPt) ; | |
258 | ||
259 | fhPrimY = new TH1D("hPrimaryRapidity","Rapidity of primary pi0",100,-5.,5.) ; | |
260 | outputContainer->Add(fhPrimY) ; | |
261 | ||
262 | fhPrimAccY = new TH1D("hPrimAccRapidity","Rapidity of primary pi0",100,-5.,5.) ; | |
263 | outputContainer->Add(fhPrimAccY) ; | |
264 | ||
265 | fhPrimPhi = new TH1D("hPrimaryPhi","Azimithal of primary pi0",180,0.,360.) ; | |
266 | outputContainer->Add(fhPrimPhi) ; | |
267 | ||
268 | fhPrimAccPhi = new TH1D("hPrimAccPhi","Azimithal of primary pi0 with accepted daughters",180,-0.,360.) ; | |
269 | outputContainer->Add(fhPrimAccPhi) ; | |
270 | } | |
a3aebfff | 271 | |
477d6cee | 272 | //Save parameters used for analysis |
273 | TString parList ; //this will be list of parameters used for this analysis. | |
274 | char onePar[255] ; | |
275 | sprintf(onePar,"--- AliAnaPi0 ---\n") ; | |
276 | parList+=onePar ; | |
277 | sprintf(onePar,"Number of bins in Centrality: %d \n",fNCentrBin) ; | |
278 | parList+=onePar ; | |
279 | sprintf(onePar,"Number of bins in Z vert. pos: %d \n",fNZvertBin) ; | |
280 | parList+=onePar ; | |
281 | sprintf(onePar,"Number of bins in Reac. Plain: %d \n",fNrpBin) ; | |
282 | parList+=onePar ; | |
283 | sprintf(onePar,"Depth of event buffer: %d \n",fNmaxMixEv) ; | |
284 | parList+=onePar ; | |
285 | sprintf(onePar,"Number of different PID used: %d \n",fNPID) ; | |
286 | parList+=onePar ; | |
287 | sprintf(onePar,"Cuts: \n") ; | |
288 | parList+=onePar ; | |
289 | sprintf(onePar,"Z vertex position: -%f < z < %f \n",fZvtxCut,fZvtxCut) ; | |
290 | parList+=onePar ; | |
291 | sprintf(onePar,"Calorimeter: %s \n",fCalorimeter.Data()) ; | |
292 | parList+=onePar ; | |
293 | ||
294 | TObjString *oString= new TObjString(parList) ; | |
295 | outputContainer->Add(oString); | |
296 | ||
297 | return outputContainer; | |
1c5acb87 | 298 | } |
299 | ||
300 | //_________________________________________________________________________________________________________________________________________________ | |
301 | void AliAnaPi0::Print(const Option_t * /*opt*/) const | |
302 | { | |
477d6cee | 303 | //Print some relevant parameters set for the analysis |
a3aebfff | 304 | printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; |
477d6cee | 305 | AliAnaPartCorrBaseClass::Print(" "); |
a3aebfff | 306 | |
477d6cee | 307 | printf("Number of bins in Centrality: %d \n",fNCentrBin) ; |
308 | printf("Number of bins in Z vert. pos: %d \n",fNZvertBin) ; | |
309 | printf("Number of bins in Reac. Plain: %d \n",fNrpBin) ; | |
310 | printf("Depth of event buffer: %d \n",fNmaxMixEv) ; | |
311 | printf("Number of different PID used: %d \n",fNPID) ; | |
312 | printf("Cuts: \n") ; | |
313 | printf("Z vertex position: -%2.3f < z < %2.3f \n",fZvtxCut,fZvtxCut) ; | |
314 | printf("------------------------------------------------------\n") ; | |
1c5acb87 | 315 | } |
316 | ||
317 | ||
318 | //____________________________________________________________________________________________________________________________________________________ | |
6639984f | 319 | void AliAnaPi0::MakeAnalysisFillHistograms() |
1c5acb87 | 320 | { |
477d6cee | 321 | //Process one event and extract photons from AOD branch |
322 | // filled with AliAnaPhoton and fill histos with invariant mass | |
323 | ||
324 | //Apply some cuts on event: vertex position and centrality range | |
325 | Int_t iRun=(GetReader()->GetInputEvent())->GetRunNumber() ; | |
326 | if(IsBadRun(iRun)) return ; | |
327 | ||
328 | Double_t vert[]={0,0,0} ; //vertex ; | |
329 | GetReader()->GetVertex(vert); | |
330 | if(vert[2]<-fZvtxCut || vert[2]> fZvtxCut) return ; //Event can not be used (vertex, centrality,... cuts not fulfilled) | |
331 | ||
332 | //Get Centrality and calculate centrality bin | |
333 | //Does not exist in ESD yet??????? | |
334 | Int_t curCentrBin=0 ; | |
335 | ||
336 | //Get Reaction Plain position and calculate RP bin | |
337 | //does not exist in ESD yet???? | |
338 | Int_t curRPBin=0 ; | |
339 | ||
340 | Int_t curZvertBin=(Int_t)(0.5*fNZvertBin*(vert[2]+fZvtxCut)/fZvtxCut) ; | |
341 | ||
342 | fhEvents->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ; | |
343 | ||
344 | Int_t nPhot = GetInputAODBranch()->GetEntriesFast() ; | |
a3aebfff | 345 | if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Photon entries %d\n", nPhot); |
477d6cee | 346 | |
347 | for(Int_t i1=0; i1<nPhot-1; i1++){ | |
348 | AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ; | |
349 | TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); | |
350 | for(Int_t i2=i1+1; i2<nPhot; i2++){ | |
351 | AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i2)) ; | |
352 | TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); | |
353 | Double_t m = (photon1 + photon2).M() ; | |
354 | Double_t pt = (photon1 + photon2).Pt(); | |
355 | Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; | |
356 | if(GetDebug() > 2) | |
a3aebfff | 357 | printf("AliAnaPi0::MakeAnalysisFillHistograms() - Current Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", |
477d6cee | 358 | p1->Pt(), p2->Pt(), pt,m,a); |
359 | for(Int_t ipid=0; ipid<fNPID; ipid++) | |
360 | { | |
361 | if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ | |
362 | fhRe1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; | |
363 | if(p1->DistToBad()>0 && p2->DistToBad()>0){ | |
364 | fhRe2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; | |
365 | if(p1->DistToBad()>1 && p2->DistToBad()>1){ | |
366 | fhRe3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; | |
367 | } | |
368 | } | |
369 | } | |
370 | } | |
371 | } | |
372 | } | |
373 | ||
374 | //Fill mixed | |
375 | ||
376 | TList * evMixList=fEventsList[curCentrBin*fNZvertBin*fNrpBin+curZvertBin*fNrpBin+curRPBin] ; | |
377 | Int_t nMixed = evMixList->GetSize() ; | |
378 | for(Int_t ii=0; ii<nMixed; ii++){ | |
379 | TClonesArray* ev2= (TClonesArray*) (evMixList->At(ii)); | |
380 | Int_t nPhot2=ev2->GetEntriesFast() ; | |
381 | Double_t m = -999; | |
a3aebfff | 382 | if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d\n", ii, nPhot); |
477d6cee | 383 | |
384 | for(Int_t i1=0; i1<nPhot; i1++){ | |
385 | AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ; | |
386 | TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); | |
387 | for(Int_t i2=0; i2<nPhot2; i2++){ | |
388 | AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (ev2->At(i2)) ; | |
1c5acb87 | 389 | |
477d6cee | 390 | TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); |
391 | m = (photon1+photon2).M() ; | |
392 | Double_t pt = (photon1 + photon2).Pt(); | |
393 | Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; | |
394 | if(GetDebug() > 2) | |
a3aebfff | 395 | printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", |
477d6cee | 396 | p1->Pt(), p2->Pt(), pt,m,a); |
397 | for(Int_t ipid=0; ipid<fNPID; ipid++){ | |
398 | if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ | |
399 | fhMi1[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; | |
400 | if(p1->DistToBad()>0 && p2->DistToBad()>0){ | |
401 | fhMi2[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; | |
402 | if(p1->DistToBad()>1 && p2->DistToBad()>1){ | |
403 | fhMi3[curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; | |
404 | } | |
405 | ||
406 | } | |
407 | } | |
1c5acb87 | 408 | } |
477d6cee | 409 | } |
410 | } | |
411 | } | |
412 | ||
413 | TClonesArray *currentEvent = new TClonesArray(*GetInputAODBranch()); | |
414 | //Add current event to buffer and Remove redandant events | |
415 | if(currentEvent->GetEntriesFast()>0){ | |
416 | evMixList->AddFirst(currentEvent) ; | |
417 | currentEvent=0 ; //Now list of particles belongs to buffer and it will be deleted with buffer | |
418 | if(evMixList->GetSize()>=fNmaxMixEv) | |
419 | { | |
420 | TClonesArray * tmp = (TClonesArray*) (evMixList->Last()) ; | |
421 | evMixList->RemoveLast() ; | |
422 | delete tmp ; | |
423 | } | |
424 | } | |
425 | else{ //empty event | |
426 | delete currentEvent ; | |
427 | currentEvent=0 ; | |
428 | } | |
429 | ||
430 | //Acceptance | |
431 | AliStack * stack = GetMCStack(); | |
432 | if(stack && (IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC)) ){ | |
433 | for(Int_t i=0 ; i<stack->GetNprimary(); i++){ | |
434 | TParticle * prim = stack->Particle(i) ; | |
435 | if(prim->GetPdgCode() == 111){ | |
436 | Double_t pi0Pt = prim->Pt() ; | |
437 | //printf("pi0, pt %2.2f\n",pi0Pt); | |
438 | if(prim->Energy() == TMath::Abs(prim->Pz())) continue ; //Protection against floating point exception | |
439 | Double_t pi0Y = 0.5*TMath::Log((prim->Energy()-prim->Pz())/(prim->Energy()+prim->Pz())) ; | |
440 | Double_t phi = TMath::RadToDeg()*prim->Phi() ; | |
441 | if(TMath::Abs(pi0Y) < 0.5){ | |
442 | fhPrimPt->Fill(pi0Pt) ; | |
1c5acb87 | 443 | } |
477d6cee | 444 | fhPrimY ->Fill(pi0Y) ; |
445 | fhPrimPhi->Fill(phi) ; | |
1c5acb87 | 446 | |
477d6cee | 447 | //Check if both photons hit Calorimeter |
448 | Int_t iphot1=prim->GetFirstDaughter() ; | |
449 | Int_t iphot2=prim->GetLastDaughter() ; | |
450 | if(iphot1>-1 && iphot1<stack->GetNtrack() && iphot2>-1 && iphot2<stack->GetNtrack()){ | |
451 | TParticle * phot1 = stack->Particle(iphot1) ; | |
452 | TParticle * phot2 = stack->Particle(iphot2) ; | |
453 | if(phot1 && phot2 && phot1->GetPdgCode()==22 && phot2->GetPdgCode()==22){ | |
454 | //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", | |
455 | // phot1->Pt(), phot1->Phi()*180./3.1415, phot1->Eta(), phot2->Pt(), phot2->Phi()*180./3.1415, phot2->Eta()); | |
456 | Bool_t inacceptance = kFALSE; | |
1c5acb87 | 457 | #ifdef __PHOSGEO__ |
477d6cee | 458 | Int_t mod ; |
459 | Double_t x,z ; | |
460 | if(fCalorimeter == "PHOS" && fPHOSGeo->ImpactOnEmc(phot1,mod,z,x) && fPHOSGeo->ImpactOnEmc(phot1,mod,z,x)) | |
461 | inacceptance = kTRUE; | |
462 | //printf("In REAL PHOS acceptance? %d\n",inacceptance); | |
1c5acb87 | 463 | #else |
477d6cee | 464 | TLorentzVector lv1, lv2; |
465 | phot1->Momentum(lv1); | |
466 | phot2->Momentum(lv2); | |
467 | if(GetFidutialCut()->IsInFidutialCut(lv1,fCalorimeter) && GetFidutialCut()->IsInFidutialCut(lv2,fCalorimeter)) | |
468 | inacceptance = kTRUE ; | |
469 | //printf("In %s fidutial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance); | |
1c5acb87 | 470 | #endif |
477d6cee | 471 | if(inacceptance){ |
472 | fhPrimAccPt->Fill(pi0Pt) ; | |
473 | fhPrimAccPhi->Fill(phi) ; | |
474 | fhPrimAccY->Fill(pi0Y) ; | |
475 | }//Accepted | |
476 | }// 2 photons | |
477 | }//Check daughters exist | |
478 | }// Primary pi0 | |
479 | }//loop on primaries | |
480 | }//stack exists and data is MC | |
481 | ||
1c5acb87 | 482 | } |
483 | ||
a5cc4f03 | 484 | //________________________________________________________________________ |
485 | void AliAnaPi0::ReadHistograms(TList* outputList) | |
486 | { | |
487 | // Needed when Terminate is executed in distributed environment | |
488 | // Refill analysis histograms of this class with corresponding histograms in output list. | |
489 | ||
490 | // Histograms of this analsys are kept in the same list as other analysis, recover the position of | |
50305ae9 | 491 | // the first one and then add the next. |
a5cc4f03 | 492 | Int_t index = outputList->IndexOf(outputList->FindObject(GetAddedHistogramsStringToName()+"hRe_cen0_pid0_dist1")); |
493 | ||
50305ae9 | 494 | if(!fhRe1) fhRe1 = new TH3D*[fNCentrBin*fNPID] ; |
495 | if(!fhRe2) fhRe2 = new TH3D*[fNCentrBin*fNPID] ; | |
496 | if(!fhRe3) fhRe3 = new TH3D*[fNCentrBin*fNPID] ; | |
497 | if(!fhMi1) fhMi1 = new TH3D*[fNCentrBin*fNPID] ; | |
498 | if(!fhMi2) fhMi2 = new TH3D*[fNCentrBin*fNPID] ; | |
499 | if(!fhMi3) fhMi3 = new TH3D*[fNCentrBin*fNPID] ; | |
500 | ||
a5cc4f03 | 501 | for(Int_t ic=0; ic<fNCentrBin; ic++){ |
502 | for(Int_t ipid=0; ipid<fNPID; ipid++){ | |
503 | fhRe1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
504 | fhMi1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
505 | fhRe2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
506 | fhMi2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
507 | fhRe3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
508 | fhMi3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
509 | } | |
510 | } | |
511 | ||
512 | fhEvents = (TH3D *) outputList->At(index++); | |
513 | ||
514 | //Histograms filled only if MC data is requested | |
515 | if(IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC) ){ | |
516 | fhPrimPt = (TH1D*) outputList->At(index++); | |
517 | fhPrimAccPt = (TH1D*) outputList->At(index++); | |
518 | fhPrimY = (TH1D*) outputList->At(index++); | |
519 | fhPrimAccY = (TH1D*) outputList->At(index++); | |
520 | fhPrimPhi = (TH1D*) outputList->At(index++); | |
521 | fhPrimAccPhi = (TH1D*) outputList->At(index); | |
522 | } | |
523 | ||
524 | } | |
525 | ||
526 | ||
6639984f | 527 | //____________________________________________________________________________________________________________________________________________________ |
a5cc4f03 | 528 | void AliAnaPi0::Terminate(TList* outputList) |
6639984f | 529 | { |
530 | //Do some calculations and plots from the final histograms. | |
477d6cee | 531 | |
fbeaf916 | 532 | printf(" *** %s Terminate:\n", GetName()) ; |
a5cc4f03 | 533 | |
534 | //Recover histograms from output histograms list, needed for distributed analysis. | |
535 | ReadHistograms(outputList); | |
536 | ||
2e557d1c | 537 | if (!fhRe1) { |
a3aebfff | 538 | printf("AliAnaPi0::Terminate() - Error: Remote output histograms not imported in AliAnaPi0 object"); |
2e557d1c | 539 | return; |
540 | } | |
a5cc4f03 | 541 | |
a3aebfff | 542 | printf("AliAnaPi0::Terminate() Mgg Real : %5.3f , RMS : %5.3f \n", fhRe1[0]->GetMean(), fhRe1[0]->GetRMS() ) ; |
6639984f | 543 | |
71dd883b | 544 | char nameIM[128]; |
545 | sprintf(nameIM,"AliAnaPi0_%s_cPt",fCalorimeter.Data()); | |
546 | TCanvas * cIM = new TCanvas(nameIM, "", 400, 10, 600, 700) ; | |
6639984f | 547 | cIM->Divide(2, 2); |
548 | ||
549 | cIM->cd(1) ; | |
550 | //gPad->SetLogy(); | |
551 | TH1D * hIMAllPt = (TH1D*) fhRe1[0]->ProjectionZ(); | |
552 | hIMAllPt->SetLineColor(2); | |
553 | hIMAllPt->SetTitle("No cut on p_{T, #gamma#gamma} "); | |
554 | hIMAllPt->Draw(); | |
555 | ||
556 | cIM->cd(2) ; | |
557 | TH3F * hRe1Pt5 = (TH3F*)fhRe1[0]->Clone("IMPt5"); | |
558 | hRe1Pt5->GetXaxis()->SetRangeUser(0,5); | |
559 | TH1D * hIMPt5 = (TH1D*) hRe1Pt5->Project3D("z"); | |
560 | hIMPt5->SetLineColor(2); | |
561 | hIMPt5->SetTitle("0 < p_{T, #gamma#gamma} < 5 GeV/c"); | |
562 | hIMPt5->Draw(); | |
563 | ||
564 | cIM->cd(3) ; | |
565 | TH3F * hRe1Pt10 = (TH3F*)fhRe1[0]->Clone("IMPt10"); | |
566 | hRe1Pt10->GetXaxis()->SetRangeUser(5,10); | |
567 | TH1D * hIMPt10 = (TH1D*) hRe1Pt10->Project3D("z"); | |
568 | hIMPt10->SetLineColor(2); | |
569 | hIMPt10->SetTitle("5 < p_{T, #gamma#gamma} < 10 GeV/c"); | |
570 | hIMPt10->Draw(); | |
571 | ||
572 | cIM->cd(4) ; | |
573 | TH3F * hRe1Pt20 = (TH3F*)fhRe1[0]->Clone("IMPt20"); | |
574 | hRe1Pt20->GetXaxis()->SetRangeUser(10,20); | |
575 | TH1D * hIMPt20 = (TH1D*) hRe1Pt20->Project3D("z"); | |
576 | hIMPt20->SetLineColor(2); | |
577 | hIMPt20->SetTitle("10 < p_{T, #gamma#gamma} < 20 GeV/c"); | |
578 | hIMPt20->Draw(); | |
579 | ||
71dd883b | 580 | char nameIMF[128]; |
581 | sprintf(nameIMF,"AliAnaPi0_%s_Mgg.eps",fCalorimeter.Data()); | |
582 | cIM->Print(nameIMF); | |
6639984f | 583 | |
71dd883b | 584 | char namePt[128]; |
585 | sprintf(namePt,"AliAnaPi0_%s_cPt",fCalorimeter.Data()); | |
586 | TCanvas * cPt = new TCanvas(namePt, "", 400, 10, 600, 700) ; | |
6639984f | 587 | cPt->Divide(2, 2); |
588 | ||
589 | cPt->cd(1) ; | |
590 | //gPad->SetLogy(); | |
591 | TH1D * hPt = (TH1D*) fhRe1[0]->Project3D("x"); | |
592 | hPt->SetLineColor(2); | |
593 | hPt->SetTitle("No cut on M_{#gamma#gamma} "); | |
594 | hPt->Draw(); | |
595 | ||
596 | cPt->cd(2) ; | |
597 | TH3F * hRe1IM1 = (TH3F*)fhRe1[0]->Clone("PtIM1"); | |
598 | hRe1IM1->GetZaxis()->SetRangeUser(0.05,0.21); | |
599 | TH1D * hPtIM1 = (TH1D*) hRe1IM1->Project3D("x"); | |
600 | hPtIM1->SetLineColor(2); | |
601 | hPtIM1->SetTitle("0.05 < M_{#gamma#gamma} < 0.21 GeV/c^{2}"); | |
602 | hPtIM1->Draw(); | |
603 | ||
604 | cPt->cd(3) ; | |
605 | TH3F * hRe1IM2 = (TH3F*)fhRe1[0]->Clone("PtIM2"); | |
606 | hRe1IM2->GetZaxis()->SetRangeUser(0.09,0.17); | |
607 | TH1D * hPtIM2 = (TH1D*) hRe1IM2->Project3D("x"); | |
608 | hPtIM2->SetLineColor(2); | |
609 | hPtIM2->SetTitle("0.09 < M_{#gamma#gamma} < 0.17 GeV/c^{2}"); | |
610 | hPtIM2->Draw(); | |
611 | ||
612 | cPt->cd(4) ; | |
613 | TH3F * hRe1IM3 = (TH3F*)fhRe1[0]->Clone("PtIM3"); | |
614 | hRe1IM3->GetZaxis()->SetRangeUser(0.11,0.15); | |
615 | TH1D * hPtIM3 = (TH1D*) hRe1IM1->Project3D("x"); | |
616 | hPtIM3->SetLineColor(2); | |
617 | hPtIM3->SetTitle("0.11 < M_{#gamma#gamma} < 0.15 GeV/c^{2}"); | |
618 | hPtIM3->Draw(); | |
619 | ||
71dd883b | 620 | char namePtF[128]; |
621 | sprintf(namePtF,"AliAnaPi0_%s_Pt.eps",fCalorimeter.Data()); | |
622 | cPt->Print(namePtF); | |
1c5acb87 | 623 | |
6639984f | 624 | |
625 | char line[1024] ; | |
71dd883b | 626 | sprintf(line, ".!tar -zcf %s_%s.tar.gz *.eps", GetName(),fCalorimeter.Data()) ; |
6639984f | 627 | gROOT->ProcessLine(line); |
71dd883b | 628 | sprintf(line, ".!rm -fR AliAnaPi0_%s*.eps",fCalorimeter.Data()); |
6639984f | 629 | gROOT->ProcessLine(line); |
630 | ||
71dd883b | 631 | printf(" AliAnaPi0::Terminate() - !! All the eps files are in %s_%s.tar.gz !!!\n", GetName(), fCalorimeter.Data()); |
1c5acb87 | 632 | |
6639984f | 633 | } |
1c5acb87 | 634 | |
635 | ||
636 | ||
637 | ||
638 |