]>
Commit | Line | Data |
---|---|---|
bc41680b | 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 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 | ||
16 | //_________________________________________________________________________ | |
17 | // | |
18 | // Class for the study of Pile-up effect on | |
19 | // Calorimeter clusters. | |
20 | // Open time cuts in reader. | |
21 | // | |
22 | //-- Author: Gustavo Conesa (CNRS-LPSC-Grenoble) | |
23 | ////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | // --- ROOT system --- | |
26 | #include <TH2F.h> | |
27 | #include <TClonesArray.h> | |
28 | #include <TObjString.h> | |
29 | ||
30 | // --- Analysis system --- | |
31 | #include "AliAnaClusterPileUp.h" | |
32 | #include "AliCaloTrackReader.h" | |
33 | #include "AliFiducialCut.h" | |
34 | #include "AliVCluster.h" | |
35 | #include "AliAODEvent.h" | |
36 | #include "AliESDEvent.h" | |
37 | ||
38 | ClassImp(AliAnaClusterPileUp) | |
39 | ||
40 | //___________________________________________ | |
41 | AliAnaClusterPileUp::AliAnaClusterPileUp() : | |
42 | AliAnaCaloTrackCorrBaseClass(), | |
0cea6003 | 43 | fNCellsCut(0), |
f59c9dd3 | 44 | fMomentum(), |
bc41680b | 45 | // Histograms |
46 | fhTimePtNoCut(0), fhTimePtSPD(0), | |
47 | fhTimeNPileUpVertSPD(0), fhTimeNPileUpVertTrack(0), | |
48 | fhTimeNPileUpVertContributors(0), | |
49 | fhTimePileUpMainVertexZDistance(0), fhTimePileUpMainVertexZDiamond(0), | |
50 | fhClusterMultSPDPileUp(), fhClusterMultNoPileUp(), | |
51 | fhEtaPhiBC0(0), fhEtaPhiBCPlus(0), fhEtaPhiBCMinus(0), | |
52 | fhEtaPhiBC0PileUpSPD(0), | |
53 | fhEtaPhiBCPlusPileUpSPD(0), fhEtaPhiBCMinusPileUpSPD(0), | |
54 | fhPtNPileUpSPDVtx(0), fhPtNPileUpTrkVtx(0), | |
55 | fhPtNPileUpSPDVtxTimeCut(0), fhPtNPileUpTrkVtxTimeCut(0), | |
56 | fhPtNPileUpSPDVtxTimeCut2(0), fhPtNPileUpTrkVtxTimeCut2(0) | |
57 | { | |
58 | //default ctor | |
59 | ||
60 | for(Int_t i = 0; i < 7; i++) | |
61 | { | |
62 | fhPtPileUp [i] = 0; | |
63 | fhPtNeutralPileUp[i] = 0; | |
64 | ||
65 | fhLambda0PileUp [i] = 0; | |
66 | fhLambda0NeutralPileUp[i] = 0; | |
67 | ||
68 | fhClusterEFracLongTimePileUp [i] = 0; | |
69 | ||
70 | fhClusterCellTimePileUp [i] = 0; | |
71 | fhClusterTimeDiffPileUp [i] = 0; | |
72 | fhClusterTimeDiffNeutralPileUp[i] = 0; | |
73 | ||
74 | } | |
75 | ||
76 | for(Int_t i = 0; i < 4; i++) | |
77 | { | |
78 | fhClusterMultSPDPileUp[i] = 0; | |
79 | fhClusterMultNoPileUp [i] = 0; | |
80 | } | |
81 | ||
82 | //Initialize parameters | |
83 | InitParameters(); | |
84 | ||
85 | } | |
86 | ||
87 | //___________________________________________ | |
88 | TObjString * AliAnaClusterPileUp::GetAnalysisCuts() | |
89 | { | |
90 | //Save parameters used for analysis | |
91 | TString parList ; //this will be list of parameters used for this analysis. | |
92 | const Int_t buffersize = 255; | |
93 | char onePar[buffersize] ; | |
94 | ||
95 | snprintf(onePar,buffersize,"--- AliAnaClusterPileUp ---\n") ; | |
96 | parList+=onePar ; | |
cb67d5f1 | 97 | snprintf(onePar,buffersize,"Calorimeter: %s\n",GetCalorimeterString().Data()) ; |
bc41680b | 98 | parList+=onePar ; |
99 | ||
100 | //Get parameters set in base class. | |
101 | //parList += GetBaseParametersList() ; | |
102 | ||
103 | return new TObjString(parList) ; | |
104 | } | |
105 | ||
106 | //________________________________________________________________________ | |
107 | TList * AliAnaClusterPileUp::GetCreateOutputObjects() | |
108 | { | |
109 | // Create histograms to be saved in output file and | |
110 | // store them in outputContainer | |
111 | TList * outputContainer = new TList() ; | |
112 | outputContainer->SetName("PhotonHistos") ; | |
113 | ||
114 | Int_t nptbins = GetHistogramRanges()->GetHistoPtBins(); Float_t ptimecluster = GetHistogramRanges()->GetHistoPtMax(); Float_t ptmin = GetHistogramRanges()->GetHistoPtMin(); | |
115 | Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins(); Float_t phimax = GetHistogramRanges()->GetHistoPhiMax(); Float_t phimin = GetHistogramRanges()->GetHistoPhiMin(); | |
116 | Int_t netabins = GetHistogramRanges()->GetHistoEtaBins(); Float_t etamax = GetHistogramRanges()->GetHistoEtaMax(); Float_t etamin = GetHistogramRanges()->GetHistoEtaMin(); | |
117 | Int_t ssbins = GetHistogramRanges()->GetHistoShowerShapeBins(); Float_t ssmax = GetHistogramRanges()->GetHistoShowerShapeMax(); Float_t ssmin = GetHistogramRanges()->GetHistoShowerShapeMin(); | |
118 | Int_t ntimebins= GetHistogramRanges()->GetHistoTimeBins(); Float_t timemax = GetHistogramRanges()->GetHistoTimeMax(); Float_t timemin = GetHistogramRanges()->GetHistoTimeMin(); | |
119 | ||
120 | ||
121 | fhTimePtNoCut = new TH2F ("hTimePt_NoCut","time of cluster vs pT of clusters, no event selection", nptbins,ptmin,ptimecluster, ntimebins,timemin,timemax); | |
122 | fhTimePtNoCut->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
123 | fhTimePtNoCut->SetYTitle("#it{time} (ns)"); | |
124 | outputContainer->Add(fhTimePtNoCut); | |
125 | ||
126 | fhTimePtSPD = new TH2F ("hTimePt_SPD","time of cluster vs pT of clusters, SPD Pile-up events", nptbins,ptmin,ptimecluster, ntimebins,timemin,timemax); | |
127 | fhTimePtSPD->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
128 | fhTimePtSPD->SetYTitle("#it{time} (ns)"); | |
129 | outputContainer->Add(fhTimePtSPD); | |
130 | ||
131 | fhTimeNPileUpVertSPD = new TH2F ("hTime_NPileUpVertSPD","time of cluster vs N pile-up SPD vertex", ntimebins,timemin,timemax,20,0,20); | |
132 | fhTimeNPileUpVertSPD->SetYTitle("# vertex "); | |
133 | fhTimeNPileUpVertSPD->SetXTitle("#it{time} (ns)"); | |
134 | outputContainer->Add(fhTimeNPileUpVertSPD); | |
135 | ||
136 | fhTimeNPileUpVertTrack = new TH2F ("hTime_NPileUpVertTracks","time of cluster vs N pile-up Tracks vertex", ntimebins,timemin,timemax, 20,0,20 ); | |
137 | fhTimeNPileUpVertTrack->SetYTitle("# vertex "); | |
138 | fhTimeNPileUpVertTrack->SetXTitle("#it{time} (ns)"); | |
139 | outputContainer->Add(fhTimeNPileUpVertTrack); | |
140 | ||
141 | fhTimeNPileUpVertContributors = new TH2F ("hTime_NPileUpVertContributors","time of cluster vs N constributors to pile-up SPD vertex", ntimebins,timemin,timemax,50,0,50); | |
142 | fhTimeNPileUpVertContributors->SetYTitle("# vertex "); | |
143 | fhTimeNPileUpVertContributors->SetXTitle("#it{time} (ns)"); | |
144 | outputContainer->Add(fhTimeNPileUpVertContributors); | |
145 | ||
146 | fhTimePileUpMainVertexZDistance = new TH2F ("hTime_PileUpMainVertexZDistance","time of cluster vs distance in Z pile-up SPD vertex - main SPD vertex",ntimebins,timemin,timemax,100,0,50); | |
147 | fhTimePileUpMainVertexZDistance->SetYTitle("distance Z (cm) "); | |
148 | fhTimePileUpMainVertexZDistance->SetXTitle("#it{time} (ns)"); | |
149 | outputContainer->Add(fhTimePileUpMainVertexZDistance); | |
150 | ||
151 | fhTimePileUpMainVertexZDiamond = new TH2F ("hTime_PileUpMainVertexZDiamond","time of cluster vs distance in Z pile-up SPD vertex - z diamond",ntimebins,timemin,timemax,100,0,50); | |
152 | fhTimePileUpMainVertexZDiamond->SetYTitle("diamond distance Z (cm) "); | |
153 | fhTimePileUpMainVertexZDiamond->SetXTitle("#it{time} (ns)"); | |
154 | outputContainer->Add(fhTimePileUpMainVertexZDiamond); | |
155 | ||
156 | fhEtaPhiBC0 = new TH2F ("hEtaPhiBC0","eta-phi for clusters tof corresponding to BC=0",netabins,etamin,etamax, nphibins,phimin,phimax); | |
157 | fhEtaPhiBC0->SetXTitle("#eta "); | |
158 | fhEtaPhiBC0->SetYTitle("#phi (rad)"); | |
159 | outputContainer->Add(fhEtaPhiBC0); | |
160 | ||
161 | fhEtaPhiBCPlus = new TH2F ("hEtaPhiBCPlus","eta-phi for clusters tof corresponding to BC>0",netabins,etamin,etamax, nphibins,phimin,phimax); | |
162 | fhEtaPhiBCPlus->SetXTitle("#eta "); | |
163 | fhEtaPhiBCPlus->SetYTitle("#phi (rad)"); | |
164 | outputContainer->Add(fhEtaPhiBCPlus); | |
165 | ||
166 | fhEtaPhiBCMinus = new TH2F ("hEtaPhiBCMinus","eta-phi for clusters tof corresponding to BC<0",netabins,etamin,etamax, nphibins,phimin,phimax); | |
167 | fhEtaPhiBCMinus->SetXTitle("#eta "); | |
168 | fhEtaPhiBCMinus->SetYTitle("#phi (rad)"); | |
169 | outputContainer->Add(fhEtaPhiBCMinus); | |
170 | ||
171 | fhEtaPhiBC0PileUpSPD = new TH2F ("hEtaPhiBC0PileUpSPD","eta-phi for clusters tof corresponding to BC=0, SPD pile-up",netabins,etamin,etamax, nphibins,phimin,phimax); | |
172 | fhEtaPhiBC0PileUpSPD->SetXTitle("#eta "); | |
173 | fhEtaPhiBC0PileUpSPD->SetYTitle("#phi (rad)"); | |
174 | outputContainer->Add(fhEtaPhiBC0PileUpSPD); | |
175 | ||
176 | fhEtaPhiBCPlusPileUpSPD = new TH2F ("hEtaPhiBCPlusPileUpSPD","eta-phi for clusters tof corresponding to BC>0, SPD pile-up",netabins,etamin,etamax, nphibins,phimin,phimax); | |
177 | fhEtaPhiBCPlusPileUpSPD->SetXTitle("#eta "); | |
178 | fhEtaPhiBCPlusPileUpSPD->SetYTitle("#phi (rad)"); | |
179 | outputContainer->Add(fhEtaPhiBCPlusPileUpSPD); | |
180 | ||
181 | fhEtaPhiBCMinusPileUpSPD = new TH2F ("hEtaPhiBCMinusPileUpSPD","eta-phi for clusters tof corresponding to BC<0, SPD pile-up",netabins,etamin,etamax, nphibins,phimin,phimax); | |
182 | fhEtaPhiBCMinusPileUpSPD->SetXTitle("#eta "); | |
183 | fhEtaPhiBCMinusPileUpSPD->SetYTitle("#phi (rad)"); | |
184 | outputContainer->Add(fhEtaPhiBCMinusPileUpSPD); | |
185 | ||
186 | TString title[] = {"no |t diff| cut","|t diff|<20 ns","|t diff|>20 ns","|t diff|>40 ns"}; | |
187 | TString name [] = {"TDiffNoCut","TDiffSmaller20ns","TDiffLarger20ns","TDiffLarger40ns"}; | |
188 | for(Int_t i = 0; i < 4; i++) | |
189 | { | |
190 | fhClusterMultSPDPileUp[i] = new TH2F(Form("fhClusterMultSPDPileUp_%s", name[i].Data()), | |
191 | Form("Number of clusters per pile up event with #it{E} > 0.5 and %s respect cluster max vs cluster max E ",title[i].Data()), | |
192 | nptbins,ptmin,ptimecluster,100,0,100); | |
193 | fhClusterMultSPDPileUp[i]->SetYTitle("n clusters "); | |
194 | fhClusterMultSPDPileUp[i]->SetXTitle("#it{E}_{cluster max} (GeV)"); | |
195 | outputContainer->Add(fhClusterMultSPDPileUp[i]) ; | |
196 | ||
197 | fhClusterMultNoPileUp[i] = new TH2F(Form("fhClusterMultNoPileUp_%s", name[i].Data()), | |
198 | Form("Number of clusters per non pile up event with #it{E} > 0.5 and %s respect cluster max vs cluster max E ",title[i].Data()), | |
199 | nptbins,ptmin,ptimecluster,100,0,100); | |
200 | fhClusterMultNoPileUp[i]->SetYTitle("n clusters "); | |
201 | fhClusterMultNoPileUp[i]->SetXTitle("#it{E}_{cluster max} (GeV)"); | |
202 | outputContainer->Add(fhClusterMultNoPileUp[i]) ; | |
203 | } | |
204 | ||
205 | fhPtNPileUpSPDVtx = new TH2F ("hPt_NPileUpVertSPD","pT of cluster vs N pile-up SPD vertex", | |
206 | nptbins,ptmin,ptimecluster,20,0,20); | |
207 | fhPtNPileUpSPDVtx->SetYTitle("# vertex "); | |
208 | fhPtNPileUpSPDVtx->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
209 | outputContainer->Add(fhPtNPileUpSPDVtx); | |
210 | ||
211 | fhPtNPileUpTrkVtx = new TH2F ("hPt_NPileUpVertTracks","pT of cluster vs N pile-up Tracks vertex", | |
212 | nptbins,ptmin,ptimecluster, 20,0,20 ); | |
213 | fhPtNPileUpTrkVtx->SetYTitle("# vertex "); | |
214 | fhPtNPileUpTrkVtx->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
215 | outputContainer->Add(fhPtNPileUpTrkVtx); | |
216 | ||
217 | fhPtNPileUpSPDVtxTimeCut = new TH2F ("hPt_NPileUpVertSPD_TimeCut","pT of cluster vs N pile-up SPD vertex, |tof| < 25 ns", | |
218 | nptbins,ptmin,ptimecluster,20,0,20); | |
219 | fhPtNPileUpSPDVtxTimeCut->SetYTitle("# vertex "); | |
220 | fhPtNPileUpSPDVtxTimeCut->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
221 | outputContainer->Add(fhPtNPileUpSPDVtxTimeCut); | |
222 | ||
223 | fhPtNPileUpTrkVtxTimeCut = new TH2F ("hPt_NPileUpVertTracks_TimeCut","pT of cluster vs N pile-up Tracks vertex, |tof| < 25 ns", | |
224 | nptbins,ptmin,ptimecluster, 20,0,20 ); | |
225 | fhPtNPileUpTrkVtxTimeCut->SetYTitle("# vertex "); | |
226 | fhPtNPileUpTrkVtxTimeCut->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
227 | outputContainer->Add(fhPtNPileUpTrkVtxTimeCut); | |
228 | ||
229 | fhPtNPileUpSPDVtxTimeCut2 = new TH2F ("hPt_NPileUpVertSPD_TimeCut2","pT of cluster vs N pile-up SPD vertex, -25 < tof < 75 ns", | |
230 | nptbins,ptmin,ptimecluster,20,0,20); | |
231 | fhPtNPileUpSPDVtxTimeCut2->SetYTitle("# vertex "); | |
232 | fhPtNPileUpSPDVtxTimeCut2->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
233 | outputContainer->Add(fhPtNPileUpSPDVtxTimeCut2); | |
234 | ||
235 | fhPtNPileUpTrkVtxTimeCut2 = new TH2F ("hPt_NPileUpVertTracks_TimeCut2","pT of cluster vs N pile-up Tracks vertex, -25 < tof < 75 ns", | |
236 | nptbins,ptmin,ptimecluster, 20,0,20 ); | |
237 | fhPtNPileUpTrkVtxTimeCut2->SetYTitle("# vertex "); | |
238 | fhPtNPileUpTrkVtxTimeCut2->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
239 | outputContainer->Add(fhPtNPileUpTrkVtxTimeCut2); | |
240 | ||
241 | ||
cb67d5f1 | 242 | TString pileUpName[] = {"SPD",kEMCAL,"SPDOrEMCAL","SPDAndEMCAL","SPDAndNotEMCAL","EMCALAndNotSPD","NotSPDAndNotEMCAL"} ; |
bc41680b | 243 | |
244 | for(Int_t i = 0 ; i < 7 ; i++) | |
245 | { | |
246 | fhPtPileUp[i] = new TH1F(Form("hPtPileUp%s",pileUpName[i].Data()), | |
247 | Form("Cluster #it{p}_{T} distribution, %s Pile-Up event",pileUpName[i].Data()), nptbins,ptmin,ptimecluster); | |
248 | fhPtPileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
249 | outputContainer->Add(fhPtPileUp[i]); | |
250 | ||
251 | fhPtNeutralPileUp[i] = new TH1F(Form("hPtNeutralPileUp%s",pileUpName[i].Data()), | |
252 | Form("Neutral clusters #it{p}_{T} distribution, %s Pile-Up event",pileUpName[i].Data()), nptbins,ptmin,ptimecluster); | |
253 | fhPtNeutralPileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})"); | |
254 | outputContainer->Add(fhPtNeutralPileUp[i]); | |
255 | ||
256 | fhClusterEFracLongTimePileUp[i] = new TH2F(Form("hClusterEFracLongTimePileUp%s",pileUpName[i].Data()), | |
257 | Form("Cluster E vs fraction of cluster energy from large T cells, %s Pile-Up event",pileUpName[i].Data()), | |
258 | nptbins,ptmin,ptimecluster,200,0,1); | |
259 | fhClusterEFracLongTimePileUp[i]->SetXTitle("#it{E} (GeV)"); | |
260 | fhClusterEFracLongTimePileUp[i]->SetYTitle("E(large time) / E"); | |
261 | outputContainer->Add(fhClusterEFracLongTimePileUp[i]); | |
262 | ||
263 | fhClusterCellTimePileUp[i] = new TH2F(Form("hClusterCellTimePileUp%s",pileUpName[i].Data()), | |
264 | Form("Cluster E vs cell time in cluster, %s Pile-Up event",pileUpName[i].Data()), | |
265 | nptbins,ptmin,ptimecluster,ntimebins,timemin,timemax); | |
266 | fhClusterCellTimePileUp[i]->SetXTitle("#it{E} (GeV)"); | |
267 | fhClusterCellTimePileUp[i]->SetYTitle("t_{cell} (ns)"); | |
268 | outputContainer->Add(fhClusterCellTimePileUp[i]); | |
269 | ||
270 | fhClusterTimeDiffPileUp[i] = new TH2F(Form("hClusterTimeDiffPileUp%s",pileUpName[i].Data()), | |
271 | Form("Cluster E vs t_{max}-t_{cell} in cluster, %s Pile-Up event",pileUpName[i].Data()), | |
272 | nptbins,ptmin,ptimecluster,400,-200,200); | |
273 | fhClusterTimeDiffPileUp[i]->SetXTitle("#it{E} (GeV)"); | |
274 | fhClusterTimeDiffPileUp[i]->SetYTitle("t_{max}-t_{cell} (ns)"); | |
275 | outputContainer->Add(fhClusterTimeDiffPileUp[i]); | |
276 | ||
277 | fhClusterTimeDiffNeutralPileUp[i] = new TH2F(Form("hClusterTimeDiffNeutralPileUp%s",pileUpName[i].Data()), | |
278 | Form("Neutral clusters E vs t_{max}-t_{cell} in cluster, %s Pile-Up event",pileUpName[i].Data()), | |
279 | nptbins,ptmin,ptimecluster,400,-200,200); | |
280 | fhClusterTimeDiffNeutralPileUp[i]->SetXTitle("#it{E} (GeV)"); | |
281 | fhClusterTimeDiffNeutralPileUp[i]->SetYTitle("t_{max}-t_{cell} (ns)"); | |
282 | outputContainer->Add(fhClusterTimeDiffNeutralPileUp[i]); | |
283 | ||
284 | fhLambda0PileUp[i] = new TH2F(Form("hLambda0PileUp%s",pileUpName[i].Data()), | |
285 | Form("Cluster E vs #lambda^{2}_{0} in cluster, %s Pile-Up event",pileUpName[i].Data()), | |
286 | nptbins,ptmin,ptimecluster,ssbins,ssmin,ssmax); | |
287 | fhLambda0PileUp[i]->SetXTitle("#it{E} (GeV)"); | |
288 | fhLambda0PileUp[i]->SetYTitle("#lambda^{2}_{0}"); | |
289 | outputContainer->Add(fhLambda0PileUp[i]); | |
290 | ||
291 | fhLambda0NeutralPileUp[i] = new TH2F(Form("hLambda0NeutralPileUp%s",pileUpName[i].Data()), | |
292 | Form("Neutral clusters E vs #lambda^{2}_{0}in cluster, %s Pile-Up event",pileUpName[i].Data()), nptbins,ptmin,ptimecluster,ssbins,ssmin,ssmax); | |
293 | fhLambda0NeutralPileUp[i]->SetXTitle("#it{E} (GeV)"); | |
294 | fhLambda0NeutralPileUp[i]->SetYTitle("#lambda^{2}_{0}"); | |
295 | outputContainer->Add(fhLambda0NeutralPileUp[i]); | |
296 | ||
297 | } | |
298 | ||
299 | return outputContainer ; | |
300 | ||
301 | } | |
302 | ||
303 | //_______________________ | |
304 | void AliAnaClusterPileUp::Init() | |
305 | { | |
306 | //Init | |
307 | ||
308 | //Do some checks | |
cb67d5f1 | 309 | if(GetCalorimeter() == kPHOS && !GetReader()->IsPHOSSwitchedOn()) |
bc41680b | 310 | AliFatal("You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!"); |
311 | ||
cb67d5f1 | 312 | if(GetCalorimeter() == kEMCAL && !GetReader()->IsEMCALSwitchedOn()) |
bc41680b | 313 | AliFatal("You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!"); |
314 | ||
315 | if(GetReader()->GetDataType() == AliCaloTrackReader::kMC) | |
316 | AliFatal("You want to use MC data in analysis but this is not possible in pile-up!!"); | |
317 | ||
318 | } | |
319 | ||
320 | //____________________________________________________________________________ | |
321 | void AliAnaClusterPileUp::InitParameters() | |
322 | { | |
323 | ||
324 | //Initialize the parameters of the analysis. | |
325 | AddToHistogramsName("AnaClusterPileUp_"); | |
326 | ||
bc41680b | 327 | fNCellsCut = 2; |
328 | } | |
329 | ||
330 | //__________________________________________________________________ | |
331 | void AliAnaClusterPileUp::MakeAnalysisFillHistograms() | |
332 | { | |
333 | // Do cluster analysis | |
334 | // Remember to open time cuts in reader | |
335 | ||
336 | //Select the calorimeter | |
337 | TObjArray * pl = 0x0; | |
338 | AliVCaloCells* cells = 0; | |
cb67d5f1 | 339 | if (GetCalorimeter() == kPHOS ) |
bc41680b | 340 | { |
341 | pl = GetPHOSClusters(); | |
342 | cells = GetPHOSCells(); | |
343 | } | |
cb67d5f1 | 344 | else if (GetCalorimeter() == kEMCAL) |
bc41680b | 345 | { |
346 | pl = GetEMCALClusters(); | |
347 | cells = GetEMCALCells(); | |
348 | } | |
349 | ||
350 | if(!pl) | |
351 | { | |
cb67d5f1 | 352 | Info("MakeAnalysisFillAOD","TObjArray with %s clusters is NULL!\n",GetCalorimeterString().Data()); |
bc41680b | 353 | return; |
354 | } | |
355 | ||
356 | AliVEvent * event = GetReader()->GetInputEvent(); | |
357 | AliESDEvent* esdEv = dynamic_cast<AliESDEvent*> (event); | |
358 | AliAODEvent* aodEv = dynamic_cast<AliAODEvent*> (event); | |
359 | ||
360 | //------------------- | |
361 | // N pile up vertices | |
362 | Int_t nVtxSPD = -1; | |
363 | Int_t nVtxTrk = -1; | |
364 | ||
365 | if (esdEv) | |
366 | { | |
367 | nVtxSPD = esdEv->GetNumberOfPileupVerticesSPD(); | |
368 | nVtxTrk = esdEv->GetNumberOfPileupVerticesTracks(); | |
369 | }//ESD | |
370 | else if (aodEv) | |
371 | { | |
372 | nVtxSPD = aodEv->GetNumberOfPileupVerticesSPD(); | |
373 | nVtxTrk = aodEv->GetNumberOfPileupVerticesTracks(); | |
374 | }//AOD | |
375 | ||
376 | //------------------- | |
377 | // Loop on clusters | |
378 | Int_t nCaloClusters = pl->GetEntriesFast(); | |
379 | ||
cb67d5f1 | 380 | if(GetDebug() > 0) printf("AliAnaClusterPileUp::MakeAnalysisFillAOD() - input %s cluster entries %d\n", GetCalorimeterString().Data(), nCaloClusters); |
bc41680b | 381 | //Init variables |
bc41680b | 382 | Int_t idMax = 0; |
383 | Float_t ptMax = 0; | |
384 | Float_t tMax = 0; | |
385 | ||
386 | for(Int_t icalo = 0; icalo < nCaloClusters; icalo++) | |
387 | { | |
388 | AliVCluster * calo = (AliVCluster*) (pl->At(icalo)); | |
389 | //printf("calo %d, %f\n",icalo,calo->E()); | |
390 | ||
391 | if(!calo) continue; // it should not happen, but just in case | |
392 | ||
f59c9dd3 | 393 | calo->GetMomentum(fMomentum,GetVertex(0)) ; |
bc41680b | 394 | |
f59c9dd3 | 395 | Float_t ecluster = fMomentum.E(); |
396 | Float_t ptcluster = fMomentum.Pt(); | |
bc41680b | 397 | Float_t l0cluster = calo->GetM02(); |
f59c9dd3 | 398 | Float_t etacluster = fMomentum.Eta(); |
399 | Float_t phicluster = fMomentum.Phi(); | |
bc41680b | 400 | if(phicluster < 0) phicluster+=TMath::TwoPi(); |
401 | Float_t tofcluster = calo->GetTOF()*1.e9; | |
402 | ||
403 | Bool_t matched = IsTrackMatched(calo,GetReader()->GetInputEvent()); | |
404 | ||
405 | //....................................... | |
406 | //If too small or big energy, skip it | |
407 | if(ecluster < GetMinEnergy() || ecluster > GetMaxEnergy() ) continue ; | |
408 | ||
409 | //....................................... | |
410 | if(calo->GetNCells() <= fNCellsCut && GetReader()->GetDataType() != AliCaloTrackReader::kMC) continue; | |
411 | ||
412 | //....................................... | |
413 | //Check acceptance selection | |
414 | if(IsFiducialCutOn()) | |
415 | { | |
f59c9dd3 | 416 | Bool_t in = GetFiducialCut()->IsInFiducialCut(fMomentum.Eta(),fMomentum.Phi(),GetCalorimeter()) ; |
bc41680b | 417 | if(! in ) continue; |
418 | } | |
419 | ||
420 | // Select highest pt cluster passing the cuts | |
421 | if(ptcluster > ptMax && tofcluster < 30) | |
422 | { | |
423 | ptMax = ptcluster; | |
424 | tMax = tofcluster; | |
425 | idMax = icalo; | |
426 | } | |
427 | ||
428 | //------------------------------------- | |
429 | // Cluster timing for different pile-up | |
430 | ||
431 | fhTimePtNoCut->Fill(ptcluster,tofcluster); | |
432 | if(GetReader()->IsPileUpFromSPD()) fhTimePtSPD->Fill(ptcluster,tofcluster); | |
433 | ||
434 | //---------------------------------------- | |
435 | // correlate cluster and number of vertices | |
436 | ||
437 | fhPtNPileUpSPDVtx->Fill(ptcluster,nVtxSPD); | |
438 | fhPtNPileUpTrkVtx->Fill(ptcluster,nVtxTrk); | |
439 | ||
440 | if(TMath::Abs(tofcluster) < 30) | |
441 | { | |
442 | fhPtNPileUpSPDVtxTimeCut->Fill(ptcluster,nVtxSPD); | |
443 | fhPtNPileUpTrkVtxTimeCut->Fill(ptcluster,nVtxTrk); | |
444 | } | |
445 | ||
446 | if(tofcluster < 75 && tofcluster > -30) | |
447 | { | |
448 | fhPtNPileUpSPDVtxTimeCut2->Fill(ptcluster,nVtxSPD); | |
449 | fhPtNPileUpTrkVtxTimeCut2->Fill(ptcluster,nVtxTrk); | |
450 | } | |
451 | ||
452 | // Loop on the vertices arrays, correlate with timing | |
453 | // only for sufficiently large cluster energy | |
454 | if(ecluster > 8) | |
455 | { | |
456 | fhTimeNPileUpVertSPD ->Fill(tofcluster,nVtxSPD); | |
457 | fhTimeNPileUpVertTrack->Fill(tofcluster,nVtxTrk); | |
458 | ||
459 | Int_t ncont = -1; | |
460 | Float_t z1 = -1, z2 = -1; | |
461 | Float_t diamZ = -1; | |
462 | for(Int_t iVert=0; iVert<nVtxSPD;iVert++) | |
463 | { | |
464 | if (esdEv) | |
465 | { | |
466 | const AliESDVertex* pv=esdEv->GetPileupVertexSPD(iVert); | |
467 | ncont=pv->GetNContributors(); | |
468 | z1 = esdEv->GetPrimaryVertexSPD()->GetZ(); | |
469 | z2 = pv->GetZ(); | |
470 | diamZ = esdEv->GetDiamondZ(); | |
471 | }//ESD | |
472 | else if (aodEv) | |
473 | { | |
474 | AliAODVertex *pv=aodEv->GetVertex(iVert); | |
475 | if(pv->GetType()!=AliAODVertex::kPileupSPD) continue; | |
476 | ncont=pv->GetNContributors(); | |
477 | z1=aodEv->GetPrimaryVertexSPD()->GetZ(); | |
478 | z2=pv->GetZ(); | |
479 | diamZ = aodEv->GetDiamondZ(); | |
480 | }// AOD | |
481 | ||
482 | Double_t distZ = TMath::Abs(z2-z1); | |
483 | diamZ = TMath::Abs(z2-diamZ); | |
484 | ||
485 | fhTimeNPileUpVertContributors ->Fill(tofcluster,ncont); | |
486 | fhTimePileUpMainVertexZDistance->Fill(tofcluster,distZ); | |
487 | fhTimePileUpMainVertexZDiamond ->Fill(tofcluster,diamZ); | |
488 | ||
489 | }// vertex loop | |
490 | } | |
491 | ||
492 | //------------------------------------ | |
493 | // Eta-Phi cluster position depending on timing | |
494 | // Continue only for BC0 | |
495 | if (tofcluster > 28) | |
496 | { | |
497 | fhEtaPhiBCPlus ->Fill(etacluster,phicluster); | |
498 | if(GetReader()->IsPileUpFromSPD()) fhEtaPhiBCPlusPileUpSPD ->Fill(etacluster,phicluster); | |
499 | continue; | |
500 | } | |
501 | else if (tofcluster <-28) | |
502 | { | |
503 | fhEtaPhiBCMinus->Fill(etacluster,phicluster); | |
504 | if(GetReader()->IsPileUpFromSPD()) fhEtaPhiBCMinusPileUpSPD->Fill(etacluster,phicluster); | |
505 | continue ; | |
506 | } | |
507 | ||
508 | //-------------------------------------- | |
509 | // Fill histograms for clusters in BC=0 | |
510 | ||
511 | fhEtaPhiBC0->Fill(etacluster,phicluster); if(GetReader()->IsPileUpFromSPD()) fhEtaPhiBC0PileUpSPD ->Fill(etacluster,phicluster); | |
512 | ||
513 | if(GetReader()->IsPileUpFromSPD()) {fhPtPileUp[0]->Fill(ptcluster); fhLambda0PileUp[0]->Fill(ptcluster,l0cluster); } | |
514 | if(GetReader()->IsPileUpFromEMCal()) {fhPtPileUp[1]->Fill(ptcluster); fhLambda0PileUp[1]->Fill(ptcluster,l0cluster); } | |
515 | if(GetReader()->IsPileUpFromSPDOrEMCal()) {fhPtPileUp[2]->Fill(ptcluster); fhLambda0PileUp[2]->Fill(ptcluster,l0cluster); } | |
516 | if(GetReader()->IsPileUpFromSPDAndEMCal()) {fhPtPileUp[3]->Fill(ptcluster); fhLambda0PileUp[3]->Fill(ptcluster,l0cluster); } | |
517 | if(GetReader()->IsPileUpFromSPDAndNotEMCal()) {fhPtPileUp[4]->Fill(ptcluster); fhLambda0PileUp[4]->Fill(ptcluster,l0cluster); } | |
518 | if(GetReader()->IsPileUpFromEMCalAndNotSPD()) {fhPtPileUp[5]->Fill(ptcluster); fhLambda0PileUp[5]->Fill(ptcluster,l0cluster); } | |
519 | if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) {fhPtPileUp[6]->Fill(ptcluster); fhLambda0PileUp[6]->Fill(ptcluster,l0cluster); } | |
520 | ||
521 | if(!matched) | |
522 | { | |
523 | if(GetReader()->IsPileUpFromSPD()) {fhPtNeutralPileUp[0]->Fill(ptcluster); fhLambda0NeutralPileUp[0]->Fill(ptcluster,l0cluster); } | |
524 | if(GetReader()->IsPileUpFromEMCal()) {fhPtNeutralPileUp[1]->Fill(ptcluster); fhLambda0NeutralPileUp[1]->Fill(ptcluster,l0cluster); } | |
525 | if(GetReader()->IsPileUpFromSPDOrEMCal()) {fhPtNeutralPileUp[2]->Fill(ptcluster); fhLambda0NeutralPileUp[2]->Fill(ptcluster,l0cluster); } | |
526 | if(GetReader()->IsPileUpFromSPDAndEMCal()) {fhPtNeutralPileUp[3]->Fill(ptcluster); fhLambda0NeutralPileUp[3]->Fill(ptcluster,l0cluster); } | |
527 | if(GetReader()->IsPileUpFromSPDAndNotEMCal()) {fhPtNeutralPileUp[4]->Fill(ptcluster); fhLambda0NeutralPileUp[4]->Fill(ptcluster,l0cluster); } | |
528 | if(GetReader()->IsPileUpFromEMCalAndNotSPD()) {fhPtNeutralPileUp[5]->Fill(ptcluster); fhLambda0NeutralPileUp[5]->Fill(ptcluster,l0cluster); } | |
529 | if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) {fhPtNeutralPileUp[6]->Fill(ptcluster); fhLambda0NeutralPileUp[6]->Fill(ptcluster,l0cluster); } | |
530 | } | |
531 | ||
532 | //---------------------------------------------------------------------------- | |
533 | // Loop on cells inside cluster, max cell must be over 100 MeV and time in BC=0 | |
534 | // Get the fraction of the cluster energy that carries the cell with highest | |
535 | // energy and its absId | |
536 | ||
537 | Float_t maxCellFraction = 0.; | |
538 | Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(cells, calo,maxCellFraction); | |
539 | ||
540 | Float_t clusterLongTimePt = 0; | |
541 | Float_t clusterOKTimePt = 0; | |
542 | ||
543 | if(cells->GetCellAmplitude(absIdMax) < 0.1) continue ; | |
544 | ||
545 | for (Int_t ipos = 0; ipos < calo->GetNCells(); ipos++) | |
546 | { | |
547 | Int_t absId = calo->GetCellsAbsId()[ipos]; | |
548 | ||
549 | if( absId == absIdMax ) continue ; | |
550 | ||
551 | Double_t time = cells->GetCellTime(absId); | |
552 | Float_t amp = cells->GetCellAmplitude(absId); | |
553 | Int_t bc = GetReader()->GetInputEvent()->GetBunchCrossNumber(); | |
554 | GetCaloUtils()->GetEMCALRecoUtils()->AcceptCalibrateCell(absId,bc,amp,time,cells); | |
555 | time*=1e9; | |
556 | ||
557 | Float_t diff = (tofcluster-time); | |
558 | ||
559 | if(GetReader()->IsInTimeWindow(time,amp)) clusterOKTimePt += amp; | |
560 | else clusterLongTimePt += amp; | |
561 | ||
562 | if( cells->GetCellAmplitude(absIdMax) < 0.1 ) continue ; | |
563 | ||
564 | if(GetReader()->IsPileUpFromSPD()) | |
565 | { | |
566 | fhClusterCellTimePileUp[0]->Fill(ptcluster, time); | |
567 | fhClusterTimeDiffPileUp[0]->Fill(ptcluster, diff); | |
568 | if(!matched) fhClusterTimeDiffNeutralPileUp[0]->Fill(ptcluster, diff); | |
569 | } | |
570 | ||
571 | if(GetReader()->IsPileUpFromEMCal()) | |
572 | { | |
573 | fhClusterCellTimePileUp[1]->Fill(ptcluster, time); | |
574 | fhClusterTimeDiffPileUp[1]->Fill(ptcluster, diff); | |
575 | if(!matched) fhClusterTimeDiffNeutralPileUp[1]->Fill(ptcluster, diff); | |
576 | } | |
577 | ||
578 | if(GetReader()->IsPileUpFromSPDOrEMCal()) | |
579 | { | |
580 | fhClusterCellTimePileUp[2]->Fill(ptcluster, time); | |
581 | fhClusterTimeDiffPileUp[2]->Fill(ptcluster, diff); | |
582 | if(!matched) fhClusterTimeDiffNeutralPileUp[2]->Fill(ptcluster, diff); | |
583 | } | |
584 | ||
585 | if(GetReader()->IsPileUpFromSPDAndEMCal()) | |
586 | { | |
587 | fhClusterCellTimePileUp[3]->Fill(ptcluster, time); | |
588 | fhClusterTimeDiffPileUp[3]->Fill(ptcluster, diff); | |
589 | if(!matched) fhClusterTimeDiffNeutralPileUp[3]->Fill(ptcluster, diff); | |
590 | } | |
591 | ||
592 | if(GetReader()->IsPileUpFromSPDAndNotEMCal()) | |
593 | { | |
594 | fhClusterCellTimePileUp[4]->Fill(ptcluster, time); | |
595 | fhClusterTimeDiffPileUp[4]->Fill(ptcluster, diff); | |
596 | if(!matched) fhClusterTimeDiffNeutralPileUp[4]->Fill(ptcluster, diff); | |
597 | } | |
598 | ||
599 | if(GetReader()->IsPileUpFromEMCalAndNotSPD()) | |
600 | { | |
601 | fhClusterCellTimePileUp[5]->Fill(ptcluster, time); | |
602 | fhClusterTimeDiffPileUp[5]->Fill(ptcluster, diff); | |
603 | if(!matched) fhClusterTimeDiffNeutralPileUp[5]->Fill(ptcluster, diff); | |
604 | } | |
605 | ||
606 | if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) | |
607 | { | |
608 | fhClusterCellTimePileUp[6]->Fill(ptcluster, time); | |
609 | fhClusterTimeDiffPileUp[6]->Fill(ptcluster, diff); | |
610 | if(!matched) fhClusterTimeDiffNeutralPileUp[6]->Fill(ptcluster, diff); | |
611 | } | |
612 | }//loop | |
613 | ||
614 | Float_t frac = 0; | |
615 | if(clusterLongTimePt+clusterOKTimePt > 0.001) | |
616 | frac = clusterLongTimePt/(clusterLongTimePt+clusterOKTimePt); | |
617 | //printf("E long %f, E OK %f, Fraction large time %f, E %f\n",clusterLongTimePt,clusterOKTimePt,frac,ptcluster); | |
618 | ||
619 | if(GetReader()->IsPileUpFromSPD()) fhClusterEFracLongTimePileUp[0]->Fill(ptcluster,frac); | |
620 | if(GetReader()->IsPileUpFromEMCal()) fhClusterEFracLongTimePileUp[1]->Fill(ptcluster,frac); | |
621 | if(GetReader()->IsPileUpFromSPDOrEMCal()) fhClusterEFracLongTimePileUp[2]->Fill(ptcluster,frac); | |
622 | if(GetReader()->IsPileUpFromSPDAndEMCal()) fhClusterEFracLongTimePileUp[3]->Fill(ptcluster,frac); | |
623 | if(GetReader()->IsPileUpFromSPDAndNotEMCal()) fhClusterEFracLongTimePileUp[4]->Fill(ptcluster,frac); | |
624 | if(GetReader()->IsPileUpFromEMCalAndNotSPD()) fhClusterEFracLongTimePileUp[5]->Fill(ptcluster,frac); | |
625 | if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhClusterEFracLongTimePileUp[6]->Fill(ptcluster,frac); | |
626 | }//loop | |
627 | ||
628 | //---------------------------------------------------------------------------------------------- | |
629 | // Loop again on clusters to compare this max cluster t and the rest of the clusters, if E > 0.3 | |
630 | Int_t n20 = 0; | |
631 | Int_t n40 = 0; | |
632 | Int_t n = 0; | |
633 | Int_t nOK = 0; | |
634 | ||
635 | for(Int_t icalo = 0; icalo < nCaloClusters; icalo++) | |
636 | { | |
637 | AliVCluster * calo = (AliVCluster*) (pl->At(icalo)); | |
638 | ||
639 | if(!calo || calo->E() < 0.3 || icalo == idMax) continue; | |
640 | ||
641 | Float_t tdiff = TMath::Abs(tMax-calo->GetTOF()*1e9); | |
642 | n++; | |
643 | if(tdiff < 25) nOK++; | |
644 | else | |
645 | { | |
646 | n20++; | |
647 | if(tdiff > 40 ) n40++; | |
648 | } | |
649 | } | |
650 | ||
651 | // Check pile-up and fill histograms depending on the different cluster multiplicities | |
652 | if(GetReader()->IsPileUpFromSPD()) | |
653 | { | |
654 | fhClusterMultSPDPileUp[0]->Fill(ptMax,n ); | |
655 | fhClusterMultSPDPileUp[1]->Fill(ptMax,nOK); | |
656 | fhClusterMultSPDPileUp[2]->Fill(ptMax,n20); | |
657 | fhClusterMultSPDPileUp[3]->Fill(ptMax,n40); | |
658 | } | |
659 | else | |
660 | { | |
661 | fhClusterMultNoPileUp[0]->Fill(ptMax,n ); | |
662 | fhClusterMultNoPileUp[1]->Fill(ptMax,nOK); | |
663 | fhClusterMultNoPileUp[2]->Fill(ptMax,n20); | |
664 | fhClusterMultNoPileUp[3]->Fill(ptMax,n40); | |
665 | } | |
666 | ||
667 | ||
668 | if(GetDebug() > 1) printf("AliAnaClusterPileUp::MakeAnalysisFillHistograms() End fill histograms\n"); | |
669 | ||
670 | } | |
671 | ||
672 | ||
673 | ||
674 | //__________________________________________________________________ | |
675 | void AliAnaClusterPileUp::Print(const Option_t * opt) const | |
676 | { | |
677 | //Print some relevant parameters set for the analysis | |
678 | ||
679 | if(! opt) | |
680 | return; | |
681 | ||
682 | printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; | |
683 | AliAnaCaloTrackCorrBaseClass::Print(" "); | |
684 | ||
cb67d5f1 | 685 | printf("Calorimeter = %s\n", GetCalorimeterString().Data()) ; |
bc41680b | 686 | printf(" \n") ; |
687 | ||
688 | } |