7 #include <TProfile2D.h>
11 #include <../TPC/AliTPCclusterMI.h>
15 #include "AliTPCClusterHistograms.h"
17 //____________________________________________________________________
18 ClassImp(AliTPCClusterHistograms)
20 //____________________________________________________________________
21 AliTPCClusterHistograms::AliTPCClusterHistograms()
27 fhQmaxProfileYVsRow(0),
28 fhQtotProfileYVsRow(0),
29 fhSigmaYProfileYVsRow(0),
30 fhSigmaZProfileYVsRow(0),
31 fhQmaxProfileZVsRow(0),
32 fhQtotProfileZVsRow(0),
33 fhSigmaYProfileZVsRow(0),
34 fhSigmaZProfileZVsRow(0),
38 // default constructor
41 //____________________________________________________________________
42 //AliTPCClusterHistograms::AliTPCClusterHistograms(const Char_t* name, const Char_t* title)
43 AliTPCClusterHistograms::AliTPCClusterHistograms(Int_t detector, const Char_t* comment, Int_t timeStart, Int_t timeStop)
49 fhQmaxProfileYVsRow(0),
50 fhQtotProfileYVsRow(0),
51 fhSigmaYProfileYVsRow(0),
52 fhSigmaZProfileYVsRow(0),
53 fhQmaxProfileZVsRow(0),
54 fhQtotProfileZVsRow(0),
55 fhSigmaYProfileZVsRow(0),
56 fhSigmaZProfileZVsRow(0),
62 // make name and title
64 if (detector < 0 || detector >= 72) {
65 AliDebug(AliLog::kError, Form("Detector %d does not exist", detector));
69 Int_t sector = detector%18;
72 if (detector<18 || ( detector>=36 && detector<54))
83 name.Form("sector_%s%d_%s", side.Data(), sector, inout.Data());
86 SetTitle(Form("%s (detector %d)",name.Data(), detector));
88 fTimeStart = timeStart;
91 #define BINNING_Z 250, 0, 250
96 if (TString(name).Contains("IROC")) {
101 // 1 bin for each 0.5 cm
102 Int_t nBinsY = Int_t(4*yRange);
104 fhQmaxVsRow = new TH2F("QmaxVsPadRow", "Qmax vs. pad row;Pad row;Qmax", nPadRows+2, -1.5, nPadRows+0.5, 301, -0.5, 300.5);
105 fhQtotVsRow = new TH2F("QtotVsPadRow", "Qtot vs. pad row;Pad row;Qtot", nPadRows+2, -1.5, nPadRows+0.5, 400, 0, 4000);
107 fhSigmaYVsRow = new TH2F("SigmaYVsPadRow", "Sigma Y vs. pad row;Pad row;#sigma_{Y}", nPadRows+2, -1.5, nPadRows+0.5, 100, 0, 0.5);
108 fhSigmaZVsRow = new TH2F("SigmaZVsPadRow", "Sigma Z vs. pad row;Pad row;#sigma_{Z}", nPadRows+2, -1.5, nPadRows+0.5, 100, 0, 0.5);
110 fhQmaxProfileYVsRow = new TProfile2D("MeanQmaxYVsPadRow","Mean Qmax, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
111 fhQtotProfileYVsRow = new TProfile2D("MeanQtotYVsPadRow","Mean Qtot, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
112 fhSigmaYProfileYVsRow = new TProfile2D("MeanSigmaYVsPadRow","Mean Sigma y, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
113 fhSigmaZProfileYVsRow = new TProfile2D("MeanSigmaYVsPadRow","Mean Sigma y, y vs pad row;Pad row;y",nPadRows+2, -1.5, nPadRows+0.5, nBinsY, -yRange, yRange);
115 fhQmaxProfileZVsRow = new TProfile2D("MeanQmaxZVsPadRow","Mean Qmax, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
116 fhQtotProfileZVsRow = new TProfile2D("MeanQtotZVsPadRow","Mean Qtot, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
117 fhSigmaYProfileZVsRow = new TProfile2D("MeanSigmaZVsPadRow","Mean Sigma y, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
118 fhSigmaZProfileZVsRow = new TProfile2D("MeanSigmaZVsPadRow","Mean Sigma y, z vs pad row;Pad row;z",nPadRows+2, -1.5, nPadRows+0.5, BINNING_Z);
120 Int_t nTimeBins = 100;
122 fhQtotVsTime = new TProfile("MeanQtotVsTime", "Mean Qtot vs. event time stamp; time; Qtot",nTimeBins, fTimeStart, fTimeStop);
123 fhQmaxVsTime = new TProfile("MeanQmaxVsTime", "Mean Qmax vs. event time stamp; time; Qmax",nTimeBins, fTimeStart, fTimeStop);
127 //____________________________________________________________________
128 AliTPCClusterHistograms::AliTPCClusterHistograms(const AliTPCClusterHistograms& c) : TNamed(c)
131 ((AliTPCClusterHistograms &)c).Copy(*this);
134 //____________________________________________________________________
135 AliTPCClusterHistograms::~AliTPCClusterHistograms()
150 delete fhSigmaYVsRow;
154 delete fhSigmaZVsRow;
157 if (fhQmaxProfileYVsRow) {
158 delete fhQmaxProfileYVsRow;
159 fhQmaxProfileYVsRow = 0;
161 if (fhQtotProfileYVsRow) {
162 delete fhQtotProfileYVsRow;
163 fhQtotProfileYVsRow = 0;
165 if (fhSigmaYProfileYVsRow) {
166 delete fhSigmaYProfileYVsRow;
167 fhSigmaYProfileYVsRow = 0;
169 if (fhSigmaZProfileYVsRow) {
170 delete fhSigmaZProfileYVsRow;
171 fhSigmaZProfileYVsRow = 0;
173 if (fhQmaxProfileZVsRow) {
174 delete fhQmaxProfileZVsRow;
175 fhQmaxProfileZVsRow = 0;
177 if (fhQtotProfileZVsRow) {
178 delete fhQtotProfileZVsRow;
179 fhQtotProfileZVsRow = 0;
181 if (fhSigmaYProfileZVsRow) {
182 delete fhSigmaYProfileZVsRow;
183 fhSigmaYProfileZVsRow = 0;
185 if (fhSigmaZProfileZVsRow) {
186 delete fhSigmaZProfileZVsRow;
187 fhSigmaZProfileZVsRow = 0;
200 //____________________________________________________________________
201 AliTPCClusterHistograms &AliTPCClusterHistograms::operator=(const AliTPCClusterHistograms &c)
203 // assigment operator
206 ((AliTPCClusterHistograms &) c).Copy(*this);
212 //____________________________________________________________________
213 Long64_t AliTPCClusterHistograms::Merge(TCollection* list)
215 // Merge a list of AliTPCClusterHistograms objects with this (needed for
217 // Returns the number of merged objects (including this).
225 TIterator* iter = list->MakeIterator();
228 // collections of measured and generated histograms
229 TList* collectionQmaxVsRow = new TList;
230 TList* collectionQtotVsRow = new TList;
231 TList* collectionSigmaYVsRow = new TList;
232 TList* collectionSigmaZVsRow = new TList;
234 TList* collectionQmaxProfileYVsRow = new TList;
235 TList* collectionQtotProfileYVsRow = new TList;
236 TList* collectionSigmaYProfileYVsRow = new TList;
237 TList* collectionSigmaZProfileYVsRow = new TList;
239 TList* collectionQmaxProfileZVsRow = new TList;
240 TList* collectionQtotProfileZVsRow = new TList;
241 TList* collectionSigmaYProfileZVsRow = new TList;
242 TList* collectionSigmaZProfileZVsRow = new TList;
244 TList* collectionQtotVsTime = new TList;
245 TList* collectionQmaxVsTime = new TList;
248 while ((obj = iter->Next())) {
250 AliTPCClusterHistograms* entry = dynamic_cast<AliTPCClusterHistograms*> (obj);
254 collectionQmaxVsRow ->Add(entry->fhQmaxVsRow );
255 collectionQtotVsRow ->Add(entry->fhQtotVsRow );
256 collectionSigmaYVsRow ->Add(entry->fhSigmaYVsRow );
257 collectionSigmaZVsRow ->Add(entry->fhSigmaZVsRow );
259 collectionQmaxProfileYVsRow ->Add(entry->fhQmaxProfileYVsRow );
260 collectionQtotProfileYVsRow ->Add(entry->fhQtotProfileYVsRow );
261 collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow);
262 collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow);
264 collectionQmaxProfileZVsRow ->Add(entry->fhQmaxProfileZVsRow );
265 collectionQtotProfileZVsRow ->Add(entry->fhQtotProfileZVsRow );
266 collectionSigmaYProfileZVsRow->Add(entry->fhSigmaYProfileZVsRow);
267 collectionSigmaZProfileZVsRow->Add(entry->fhSigmaZProfileZVsRow);
269 collectionQtotVsTime->Add(entry->fhQtotVsTime);
270 collectionQmaxVsTime->Add(entry->fhQmaxVsTime);
276 fhQmaxVsRow ->Merge(collectionQmaxVsRow );
277 fhQtotVsRow ->Merge(collectionQtotVsRow );
278 fhSigmaYVsRow ->Merge(collectionSigmaYVsRow );
279 fhSigmaZVsRow ->Merge(collectionSigmaZVsRow );
281 fhQmaxProfileYVsRow ->Merge(collectionQmaxProfileYVsRow );
282 fhQtotProfileYVsRow ->Merge(collectionQtotProfileYVsRow );
283 fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow);
284 fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow);
286 fhQmaxProfileZVsRow ->Merge(collectionQmaxProfileZVsRow );
287 fhQtotProfileZVsRow ->Merge(collectionQtotProfileZVsRow );
288 fhSigmaYProfileZVsRow->Merge(collectionSigmaYProfileZVsRow);
289 fhSigmaZProfileZVsRow->Merge(collectionSigmaZProfileZVsRow);
291 fhQtotVsTime->Merge(collectionQtotVsTime);
292 fhQmaxVsTime->Merge(collectionQmaxVsTime);
294 delete collectionQmaxVsRow;
295 delete collectionQtotVsRow;
296 delete collectionSigmaYVsRow;
297 delete collectionSigmaZVsRow;
299 delete collectionQmaxProfileYVsRow;
300 delete collectionQtotProfileYVsRow;
301 delete collectionSigmaYProfileYVsRow;
302 delete collectionSigmaZProfileYVsRow;
304 delete collectionQmaxProfileZVsRow;
305 delete collectionQtotProfileZVsRow;
306 delete collectionSigmaYProfileZVsRow;
307 delete collectionSigmaZProfileZVsRow;
309 delete collectionQtotVsTime;
310 delete collectionQmaxVsTime;
315 //____________________________________________________________________
316 void AliTPCClusterHistograms::FillCluster(AliTPCclusterMI* cluster, Int_t time) {
321 Int_t padRow = cluster->GetRow();
322 Float_t qMax = cluster->GetMax();
323 Float_t qTot = cluster->GetQ();
324 Float_t sigmaY = cluster->GetSigmaY2();
325 Float_t sigmaZ = cluster->GetSigmaZ2();
326 Float_t y = cluster->GetY();
327 Float_t z = cluster->GetZ();
329 fhQmaxVsRow ->Fill(padRow, qMax);
330 fhQtotVsRow ->Fill(padRow, qTot);
332 fhSigmaYVsRow ->Fill(padRow, sigmaY);
333 fhSigmaZVsRow ->Fill(padRow, sigmaZ);
335 fhQmaxProfileYVsRow ->Fill(padRow, y, qMax);
336 fhQtotProfileYVsRow ->Fill(padRow, y, qTot);
337 fhSigmaYProfileYVsRow ->Fill(padRow, y, sigmaY);
338 fhSigmaZProfileYVsRow ->Fill(padRow, y, sigmaZ);
340 fhQmaxProfileZVsRow ->Fill(padRow, z, qMax);
341 fhQtotProfileZVsRow ->Fill(padRow, z, qTot);
342 fhSigmaYProfileZVsRow ->Fill(padRow, z, sigmaY);
343 fhSigmaZProfileZVsRow ->Fill(padRow, z, sigmaZ);
345 if (time>0 & fTimeStart>0 & fTimeStop>0 & time>fTimeStart) {
346 //Float_t timeFraction = (time - fTimeStart)/(fTimeStop-fTimeStart);
348 fhQtotVsTime->Fill(time,qTot);
349 fhQmaxVsTime->Fill(time,qMax);
355 //____________________________________________________________________
356 void AliTPCClusterHistograms::SaveHistograms()
359 // saves the histograms
362 gDirectory->mkdir(fName.Data());
363 gDirectory->cd(fName.Data());
365 fhQmaxVsRow ->Write();
366 fhQtotVsRow ->Write();
368 fhSigmaYVsRow ->Write();
369 fhSigmaZVsRow ->Write();
371 fhQmaxProfileYVsRow ->Write();
372 fhQtotProfileYVsRow ->Write();
373 fhSigmaYProfileYVsRow ->Write();
374 fhSigmaZProfileYVsRow ->Write();
376 fhQmaxProfileZVsRow ->Write();
377 fhQtotProfileZVsRow ->Write();
378 fhSigmaYProfileZVsRow ->Write();
379 fhSigmaZProfileZVsRow ->Write();
381 if (fhQtotVsTime->GetEntries()>0)
382 fhQtotVsTime->Write();
384 if (fhQmaxVsTime->GetEntries()>0)
385 fhQmaxVsTime->Write();
387 gDirectory->cd("../");
391 //____________________________________________________________________
392 TCanvas* AliTPCClusterHistograms::DrawHistograms(const Char_t* opt) {
394 TCanvas* c = new TCanvas(Form("plots_%s",fName.Data()), fName.Data(), 1200, 1000);
396 gStyle->SetOptStat(0);
397 gStyle->SetOptFit(0);
399 gStyle->SetPadLeftMargin(0.05);
407 // this is not really a nice way to do it...
408 c->GetPad(1)->Delete();
410 TLatex* name = new TLatex(0.1,0.8,fName.Data());
411 name->SetTextSize(0.02);
415 fhQmaxVsRow->Draw("colz");
418 fhQtotVsRow->Draw("colz");
421 fhQmaxProfileYVsRow ->Draw("colz");
423 fhQtotProfileYVsRow ->Draw("colz");
425 fhQmaxProfileZVsRow ->Draw("colz");
427 fhQtotProfileZVsRow ->Draw("colz");
429 fhSigmaYVsRow ->Draw("colz");
432 fhSigmaZVsRow ->Draw("colz");
434 //fhSigmaYProfileYVsRow ->Draw("colz");
435 //fhSigmaZProfileYVsRow ->Draw("colz");
437 //fhSigmaYProfileZVsRow ->Draw("colz");
438 //fhSigmaZProfileZVsRow ->Draw("colz");