3 // This class contains a number of histograms for diagnostics of a TPC
4 // read out chamber from the reconstructed clusters.
11 #include "AliTPCClusterHistograms.h"
17 #include <TProfile2D.h>
20 #include <../TPC/AliTPCclusterMI.h>
24 //____________________________________________________________________
25 ClassImp(AliTPCClusterHistograms)
27 //____________________________________________________________________
28 AliTPCClusterHistograms::AliTPCClusterHistograms()
34 fhQmaxProfileYVsRow(0),
35 fhQtotProfileYVsRow(0),
36 fhSigmaYProfileYVsRow(0),
37 fhSigmaZProfileYVsRow(0),
38 fhQmaxProfileZVsRow(0),
39 fhQtotProfileZVsRow(0),
40 fhSigmaYProfileZVsRow(0),
41 fhSigmaZProfileZVsRow(0),
45 fEdgeSuppression(kFALSE)
47 // default constructor
50 //____________________________________________________________________
51 AliTPCClusterHistograms::AliTPCClusterHistograms(Int_t detector, const Char_t* comment, Int_t timeStart, Int_t timeStop, Bool_t edgeSuppression)
57 fhQmaxProfileYVsRow(0),
58 fhQtotProfileYVsRow(0),
59 fhSigmaYProfileYVsRow(0),
60 fhSigmaZProfileYVsRow(0),
61 fhQmaxProfileZVsRow(0),
62 fhQtotProfileZVsRow(0),
63 fhSigmaYProfileZVsRow(0),
64 fhSigmaZProfileZVsRow(0),
68 fEdgeSuppression(edgeSuppression)
72 // make name and title
73 if (detector < 0 || detector >= 72) {
74 AliDebug(AliLog::kError, Form("Detector %d does not exist", detector));
78 TString name(FormDetectorName(detector, edgeSuppression, comment));
84 SetTitle(Form("%s (detector %d)",name.Data(), detector));
86 fTimeStart = timeStart;
89 #define BINNING_Z 250, 0, 250
100 // 1 bin for each 0.5 cm
101 Int_t nBinsY = Int_t(4*yRange);
103 // do not add this hists to the directory
104 Bool_t oldStatus = TH1::AddDirectoryStatus();
105 TH1::AddDirectory(kFALSE);
107 //defining histograms and profile plots
108 fhQmaxVsRow = new TH2F("QmaxVsPadRow", "Qmax vs. pad row;Pad row;Qmax", nPadRows+2, -1.5, nPadRows+0.5, 500, 0, 500);
109 fhQtotVsRow = new TH2F("QtotVsPadRow", "Qtot vs. pad row;Pad row;Qtot", nPadRows+2, -1.5, nPadRows+0.5, 400, 0, 4000);
111 fhSigmaYVsRow = new TH2F("SigmaYVsPadRow", "Sigma Y vs. pad row;Pad row;#sigma_{Y}", nPadRows+2, -1.5, nPadRows+0.5, 100, 0, 0.5);
112 fhSigmaZVsRow = new TH2F("SigmaZVsPadRow", "Sigma Z vs. pad row;Pad row;#sigma_{Z}", nPadRows+2, -1.5, nPadRows+0.5, 100, 0, 0.5);
114 fhQmaxProfileYVsRow = new TProfile2D("MeanQmaxYVsPadRow","Mean Qmax, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
115 fhQtotProfileYVsRow = new TProfile2D("MeanQtotYVsPadRow","Mean Qtot, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
116 fhSigmaYProfileYVsRow = new TProfile2D("MeanSigmaYYVsPadRow","Mean Sigma y, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
117 fhSigmaZProfileYVsRow = new TProfile2D("MeanSigmaZYVsPadRow","Mean Sigma z, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
119 fhQmaxProfileZVsRow = new TProfile2D("MeanQmaxZVsPadRow","Mean Qmax, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
120 fhQtotProfileZVsRow = new TProfile2D("MeanQtotZVsPadRow","Mean Qtot, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
121 fhSigmaYProfileZVsRow = new TProfile2D("MeanSigmaYZVsPadRow","Mean Sigma y, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
122 fhSigmaZProfileZVsRow = new TProfile2D("MeanSigmaZZVsPadRow","Mean Sigma z, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
124 Int_t nTimeBins = 100;
126 fhQtotVsTime = new TProfile("MeanQtotVsTime", "Mean Qtot vs. event time stamp; time; Qtot",nTimeBins, fTimeStart, fTimeStop);
127 fhQmaxVsTime = new TProfile("MeanQmaxVsTime", "Mean Qmax vs. event time stamp; time; Qmax",nTimeBins, fTimeStart, fTimeStop);
129 TH1::AddDirectory(oldStatus);
132 //____________________________________________________________________
133 AliTPCClusterHistograms::AliTPCClusterHistograms(const AliTPCClusterHistograms& c) : TNamed(c)
136 ((AliTPCClusterHistograms &)c).Copy(*this);
139 //____________________________________________________________________
140 AliTPCClusterHistograms::~AliTPCClusterHistograms()
155 delete fhSigmaYVsRow;
159 delete fhSigmaZVsRow;
162 if (fhQmaxProfileYVsRow) {
163 delete fhQmaxProfileYVsRow;
164 fhQmaxProfileYVsRow = 0;
166 if (fhQtotProfileYVsRow) {
167 delete fhQtotProfileYVsRow;
168 fhQtotProfileYVsRow = 0;
170 if (fhSigmaYProfileYVsRow) {
171 delete fhSigmaYProfileYVsRow;
172 fhSigmaYProfileYVsRow = 0;
174 if (fhSigmaZProfileYVsRow) {
175 delete fhSigmaZProfileYVsRow;
176 fhSigmaZProfileYVsRow = 0;
178 if (fhQmaxProfileZVsRow) {
179 delete fhQmaxProfileZVsRow;
180 fhQmaxProfileZVsRow = 0;
182 if (fhQtotProfileZVsRow) {
183 delete fhQtotProfileZVsRow;
184 fhQtotProfileZVsRow = 0;
186 if (fhSigmaYProfileZVsRow) {
187 delete fhSigmaYProfileZVsRow;
188 fhSigmaYProfileZVsRow = 0;
190 if (fhSigmaZProfileZVsRow) {
191 delete fhSigmaZProfileZVsRow;
192 fhSigmaZProfileZVsRow = 0;
205 //____________________________________________________________________
206 AliTPCClusterHistograms &AliTPCClusterHistograms::operator=(const AliTPCClusterHistograms &c)
208 // assigment operator
211 ((AliTPCClusterHistograms &) c).Copy(*this);
216 //____________________________________________________________________
217 const char* AliTPCClusterHistograms::FormDetectorName(Int_t detector, Bool_t edgeSuppression, const char* comment)
220 // creates a readable name from the detector number
223 Int_t sector = detector%18;
227 if (detector<18 || ( detector>=36 && detector<54))
238 name.Form("sector_%s%d_%s", side.Data(), sector, inout.Data());
249 //____________________________________________________________________
250 Long64_t AliTPCClusterHistograms::Merge(TCollection* list)
252 // Merge a list of AliTPCClusterHistograms objects with this (needed for
254 // Returns the number of merged objects (including this).
262 TIterator* iter = list->MakeIterator();
265 // collections of measured and generated histograms
266 TList* collectionQmaxVsRow = new TList;
267 TList* collectionQtotVsRow = new TList;
268 TList* collectionSigmaYVsRow = new TList;
269 TList* collectionSigmaZVsRow = new TList;
271 TList* collectionQmaxProfileYVsRow = new TList;
272 TList* collectionQtotProfileYVsRow = new TList;
273 TList* collectionSigmaYProfileYVsRow = new TList;
274 TList* collectionSigmaZProfileYVsRow = new TList;
276 TList* collectionQmaxProfileZVsRow = new TList;
277 TList* collectionQtotProfileZVsRow = new TList;
278 TList* collectionSigmaYProfileZVsRow = new TList;
279 TList* collectionSigmaZProfileZVsRow = new TList;
281 TList* collectionQtotVsTime = new TList;
282 TList* collectionQmaxVsTime = new TList;
285 while ((obj = iter->Next())) {
287 AliTPCClusterHistograms* entry = dynamic_cast<AliTPCClusterHistograms*> (obj);
291 collectionQmaxVsRow ->Add(entry->fhQmaxVsRow );
292 collectionQtotVsRow ->Add(entry->fhQtotVsRow );
293 collectionSigmaYVsRow ->Add(entry->fhSigmaYVsRow );
294 collectionSigmaZVsRow ->Add(entry->fhSigmaZVsRow );
296 collectionQmaxProfileYVsRow ->Add(entry->fhQmaxProfileYVsRow );
297 collectionQtotProfileYVsRow ->Add(entry->fhQtotProfileYVsRow );
298 collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow);
299 collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow);
301 collectionQmaxProfileZVsRow ->Add(entry->fhQmaxProfileZVsRow );
302 collectionQtotProfileZVsRow ->Add(entry->fhQtotProfileZVsRow );
303 collectionSigmaYProfileZVsRow->Add(entry->fhSigmaYProfileZVsRow);
304 collectionSigmaZProfileZVsRow->Add(entry->fhSigmaZProfileZVsRow);
306 collectionQtotVsTime->Add(entry->fhQtotVsTime);
307 collectionQmaxVsTime->Add(entry->fhQmaxVsTime);
313 fhQmaxVsRow ->Merge(collectionQmaxVsRow );
314 fhQtotVsRow ->Merge(collectionQtotVsRow );
315 fhSigmaYVsRow ->Merge(collectionSigmaYVsRow );
316 fhSigmaZVsRow ->Merge(collectionSigmaZVsRow );
318 fhQmaxProfileYVsRow ->Merge(collectionQmaxProfileYVsRow );
319 fhQtotProfileYVsRow ->Merge(collectionQtotProfileYVsRow );
320 fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow);
321 fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow);
323 fhQmaxProfileZVsRow ->Merge(collectionQmaxProfileZVsRow );
324 fhQtotProfileZVsRow ->Merge(collectionQtotProfileZVsRow );
325 fhSigmaYProfileZVsRow->Merge(collectionSigmaYProfileZVsRow);
326 fhSigmaZProfileZVsRow->Merge(collectionSigmaZProfileZVsRow);
328 fhQtotVsTime->Merge(collectionQtotVsTime);
329 fhQmaxVsTime->Merge(collectionQmaxVsTime);
331 delete collectionQmaxVsRow;
332 delete collectionQtotVsRow;
333 delete collectionSigmaYVsRow;
334 delete collectionSigmaZVsRow;
336 delete collectionQmaxProfileYVsRow;
337 delete collectionQtotProfileYVsRow;
338 delete collectionSigmaYProfileYVsRow;
339 delete collectionSigmaZProfileYVsRow;
341 delete collectionQmaxProfileZVsRow;
342 delete collectionQtotProfileZVsRow;
343 delete collectionSigmaYProfileZVsRow;
344 delete collectionSigmaZProfileZVsRow;
346 delete collectionQtotVsTime;
347 delete collectionQmaxVsTime;
352 //____________________________________________________________________
353 void AliTPCClusterHistograms::FillCluster(AliTPCclusterMI* cluster, Int_t time) {
355 // Fills the different histograms with the information from the cluster.
358 Int_t padRow = cluster->GetRow();
359 Float_t qMax = cluster->GetMax();
360 Float_t qTot = cluster->GetQ();
361 Float_t sigmaY = cluster->GetSigmaY2();
362 Float_t sigmaZ = cluster->GetSigmaZ2();
363 Float_t y = cluster->GetY();
364 Float_t z = cluster->GetZ();
367 printf(Form("\n WARNING: Hi Marian! How can we have Qmax = %f ??? \n \n", qMax));
371 printf(Form("\n WARNING: Hi Marian! How can we have Qtot = %f ??? \n \n ", qTot));
375 if (fEdgeSuppression)
380 limit = 12 + padRow * (20.0 - 12.0) / 63;
383 limit = 16 + padRow * (36.0 - 16.0) / 96;
385 if (TMath::Abs(y) > limit)
389 fhQmaxVsRow ->Fill(padRow, qMax);
390 fhQtotVsRow ->Fill(padRow, qTot);
392 fhSigmaYVsRow ->Fill(padRow, sigmaY);
393 fhSigmaZVsRow ->Fill(padRow, sigmaZ);
395 fhQmaxProfileYVsRow ->Fill(padRow, y, qMax);
396 fhQtotProfileYVsRow ->Fill(padRow, y, qTot);
397 fhSigmaYProfileYVsRow ->Fill(padRow, y, sigmaY);
398 fhSigmaZProfileYVsRow ->Fill(padRow, y, sigmaZ);
400 fhQmaxProfileZVsRow ->Fill(padRow, z, qMax);
401 fhQtotProfileZVsRow ->Fill(padRow, z, qTot);
402 fhSigmaYProfileZVsRow ->Fill(padRow, z, sigmaY);
403 fhSigmaZProfileZVsRow ->Fill(padRow, z, sigmaZ);
405 if (time>0 & fTimeStart>0 & fTimeStop>0 & time>fTimeStart) {
406 //Float_t timeFraction = (time - fTimeStart)/(fTimeStop-fTimeStart);
408 fhQtotVsTime->Fill(time,qTot);
409 fhQmaxVsTime->Fill(time,qMax);
415 //____________________________________________________________________
416 void AliTPCClusterHistograms::SaveHistograms()
419 // saves the histograms
422 gDirectory->mkdir(fName.Data());
423 gDirectory->cd(fName.Data());
425 fhQmaxVsRow ->Write();
426 fhQtotVsRow ->Write();
428 fhSigmaYVsRow ->Write();
429 fhSigmaZVsRow ->Write();
431 fhQmaxProfileYVsRow ->Write();
432 fhQtotProfileYVsRow ->Write();
433 fhSigmaYProfileYVsRow ->Write();
434 fhSigmaZProfileYVsRow ->Write();
436 fhQmaxProfileZVsRow ->Write();
437 fhQtotProfileZVsRow ->Write();
438 fhSigmaYProfileZVsRow ->Write();
439 fhSigmaZProfileZVsRow ->Write();
441 TProfile* profileQmaxVsRow = fhQmaxVsRow->ProfileX("MeanQmaxVsRow");
442 TProfile* profileQtotVsRow = fhQtotVsRow->ProfileX("MeanQtotVsRow");
444 profileQmaxVsRow->SetTitle("Mean Qmax vs. pad row; Pad row; Mean Qmax");
445 profileQtotVsRow->SetTitle("Mean Qtot vs. pad row; Pad row; Mean Qmax");
447 profileQmaxVsRow->Write();
448 profileQtotVsRow->Write();
450 if (fhQtotVsTime->GetEntries()>0)
451 fhQtotVsTime->Write();
453 if (fhQmaxVsTime->GetEntries()>0)
454 fhQmaxVsTime->Write();
456 gDirectory->cd("../");
460 //____________________________________________________________________
461 TCanvas* AliTPCClusterHistograms::DrawHistograms(const Char_t* /*opt*/) {
463 // Draws some histograms and save the canvas as eps and gif file.
466 TCanvas* c = new TCanvas(fName.Data(), fName.Data(), 1200, 1000);
468 gStyle->SetOptStat(0);
469 gStyle->SetOptFit(0);
471 gStyle->SetPadLeftMargin(0.1);
479 // this is not really a nice way to do it...
480 c->GetPad(1)->Delete();
482 TLatex* name = new TLatex(0.1,0.8,fName.Data());
483 name->SetTextSize(0.02);
487 fhQmaxVsRow->Draw("colz");
490 fhQtotVsRow->Draw("colz");
493 fhQmaxProfileYVsRow ->Draw("colz");
495 fhQtotProfileYVsRow ->Draw("colz");
497 fhQmaxProfileZVsRow ->Draw("colz");
499 fhQtotProfileZVsRow ->Draw("colz");
501 fhSigmaYVsRow ->Draw("colz");
504 fhSigmaZVsRow ->Draw("colz");
506 //fhSigmaYProfileYVsRow ->Draw("colz");
507 //fhSigmaZProfileYVsRow ->Draw("colz");
509 //fhSigmaYProfileZVsRow ->Draw("colz");
510 //fhSigmaZProfileZVsRow ->Draw("colz");