]>
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" | |
50f39b97 | 29 | #include "TH2D.h" |
1c5acb87 | 30 | //#include "Riostream.h" |
6639984f | 31 | #include "TCanvas.h" |
32 | #include "TPad.h" | |
33 | #include "TROOT.h" | |
477d6cee | 34 | #include "TClonesArray.h" |
0c1383b5 | 35 | #include "TObjString.h" |
1c5acb87 | 36 | |
37 | //---- AliRoot system ---- | |
38 | #include "AliAnaPi0.h" | |
39 | #include "AliCaloTrackReader.h" | |
40 | #include "AliCaloPID.h" | |
6639984f | 41 | #include "AliStack.h" |
ff45398a | 42 | #include "AliFiducialCut.h" |
477d6cee | 43 | #include "TParticle.h" |
477d6cee | 44 | #include "AliVEvent.h" |
6921fa00 | 45 | #include "AliESDCaloCluster.h" |
46 | #include "AliESDEvent.h" | |
47 | #include "AliAODEvent.h" | |
50f39b97 | 48 | #include "AliNeutralMesonSelection.h" |
c8fe2783 | 49 | #include "AliMixedEvent.h" |
50 | ||
591cc579 | 51 | |
1c5acb87 | 52 | ClassImp(AliAnaPi0) |
53 | ||
54 | //________________________________________________________________________________________________________________________________________________ | |
55 | AliAnaPi0::AliAnaPi0() : AliAnaPartCorrBaseClass(), | |
7e7694bb | 56 | fDoOwnMix(kFALSE),fNCentrBin(0),fNZvertBin(0),fNrpBin(0), |
1c5acb87 | 57 | fNPID(0),fNmaxMixEv(0), fZvtxCut(0.),fCalorimeter(""), |
5ae09196 | 58 | fNModules(12), fUseAngleCut(kFALSE), fEventsList(0x0), fMultiCutAna(kFALSE), |
59 | fNPtCuts(0),fPtCuts(0x0),fNAsymCuts(0),fAsymCuts(0x0), | |
db2bf6fd | 60 | fNCellNCuts(0),fCellNCuts(0x0),fNPIDBits(0),fPIDBits(0x0),fhReMod(0x0), |
5ae09196 | 61 | fhRe1(0x0), fhMi1(0x0), fhRe2(0x0), fhMi2(0x0), fhRe3(0x0), fhMi3(0x0), |
62 | fhReInvPt1(0x0), fhMiInvPt1(0x0), fhReInvPt2(0x0), fhMiInvPt2(0x0), fhReInvPt3(0x0), fhMiInvPt3(0x0), | |
63 | fhRePtNCellAsymCuts(0x0), fhRePIDBits(0x0), | |
64 | fhEvents(0x0), fhRealOpeningAngle(0x0),fhRealCosOpeningAngle(0x0), | |
50f39b97 | 65 | fhPrimPt(0x0), fhPrimAccPt(0x0), fhPrimY(0x0), fhPrimAccY(0x0), fhPrimPhi(0x0), fhPrimAccPhi(0x0), |
66 | fhPrimOpeningAngle(0x0),fhPrimCosOpeningAngle(0x0) | |
1c5acb87 | 67 | { |
68 | //Default Ctor | |
69 | InitParameters(); | |
70 | ||
71 | } | |
1c5acb87 | 72 | |
73 | //________________________________________________________________________________________________________________________________________________ | |
74 | AliAnaPi0::~AliAnaPi0() { | |
477d6cee | 75 | // Remove event containers |
7e7694bb | 76 | |
77 | if(fDoOwnMix && fEventsList){ | |
477d6cee | 78 | for(Int_t ic=0; ic<fNCentrBin; ic++){ |
79 | for(Int_t iz=0; iz<fNZvertBin; iz++){ | |
7e7694bb | 80 | for(Int_t irp=0; irp<fNrpBin; irp++){ |
81 | fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp]->Delete() ; | |
82 | delete fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] ; | |
83 | } | |
477d6cee | 84 | } |
85 | } | |
86 | delete[] fEventsList; | |
87 | fEventsList=0 ; | |
88 | } | |
591cc579 | 89 | |
1c5acb87 | 90 | } |
91 | ||
92 | //________________________________________________________________________________________________________________________________________________ | |
93 | void AliAnaPi0::InitParameters() | |
94 | { | |
95 | //Init parameters when first called the analysis | |
96 | //Set default parameters | |
a3aebfff | 97 | SetInputAODName("PWG4Particle"); |
98 | ||
99 | AddToHistogramsName("AnaPi0_"); | |
6921fa00 | 100 | fNModules = 12; // set maximum to maximum number of EMCAL modules |
477d6cee | 101 | fNCentrBin = 1; |
102 | fNZvertBin = 1; | |
103 | fNrpBin = 1; | |
104 | fNPID = 9; | |
105 | fNmaxMixEv = 10; | |
106 | fZvtxCut = 40; | |
107 | fCalorimeter = "PHOS"; | |
50f39b97 | 108 | fUseAngleCut = kFALSE; |
5ae09196 | 109 | |
110 | fMultiCutAna = kFALSE; | |
111 | ||
112 | fNPtCuts = 3; | |
113 | fPtCuts = new Float_t[fNPtCuts]; | |
114 | fPtCuts[0] = 0.; fPtCuts[1] = 0.2; fPtCuts[2] = 0.3; | |
115 | ||
116 | fNAsymCuts = 3; | |
117 | fAsymCuts = new Float_t[fNAsymCuts]; | |
db2bf6fd | 118 | fAsymCuts[0] = 0.7; fAsymCuts[1] = 0.8; fAsymCuts[2] = 1.; |
5ae09196 | 119 | |
120 | fNCellNCuts = 3; | |
121 | fCellNCuts = new Int_t[fNCellNCuts]; | |
122 | fCellNCuts[0] = 1; fCellNCuts[1] = 2; fCellNCuts[2] = 3; | |
123 | ||
124 | fNPIDBits = 3; | |
125 | fPIDBits = new Int_t[fNPIDBits]; | |
126 | fPIDBits[0] = 2; fPIDBits[1] = 4; fPIDBits[2] = 6; // check dispersion, neutral, dispersion&&neutral | |
127 | ||
1c5acb87 | 128 | } |
1c5acb87 | 129 | |
0c1383b5 | 130 | |
131 | //________________________________________________________________________________________________________________________________________________ | |
132 | TObjString * AliAnaPi0::GetAnalysisCuts() | |
133 | { | |
134 | //Save parameters used for analysis | |
135 | TString parList ; //this will be list of parameters used for this analysis. | |
5ae09196 | 136 | const Int_t buffersize = 255; |
137 | char onePar[buffersize] ; | |
138 | snprintf(onePar,buffersize,"--- AliAnaPi0 ---\n") ; | |
0c1383b5 | 139 | parList+=onePar ; |
5ae09196 | 140 | snprintf(onePar,buffersize,"Number of bins in Centrality: %d \n",fNCentrBin) ; |
0c1383b5 | 141 | parList+=onePar ; |
5ae09196 | 142 | snprintf(onePar,buffersize,"Number of bins in Z vert. pos: %d \n",fNZvertBin) ; |
0c1383b5 | 143 | parList+=onePar ; |
5ae09196 | 144 | snprintf(onePar,buffersize,"Number of bins in Reac. Plain: %d \n",fNrpBin) ; |
0c1383b5 | 145 | parList+=onePar ; |
5ae09196 | 146 | snprintf(onePar,buffersize,"Depth of event buffer: %d \n",fNmaxMixEv) ; |
0c1383b5 | 147 | parList+=onePar ; |
5ae09196 | 148 | snprintf(onePar,buffersize,"Number of different PID used: %d \n",fNPID) ; |
0c1383b5 | 149 | parList+=onePar ; |
5ae09196 | 150 | snprintf(onePar,buffersize,"Cuts: \n") ; |
0c1383b5 | 151 | parList+=onePar ; |
5ae09196 | 152 | snprintf(onePar,buffersize,"Z vertex position: -%f < z < %f \n",fZvtxCut,fZvtxCut) ; |
0c1383b5 | 153 | parList+=onePar ; |
5ae09196 | 154 | snprintf(onePar,buffersize,"Calorimeter: %s \n",fCalorimeter.Data()) ; |
0c1383b5 | 155 | parList+=onePar ; |
5ae09196 | 156 | snprintf(onePar,buffersize,"Number of modules: %d \n",fNModules) ; |
0c1383b5 | 157 | parList+=onePar ; |
db2bf6fd | 158 | if(fMultiCutAna){ |
159 | snprintf(onePar, buffersize," pT cuts: n = %d, pt > ",fNPtCuts) ; | |
160 | for(Int_t i = 0; i < fNPtCuts; i++) snprintf(onePar,buffersize,"%s %2.2f;",onePar,fPtCuts[i]); | |
161 | parList+=onePar ; | |
162 | ||
163 | snprintf(onePar,buffersize, " N cell in cluster cuts: n = %d, nCell > ",fNCellNCuts) ; | |
164 | for(Int_t i = 0; i < fNCellNCuts; i++) snprintf(onePar,buffersize,"%s %d;",onePar,fCellNCuts[i]); | |
165 | parList+=onePar ; | |
166 | ||
167 | snprintf(onePar,buffersize," Asymmetry cuts: n = %d, asymmetry < ",fNAsymCuts) ; | |
168 | for(Int_t i = 0; i < fNAsymCuts; i++) snprintf(onePar,buffersize,"%s %2.2f;",onePar,fAsymCuts[i]); | |
169 | parList+=onePar ; | |
170 | ||
171 | snprintf(onePar,buffersize," PID selection bits: n = %d, PID bit =\n",fNPIDBits) ; | |
172 | for(Int_t i = 0; i < fNPIDBits; i++) snprintf(onePar,buffersize,"%s %d;",onePar,fPIDBits[i]); | |
173 | parList+=onePar ; | |
174 | } | |
175 | ||
0c1383b5 | 176 | return new TObjString(parList) ; |
177 | } | |
178 | ||
2e557d1c | 179 | //________________________________________________________________________________________________________________________________________________ |
180 | TList * AliAnaPi0::GetCreateOutputObjects() | |
181 | { | |
477d6cee | 182 | // Create histograms to be saved in output file and |
183 | // store them in fOutputContainer | |
184 | ||
185 | //create event containers | |
186 | fEventsList = new TList*[fNCentrBin*fNZvertBin*fNrpBin] ; | |
1c5acb87 | 187 | |
477d6cee | 188 | for(Int_t ic=0; ic<fNCentrBin; ic++){ |
189 | for(Int_t iz=0; iz<fNZvertBin; iz++){ | |
190 | for(Int_t irp=0; irp<fNrpBin; irp++){ | |
7e7694bb | 191 | fEventsList[ic*fNZvertBin*fNrpBin+iz*fNrpBin+irp] = new TList() ; |
477d6cee | 192 | } |
193 | } | |
194 | } | |
7e7694bb | 195 | |
477d6cee | 196 | TList * outputContainer = new TList() ; |
197 | outputContainer->SetName(GetName()); | |
6921fa00 | 198 | |
199 | fhReMod = new TH3D*[fNModules] ; | |
50305ae9 | 200 | fhRe1 = new TH3D*[fNCentrBin*fNPID] ; |
201 | fhRe2 = new TH3D*[fNCentrBin*fNPID] ; | |
202 | fhRe3 = new TH3D*[fNCentrBin*fNPID] ; | |
203 | fhMi1 = new TH3D*[fNCentrBin*fNPID] ; | |
204 | fhMi2 = new TH3D*[fNCentrBin*fNPID] ; | |
205 | fhMi3 = new TH3D*[fNCentrBin*fNPID] ; | |
5ae09196 | 206 | |
207 | fhReInvPt1 = new TH3D*[fNCentrBin*fNPID] ; | |
208 | fhReInvPt2 = new TH3D*[fNCentrBin*fNPID] ; | |
209 | fhReInvPt3 = new TH3D*[fNCentrBin*fNPID] ; | |
210 | fhMiInvPt1 = new TH3D*[fNCentrBin*fNPID] ; | |
211 | fhMiInvPt2 = new TH3D*[fNCentrBin*fNPID] ; | |
212 | fhMiInvPt3 = new TH3D*[fNCentrBin*fNPID] ; | |
213 | ||
214 | const Int_t buffersize = 255; | |
215 | char key[buffersize] ; | |
216 | char title[buffersize] ; | |
477d6cee | 217 | |
5a2dbc3c | 218 | Int_t nptbins = GetHistoPtBins(); |
219 | Int_t nphibins = GetHistoPhiBins(); | |
220 | Int_t netabins = GetHistoEtaBins(); | |
221 | Float_t ptmax = GetHistoPtMax(); | |
222 | Float_t phimax = GetHistoPhiMax(); | |
223 | Float_t etamax = GetHistoEtaMax(); | |
224 | Float_t ptmin = GetHistoPtMin(); | |
225 | Float_t phimin = GetHistoPhiMin(); | |
226 | Float_t etamin = GetHistoEtaMin(); | |
227 | ||
228 | Int_t nmassbins = GetHistoMassBins(); | |
229 | Int_t nasymbins = GetHistoAsymmetryBins(); | |
230 | Float_t massmax = GetHistoMassMax(); | |
231 | Float_t asymmax = GetHistoAsymmetryMax(); | |
232 | Float_t massmin = GetHistoMassMin(); | |
233 | Float_t asymmin = GetHistoAsymmetryMin(); | |
234 | ||
477d6cee | 235 | for(Int_t ic=0; ic<fNCentrBin; ic++){ |
236 | for(Int_t ipid=0; ipid<fNPID; ipid++){ | |
7e7694bb | 237 | |
477d6cee | 238 | //Distance to bad module 1 |
5ae09196 | 239 | snprintf(key, buffersize,"hRe_cen%d_pid%d_dist1",ic,ipid) ; |
240 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
7e7694bb | 241 | fhRe1[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
477d6cee | 242 | outputContainer->Add(fhRe1[ic*fNPID+ipid]) ; |
7e7694bb | 243 | |
477d6cee | 244 | //Distance to bad module 2 |
5ae09196 | 245 | snprintf(key, buffersize,"hRe_cen%d_pid%d_dist2",ic,ipid) ; |
246 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
7e7694bb | 247 | fhRe2[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
477d6cee | 248 | outputContainer->Add(fhRe2[ic*fNPID+ipid]) ; |
249 | ||
477d6cee | 250 | //Distance to bad module 3 |
5ae09196 | 251 | snprintf(key, buffersize,"hRe_cen%d_pid%d_dist3",ic,ipid) ; |
252 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
7e7694bb | 253 | fhRe3[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
477d6cee | 254 | outputContainer->Add(fhRe3[ic*fNPID+ipid]) ; |
255 | ||
5ae09196 | 256 | //Inverse pT |
257 | //Distance to bad module 1 | |
258 | snprintf(key, buffersize,"hReInvPt_cen%d_pid%d_dist1",ic,ipid) ; | |
259 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
db2bf6fd | 260 | fhReInvPt1[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
5ae09196 | 261 | outputContainer->Add(fhReInvPt1[ic*fNPID+ipid]) ; |
262 | ||
263 | //Distance to bad module 2 | |
264 | snprintf(key, buffersize,"hReInvPt_cen%d_pid%d_dist2",ic,ipid) ; | |
265 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
db2bf6fd | 266 | fhReInvPt2[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
5ae09196 | 267 | outputContainer->Add(fhReInvPt2[ic*fNPID+ipid]) ; |
268 | ||
269 | //Distance to bad module 3 | |
270 | snprintf(key, buffersize,"hReInvPt_cen%d_pid%d_dist3",ic,ipid) ; | |
271 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
db2bf6fd | 272 | fhReInvPt3[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
5ae09196 | 273 | outputContainer->Add(fhReInvPt3[ic*fNPID+ipid]) ; |
274 | ||
275 | ||
7e7694bb | 276 | if(fDoOwnMix){ |
277 | //Distance to bad module 1 | |
5ae09196 | 278 | snprintf(key, buffersize,"hMi_cen%d_pid%d_dist1",ic,ipid) ; |
279 | snprintf(title, buffersize,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
7e7694bb | 280 | fhMi1[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
281 | outputContainer->Add(fhMi1[ic*fNPID+ipid]) ; | |
282 | ||
283 | //Distance to bad module 2 | |
5ae09196 | 284 | snprintf(key, buffersize,"hMi_cen%d_pid%d_dist2",ic,ipid) ; |
285 | snprintf(title, buffersize,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
7e7694bb | 286 | fhMi2[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
287 | outputContainer->Add(fhMi2[ic*fNPID+ipid]) ; | |
288 | ||
289 | //Distance to bad module 3 | |
5ae09196 | 290 | snprintf(key, buffersize,"hMi_cen%d_pid%d_dist3",ic,ipid) ; |
291 | snprintf(title, buffersize,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
7e7694bb | 292 | fhMi3[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
293 | outputContainer->Add(fhMi3[ic*fNPID+ipid]) ; | |
5ae09196 | 294 | |
295 | //Inverse pT | |
296 | //Distance to bad module 1 | |
297 | snprintf(key, buffersize,"hMiInvPt_cen%d_pid%d_dist1",ic,ipid) ; | |
298 | snprintf(title, buffersize,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
db2bf6fd | 299 | fhMiInvPt1[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
5ae09196 | 300 | outputContainer->Add(fhMiInvPt1[ic*fNPID+ipid]) ; |
301 | ||
302 | //Distance to bad module 2 | |
303 | snprintf(key, buffersize,"hMiInvPt_cen%d_pid%d_dist2",ic,ipid) ; | |
304 | snprintf(title, buffersize,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
db2bf6fd | 305 | fhMiInvPt2[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
5ae09196 | 306 | outputContainer->Add(fhMiInvPt2[ic*fNPID+ipid]) ; |
307 | ||
308 | //Distance to bad module 3 | |
309 | snprintf(key, buffersize,"hMiInvPt_cen%d_pid%d_dist3",ic,ipid) ; | |
310 | snprintf(title, buffersize,"Mixed m_{#gamma#gamma} distr. for centrality=%d and PID=%d",ic,ipid) ; | |
db2bf6fd | 311 | fhMiInvPt3[ic*fNPID+ipid] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
5ae09196 | 312 | outputContainer->Add(fhMiInvPt3[ic*fNPID+ipid]) ; |
313 | ||
314 | ||
7e7694bb | 315 | } |
1c5acb87 | 316 | } |
477d6cee | 317 | } |
318 | ||
5ae09196 | 319 | if(fMultiCutAna){ |
320 | ||
321 | fhRePIDBits = new TH2D*[fNPIDBits]; | |
322 | for(Int_t ipid=0; ipid<fNPIDBits; ipid++){ | |
323 | snprintf(key, buffersize,"hRe_pidbit%d",ipid) ; | |
324 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for PIDBit=%d",fPIDBits[ipid]) ; | |
325 | fhRePIDBits[ipid] = new TH2D(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ; | |
326 | outputContainer->Add(fhRePIDBits[ipid]) ; | |
327 | }// pid bit loop | |
328 | ||
329 | fhRePtNCellAsymCuts = new TH2D*[fNPtCuts*fNAsymCuts*fNCellNCuts]; | |
330 | for(Int_t ipt=0; ipt<fNPtCuts; ipt++){ | |
331 | for(Int_t icell=0; icell<fNCellNCuts; icell++){ | |
332 | for(Int_t iasym=0; iasym<fNAsymCuts; iasym++){ | |
333 | snprintf(key, buffersize,"hRe_pt%d_cell%d_asym%d",ipt,icell,iasym) ; | |
334 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for pt >%2.2f, ncell>%d and asym >%2.2f ",fPtCuts[ipt],fCellNCuts[icell], fAsymCuts[iasym]) ; | |
335 | Int_t index = ((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym; | |
336 | //printf("ipt %d, icell %d, iassym %d, index %d\n",ipt, icell, iasym, index); | |
337 | fhRePtNCellAsymCuts[index] = new TH2D(key,title,nptbins,ptmin,ptmax,nmassbins,massmin,massmax) ; | |
338 | outputContainer->Add(fhRePtNCellAsymCuts[index]) ; | |
339 | } | |
340 | } | |
341 | } | |
342 | }// multi cuts analysis | |
343 | ||
477d6cee | 344 | fhEvents=new TH3D("hEvents","Number of events",fNCentrBin,0.,1.*fNCentrBin, |
7e7694bb | 345 | fNZvertBin,0.,1.*fNZvertBin,fNrpBin,0.,1.*fNrpBin) ; |
477d6cee | 346 | outputContainer->Add(fhEvents) ; |
50f39b97 | 347 | |
348 | fhRealOpeningAngle = new TH2D | |
349 | ("hRealOpeningAngle","Angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,200,0,0.5); | |
350 | fhRealOpeningAngle->SetYTitle("#theta(rad)"); | |
351 | fhRealOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)"); | |
352 | outputContainer->Add(fhRealOpeningAngle) ; | |
7e7694bb | 353 | |
50f39b97 | 354 | fhRealCosOpeningAngle = new TH2D |
355 | ("hRealCosOpeningAngle","Cosinus of angle between all #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,200,-1,1); | |
356 | fhRealCosOpeningAngle->SetYTitle("cos (#theta) "); | |
357 | fhRealCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)"); | |
358 | outputContainer->Add(fhRealCosOpeningAngle) ; | |
359 | ||
360 | ||
477d6cee | 361 | //Histograms filled only if MC data is requested |
0ae57829 | 362 | if(IsDataMC()){ |
5ae09196 | 363 | |
7e7694bb | 364 | fhPrimPt = new TH1D("hPrimPt","Primary pi0 pt",nptbins,ptmin,ptmax) ; |
5a2dbc3c | 365 | fhPrimAccPt = new TH1D("hPrimAccPt","Primary pi0 pt with both photons in acceptance",nptbins,ptmin,ptmax) ; |
477d6cee | 366 | outputContainer->Add(fhPrimPt) ; |
367 | outputContainer->Add(fhPrimAccPt) ; | |
368 | ||
5a2dbc3c | 369 | fhPrimY = new TH1D("hPrimaryRapidity","Rapidity of primary pi0",netabins,etamin,etamax) ; |
477d6cee | 370 | outputContainer->Add(fhPrimY) ; |
371 | ||
5a2dbc3c | 372 | fhPrimAccY = new TH1D("hPrimAccRapidity","Rapidity of primary pi0",netabins,etamin,etamax) ; |
477d6cee | 373 | outputContainer->Add(fhPrimAccY) ; |
374 | ||
7e7694bb | 375 | fhPrimPhi = new TH1D("hPrimaryPhi","Azimithal of primary pi0",nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ; |
477d6cee | 376 | outputContainer->Add(fhPrimPhi) ; |
377 | ||
5a2dbc3c | 378 | fhPrimAccPhi = new TH1D("hPrimAccPhi","Azimithal of primary pi0 with accepted daughters",nphibins,phimin*TMath::RadToDeg(),phimax*TMath::RadToDeg()) ; |
477d6cee | 379 | outputContainer->Add(fhPrimAccPhi) ; |
50f39b97 | 380 | |
381 | ||
382 | fhPrimOpeningAngle = new TH2D | |
7e7694bb | 383 | ("hPrimOpeningAngle","Angle between all primary #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,0,0.5); |
50f39b97 | 384 | fhPrimOpeningAngle->SetYTitle("#theta(rad)"); |
385 | fhPrimOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)"); | |
386 | outputContainer->Add(fhPrimOpeningAngle) ; | |
387 | ||
388 | fhPrimCosOpeningAngle = new TH2D | |
7e7694bb | 389 | ("hPrimCosOpeningAngle","Cosinus of angle between all primary #gamma pair vs E_{#pi^{0}}",nptbins,ptmin,ptmax,100,-1,1); |
50f39b97 | 390 | fhPrimCosOpeningAngle->SetYTitle("cos (#theta) "); |
391 | fhPrimCosOpeningAngle->SetXTitle("E_{ #pi^{0}} (GeV)"); | |
392 | outputContainer->Add(fhPrimCosOpeningAngle) ; | |
393 | ||
477d6cee | 394 | } |
50f39b97 | 395 | |
6921fa00 | 396 | for(Int_t imod=0; imod<fNModules; imod++){ |
50f39b97 | 397 | //Module dependent invariant mass |
5ae09196 | 398 | snprintf(key, buffersize,"hReMod_%d",imod) ; |
399 | snprintf(title, buffersize,"Real m_{#gamma#gamma} distr. for Module %d",imod) ; | |
50f39b97 | 400 | fhReMod[imod] = new TH3D(key,title,nptbins,ptmin,ptmax,nasymbins,asymmin,asymmax,nmassbins,massmin,massmax) ; |
401 | outputContainer->Add(fhReMod[imod]) ; | |
6921fa00 | 402 | } |
50f39b97 | 403 | |
eee5fcf1 | 404 | // for(Int_t i = 0; i < outputContainer->GetEntries() ; i++){ |
405 | // | |
406 | // printf("Histogram %d, name: %s\n ",i, outputContainer->At(i)->GetName()); | |
407 | // | |
408 | // } | |
409 | ||
477d6cee | 410 | return outputContainer; |
1c5acb87 | 411 | } |
412 | ||
413 | //_________________________________________________________________________________________________________________________________________________ | |
414 | void AliAnaPi0::Print(const Option_t * /*opt*/) const | |
415 | { | |
477d6cee | 416 | //Print some relevant parameters set for the analysis |
a3aebfff | 417 | printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; |
477d6cee | 418 | AliAnaPartCorrBaseClass::Print(" "); |
a3aebfff | 419 | |
477d6cee | 420 | printf("Number of bins in Centrality: %d \n",fNCentrBin) ; |
421 | printf("Number of bins in Z vert. pos: %d \n",fNZvertBin) ; | |
422 | printf("Number of bins in Reac. Plain: %d \n",fNrpBin) ; | |
423 | printf("Depth of event buffer: %d \n",fNmaxMixEv) ; | |
424 | printf("Number of different PID used: %d \n",fNPID) ; | |
425 | printf("Cuts: \n") ; | |
426 | printf("Z vertex position: -%2.3f < z < %2.3f \n",fZvtxCut,fZvtxCut) ; | |
50f39b97 | 427 | printf("Number of modules: %d \n",fNModules) ; |
428 | printf("Select pairs with their angle: %d \n",fUseAngleCut) ; | |
db2bf6fd | 429 | if(fMultiCutAna){ |
430 | printf("pT cuts: n = %d, \n",fNPtCuts) ; | |
431 | printf("\tpT > "); | |
432 | for(Int_t i = 0; i < fNPtCuts; i++) printf("%2.2f ",fPtCuts[i]); | |
433 | printf("GeV/c\n"); | |
434 | ||
435 | printf("N cell in cluster cuts: n = %d, \n",fNCellNCuts) ; | |
436 | printf("\tnCell > "); | |
437 | for(Int_t i = 0; i < fNCellNCuts; i++) printf("%d ",fCellNCuts[i]); | |
438 | printf("\n"); | |
439 | ||
440 | printf("Asymmetry cuts: n = %d, \n",fNAsymCuts) ; | |
441 | printf("\tasymmetry < "); | |
442 | for(Int_t i = 0; i < fNAsymCuts; i++) printf("%2.2f ",fAsymCuts[i]); | |
443 | printf("\n"); | |
444 | ||
445 | printf("PID selection bits: n = %d, \n",fNPIDBits) ; | |
446 | printf("\tPID bit = "); | |
447 | for(Int_t i = 0; i < fNPIDBits; i++) printf("%d ",fPIDBits[i]); | |
448 | printf("\n"); | |
449 | ||
450 | } | |
477d6cee | 451 | printf("------------------------------------------------------\n") ; |
1c5acb87 | 452 | } |
453 | ||
5ae09196 | 454 | //_____________________________________________________________ |
455 | void AliAnaPi0::FillAcceptanceHistograms(){ | |
456 | //Fill acceptance histograms if MC data is available | |
c8fe2783 | 457 | |
5ae09196 | 458 | if(IsDataMC() && 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) ; | |
471 | } | |
472 | fhPrimY ->Fill(pi0Y) ; | |
473 | fhPrimPhi->Fill(phi) ; | |
474 | ||
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 | ||
485 | TLorentzVector lv1, lv2; | |
486 | phot1->Momentum(lv1); | |
487 | phot2->Momentum(lv2); | |
488 | ||
489 | Bool_t inacceptance = kFALSE; | |
490 | if(fCalorimeter == "PHOS"){ | |
491 | if(GetPHOSGeometry() && GetCaloUtils()->IsPHOSGeoMatrixSet()){ | |
492 | Int_t mod ; | |
493 | Double_t x,z ; | |
494 | if(GetPHOSGeometry()->ImpactOnEmc(phot1,mod,z,x) && GetPHOSGeometry()->ImpactOnEmc(phot2,mod,z,x)) | |
495 | inacceptance = kTRUE; | |
496 | if(GetDebug() > 2) printf("In %s Real acceptance? %d\n",fCalorimeter.Data(),inacceptance); | |
497 | } | |
498 | else{ | |
499 | ||
500 | if(GetFiducialCut()->IsInFiducialCut(lv1,fCalorimeter) && GetFiducialCut()->IsInFiducialCut(lv2,fCalorimeter)) | |
501 | inacceptance = kTRUE ; | |
502 | if(GetDebug() > 2) printf("In %s fiducial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance); | |
503 | } | |
504 | ||
505 | } | |
506 | else if(fCalorimeter == "EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){ | |
507 | if(GetEMCALGeometry()){ | |
508 | if(GetEMCALGeometry()->Impact(phot1) && GetEMCALGeometry()->Impact(phot2)) | |
509 | inacceptance = kTRUE; | |
510 | if(GetDebug() > 2) printf("In %s Real acceptance? %d\n",fCalorimeter.Data(),inacceptance); | |
511 | } | |
512 | else{ | |
513 | if(GetFiducialCut()->IsInFiducialCut(lv1,fCalorimeter) && GetFiducialCut()->IsInFiducialCut(lv2,fCalorimeter)) | |
514 | inacceptance = kTRUE ; | |
515 | if(GetDebug() > 2) printf("In %s fiducial cut acceptance? %d\n",fCalorimeter.Data(),inacceptance); | |
516 | } | |
517 | } | |
518 | ||
519 | if(inacceptance){ | |
520 | ||
521 | fhPrimAccPt->Fill(pi0Pt) ; | |
522 | fhPrimAccPhi->Fill(phi) ; | |
523 | fhPrimAccY->Fill(pi0Y) ; | |
524 | Double_t angle = lv1.Angle(lv2.Vect()); | |
525 | fhPrimOpeningAngle ->Fill(pi0Pt,angle); | |
526 | fhPrimCosOpeningAngle->Fill(pi0Pt,TMath::Cos(angle)); | |
527 | ||
528 | }//Accepted | |
529 | }// 2 photons | |
530 | }//Check daughters exist | |
531 | }// Primary pi0 | |
532 | }//loop on primaries | |
533 | }//stack exists and data is MC | |
534 | }//read stack | |
535 | else if(GetReader()->ReadAODMCParticles()){ | |
536 | if(GetDebug() >= 0) printf("AliAnaPi0::FillAcceptanceHistograms() - Acceptance calculation with MCParticles not implemented yet\n"); | |
537 | } | |
538 | } | |
539 | ||
1c5acb87 | 540 | //____________________________________________________________________________________________________________________________________________________ |
6639984f | 541 | void AliAnaPi0::MakeAnalysisFillHistograms() |
1c5acb87 | 542 | { |
477d6cee | 543 | //Process one event and extract photons from AOD branch |
544 | // filled with AliAnaPhoton and fill histos with invariant mass | |
545 | ||
5ae09196 | 546 | //In case of MC data, fill acceptance histograms |
547 | FillAcceptanceHistograms(); | |
548 | ||
477d6cee | 549 | //Apply some cuts on event: vertex position and centrality range |
550 | Int_t iRun=(GetReader()->GetInputEvent())->GetRunNumber() ; | |
551 | if(IsBadRun(iRun)) return ; | |
552 | ||
477d6cee | 553 | Int_t nPhot = GetInputAODBranch()->GetEntriesFast() ; |
c8fe2783 | 554 | if(GetDebug() > 1) |
555 | printf("AliAnaPi0::MakeAnalysisFillHistograms() - Photon entries %d\n", nPhot); | |
556 | if(nPhot < 2 ) | |
557 | return ; | |
6921fa00 | 558 | Int_t module1 = -1; |
559 | Int_t module2 = -1; | |
7e7694bb | 560 | Double_t vert[] = {0.0, 0.0, 0.0} ; //vertex |
561 | Int_t evtIndex1 = 0 ; | |
562 | Int_t currentEvtIndex = -1 ; | |
563 | Int_t curCentrBin = 0 ; | |
564 | Int_t curRPBin = 0 ; | |
565 | Int_t curZvertBin = 0 ; | |
566 | ||
477d6cee | 567 | for(Int_t i1=0; i1<nPhot-1; i1++){ |
568 | AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ; | |
7e7694bb | 569 | // get the event index in the mixed buffer where the photon comes from |
570 | // in case of mixing with analysis frame, not own mixing | |
c8fe2783 | 571 | evtIndex1 = GetEventIndex(p1, vert) ; |
7e7694bb | 572 | if(vert[2]<-fZvtxCut || vert[2]> fZvtxCut) return ; //Event can not be used (vertex, centrality,... cuts not fulfilled) |
c8fe2783 | 573 | if ( evtIndex1 == -1 ) |
574 | return ; | |
575 | if ( evtIndex1 == -2 ) | |
576 | continue ; | |
577 | if (evtIndex1 != currentEvtIndex) { | |
7e7694bb | 578 | //Get Reaction Plan position and calculate RP bin |
579 | //does not exist in ESD yet???? | |
c8fe2783 | 580 | curCentrBin = 0 ; |
581 | curRPBin = 0 ; | |
582 | curZvertBin = (Int_t)(0.5*fNZvertBin*(vert[2]+fZvtxCut)/fZvtxCut) ; | |
583 | fhEvents->Fill(curCentrBin+0.5,curZvertBin+0.5,curRPBin+0.5) ; | |
584 | currentEvtIndex = evtIndex1 ; | |
585 | } | |
7e7694bb | 586 | |
477d6cee | 587 | TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); |
59b6bd99 | 588 | //Get Module number |
589 | module1 = GetModuleNumber(p1); | |
477d6cee | 590 | for(Int_t i2=i1+1; i2<nPhot; i2++){ |
591 | AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i2)) ; | |
c8fe2783 | 592 | Int_t evtIndex2 = GetEventIndex(p2, vert) ; |
593 | if ( evtIndex2 == -1 ) | |
594 | return ; | |
595 | if ( evtIndex2 == -2 ) | |
596 | continue ; | |
597 | if (GetMixedEvent() && (evtIndex1 == evtIndex2)) | |
7e7694bb | 598 | continue ; |
477d6cee | 599 | TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); |
59b6bd99 | 600 | //Get module number |
601 | module2 = GetModuleNumber(p2); | |
477d6cee | 602 | Double_t m = (photon1 + photon2).M() ; |
603 | Double_t pt = (photon1 + photon2).Pt(); | |
604 | Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; | |
605 | if(GetDebug() > 2) | |
c8fe2783 | 606 | printf("AliAnaPi0::MakeAnalysisFillHistograms() - Current Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", |
607 | p1->Pt(), p2->Pt(), pt,m,a); | |
50f39b97 | 608 | //Check if opening angle is too large or too small compared to what is expected |
609 | Double_t angle = photon1.Angle(photon2.Vect()); | |
610 | //if(fUseAngleCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle)) continue; | |
611 | //printf("angle %f\n",angle); | |
c8fe2783 | 612 | if(fUseAngleCut && angle < 0.1) |
613 | continue; | |
50f39b97 | 614 | fhRealOpeningAngle ->Fill(pt,angle); |
615 | fhRealCosOpeningAngle->Fill(pt,TMath::Cos(angle)); | |
59b6bd99 | 616 | //Fill module dependent histograms |
617 | //if(module1==module2) printf("mod1 %d\n",module1); | |
618 | if(module1==module2 && module1 >=0 && module1<fNModules) | |
c8fe2783 | 619 | fhReMod[module1]->Fill(pt,a,m) ; |
7e7694bb | 620 | |
c8fe2783 | 621 | for(Int_t ipid=0; ipid<fNPID; ipid++){ |
622 | if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ | |
db2bf6fd | 623 | fhRe1 [curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; |
624 | fhReInvPt1[curCentrBin*fNPID+ipid]->Fill(pt,a,m,1./pt) ; | |
c8fe2783 | 625 | if(p1->DistToBad()>0 && p2->DistToBad()>0){ |
db2bf6fd | 626 | fhRe2 [curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; |
627 | fhReInvPt2[curCentrBin*fNPID+ipid]->Fill(pt,a,m,1./pt) ; | |
c8fe2783 | 628 | if(p1->DistToBad()>1 && p2->DistToBad()>1){ |
db2bf6fd | 629 | fhRe3 [curCentrBin*fNPID+ipid]->Fill(pt,a,m) ; |
630 | fhReInvPt3[curCentrBin*fNPID+ipid]->Fill(pt,a,m,1./pt) ; | |
5ae09196 | 631 | }// bad 3 |
632 | }// bad2 | |
633 | }// bad 1 | |
634 | }// pid loop | |
635 | ||
636 | //Multi cuts analysis | |
637 | if(fMultiCutAna){ | |
638 | //Histograms for different PID bits selection | |
639 | for(Int_t ipid=0; ipid<fNPIDBits; ipid++){ | |
640 | ||
641 | if(p1->IsPIDOK(fPIDBits[ipid],AliCaloPID::kPhoton) && | |
642 | p2->IsPIDOK(fPIDBits[ipid],AliCaloPID::kPhoton)) fhRePIDBits[ipid]->Fill(pt,m) ; | |
643 | ||
644 | //printf("ipt %d, ipid%d, name %s\n",ipt, ipid, fhRePtPIDCuts[ipt*fNPIDBits+ipid]->GetName()); | |
645 | } // pid bit cut loop | |
646 | ||
647 | //Several pt,ncell and asymetry cuts | |
648 | //Get the number of cells | |
649 | Int_t ncell1 = 0; | |
650 | Int_t ncell2 = 0; | |
651 | if(GetReader()->GetInputEvent()){ | |
652 | AliVCluster *cluster1 = (GetReader()->GetInputEvent())->GetCaloCluster(p1->GetCaloLabel(0)); | |
653 | ncell1 = cluster1->GetNCells(); | |
654 | AliVCluster *cluster2 = (GetReader()->GetInputEvent())->GetCaloCluster(p2->GetCaloLabel(0)); | |
655 | ncell2 = cluster2->GetNCells(); | |
656 | //printf("e 1: %2.2f - %2.2f, e 2: %2.2f - %2.2f, ncells: %d, %d\n",cluster1->E(),p1->E(),cluster2->E(), p2->E(),ncell1,ncell2); | |
c8fe2783 | 657 | } |
5ae09196 | 658 | for(Int_t ipt=0; ipt<fNPtCuts; ipt++){ |
659 | for(Int_t icell=0; icell<fNCellNCuts; icell++){ | |
660 | for(Int_t iasym=0; iasym<fNAsymCuts; iasym++){ | |
661 | ||
662 | if(p1->Pt() > fPtCuts[ipt] && p2->Pt() > fPtCuts[ipt] && | |
663 | a < fAsymCuts[iasym] && | |
664 | ncell1 >= fCellNCuts[icell] && ncell2 >= fCellNCuts[icell]) fhRePtNCellAsymCuts[((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym]->Fill(pt,m) ; | |
665 | ||
666 | //printf("ipt %d, icell%d, iasym %d, name %s\n",ipt, icell, iasym, fhRePtNCellAsymCuts[((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym]->GetName()); | |
667 | }// pid bit cut loop | |
668 | }// icell loop | |
669 | }// pt cut loop | |
670 | ||
671 | }// multiple cuts analysis | |
7e7694bb | 672 | }// second same event particle |
673 | }// first cluster | |
674 | ||
675 | if(fDoOwnMix){ | |
676 | //Fill mixed | |
677 | TList * evMixList=fEventsList[curCentrBin*fNZvertBin*fNrpBin+curZvertBin*fNrpBin+curRPBin] ; | |
678 | Int_t nMixed = evMixList->GetSize() ; | |
679 | for(Int_t ii=0; ii<nMixed; ii++){ | |
680 | TClonesArray* ev2= (TClonesArray*) (evMixList->At(ii)); | |
681 | Int_t nPhot2=ev2->GetEntriesFast() ; | |
682 | Double_t m = -999; | |
683 | if(GetDebug() > 1) printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed event %d photon entries %d\n", ii, nPhot); | |
684 | ||
685 | for(Int_t i1=0; i1<nPhot; i1++){ | |
686 | AliAODPWG4Particle * p1 = (AliAODPWG4Particle*) (GetInputAODBranch()->At(i1)) ; | |
687 | TLorentzVector photon1(p1->Px(),p1->Py(),p1->Pz(),p1->E()); | |
688 | for(Int_t i2=0; i2<nPhot2; i2++){ | |
689 | AliAODPWG4Particle * p2 = (AliAODPWG4Particle*) (ev2->At(i2)) ; | |
690 | ||
691 | TLorentzVector photon2(p2->Px(),p2->Py(),p2->Pz(),p2->E()); | |
692 | m = (photon1+photon2).M() ; | |
693 | Double_t pt = (photon1 + photon2).Pt(); | |
694 | Double_t a = TMath::Abs(p1->E()-p2->E())/(p1->E()+p2->E()) ; | |
695 | ||
696 | //Check if opening angle is too large or too small compared to what is expected | |
697 | Double_t angle = photon1.Angle(photon2.Vect()); | |
698 | //if(fUseAngleCut && !GetNeutralMesonSelection()->IsAngleInWindow((photon1+photon2).E(),angle)) continue; | |
699 | if(fUseAngleCut && angle < 0.1) continue; | |
700 | ||
701 | if(GetDebug() > 2) | |
702 | printf("AliAnaPi0::MakeAnalysisFillHistograms() - Mixed Event: pT: photon1 %2.2f, photon2 %2.2f; Pair: pT %2.2f, mass %2.3f, a %f2.3\n", | |
703 | p1->Pt(), p2->Pt(), pt,m,a); | |
704 | for(Int_t ipid=0; ipid<fNPID; ipid++){ | |
705 | if((p1->IsPIDOK(ipid,AliCaloPID::kPhoton)) && (p2->IsPIDOK(ipid,AliCaloPID::kPhoton))){ | |
5ae09196 | 706 | fhMi1 [curCentrBin*fNPID+ipid]->Fill(pt, a,m) ; |
707 | fhMiInvPt1[curCentrBin*fNPID+ipid]->Fill(1./pt,a,m) ; | |
7e7694bb | 708 | if(p1->DistToBad()>0 && p2->DistToBad()>0){ |
5ae09196 | 709 | fhMi2 [curCentrBin*fNPID+ipid]->Fill(pt, a,m) ; |
710 | fhMiInvPt2[curCentrBin*fNPID+ipid]->Fill(1./pt,a,m) ; | |
7e7694bb | 711 | if(p1->DistToBad()>1 && p2->DistToBad()>1){ |
5ae09196 | 712 | fhMi3 [curCentrBin*fNPID+ipid]->Fill(pt, a,m) ; |
713 | fhMiInvPt3[curCentrBin*fNPID+ipid]->Fill(1./pt,a,m) ; | |
7e7694bb | 714 | } |
715 | ||
716 | } | |
717 | } | |
718 | }//loop for histograms | |
719 | }// second cluster loop | |
720 | }//first cluster loop | |
721 | }//loop on mixed events | |
722 | ||
723 | TClonesArray *currentEvent = new TClonesArray(*GetInputAODBranch()); | |
724 | //Ad d current event to buffer and Remove redundant events | |
725 | if(currentEvent->GetEntriesFast()>0){ | |
726 | evMixList->AddFirst(currentEvent) ; | |
727 | currentEvent=0 ; //Now list of particles belongs to buffer and it will be deleted with buffer | |
728 | if(evMixList->GetSize()>=fNmaxMixEv) | |
729 | { | |
730 | TClonesArray * tmp = (TClonesArray*) (evMixList->Last()) ; | |
731 | evMixList->RemoveLast() ; | |
732 | delete tmp ; | |
733 | } | |
734 | } | |
735 | else{ //empty event | |
736 | delete currentEvent ; | |
737 | currentEvent=0 ; | |
477d6cee | 738 | } |
7e7694bb | 739 | }// DoOwnMix |
c8fe2783 | 740 | |
1c5acb87 | 741 | } |
742 | ||
a5cc4f03 | 743 | //________________________________________________________________________ |
744 | void AliAnaPi0::ReadHistograms(TList* outputList) | |
745 | { | |
50f39b97 | 746 | // Needed when Terminate is executed in distributed environment |
747 | // Refill analysis histograms of this class with corresponding histograms in output list. | |
748 | ||
749 | // Histograms of this analsys are kept in the same list as other analysis, recover the position of | |
750 | // the first one and then add the next. | |
751 | Int_t index = outputList->IndexOf(outputList->FindObject(GetAddedHistogramsStringToName()+"hRe_cen0_pid0_dist1")); | |
752 | ||
753 | if(!fhRe1) fhRe1 = new TH3D*[fNCentrBin*fNPID] ; | |
754 | if(!fhRe2) fhRe2 = new TH3D*[fNCentrBin*fNPID] ; | |
755 | if(!fhRe3) fhRe3 = new TH3D*[fNCentrBin*fNPID] ; | |
756 | if(!fhMi1) fhMi1 = new TH3D*[fNCentrBin*fNPID] ; | |
757 | if(!fhMi2) fhMi2 = new TH3D*[fNCentrBin*fNPID] ; | |
758 | if(!fhMi3) fhMi3 = new TH3D*[fNCentrBin*fNPID] ; | |
5ae09196 | 759 | if(!fhReInvPt1) fhRe1 = new TH3D*[fNCentrBin*fNPID] ; |
760 | if(!fhReInvPt2) fhRe2 = new TH3D*[fNCentrBin*fNPID] ; | |
761 | if(!fhReInvPt3) fhRe3 = new TH3D*[fNCentrBin*fNPID] ; | |
762 | if(!fhMiInvPt1) fhMi1 = new TH3D*[fNCentrBin*fNPID] ; | |
763 | if(!fhMiInvPt2) fhMi2 = new TH3D*[fNCentrBin*fNPID] ; | |
764 | if(!fhMiInvPt3) fhMi3 = new TH3D*[fNCentrBin*fNPID] ; | |
eee5fcf1 | 765 | if(!fhReMod) fhReMod = new TH3D*[fNModules] ; |
766 | ||
50f39b97 | 767 | for(Int_t ic=0; ic<fNCentrBin; ic++){ |
768 | for(Int_t ipid=0; ipid<fNPID; ipid++){ | |
769 | fhRe1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
50f39b97 | 770 | fhRe2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); |
50f39b97 | 771 | fhRe3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); |
5ae09196 | 772 | |
773 | fhReInvPt1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
774 | fhReInvPt2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
775 | fhReInvPt3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
776 | ||
777 | fhMi1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
778 | fhMi2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
50f39b97 | 779 | fhMi3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); |
5ae09196 | 780 | |
781 | fhMiInvPt1[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
782 | fhMiInvPt2[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
783 | fhMiInvPt3[ic*fNPID+ipid] = (TH3D*) outputList->At(index++); | |
50f39b97 | 784 | } |
785 | } | |
eee5fcf1 | 786 | |
5ae09196 | 787 | if(fMultiCutAna){ |
788 | ||
eee5fcf1 | 789 | if(!fhRePtNCellAsymCuts) fhRePtNCellAsymCuts = new TH2D*[fNPtCuts*fNAsymCuts*fNCellNCuts]; |
790 | if(!fhRePIDBits) fhRePIDBits = new TH2D*[fNPIDBits]; | |
791 | ||
5ae09196 | 792 | for(Int_t ipid=0; ipid<fNPIDBits; ipid++){ |
793 | fhRePIDBits[ipid] = (TH2D*) outputList->At(index++); | |
794 | }// ipid loop | |
795 | ||
796 | for(Int_t ipt=0; ipt<fNPtCuts; ipt++){ | |
797 | for(Int_t icell=0; icell<fNCellNCuts; icell++){ | |
798 | for(Int_t iasym=0; iasym<fNAsymCuts; iasym++){ | |
799 | fhRePtNCellAsymCuts[((ipt*fNCellNCuts)+icell)*fNAsymCuts + iasym] = (TH2D*) outputList->At(index++); | |
800 | }// iasym | |
801 | }// icell loop | |
802 | }// ipt loop | |
803 | }// multi cut analysis | |
50f39b97 | 804 | |
805 | fhEvents = (TH3D *) outputList->At(index++); | |
806 | ||
807 | //Histograms filled only if MC data is requested | |
808 | if(IsDataMC() || (GetReader()->GetDataType() == AliCaloTrackReader::kMC) ){ | |
809 | fhPrimPt = (TH1D*) outputList->At(index++); | |
810 | fhPrimAccPt = (TH1D*) outputList->At(index++); | |
811 | fhPrimY = (TH1D*) outputList->At(index++); | |
812 | fhPrimAccY = (TH1D*) outputList->At(index++); | |
813 | fhPrimPhi = (TH1D*) outputList->At(index++); | |
814 | fhPrimAccPhi = (TH1D*) outputList->At(index++); | |
815 | } | |
816 | ||
817 | for(Int_t imod=0; imod < fNModules; imod++) | |
818 | fhReMod[imod] = (TH3D*) outputList->At(index++); | |
819 | ||
eee5fcf1 | 820 | |
a5cc4f03 | 821 | } |
822 | ||
823 | ||
6639984f | 824 | //____________________________________________________________________________________________________________________________________________________ |
a5cc4f03 | 825 | void AliAnaPi0::Terminate(TList* outputList) |
6639984f | 826 | { |
827 | //Do some calculations and plots from the final histograms. | |
477d6cee | 828 | |
fbeaf916 | 829 | printf(" *** %s Terminate:\n", GetName()) ; |
50f39b97 | 830 | |
a5cc4f03 | 831 | //Recover histograms from output histograms list, needed for distributed analysis. |
832 | ReadHistograms(outputList); | |
50f39b97 | 833 | |
2e557d1c | 834 | if (!fhRe1) { |
50f39b97 | 835 | printf("AliAnaPi0::Terminate() - Error: Remote output histograms not imported in AliAnaPi0 object"); |
836 | return; | |
2e557d1c | 837 | } |
50f39b97 | 838 | |
a3aebfff | 839 | printf("AliAnaPi0::Terminate() Mgg Real : %5.3f , RMS : %5.3f \n", fhRe1[0]->GetMean(), fhRe1[0]->GetRMS() ) ; |
5ae09196 | 840 | |
841 | const Int_t buffersize = 255; | |
842 | ||
843 | char nameIM[buffersize]; | |
844 | snprintf(nameIM, buffersize,"AliAnaPi0_%s_cPt",fCalorimeter.Data()); | |
71dd883b | 845 | TCanvas * cIM = new TCanvas(nameIM, "", 400, 10, 600, 700) ; |
6639984f | 846 | cIM->Divide(2, 2); |
50f39b97 | 847 | |
6639984f | 848 | cIM->cd(1) ; |
849 | //gPad->SetLogy(); | |
583c48f1 | 850 | TH1D * hIMAllPt = (TH1D*) fhRe1[0]->ProjectionZ(Form("IMPtAll_%s",fCalorimeter.Data())); |
6639984f | 851 | hIMAllPt->SetLineColor(2); |
852 | hIMAllPt->SetTitle("No cut on p_{T, #gamma#gamma} "); | |
853 | hIMAllPt->Draw(); | |
854 | ||
855 | cIM->cd(2) ; | |
583c48f1 | 856 | TH3F * hRe1Pt5 = (TH3F*)fhRe1[0]->Clone(Form("IMPt5_%s",fCalorimeter.Data())); |
6639984f | 857 | hRe1Pt5->GetXaxis()->SetRangeUser(0,5); |
583c48f1 | 858 | TH1D * hIMPt5 = (TH1D*) hRe1Pt5->Project3D(Form("IMPt5_%s_pz",fCalorimeter.Data())); |
6639984f | 859 | hIMPt5->SetLineColor(2); |
860 | hIMPt5->SetTitle("0 < p_{T, #gamma#gamma} < 5 GeV/c"); | |
861 | hIMPt5->Draw(); | |
862 | ||
863 | cIM->cd(3) ; | |
583c48f1 | 864 | TH3F * hRe1Pt10 = (TH3F*)fhRe1[0]->Clone(Form("IMPt10_%s",fCalorimeter.Data())); |
6639984f | 865 | hRe1Pt10->GetXaxis()->SetRangeUser(5,10); |
583c48f1 | 866 | TH1D * hIMPt10 = (TH1D*) hRe1Pt10->Project3D(Form("IMPt10_%s_pz",fCalorimeter.Data())); |
6639984f | 867 | hIMPt10->SetLineColor(2); |
868 | hIMPt10->SetTitle("5 < p_{T, #gamma#gamma} < 10 GeV/c"); | |
869 | hIMPt10->Draw(); | |
870 | ||
871 | cIM->cd(4) ; | |
583c48f1 | 872 | TH3F * hRe1Pt20 = (TH3F*)fhRe1[0]->Clone(Form("IMPt20_%s",fCalorimeter.Data())); |
6639984f | 873 | hRe1Pt20->GetXaxis()->SetRangeUser(10,20); |
583c48f1 | 874 | TH1D * hIMPt20 = (TH1D*) hRe1Pt20->Project3D(Form("IMPt20_%s_pz",fCalorimeter.Data())); |
6639984f | 875 | hIMPt20->SetLineColor(2); |
876 | hIMPt20->SetTitle("10 < p_{T, #gamma#gamma} < 20 GeV/c"); | |
877 | hIMPt20->Draw(); | |
878 | ||
5ae09196 | 879 | char nameIMF[buffersize]; |
880 | snprintf(nameIMF,buffersize,"AliAnaPi0_%s_Mgg.eps",fCalorimeter.Data()); | |
71dd883b | 881 | cIM->Print(nameIMF); |
6639984f | 882 | |
5ae09196 | 883 | char namePt[buffersize]; |
884 | snprintf(namePt,buffersize,"AliAnaPi0_%s_cPt",fCalorimeter.Data()); | |
71dd883b | 885 | TCanvas * cPt = new TCanvas(namePt, "", 400, 10, 600, 700) ; |
6639984f | 886 | cPt->Divide(2, 2); |
887 | ||
888 | cPt->cd(1) ; | |
889 | //gPad->SetLogy(); | |
890 | TH1D * hPt = (TH1D*) fhRe1[0]->Project3D("x"); | |
891 | hPt->SetLineColor(2); | |
892 | hPt->SetTitle("No cut on M_{#gamma#gamma} "); | |
893 | hPt->Draw(); | |
894 | ||
895 | cPt->cd(2) ; | |
583c48f1 | 896 | TH3F * hRe1IM1 = (TH3F*)fhRe1[0]->Clone(Form("Pt1_%s",fCalorimeter.Data())); |
6639984f | 897 | hRe1IM1->GetZaxis()->SetRangeUser(0.05,0.21); |
898 | TH1D * hPtIM1 = (TH1D*) hRe1IM1->Project3D("x"); | |
899 | hPtIM1->SetLineColor(2); | |
900 | hPtIM1->SetTitle("0.05 < M_{#gamma#gamma} < 0.21 GeV/c^{2}"); | |
901 | hPtIM1->Draw(); | |
902 | ||
903 | cPt->cd(3) ; | |
583c48f1 | 904 | TH3F * hRe1IM2 = (TH3F*)fhRe1[0]->Clone(Form("Pt2_%s",fCalorimeter.Data())); |
6639984f | 905 | hRe1IM2->GetZaxis()->SetRangeUser(0.09,0.17); |
906 | TH1D * hPtIM2 = (TH1D*) hRe1IM2->Project3D("x"); | |
907 | hPtIM2->SetLineColor(2); | |
908 | hPtIM2->SetTitle("0.09 < M_{#gamma#gamma} < 0.17 GeV/c^{2}"); | |
909 | hPtIM2->Draw(); | |
910 | ||
911 | cPt->cd(4) ; | |
583c48f1 | 912 | TH3F * hRe1IM3 = (TH3F*)fhRe1[0]->Clone(Form("Pt3_%s",fCalorimeter.Data())); |
6639984f | 913 | hRe1IM3->GetZaxis()->SetRangeUser(0.11,0.15); |
914 | TH1D * hPtIM3 = (TH1D*) hRe1IM1->Project3D("x"); | |
915 | hPtIM3->SetLineColor(2); | |
916 | hPtIM3->SetTitle("0.11 < M_{#gamma#gamma} < 0.15 GeV/c^{2}"); | |
917 | hPtIM3->Draw(); | |
918 | ||
71dd883b | 919 | char namePtF[128]; |
5ae09196 | 920 | snprintf(namePtF,buffersize,"AliAnaPi0_%s_Pt.eps",fCalorimeter.Data()); |
71dd883b | 921 | cPt->Print(namePtF); |
1c5acb87 | 922 | |
5ae09196 | 923 | char line[buffersize] ; |
924 | snprintf(line,buffersize,".!tar -zcf %s_%s.tar.gz *.eps", GetName(),fCalorimeter.Data()) ; | |
6639984f | 925 | gROOT->ProcessLine(line); |
5ae09196 | 926 | snprintf(line, buffersize,".!rm -fR AliAnaPi0_%s*.eps",fCalorimeter.Data()); |
6639984f | 927 | gROOT->ProcessLine(line); |
928 | ||
71dd883b | 929 | printf(" AliAnaPi0::Terminate() - !! All the eps files are in %s_%s.tar.gz !!!\n", GetName(), fCalorimeter.Data()); |
1c5acb87 | 930 | |
6639984f | 931 | } |
c8fe2783 | 932 | //____________________________________________________________________________________________________________________________________________________ |
933 | Int_t AliAnaPi0::GetEventIndex(AliAODPWG4Particle * part, Double_t * vert) | |
934 | { | |
935 | // retieves the event index and checks the vertex | |
936 | // in the mixed buffer returns -2 if vertex NOK | |
937 | // for normal events returns 0 if vertex OK and -1 if vertex NOK | |
938 | ||
939 | Int_t rv = -1 ; | |
940 | if (GetMixedEvent()){ | |
941 | TObjArray * pl = 0x0; | |
942 | if (part->GetDetector().Contains("PHOS")) { | |
943 | pl = GetAODPHOS(); | |
944 | } else if (part->GetDetector().Contains("EMCAL")) { | |
945 | pl = GetAODEMCAL(); | |
946 | } else { | |
947 | AliFatal(Form("%s is an unknown calorimeter", part->GetDetector().Data())) ; | |
948 | } | |
949 | rv = GetMixedEvent()->EventIndexForCaloCluster(part->GetCaloLabel(0)) ; | |
950 | GetMixedEvent()->GetVertexOfEvent(rv)->GetXYZ(vert); | |
951 | if(vert[2] < -fZvtxCut || vert[2] > fZvtxCut) | |
952 | rv = -2 ; //Event can not be used (vertex, centrality,... cuts not fulfilled) | |
0ae57829 | 953 | } else if(GetReader()->GetDataType()!=AliCaloTrackReader::kMC){ |
c8fe2783 | 954 | Double_t * tempo = GetReader()->GetVertex() ; |
955 | vert[0] = tempo[0] ; | |
956 | vert[1] = tempo[1] ; | |
957 | vert[2] = tempo[2] ; | |
958 | if(vert[2] < -fZvtxCut || vert[2] > fZvtxCut) | |
959 | rv = -1 ; //Event can not be used (vertex, centrality,... cuts not fulfilled) | |
960 | else | |
961 | rv = 0 ; | |
0ae57829 | 962 | }//No MC reader |
963 | else rv = 0; | |
964 | ||
c8fe2783 | 965 | return rv ; |
966 | } |