]>
Commit | Line | Data |
---|---|---|
2d9e89d4 | 1 | /* $Id$ */ |
2 | ||
c50f9dc0 | 3 | // This class contains a number of histograms for diagnostics of a TPC |
4 | // read out chamber from the reconstructed clusters. | |
5 | // | |
6 | // TODO: | |
7 | // | |
8 | // | |
9 | // | |
10 | ||
11 | #include "AliTPCClusterHistograms.h" | |
12 | ||
483b1eb8 | 13 | #include <TStyle.h> |
2d9e89d4 | 14 | #include <TFile.h> |
15 | #include <TCanvas.h> | |
16 | #include <TH2F.h> | |
17 | #include <TProfile2D.h> | |
483b1eb8 | 18 | #include <TLatex.h> |
19 | ||
2d9e89d4 | 20 | #include <../TPC/AliTPCclusterMI.h> |
2d9e89d4 | 21 | #include <AliLog.h> |
22 | ||
2d9e89d4 | 23 | |
24 | //____________________________________________________________________ | |
25 | ClassImp(AliTPCClusterHistograms) | |
26 | ||
27 | //____________________________________________________________________ | |
28 | AliTPCClusterHistograms::AliTPCClusterHistograms() | |
29 | : TNamed(), | |
30 | fhQmaxVsRow(0), | |
31 | fhQtotVsRow(0), | |
32 | fhSigmaYVsRow(0), | |
33 | fhSigmaZVsRow(0), | |
34 | fhQmaxProfileYVsRow(0), | |
35 | fhQtotProfileYVsRow(0), | |
36 | fhSigmaYProfileYVsRow(0), | |
483b1eb8 | 37 | fhSigmaZProfileYVsRow(0), |
38 | fhQmaxProfileZVsRow(0), | |
39 | fhQtotProfileZVsRow(0), | |
40 | fhSigmaYProfileZVsRow(0), | |
41 | fhSigmaZProfileZVsRow(0), | |
42 | fhQtotVsTime(0), | |
43 | fhQmaxVsTime(0) | |
2d9e89d4 | 44 | { |
45 | // default constructor | |
46 | } | |
47 | ||
48 | //____________________________________________________________________ | |
483b1eb8 | 49 | //AliTPCClusterHistograms::AliTPCClusterHistograms(const Char_t* name, const Char_t* title) |
50 | AliTPCClusterHistograms::AliTPCClusterHistograms(Int_t detector, const Char_t* comment, Int_t timeStart, Int_t timeStop) | |
51 | : TNamed(), | |
2d9e89d4 | 52 | fhQmaxVsRow(0), |
53 | fhQtotVsRow(0), | |
54 | fhSigmaYVsRow(0), | |
55 | fhSigmaZVsRow(0), | |
56 | fhQmaxProfileYVsRow(0), | |
57 | fhQtotProfileYVsRow(0), | |
58 | fhSigmaYProfileYVsRow(0), | |
483b1eb8 | 59 | fhSigmaZProfileYVsRow(0), |
60 | fhQmaxProfileZVsRow(0), | |
61 | fhQtotProfileZVsRow(0), | |
62 | fhSigmaYProfileZVsRow(0), | |
63 | fhSigmaZProfileZVsRow(0), | |
64 | fhQtotVsTime(0), | |
65 | fhQmaxVsTime(0) | |
2d9e89d4 | 66 | { |
483b1eb8 | 67 | // constructor |
c50f9dc0 | 68 | |
483b1eb8 | 69 | // make name and title |
483b1eb8 | 70 | if (detector < 0 || detector >= 72) { |
71 | AliDebug(AliLog::kError, Form("Detector %d does not exist", detector)); | |
72 | return; | |
73 | } | |
74 | ||
75 | Int_t sector = detector%18; | |
76 | TString side; | |
77 | TString inout; | |
78 | if (detector<18 || ( detector>=36 && detector<54)) | |
79 | side.Form("A"); | |
80 | else | |
81 | side.Form("B"); | |
82 | ||
83 | if (detector<36) | |
84 | inout.Form("IROC"); | |
85 | else | |
86 | inout.Form("OROC"); | |
2d9e89d4 | 87 | |
483b1eb8 | 88 | TString name; |
89 | name.Form("sector_%s%d_%s", side.Data(), sector, inout.Data()); | |
90 | ||
91 | SetName(name); | |
92 | SetTitle(Form("%s (detector %d)",name.Data(), detector)); | |
93 | ||
94 | fTimeStart = timeStart; | |
95 | fTimeStop = timeStop; | |
96 | ||
97 | #define BINNING_Z 250, 0, 250 | |
98 | ||
99 | Float_t yRange = 45; | |
100 | Int_t nPadRows = 96; | |
101 | ||
102 | if (TString(name).Contains("IROC")) { | |
103 | yRange = 25; | |
104 | nPadRows = 63; | |
105 | } | |
106 | ||
107 | // 1 bin for each 0.5 cm | |
108 | Int_t nBinsY = Int_t(4*yRange); | |
9cc7192c | 109 | |
c50f9dc0 | 110 | //defining histograms and profile plots |
483b1eb8 | 111 | fhQmaxVsRow = new TH2F("QmaxVsPadRow", "Qmax vs. pad row;Pad row;Qmax", nPadRows+2, -1.5, nPadRows+0.5, 301, -0.5, 300.5); |
112 | fhQtotVsRow = new TH2F("QtotVsPadRow", "Qtot vs. pad row;Pad row;Qtot", nPadRows+2, -1.5, nPadRows+0.5, 400, 0, 4000); | |
2d9e89d4 | 113 | |
483b1eb8 | 114 | fhSigmaYVsRow = new TH2F("SigmaYVsPadRow", "Sigma Y vs. pad row;Pad row;#sigma_{Y}", nPadRows+2, -1.5, nPadRows+0.5, 100, 0, 0.5); |
115 | fhSigmaZVsRow = new TH2F("SigmaZVsPadRow", "Sigma Z vs. pad row;Pad row;#sigma_{Z}", nPadRows+2, -1.5, nPadRows+0.5, 100, 0, 0.5); | |
2d9e89d4 | 116 | |
483b1eb8 | 117 | fhQmaxProfileYVsRow = new TProfile2D("MeanQmaxYVsPadRow","Mean Qmax, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange); |
118 | fhQtotProfileYVsRow = new TProfile2D("MeanQtotYVsPadRow","Mean Qtot, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange); | |
119 | fhSigmaYProfileYVsRow = new TProfile2D("MeanSigmaYVsPadRow","Mean Sigma y, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange); | |
120 | fhSigmaZProfileYVsRow = new TProfile2D("MeanSigmaYVsPadRow","Mean Sigma y, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange); | |
2d9e89d4 | 121 | |
483b1eb8 | 122 | fhQmaxProfileZVsRow = new TProfile2D("MeanQmaxZVsPadRow","Mean Qmax, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z); |
123 | fhQtotProfileZVsRow = new TProfile2D("MeanQtotZVsPadRow","Mean Qtot, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z); | |
124 | fhSigmaYProfileZVsRow = new TProfile2D("MeanSigmaZVsPadRow","Mean Sigma y, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z); | |
125 | fhSigmaZProfileZVsRow = new TProfile2D("MeanSigmaZVsPadRow","Mean Sigma y, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z); | |
126 | ||
127 | Int_t nTimeBins = 100; | |
128 | ||
129 | fhQtotVsTime = new TProfile("MeanQtotVsTime", "Mean Qtot vs. event time stamp; time; Qtot",nTimeBins, fTimeStart, fTimeStop); | |
130 | fhQmaxVsTime = new TProfile("MeanQmaxVsTime", "Mean Qmax vs. event time stamp; time; Qmax",nTimeBins, fTimeStart, fTimeStop); | |
131 | ||
2d9e89d4 | 132 | } |
133 | ||
134 | //____________________________________________________________________ | |
135 | AliTPCClusterHistograms::AliTPCClusterHistograms(const AliTPCClusterHistograms& c) : TNamed(c) | |
136 | { | |
137 | // copy constructor | |
138 | ((AliTPCClusterHistograms &)c).Copy(*this); | |
139 | } | |
140 | ||
141 | //____________________________________________________________________ | |
142 | AliTPCClusterHistograms::~AliTPCClusterHistograms() | |
143 | { | |
144 | // | |
145 | // destructor | |
146 | // | |
147 | ||
148 | if (fhQmaxVsRow) { | |
149 | delete fhQmaxVsRow; | |
150 | fhQmaxVsRow = 0; | |
151 | } | |
152 | if (fhQtotVsRow) { | |
153 | delete fhQtotVsRow; | |
154 | fhQtotVsRow = 0; | |
155 | } | |
156 | if (fhSigmaYVsRow) { | |
157 | delete fhSigmaYVsRow; | |
158 | fhSigmaYVsRow = 0; | |
159 | } | |
160 | if (fhSigmaZVsRow) { | |
161 | delete fhSigmaZVsRow; | |
162 | fhSigmaZVsRow = 0; | |
163 | } | |
164 | if (fhQmaxProfileYVsRow) { | |
165 | delete fhQmaxProfileYVsRow; | |
166 | fhQmaxProfileYVsRow = 0; | |
167 | } | |
168 | if (fhQtotProfileYVsRow) { | |
169 | delete fhQtotProfileYVsRow; | |
170 | fhQtotProfileYVsRow = 0; | |
171 | } | |
172 | if (fhSigmaYProfileYVsRow) { | |
173 | delete fhSigmaYProfileYVsRow; | |
174 | fhSigmaYProfileYVsRow = 0; | |
175 | } | |
176 | if (fhSigmaZProfileYVsRow) { | |
177 | delete fhSigmaZProfileYVsRow; | |
178 | fhSigmaZProfileYVsRow = 0; | |
179 | } | |
483b1eb8 | 180 | if (fhQmaxProfileZVsRow) { |
181 | delete fhQmaxProfileZVsRow; | |
182 | fhQmaxProfileZVsRow = 0; | |
183 | } | |
184 | if (fhQtotProfileZVsRow) { | |
185 | delete fhQtotProfileZVsRow; | |
186 | fhQtotProfileZVsRow = 0; | |
187 | } | |
188 | if (fhSigmaYProfileZVsRow) { | |
189 | delete fhSigmaYProfileZVsRow; | |
190 | fhSigmaYProfileZVsRow = 0; | |
191 | } | |
192 | if (fhSigmaZProfileZVsRow) { | |
193 | delete fhSigmaZProfileZVsRow; | |
194 | fhSigmaZProfileZVsRow = 0; | |
195 | } | |
2d9e89d4 | 196 | |
483b1eb8 | 197 | if (fhQtotVsTime) { |
198 | delete fhQtotVsTime; | |
199 | fhQtotVsTime = 0; | |
200 | } | |
201 | if (fhQmaxVsTime) { | |
202 | delete fhQmaxVsTime; | |
203 | fhQmaxVsTime = 0; | |
204 | } | |
2d9e89d4 | 205 | } |
206 | ||
207 | //____________________________________________________________________ | |
208 | AliTPCClusterHistograms &AliTPCClusterHistograms::operator=(const AliTPCClusterHistograms &c) | |
209 | { | |
210 | // assigment operator | |
211 | ||
212 | if (this != &c) | |
213 | ((AliTPCClusterHistograms &) c).Copy(*this); | |
214 | ||
215 | return *this; | |
216 | } | |
217 | ||
218 | ||
219 | //____________________________________________________________________ | |
220 | Long64_t AliTPCClusterHistograms::Merge(TCollection* list) | |
221 | { | |
222 | // Merge a list of AliTPCClusterHistograms objects with this (needed for | |
223 | // PROOF). | |
224 | // Returns the number of merged objects (including this). | |
225 | ||
226 | if (!list) | |
227 | return 0; | |
228 | ||
229 | if (list->IsEmpty()) | |
230 | return 1; | |
231 | ||
232 | TIterator* iter = list->MakeIterator(); | |
233 | TObject* obj; | |
234 | ||
235 | // collections of measured and generated histograms | |
236 | TList* collectionQmaxVsRow = new TList; | |
237 | TList* collectionQtotVsRow = new TList; | |
238 | TList* collectionSigmaYVsRow = new TList; | |
239 | TList* collectionSigmaZVsRow = new TList; | |
240 | ||
241 | TList* collectionQmaxProfileYVsRow = new TList; | |
242 | TList* collectionQtotProfileYVsRow = new TList; | |
243 | TList* collectionSigmaYProfileYVsRow = new TList; | |
244 | TList* collectionSigmaZProfileYVsRow = new TList; | |
245 | ||
483b1eb8 | 246 | TList* collectionQmaxProfileZVsRow = new TList; |
247 | TList* collectionQtotProfileZVsRow = new TList; | |
248 | TList* collectionSigmaYProfileZVsRow = new TList; | |
249 | TList* collectionSigmaZProfileZVsRow = new TList; | |
250 | ||
251 | TList* collectionQtotVsTime = new TList; | |
252 | TList* collectionQmaxVsTime = new TList; | |
253 | ||
2d9e89d4 | 254 | Int_t count = 0; |
255 | while ((obj = iter->Next())) { | |
256 | ||
257 | AliTPCClusterHistograms* entry = dynamic_cast<AliTPCClusterHistograms*> (obj); | |
258 | if (entry == 0) | |
259 | continue; | |
260 | ||
2d9e89d4 | 261 | collectionQmaxVsRow ->Add(entry->fhQmaxVsRow ); |
262 | collectionQtotVsRow ->Add(entry->fhQtotVsRow ); | |
263 | collectionSigmaYVsRow ->Add(entry->fhSigmaYVsRow ); | |
264 | collectionSigmaZVsRow ->Add(entry->fhSigmaZVsRow ); | |
265 | ||
266 | collectionQmaxProfileYVsRow ->Add(entry->fhQmaxProfileYVsRow ); | |
267 | collectionQtotProfileYVsRow ->Add(entry->fhQtotProfileYVsRow ); | |
268 | collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow); | |
269 | collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow); | |
270 | ||
483b1eb8 | 271 | collectionQmaxProfileZVsRow ->Add(entry->fhQmaxProfileZVsRow ); |
272 | collectionQtotProfileZVsRow ->Add(entry->fhQtotProfileZVsRow ); | |
273 | collectionSigmaYProfileZVsRow->Add(entry->fhSigmaYProfileZVsRow); | |
274 | collectionSigmaZProfileZVsRow->Add(entry->fhSigmaZProfileZVsRow); | |
275 | ||
276 | collectionQtotVsTime->Add(entry->fhQtotVsTime); | |
277 | collectionQmaxVsTime->Add(entry->fhQmaxVsTime); | |
278 | ||
279 | ||
2d9e89d4 | 280 | count++; |
281 | } | |
282 | ||
283 | fhQmaxVsRow ->Merge(collectionQmaxVsRow ); | |
284 | fhQtotVsRow ->Merge(collectionQtotVsRow ); | |
285 | fhSigmaYVsRow ->Merge(collectionSigmaYVsRow ); | |
286 | fhSigmaZVsRow ->Merge(collectionSigmaZVsRow ); | |
287 | ||
288 | fhQmaxProfileYVsRow ->Merge(collectionQmaxProfileYVsRow ); | |
289 | fhQtotProfileYVsRow ->Merge(collectionQtotProfileYVsRow ); | |
290 | fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow); | |
291 | fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow); | |
292 | ||
483b1eb8 | 293 | fhQmaxProfileZVsRow ->Merge(collectionQmaxProfileZVsRow ); |
294 | fhQtotProfileZVsRow ->Merge(collectionQtotProfileZVsRow ); | |
295 | fhSigmaYProfileZVsRow->Merge(collectionSigmaYProfileZVsRow); | |
296 | fhSigmaZProfileZVsRow->Merge(collectionSigmaZProfileZVsRow); | |
297 | ||
298 | fhQtotVsTime->Merge(collectionQtotVsTime); | |
299 | fhQmaxVsTime->Merge(collectionQmaxVsTime); | |
300 | ||
2d9e89d4 | 301 | delete collectionQmaxVsRow; |
302 | delete collectionQtotVsRow; | |
303 | delete collectionSigmaYVsRow; | |
304 | delete collectionSigmaZVsRow; | |
305 | ||
306 | delete collectionQmaxProfileYVsRow; | |
307 | delete collectionQtotProfileYVsRow; | |
308 | delete collectionSigmaYProfileYVsRow; | |
309 | delete collectionSigmaZProfileYVsRow; | |
310 | ||
483b1eb8 | 311 | delete collectionQmaxProfileZVsRow; |
312 | delete collectionQtotProfileZVsRow; | |
313 | delete collectionSigmaYProfileZVsRow; | |
314 | delete collectionSigmaZProfileZVsRow; | |
315 | ||
316 | delete collectionQtotVsTime; | |
317 | delete collectionQmaxVsTime; | |
318 | ||
2d9e89d4 | 319 | return count+1; |
320 | } | |
321 | ||
322 | //____________________________________________________________________ | |
483b1eb8 | 323 | void AliTPCClusterHistograms::FillCluster(AliTPCclusterMI* cluster, Int_t time) { |
2d9e89d4 | 324 | // |
c50f9dc0 | 325 | // Fills the different histograms with the information from the cluster. |
2d9e89d4 | 326 | // |
327 | ||
328 | Int_t padRow = cluster->GetRow(); | |
329 | Float_t qMax = cluster->GetMax(); | |
330 | Float_t qTot = cluster->GetQ(); | |
331 | Float_t sigmaY = cluster->GetSigmaY2(); | |
332 | Float_t sigmaZ = cluster->GetSigmaZ2(); | |
333 | Float_t y = cluster->GetY(); | |
483b1eb8 | 334 | Float_t z = cluster->GetZ(); |
2d9e89d4 | 335 | |
336 | fhQmaxVsRow ->Fill(padRow, qMax); | |
337 | fhQtotVsRow ->Fill(padRow, qTot); | |
338 | ||
339 | fhSigmaYVsRow ->Fill(padRow, sigmaY); | |
340 | fhSigmaZVsRow ->Fill(padRow, sigmaZ); | |
341 | ||
342 | fhQmaxProfileYVsRow ->Fill(padRow, y, qMax); | |
343 | fhQtotProfileYVsRow ->Fill(padRow, y, qTot); | |
344 | fhSigmaYProfileYVsRow ->Fill(padRow, y, sigmaY); | |
345 | fhSigmaZProfileYVsRow ->Fill(padRow, y, sigmaZ); | |
483b1eb8 | 346 | |
347 | fhQmaxProfileZVsRow ->Fill(padRow, z, qMax); | |
348 | fhQtotProfileZVsRow ->Fill(padRow, z, qTot); | |
349 | fhSigmaYProfileZVsRow ->Fill(padRow, z, sigmaY); | |
350 | fhSigmaZProfileZVsRow ->Fill(padRow, z, sigmaZ); | |
351 | ||
352 | if (time>0 & fTimeStart>0 & fTimeStop>0 & time>fTimeStart) { | |
353 | //Float_t timeFraction = (time - fTimeStart)/(fTimeStop-fTimeStart); | |
354 | ||
355 | fhQtotVsTime->Fill(time,qTot); | |
356 | fhQmaxVsTime->Fill(time,qMax); | |
357 | } | |
358 | ||
2d9e89d4 | 359 | } |
360 | ||
361 | ||
362 | //____________________________________________________________________ | |
363 | void AliTPCClusterHistograms::SaveHistograms() | |
364 | { | |
365 | // | |
366 | // saves the histograms | |
367 | // | |
368 | ||
369 | gDirectory->mkdir(fName.Data()); | |
370 | gDirectory->cd(fName.Data()); | |
371 | ||
372 | fhQmaxVsRow ->Write(); | |
373 | fhQtotVsRow ->Write(); | |
374 | ||
375 | fhSigmaYVsRow ->Write(); | |
376 | fhSigmaZVsRow ->Write(); | |
377 | ||
378 | fhQmaxProfileYVsRow ->Write(); | |
379 | fhQtotProfileYVsRow ->Write(); | |
380 | fhSigmaYProfileYVsRow ->Write(); | |
381 | fhSigmaZProfileYVsRow ->Write(); | |
382 | ||
483b1eb8 | 383 | fhQmaxProfileZVsRow ->Write(); |
384 | fhQtotProfileZVsRow ->Write(); | |
385 | fhSigmaYProfileZVsRow ->Write(); | |
386 | fhSigmaZProfileZVsRow ->Write(); | |
387 | ||
388 | if (fhQtotVsTime->GetEntries()>0) | |
389 | fhQtotVsTime->Write(); | |
390 | ||
391 | if (fhQmaxVsTime->GetEntries()>0) | |
392 | fhQmaxVsTime->Write(); | |
393 | ||
2d9e89d4 | 394 | gDirectory->cd("../"); |
395 | ||
396 | } | |
397 | ||
483b1eb8 | 398 | //____________________________________________________________________ |
399 | TCanvas* AliTPCClusterHistograms::DrawHistograms(const Char_t* opt) { | |
c50f9dc0 | 400 | // |
401 | // Draws some histograms and save the canvas as eps and gif file. | |
402 | // | |
483b1eb8 | 403 | |
404 | TCanvas* c = new TCanvas(Form("plots_%s",fName.Data()), fName.Data(), 1200, 1000); | |
405 | ||
406 | gStyle->SetOptStat(0); | |
407 | gStyle->SetOptFit(0); | |
408 | ||
409 | gStyle->SetPadLeftMargin(0.05); | |
410 | ||
411 | c->Divide(3,3); | |
412 | ||
413 | c->Draw(); | |
414 | ||
415 | c->cd(1); | |
416 | ||
417 | // this is not really a nice way to do it... | |
418 | c->GetPad(1)->Delete(); | |
419 | ||
420 | TLatex* name = new TLatex(0.1,0.8,fName.Data()); | |
421 | name->SetTextSize(0.02); | |
422 | name->DrawClone(); | |
423 | ||
424 | c->cd(2); | |
425 | fhQmaxVsRow->Draw("colz"); | |
426 | ||
427 | c->cd(3); | |
428 | fhQtotVsRow->Draw("colz"); | |
429 | ||
430 | c->cd(4); | |
431 | fhQmaxProfileYVsRow ->Draw("colz"); | |
432 | c->cd(5); | |
433 | fhQtotProfileYVsRow ->Draw("colz"); | |
434 | c->cd(6); | |
435 | fhQmaxProfileZVsRow ->Draw("colz"); | |
436 | c->cd(7); | |
437 | fhQtotProfileZVsRow ->Draw("colz"); | |
438 | c->cd(8); | |
439 | fhSigmaYVsRow ->Draw("colz"); | |
440 | ||
441 | c->cd(9); | |
442 | fhSigmaZVsRow ->Draw("colz"); | |
443 | ||
444 | //fhSigmaYProfileYVsRow ->Draw("colz"); | |
445 | //fhSigmaZProfileYVsRow ->Draw("colz"); | |
446 | ||
447 | //fhSigmaYProfileZVsRow ->Draw("colz"); | |
448 | //fhSigmaZProfileZVsRow ->Draw("colz"); | |
449 | return c; | |
450 | } |