]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/TPC/AliTPCClusterHistograms.cxx
Added classes to analyse TPC data from reconstructed clusters (not on tracks) and...
[u/mrichter/AliRoot.git] / PWG0 / TPC / AliTPCClusterHistograms.cxx
CommitLineData
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>
9ecad4f3 18#include <TObjArray.h>
483b1eb8 19#include <TLatex.h>
fe8871b7 20#include <TTimeStamp.h>
21#include <TRandom.h>
483b1eb8 22
899625a7 23#include <AliTPCclusterMI.h>
24#include <AliTPCseed.h>
25
2d9e89d4 26#include <AliLog.h>
27
2d9e89d4 28
29//____________________________________________________________________
30ClassImp(AliTPCClusterHistograms)
31
32//____________________________________________________________________
33AliTPCClusterHistograms::AliTPCClusterHistograms()
34 : TNamed(),
35 fhQmaxVsRow(0),
36 fhQtotVsRow(0),
9ecad4f3 37 fhQtotProfileVsRow(0),
38 fhQmaxProfileVsRow(0),
39 fhNClustersYVsRow(0),
40 fhNClustersZVsRow(0),
2d9e89d4 41 fhSigmaYVsRow(0),
42 fhSigmaZVsRow(0),
43 fhQmaxProfileYVsRow(0),
44 fhQtotProfileYVsRow(0),
45 fhSigmaYProfileYVsRow(0),
483b1eb8 46 fhSigmaZProfileYVsRow(0),
47 fhQmaxProfileZVsRow(0),
48 fhQtotProfileZVsRow(0),
49 fhSigmaYProfileZVsRow(0),
50 fhSigmaZProfileZVsRow(0),
fe8871b7 51 fhMeanQtotVsTime(0),
52 fhQtotVsTime(0),
53 fhMeanNClustersVsTime(0),
54 fhNClustersVsTime(0),
9ecad4f3 55 fhTrackQtotPerCluster(0),
fe8871b7 56 fhTrackQtotPerClusterVsPhi(0),
57 fhTrackQtotPerClusterVsTheta(0),
58 fhTrackMeanQtotPerClusterVsPhi(0),
59 fhTrackMeanQtotPerClusterVsTheta(0),
60 fhMeanNTracksVsTime(),
61 fhNEventsVsTime(),
1d7991a5 62 fIsIROC(kFALSE),
63 fEdgeSuppression(kFALSE)
2d9e89d4 64{
65 // default constructor
66}
67
68//____________________________________________________________________
1d7991a5 69AliTPCClusterHistograms::AliTPCClusterHistograms(Int_t detector, const Char_t* comment, Int_t timeStart, Int_t timeStop, Bool_t edgeSuppression)
483b1eb8 70 : TNamed(),
2d9e89d4 71 fhQmaxVsRow(0),
72 fhQtotVsRow(0),
9ecad4f3 73 fhQtotProfileVsRow(0),
74 fhQmaxProfileVsRow(0),
75 fhNClustersYVsRow(0),
76 fhNClustersZVsRow(0),
2d9e89d4 77 fhSigmaYVsRow(0),
78 fhSigmaZVsRow(0),
79 fhQmaxProfileYVsRow(0),
80 fhQtotProfileYVsRow(0),
81 fhSigmaYProfileYVsRow(0),
483b1eb8 82 fhSigmaZProfileYVsRow(0),
83 fhQmaxProfileZVsRow(0),
84 fhQtotProfileZVsRow(0),
85 fhSigmaYProfileZVsRow(0),
86 fhSigmaZProfileZVsRow(0),
fe8871b7 87 fhMeanQtotVsTime(0),
88 fhQtotVsTime(0),
89 fhMeanNClustersVsTime(0),
90 fhNClustersVsTime(0),
9ecad4f3 91 fhTrackQtotPerCluster(0),
fe8871b7 92 fhTrackQtotPerClusterVsPhi(0),
93 fhTrackQtotPerClusterVsTheta(0),
94 fhTrackMeanQtotPerClusterVsPhi(0),
95 fhTrackMeanQtotPerClusterVsTheta(0),
96 fhMeanNTracksVsTime(0),
97 fhNEventsVsTime(0),
1d7991a5 98 fIsIROC(kFALSE),
99 fEdgeSuppression(edgeSuppression)
2d9e89d4 100{
483b1eb8 101 // constructor
c50f9dc0 102
483b1eb8 103 // make name and title
483b1eb8 104 if (detector < 0 || detector >= 72) {
105 AliDebug(AliLog::kError, Form("Detector %d does not exist", detector));
106 return;
107 }
108
1d7991a5 109 TString name(FormDetectorName(detector, edgeSuppression, comment));
2d9e89d4 110
fe8871b7 111 fNClustersInEvent = 0;
112 fQtotInEvent = 0;
113 fMaxQtotInEvent = 0;
114
115 fKeepEvent = kFALSE;
116 fWhyKeepEvent = TString("hi");
117
9ecad4f3 118 fDetector = detector;
1d7991a5 119 if (detector < 36)
120 fIsIROC = kTRUE;
483b1eb8 121
122 SetName(name);
123 SetTitle(Form("%s (detector %d)",name.Data(), detector));
124
fe8871b7 125 // rounding down to the closest hour and starting 10 hours before
126 fTimeStart = 3600*UInt_t(timeStart/3600) - 36000;
127 // rounding up to the closest hour
128 fTimeStop = 3600*UInt_t((3600 + timeStop)/3600);
9ecad4f3 129 // each time bin covers 5 min
130 Int_t nTimeBins = (fTimeStop-fTimeStart)/300;
483b1eb8 131
9ecad4f3 132 // printf(Form(" start time: %d, stop time: %d \n",fTimeStart, fTimeStop));
133
483b1eb8 134 #define BINNING_Z 250, 0, 250
135
136 Float_t yRange = 45;
137 Int_t nPadRows = 96;
138
1d7991a5 139 if (fIsIROC)
140 {
9ecad4f3 141 yRange = 25;
483b1eb8 142 nPadRows = 63;
143 }
144
145 // 1 bin for each 0.5 cm
146 Int_t nBinsY = Int_t(4*yRange);
9cc7192c 147
1d7991a5 148 // do not add this hists to the directory
149 Bool_t oldStatus = TH1::AddDirectoryStatus();
150 TH1::AddDirectory(kFALSE);
151
c50f9dc0 152 //defining histograms and profile plots
0b3ccaa2 153 fhQmaxVsRow = new TH2F("QmaxVsPadRow", "Qmax vs. pad row;Pad row;Qmax", nPadRows+2, -1.5, nPadRows+0.5, 500, 0, 500);
483b1eb8 154 fhQtotVsRow = new TH2F("QtotVsPadRow", "Qtot vs. pad row;Pad row;Qtot", nPadRows+2, -1.5, nPadRows+0.5, 400, 0, 4000);
9ecad4f3 155
156 fhQmaxProfileVsRow = new TProfile("MeanQmaxVsPadRow","Mean Qmax vs. pad row;Pad row;Mean Qmax",nPadRows+2, -1.5, nPadRows+0.5);
157 fhQtotProfileVsRow = new TProfile("MeanQtotVsPadRow","Mean Qtot vs. pad row;Pad row;Mean Qtot",nPadRows+2, -1.5, nPadRows+0.5);
2d9e89d4 158
9ecad4f3 159 fhNClustersYVsRow = new TH2F("NClusters y vs pad row","N clusters y vs pad;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
160 fhNClustersZVsRow = new TH2F("NClusters z vs pad row","N clusters z vs pad;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
161
483b1eb8 162 fhSigmaYVsRow = new TH2F("SigmaYVsPadRow", "Sigma Y vs. pad row;Pad row;#sigma_{Y}", nPadRows+2, -1.5, nPadRows+0.5, 100, 0, 0.5);
163 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 164
483b1eb8 165 fhQmaxProfileYVsRow = new TProfile2D("MeanQmaxYVsPadRow","Mean Qmax, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
166 fhQtotProfileYVsRow = new TProfile2D("MeanQtotYVsPadRow","Mean Qtot, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
0b3ccaa2 167 fhSigmaYProfileYVsRow = new TProfile2D("MeanSigmaYYVsPadRow","Mean Sigma y, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
168 fhSigmaZProfileYVsRow = new TProfile2D("MeanSigmaZYVsPadRow","Mean Sigma z, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
2d9e89d4 169
483b1eb8 170 fhQmaxProfileZVsRow = new TProfile2D("MeanQmaxZVsPadRow","Mean Qmax, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
171 fhQtotProfileZVsRow = new TProfile2D("MeanQtotZVsPadRow","Mean Qtot, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
0b3ccaa2 172 fhSigmaYProfileZVsRow = new TProfile2D("MeanSigmaYZVsPadRow","Mean Sigma y, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
173 fhSigmaZProfileZVsRow = new TProfile2D("MeanSigmaZZVsPadRow","Mean Sigma z, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
fe8871b7 174
175
176 TString start(TTimeStamp(fTimeStart).AsString());
177 // TString stop(TTimeStamp(fTimeStart).AsString());
178 start.Remove(26);
483b1eb8 179
fe8871b7 180 fhMeanQtotVsTime = new TProfile("MeanQtotVsTime",Form("Mean Qtot vs. time (start %s , 1 min bins); time; Qtot",start.Data()),5*nTimeBins, fTimeStart, fTimeStop);
181 fhQtotVsTime = new TH2F("QtotVsTime",Form("Qtot vs. time (start %s , 1 min bins); time; Qtot",start.Data()),5*nTimeBins, fTimeStart, fTimeStop,400,0,2000);
182
183 fhMeanNClustersVsTime = new TProfile("MeanNClustersVsTime",Form("Mean N Cluster vs. time (start %s , 5 min bins); time; NClusters",start.Data()),nTimeBins, fTimeStart, fTimeStop);
184 fhNClustersVsTime = new TH2F("NClustersVsTime",Form("N Clusters vs. time (start %s , 5 min bins); time; NClusters",start.Data()),nTimeBins, fTimeStart, fTimeStop,400,-0.5,3999.5);
9ecad4f3 185
186 fhQmaxProfileVsRow->SetLineWidth(2);
187 fhQtotProfileVsRow->SetLineWidth(2);
188
fe8871b7 189 fhMeanQtotVsTime->SetLineWidth(2);
9ecad4f3 190
191 // histograms related to tracks
192
fe8871b7 193 fhTrackQtotPerCluster = new TH1F("QtotPerCluster","Qtot per cluster; (Sum Qtot)/clusters",200,0,2000);
9ecad4f3 194 fhTrackQtotPerCluster->SetMarkerStyle(22);
195 fhTrackQtotPerCluster->SetMarkerSize(1);
196
fe8871b7 197 fhTrackQtotPerClusterVsPhi = new TH2F("QtotPerClusterVsPhi","QtotPerCluster vs Phi; Phi; (Sum Qtot)/clusters",40,-2,2,200,0,2000);
198 fhTrackQtotPerClusterVsTheta = new TH2F("QtotPerClusterVsTheta","QtotPerCluster vs Theta; Theta; (Sum Qtot)/clusters",40,-2,2,200,0,2000);
199
200 fhTrackMeanQtotPerClusterVsPhi = new TProfile("MeanQtotPerClusterVsPhi", "QtotPerCluster vs Phi; Phi; Mean (Sum Qtot)/clusters",40,-2,2);
201 fhTrackMeanQtotPerClusterVsTheta = new TProfile("MeanQtotPerClusterVsTheta", "QtotPerCluster vs Theta; Theta; Mean (Sum Qtot)/clusters",40,-2,2);
202
203 fhTrackMeanQtotPerClusterVsPhi->SetLineWidth(2);
204 fhTrackMeanQtotPerClusterVsTheta->SetLineWidth(2);
9ecad4f3 205
fe8871b7 206 fhMeanNTracksVsTime = new TProfile("MeanNTracksVsTime",Form("Mean n tracks vs. time (start %s , 5 min bins); time; N tracks",start.Data()),nTimeBins, fTimeStart, fTimeStop);
9ecad4f3 207
fe8871b7 208 fhNEventsVsTime = new TH1F("NEventsVsTime",Form("N events vs. time (start %s , 5 min bins); time; N events",start.Data()),nTimeBins, fTimeStart, fTimeStop);
9ecad4f3 209
1d7991a5 210 TH1::AddDirectory(oldStatus);
2d9e89d4 211}
212
213//____________________________________________________________________
214AliTPCClusterHistograms::AliTPCClusterHistograms(const AliTPCClusterHistograms& c) : TNamed(c)
215{
216 // copy constructor
217 ((AliTPCClusterHistograms &)c).Copy(*this);
218}
219
220//____________________________________________________________________
221AliTPCClusterHistograms::~AliTPCClusterHistograms()
222{
223 //
224 // destructor
225 //
226
227 if (fhQmaxVsRow) {
228 delete fhQmaxVsRow;
229 fhQmaxVsRow = 0;
230 }
231 if (fhQtotVsRow) {
232 delete fhQtotVsRow;
233 fhQtotVsRow = 0;
234 }
9ecad4f3 235 if (fhQmaxProfileVsRow) {
236 delete fhQmaxProfileVsRow;
237 fhQmaxProfileVsRow = 0;
238 }
239 if (fhQtotProfileVsRow) {
240 delete fhQtotProfileVsRow;
241 fhQtotProfileVsRow = 0;
242 }
243 if (fhNClustersYVsRow) {
244 delete fhNClustersYVsRow;
245 fhNClustersYVsRow = 0;
246 }
247 if (fhNClustersZVsRow) {
248 delete fhNClustersZVsRow;
249 fhNClustersZVsRow = 0;
250 }
2d9e89d4 251 if (fhSigmaYVsRow) {
252 delete fhSigmaYVsRow;
253 fhSigmaYVsRow = 0;
254 }
255 if (fhSigmaZVsRow) {
256 delete fhSigmaZVsRow;
257 fhSigmaZVsRow = 0;
258 }
259 if (fhQmaxProfileYVsRow) {
260 delete fhQmaxProfileYVsRow;
261 fhQmaxProfileYVsRow = 0;
262 }
263 if (fhQtotProfileYVsRow) {
264 delete fhQtotProfileYVsRow;
265 fhQtotProfileYVsRow = 0;
266 }
267 if (fhSigmaYProfileYVsRow) {
268 delete fhSigmaYProfileYVsRow;
269 fhSigmaYProfileYVsRow = 0;
270 }
271 if (fhSigmaZProfileYVsRow) {
272 delete fhSigmaZProfileYVsRow;
273 fhSigmaZProfileYVsRow = 0;
274 }
483b1eb8 275 if (fhQmaxProfileZVsRow) {
276 delete fhQmaxProfileZVsRow;
277 fhQmaxProfileZVsRow = 0;
278 }
279 if (fhQtotProfileZVsRow) {
280 delete fhQtotProfileZVsRow;
281 fhQtotProfileZVsRow = 0;
282 }
283 if (fhSigmaYProfileZVsRow) {
284 delete fhSigmaYProfileZVsRow;
285 fhSigmaYProfileZVsRow = 0;
286 }
287 if (fhSigmaZProfileZVsRow) {
288 delete fhSigmaZProfileZVsRow;
289 fhSigmaZProfileZVsRow = 0;
290 }
fe8871b7 291 if (fhMeanQtotVsTime) {
292 delete fhMeanQtotVsTime;
293 fhMeanQtotVsTime = 0;
294 }
483b1eb8 295 if (fhQtotVsTime) {
296 delete fhQtotVsTime;
297 fhQtotVsTime = 0;
298 }
fe8871b7 299 if (fhMeanNClustersVsTime) {
300 delete fhMeanNClustersVsTime;
301 fhMeanNClustersVsTime = 0;
302 }
303 if (fhNClustersVsTime) {
304 delete fhNClustersVsTime;
305 fhNClustersVsTime = 0;
483b1eb8 306 }
9ecad4f3 307 if (fhTrackQtotPerCluster) {
308 delete fhTrackQtotPerCluster;
309 fhTrackQtotPerCluster = 0;
310 }
fe8871b7 311 if (fhTrackQtotPerClusterVsPhi) {
312 delete fhTrackQtotPerClusterVsPhi;
313 fhTrackQtotPerClusterVsPhi = 0;
9ecad4f3 314 }
fe8871b7 315 if (fhTrackQtotPerClusterVsTheta) {
316 delete fhTrackQtotPerClusterVsTheta;
317 fhTrackQtotPerClusterVsTheta = 0;
9ecad4f3 318 }
fe8871b7 319 if (fhTrackMeanQtotPerClusterVsPhi) {
320 delete fhTrackMeanQtotPerClusterVsPhi;
321 fhTrackMeanQtotPerClusterVsPhi = 0;
9ecad4f3 322 }
fe8871b7 323 if (fhTrackMeanQtotPerClusterVsTheta) {
324 delete fhTrackMeanQtotPerClusterVsTheta;
325 fhTrackMeanQtotPerClusterVsTheta = 0;
9ecad4f3 326 }
fe8871b7 327 if (fhMeanNTracksVsTime) {
328 delete fhMeanNTracksVsTime;
329 fhMeanNTracksVsTime = 0;
330 }
331 if (fhNEventsVsTime) {
332 delete fhNEventsVsTime;
333 fhNEventsVsTime = 0;
334 }
2d9e89d4 335}
336
337//____________________________________________________________________
338AliTPCClusterHistograms &AliTPCClusterHistograms::operator=(const AliTPCClusterHistograms &c)
339{
340 // assigment operator
341
342 if (this != &c)
343 ((AliTPCClusterHistograms &) c).Copy(*this);
344
345 return *this;
346}
347
1d7991a5 348//____________________________________________________________________
349const char* AliTPCClusterHistograms::FormDetectorName(Int_t detector, Bool_t edgeSuppression, const char* comment)
350{
351 //
352 // creates a readable name from the detector number
353 //
354
355 Int_t sector = detector%18;
356 TString side;
357 TString inout;
358
359 if (detector<18 || ( detector>=36 && detector<54))
360 side.Form("A");
361 else
9ecad4f3 362 side.Form("C");
1d7991a5 363
364 if (detector<36)
365 inout.Form("IROC");
366 else
367 inout.Form("OROC");
368
369 TString name;
370 name.Form("sector_%s%d_%s", side.Data(), sector, inout.Data());
371
372 if (edgeSuppression)
373 name += "_noedge";
374
375 if (comment)
376 name += comment;
377
378 return name;
379}
2d9e89d4 380
381//____________________________________________________________________
382Long64_t AliTPCClusterHistograms::Merge(TCollection* list)
383{
384 // Merge a list of AliTPCClusterHistograms objects with this (needed for
385 // PROOF).
386 // Returns the number of merged objects (including this).
387
388 if (!list)
389 return 0;
390
391 if (list->IsEmpty())
392 return 1;
393
394 TIterator* iter = list->MakeIterator();
395 TObject* obj;
396
397 // collections of measured and generated histograms
398 TList* collectionQmaxVsRow = new TList;
399 TList* collectionQtotVsRow = new TList;
9ecad4f3 400
401 TList* collectionQmaxProfileVsRow = new TList;
402 TList* collectionQtotProfileVsRow = new TList;
403
404 TList* collectionNClustersYVsRow = new TList;
405 TList* collectionNClustersZVsRow = new TList;
406
2d9e89d4 407 TList* collectionSigmaYVsRow = new TList;
408 TList* collectionSigmaZVsRow = new TList;
409
410 TList* collectionQmaxProfileYVsRow = new TList;
411 TList* collectionQtotProfileYVsRow = new TList;
412 TList* collectionSigmaYProfileYVsRow = new TList;
413 TList* collectionSigmaZProfileYVsRow = new TList;
414
483b1eb8 415 TList* collectionQmaxProfileZVsRow = new TList;
416 TList* collectionQtotProfileZVsRow = new TList;
417 TList* collectionSigmaYProfileZVsRow = new TList;
418 TList* collectionSigmaZProfileZVsRow = new TList;
419
fe8871b7 420 TList* collectionMeanQtotVsTime = new TList;
421 TList* collectionQtotVsTime = new TList;
422
423 TList* collectionMeanNClustersVsTime = new TList;
424 TList* collectionNClustersVsTime = new TList;
483b1eb8 425
9ecad4f3 426 TList* collectionTrackQtotPerCluster = new TList;
427
fe8871b7 428 TList* collectionTrackQtotPerClusterVsPhi = new TList;
429 TList* collectionTrackQtotPerClusterVsTheta = new TList;
9ecad4f3 430
fe8871b7 431 TList* collectionTrackMeanQtotPerClusterVsPhi = new TList;
432 TList* collectionTrackMeanQtotPerClusterVsTheta = new TList;
9ecad4f3 433
fe8871b7 434 TList* collectionMeanNTracksVsTime = new TList;
435 TList* collectionNEventsVsTime = new TList;
9ecad4f3 436
fe8871b7 437 Int_t count = 0;
438 while ((obj = iter->Next())) {
2d9e89d4 439
fe8871b7 440 AliTPCClusterHistograms* entry = dynamic_cast<AliTPCClusterHistograms*> (obj);
441 if (entry == 0)
442 continue;
443
444 collectionQmaxVsRow ->Add(entry->fhQmaxVsRow );
445 collectionQtotVsRow ->Add(entry->fhQtotVsRow );
446
447 collectionQmaxProfileVsRow ->Add(entry->fhQmaxProfileVsRow );
448 collectionQtotProfileVsRow ->Add(entry->fhQtotProfileVsRow );
449
450 collectionNClustersYVsRow ->Add(entry->fhNClustersYVsRow);
451 collectionNClustersZVsRow ->Add(entry->fhNClustersZVsRow);
452
453 collectionSigmaYVsRow ->Add(entry->fhSigmaYVsRow );
454 collectionSigmaZVsRow ->Add(entry->fhSigmaZVsRow );
455
456 collectionQmaxProfileYVsRow ->Add(entry->fhQmaxProfileYVsRow );
457 collectionQtotProfileYVsRow ->Add(entry->fhQtotProfileYVsRow );
458 collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow);
459 collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow);
460
461 collectionQmaxProfileZVsRow ->Add(entry->fhQmaxProfileZVsRow );
462 collectionQtotProfileZVsRow ->Add(entry->fhQtotProfileZVsRow );
463 collectionSigmaYProfileZVsRow->Add(entry->fhSigmaYProfileZVsRow);
464 collectionSigmaZProfileZVsRow->Add(entry->fhSigmaZProfileZVsRow);
465
466 collectionMeanQtotVsTime ->Add(entry->fhMeanQtotVsTime);
467 collectionQtotVsTime ->Add(entry->fhQtotVsTime);
483b1eb8 468
fe8871b7 469 collectionMeanNClustersVsTime->Add(entry->fhMeanNClustersVsTime);
470 collectionNClustersVsTime ->Add(entry->fhNClustersVsTime);
471
472 collectionTrackQtotPerCluster->Add(entry->fhTrackQtotPerCluster);
473
474 collectionTrackQtotPerClusterVsPhi->Add(entry->fhTrackQtotPerClusterVsPhi);
475 collectionTrackQtotPerClusterVsTheta->Add(entry->fhTrackQtotPerClusterVsTheta);
476
477 collectionTrackMeanQtotPerClusterVsPhi->Add(entry->fhTrackMeanQtotPerClusterVsPhi);
478 collectionTrackMeanQtotPerClusterVsTheta->Add(entry->fhTrackMeanQtotPerClusterVsTheta);
479
480 collectionMeanNTracksVsTime->Add(entry->fhMeanNTracksVsTime);
481 collectionNEventsVsTime->Add(entry->fhNEventsVsTime);
482
483 count++;
484 }
485
486 fhQmaxVsRow ->Merge(collectionQmaxVsRow );
487 fhQtotVsRow ->Merge(collectionQtotVsRow );
488
489 fhQmaxProfileVsRow ->Merge(collectionQtotProfileVsRow);
490 fhQtotProfileVsRow ->Merge(collectionQtotProfileVsRow);
491
492 fhNClustersYVsRow ->Merge(collectionNClustersYVsRow);
493 fhNClustersZVsRow ->Merge(collectionNClustersZVsRow);
494
495 fhSigmaYVsRow ->Merge(collectionSigmaYVsRow );
496 fhSigmaZVsRow ->Merge(collectionSigmaZVsRow );
497
498 fhQmaxProfileYVsRow ->Merge(collectionQmaxProfileYVsRow );
499 fhQtotProfileYVsRow ->Merge(collectionQtotProfileYVsRow );
500 fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow);
501 fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow);
502
503 fhQmaxProfileZVsRow ->Merge(collectionQmaxProfileZVsRow );
504 fhQtotProfileZVsRow ->Merge(collectionQtotProfileZVsRow );
505 fhSigmaYProfileZVsRow->Merge(collectionSigmaYProfileZVsRow);
506 fhSigmaZProfileZVsRow->Merge(collectionSigmaZProfileZVsRow);
507
508 fhMeanQtotVsTime ->Merge(collectionMeanQtotVsTime);
509 fhQtotVsTime ->Merge(collectionQtotVsTime);
9ecad4f3 510
fe8871b7 511 fhMeanNClustersVsTime->Merge(collectionMeanNClustersVsTime );
512 fhNClustersVsTime ->Merge(collectionNClustersVsTime);
513
514 fhTrackQtotPerCluster->Merge(collectionTrackQtotPerCluster);
515
516 fhTrackQtotPerClusterVsPhi->Merge(collectionTrackQtotPerClusterVsPhi);
517 fhTrackQtotPerClusterVsTheta->Merge(collectionTrackQtotPerClusterVsTheta);
518
519 fhTrackMeanQtotPerClusterVsPhi->Merge(collectionTrackMeanQtotPerClusterVsPhi);
520 fhTrackMeanQtotPerClusterVsTheta->Merge(collectionTrackMeanQtotPerClusterVsTheta);
521
522 fhMeanNTracksVsTime->Merge(collectionMeanNTracksVsTime);
523 fhNEventsVsTime->Merge(collectionNEventsVsTime);
524
525 delete collectionQmaxVsRow;
526 delete collectionQtotVsRow;
527
528 delete collectionQmaxProfileVsRow;
529 delete collectionQtotProfileVsRow;
530
531 delete collectionNClustersYVsRow;
532 delete collectionNClustersZVsRow;
533
534 delete collectionSigmaYVsRow;
535 delete collectionSigmaZVsRow;
536
537 delete collectionQmaxProfileYVsRow;
538 delete collectionQtotProfileYVsRow;
539 delete collectionSigmaYProfileYVsRow;
540 delete collectionSigmaZProfileYVsRow;
541
542 delete collectionQmaxProfileZVsRow;
543 delete collectionQtotProfileZVsRow;
544 delete collectionSigmaYProfileZVsRow;
545 delete collectionSigmaZProfileZVsRow;
546
547 delete collectionMeanQtotVsTime;
548 delete collectionQtotVsTime;
9ecad4f3 549
fe8871b7 550 delete collectionMeanNClustersVsTime;
551 delete collectionNClustersVsTime;
552
553 delete collectionTrackQtotPerCluster;
554
555 delete collectionTrackQtotPerClusterVsPhi;
556 delete collectionTrackQtotPerClusterVsTheta;
557
558 delete collectionTrackMeanQtotPerClusterVsPhi;
559 delete collectionTrackMeanQtotPerClusterVsTheta;
560
561 delete collectionMeanNTracksVsTime;
562 delete collectionNEventsVsTime;
9ecad4f3 563
2d9e89d4 564 return count+1;
565}
566
9ecad4f3 567
2d9e89d4 568//____________________________________________________________________
483b1eb8 569void AliTPCClusterHistograms::FillCluster(AliTPCclusterMI* cluster, Int_t time) {
2d9e89d4 570 //
c50f9dc0 571 // Fills the different histograms with the information from the cluster.
2d9e89d4 572 //
573
574 Int_t padRow = cluster->GetRow();
575 Float_t qMax = cluster->GetMax();
576 Float_t qTot = cluster->GetQ();
577 Float_t sigmaY = cluster->GetSigmaY2();
578 Float_t sigmaZ = cluster->GetSigmaZ2();
579 Float_t y = cluster->GetY();
483b1eb8 580 Float_t z = cluster->GetZ();
0b3ccaa2 581
9ecad4f3 582 // check if this is ok!!!
583 z = TMath::Abs(z);
584
0b3ccaa2 585 if (qMax<=0) {
586 printf(Form("\n WARNING: Hi Marian! How can we have Qmax = %f ??? \n \n", qMax));
0b3ccaa2 587 }
588 if (qTot<=0) {
589 printf(Form("\n WARNING: Hi Marian! How can we have Qtot = %f ??? \n \n ", qTot));
fe8871b7 590 }
9ecad4f3 591
592 // check if the cluster is accepted
1d7991a5 593 if (fEdgeSuppression)
9ecad4f3 594 if (IsClusterOnEdge(cluster))
595 return;
2d9e89d4 596
fe8871b7 597 fNClustersInEvent++;
598 fQtotInEvent = fQtotInEvent + qTot;
599 if (qTot > fMaxQtotInEvent)
600 fMaxQtotInEvent = qTot;
601
2d9e89d4 602 fhQmaxVsRow ->Fill(padRow, qMax);
603 fhQtotVsRow ->Fill(padRow, qTot);
9ecad4f3 604
605 fhQmaxProfileVsRow ->Fill(padRow, qMax);
606 fhQtotProfileVsRow ->Fill(padRow, qTot);
607
608 fhNClustersYVsRow ->Fill(padRow, y, 1);
609 fhNClustersZVsRow ->Fill(padRow, z, 1);
2d9e89d4 610
611 fhSigmaYVsRow ->Fill(padRow, sigmaY);
612 fhSigmaZVsRow ->Fill(padRow, sigmaZ);
613
614 fhQmaxProfileYVsRow ->Fill(padRow, y, qMax);
615 fhQtotProfileYVsRow ->Fill(padRow, y, qTot);
616 fhSigmaYProfileYVsRow ->Fill(padRow, y, sigmaY);
617 fhSigmaZProfileYVsRow ->Fill(padRow, y, sigmaZ);
483b1eb8 618
619 fhQmaxProfileZVsRow ->Fill(padRow, z, qMax);
620 fhQtotProfileZVsRow ->Fill(padRow, z, qTot);
621 fhSigmaYProfileZVsRow ->Fill(padRow, z, sigmaY);
622 fhSigmaZProfileZVsRow ->Fill(padRow, z, sigmaZ);
623
624 if (time>0 & fTimeStart>0 & fTimeStop>0 & time>fTimeStart) {
625 //Float_t timeFraction = (time - fTimeStart)/(fTimeStop-fTimeStart);
626
fe8871b7 627 fhMeanQtotVsTime->Fill(time,qTot);
483b1eb8 628 fhQtotVsTime->Fill(time,qTot);
483b1eb8 629 }
9ecad4f3 630}
631
632//____________________________________________________________________
633void AliTPCClusterHistograms::FillTrack(const AliTPCseed* seed) {
634 //
635 // fill histograms related to tracks
636 //
637
638 Float_t totalQtot = 0;
639 Int_t nClusters = 0;
640 for (Int_t clusterID = 0; clusterID < 160; clusterID++) {
641 AliTPCclusterMI* cluster = seed->GetClusterPointer(clusterID);
642 if (!cluster)
643 continue;
644
645 // only use clusters within this detector
646 if (cluster->GetDetector()!=fDetector)
647 continue;
648
649 // check if the cluster is accepted
650 if (fEdgeSuppression)
651 if (IsClusterOnEdge(cluster))
652 return;
483b1eb8 653
9ecad4f3 654 Int_t padRow = cluster->GetRow();
655 Float_t qMax = cluster->GetMax();
656 Float_t qTot = cluster->GetQ();
657
658 nClusters++;
659 totalQtot += qTot;
660
661 }
662 if (nClusters==0)
663 return;
664
665 Float_t meanQtot = totalQtot/nClusters;
666
fe8871b7 667 // azimuthal angle
668 Float_t phi = TMath::ASin(seed->GetSnp() + seed->GetAlpha());
669 // angle with respect to the central membrane
670 Float_t theta = TMath::ATan(seed->GetTgl());
9ecad4f3 671
672 fhTrackQtotPerCluster->Fill(meanQtot);
673
fe8871b7 674 fhTrackMeanQtotPerClusterVsPhi->Fill(phi, meanQtot);
675 fhTrackMeanQtotPerClusterVsTheta->Fill(theta, meanQtot);
676
677 fhTrackQtotPerClusterVsPhi->Fill(phi, meanQtot);
678 fhTrackQtotPerClusterVsTheta->Fill(theta, meanQtot);
679}
680
681//____________________________________________________________________
682void AliTPCClusterHistograms::FillEvent(Int_t time, Int_t nTracks) {
683 //
684 // fill event
685 //
9ecad4f3 686
fe8871b7 687 fhMeanNTracksVsTime->Fill(time, nTracks);
9ecad4f3 688
fe8871b7 689 // fhNEventsVsTime->Fill(time);
9ecad4f3 690}
691
fe8871b7 692
9ecad4f3 693//____________________________________________________________________
694Bool_t AliTPCClusterHistograms::IsClusterOnEdge(AliTPCclusterMI* clusterMI) {
695 //
696 // check if the cluster is on the edge
697 //
698
699 Int_t padRow = clusterMI->GetRow();
700 Float_t y = clusterMI->GetY();
701
702 Float_t limit = 0;
703 if (fIsIROC)
704 {
705 limit = 12 + padRow * (20.0 - 12.0) / 63;
706 }
707 else
708 limit = 16 + padRow * (36.0 - 16.0) / 96;
709
710 if (TMath::Abs(y) > limit)
711 return kTRUE;
712
713 return kFALSE;
2d9e89d4 714}
715
fe8871b7 716//____________________________________________________________________
717Float_t AliTPCClusterHistograms::DistanceToEdge(AliTPCclusterMI* clusterMI) {
718 //
719 // get the y-distance to closest edge
720 //
721
722 Int_t detector = clusterMI->GetDetector();
723 Int_t padRow = clusterMI->GetRow();
724 Float_t y = clusterMI->GetY();
725
726 Float_t yEdge = -9999;
727 Float_t d = 0;
728
729 // IROC
730 if (detector < 36) {
731 yEdge = 14 + padRow * 0.1333;
732
733 }
734 else { // OROC
735 if (padRow<64) // small pads
736 yEdge = 22.5 + padRow * 0.1746;
737 else // large pads
738 yEdge = 34.0 + (padRow-64) * 0.2581;
739 }
740 if (y<=0) yEdge = -yEdge;
741
742 d = yEdge - y;
743
744 return d;
745}
746
747
748//____________________________________________________________________
749Bool_t AliTPCClusterHistograms::KeepThisEvent(TString& why) {
750 //
751 // is this event interesting?
752 //
753 // the criteria are ...
754 //
755
756 if (fKeepEvent) {
757 why = TString(fWhyKeepEvent);
758 return kTRUE;
759 }
760
761 if (fNClustersInEvent>20000) {
762 why.Append("_moreThan20000clusters");
763 fWhyKeepEvent = TString(why);
764 fKeepEvent = kTRUE;
765 return kTRUE;
766 }
767
768 if (fMaxQtotInEvent>10000) {
769 why.Append("_clusterWithQtot20000plus");
770 fWhyKeepEvent = TString(why);
771 fKeepEvent = kTRUE;
772 return kTRUE;
773 }
774
775 if (gRandom->Uniform()<0.001) {
776 why.Append("_random");
777 fWhyKeepEvent = TString(why);
778 fKeepEvent = kTRUE;
779 return kTRUE;
780 }
781
782 return kFALSE;
783}
784
785//____________________________________________________________________
786void AliTPCClusterHistograms::StartEvent() {
787 //
788 // reset counters
789 //
790
791 fNClustersInEvent = 0;
792 fQtotInEvent = 0;
793 fMaxQtotInEvent = 0;
794 fKeepEvent = kFALSE;
795 fWhyKeepEvent = TString("");
796
797}
798
799
800//____________________________________________________________________
801void AliTPCClusterHistograms::FinishEvent(Int_t timeStamp) {
802 //
803 // fill histograms related to the event
804 //
805
806 fhMeanNClustersVsTime->Fill(timeStamp, fNClustersInEvent);
807 fhNClustersVsTime ->Fill(timeStamp, fNClustersInEvent);
808
809 fhNEventsVsTime->Fill(timeStamp);
810
811}
2d9e89d4 812
9ecad4f3 813
2d9e89d4 814//____________________________________________________________________
815void AliTPCClusterHistograms::SaveHistograms()
816{
817 //
818 // saves the histograms
819 //
820
821 gDirectory->mkdir(fName.Data());
822 gDirectory->cd(fName.Data());
823
824 fhQmaxVsRow ->Write();
825 fhQtotVsRow ->Write();
9ecad4f3 826
827 fhQmaxProfileVsRow ->Write();
828 fhQtotProfileVsRow ->Write();
829
830 fhNClustersYVsRow ->Write();
831 fhNClustersZVsRow ->Write();
2d9e89d4 832
833 fhSigmaYVsRow ->Write();
834 fhSigmaZVsRow ->Write();
835
836 fhQmaxProfileYVsRow ->Write();
837 fhQtotProfileYVsRow ->Write();
838 fhSigmaYProfileYVsRow ->Write();
839 fhSigmaZProfileYVsRow ->Write();
840
483b1eb8 841 fhQmaxProfileZVsRow ->Write();
842 fhQtotProfileZVsRow ->Write();
843 fhSigmaYProfileZVsRow ->Write();
844 fhSigmaZProfileZVsRow ->Write();
845
fe8871b7 846 TNamed* comment = new TNamed("comment", fCommentToHistograms.Data());
847 comment->Write();
848
849 if (fhMeanQtotVsTime->GetEntries()>0)
850 fhMeanQtotVsTime->Write();
851
483b1eb8 852 if (fhQtotVsTime->GetEntries()>0)
853 fhQtotVsTime->Write();
854
fe8871b7 855 if (fhMeanNClustersVsTime->GetEntries()>0)
856 fhMeanNClustersVsTime->Write();
483b1eb8 857
fe8871b7 858 if (fhNClustersVsTime->GetEntries()>0)
859 fhNClustersVsTime->Write();
860
861 if (fhNEventsVsTime->GetEntries()>0)
862 fhNEventsVsTime->Write();
9ecad4f3 863
864 gDirectory->mkdir("track_hists");
865 gDirectory->cd("track_hists");
866
867 fhTrackQtotPerCluster->Write();
868
fe8871b7 869 fhTrackQtotPerClusterVsPhi->Write();
870 fhTrackQtotPerClusterVsTheta->Write();
871
872 fhTrackMeanQtotPerClusterVsPhi->Write();
873 fhTrackMeanQtotPerClusterVsTheta->Write();
9ecad4f3 874
fe8871b7 875 fhMeanNTracksVsTime->Write();
9ecad4f3 876
877 gDirectory->cd("../");
878
2d9e89d4 879 gDirectory->cd("../");
880
881}
882
fe8871b7 883
483b1eb8 884//____________________________________________________________________
1d7991a5 885TCanvas* AliTPCClusterHistograms::DrawHistograms(const Char_t* /*opt*/) {
c50f9dc0 886 //
887 // Draws some histograms and save the canvas as eps and gif file.
888 //
483b1eb8 889
1d7991a5 890 TCanvas* c = new TCanvas(fName.Data(), fName.Data(), 1200, 1000);
483b1eb8 891
892 gStyle->SetOptStat(0);
893 gStyle->SetOptFit(0);
894
6c3d6245 895 gStyle->SetPadLeftMargin(0.1);
483b1eb8 896
897 c->Divide(3,3);
898
899 c->Draw();
900
901 c->cd(1);
902
903 // this is not really a nice way to do it...
904 c->GetPad(1)->Delete();
905
9ecad4f3 906 TLatex* tName = new TLatex(0.05,0.9,fName.Data());
907 tName->SetTextSize(0.02);
908 tName->DrawClone();
909
910 TLatex* tEdge;
911 if (fEdgeSuppression)
912 tEdge = new TLatex(0.05,0.85,"(edges cut)");
913 else
914 tEdge = new TLatex(0.05,0.85,"(no edge cut)");
915
916 tEdge->SetTextSize(0.015);
917 tEdge->DrawClone();
fe8871b7 918
919
483b1eb8 920
921 c->cd(2);
fe8871b7 922 fhNClustersYVsRow->Draw("colz");
923
924 c->cd(3);
925 fhNClustersZVsRow->Draw("colz");
926
927 c->cd(4);
483b1eb8 928 fhQmaxVsRow->Draw("colz");
9ecad4f3 929 fhQmaxProfileVsRow->Draw("same");
483b1eb8 930
fe8871b7 931 c->cd(5);
9ecad4f3 932 fhQtotVsRow->Draw("colz");
933 fhQtotProfileVsRow->Draw("same");
483b1eb8 934
483b1eb8 935 c->cd(6);
fe8871b7 936 fhQtotProfileYVsRow ->Draw("colz");
9ecad4f3 937
483b1eb8 938 c->cd(7);
939 fhQtotProfileZVsRow ->Draw("colz");
9ecad4f3 940
483b1eb8 941 c->cd(8);
fe8871b7 942 fhQmaxProfileYVsRow ->Draw("colz");
483b1eb8 943
944 c->cd(9);
fe8871b7 945 fhQmaxProfileZVsRow ->Draw("colz");
483b1eb8 946
483b1eb8 947 return c;
948}