1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is 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 **************************************************************************/
18 // This class contains a number of histograms for diagnostics of a TPC
19 // read out chamber from the raw data
28 #include <TCollection.h>
37 #include "AliTPCRawHistograms.h"
38 #include "AliTPCRawStream.h"
40 //____________________________________________________________________
41 ClassImp(AliTPCRawHistograms)
43 //____________________________________________________________________
44 AliTPCRawHistograms::AliTPCRawHistograms()
52 // default constructor
55 //____________________________________________________________________
56 AliTPCRawHistograms::AliTPCRawHistograms(Int_t detector, const Char_t* /* comment */, Int_t timeStart, Int_t timeStop)
58 fTimeStart(timeStart),
61 fhSignal(new TH1F("fhSignal", "fhSignal", 200, 0, 2000)),
62 fDigitTree(new TNtuple("fDigitTree", "fDigitTree", "row:pad:time:signal"))
66 // make name and title
67 if (detector < 0 || detector >= 72) {
68 AliDebug(AliLog::kError, Form("Detector %d does not exist", detector));
72 Int_t sector = detector%18;
75 if (detector<18 || ( detector>=36 && detector<54))
86 name.Form("sector_%s%d_%s", side.Data(), sector, inout.Data());
89 SetTitle(Form("%s (detector %d)",name.Data(), detector));
94 if (TString(name).Contains("IROC")) {
99 // do not add this hists to the directory
100 Bool_t oldStatus = TH1::AddDirectoryStatus();
101 TH1::AddDirectory(kFALSE);
103 fhDigits = new TH3F("fhDigits", Form("signal distribution;row;pad;time", name.Data()), nPadRows, -0.5, -0.5 + nPadRows, 150, -0.5, 149.5, 100, 0, 1200);
105 TH1::AddDirectory(oldStatus);
108 //____________________________________________________________________
109 AliTPCRawHistograms::AliTPCRawHistograms(const AliTPCRawHistograms& c) : TNamed(c),
118 ((AliTPCRawHistograms &)c).Copy(*this);
121 //____________________________________________________________________
122 AliTPCRawHistograms::~AliTPCRawHistograms()
130 //____________________________________________________________________
131 AliTPCRawHistograms &AliTPCRawHistograms::operator=(const AliTPCRawHistograms &c)
133 // assigment operator
136 ((AliTPCRawHistograms &) c).Copy(*this);
142 //____________________________________________________________________
143 Long64_t AliTPCRawHistograms::Merge(TCollection* list)
145 // Merge a list of AliTPCRawHistograms objects with this (needed for
147 // Returns the number of merged objects (including this).
155 // TIterator* iter = list->MakeIterator();
161 // collections of measured and generated histograms
162 TList* collectionQmaxVsRow = new TList;
163 TList* collectionQtotVsRow = new TList;
164 TList* collectionSigmaYVsRow = new TList;
165 TList* collectionSigmaZVsRow = new TList;
167 TList* collectionQmaxProfileYVsRow = new TList;
168 TList* collectionQtotProfileYVsRow = new TList;
169 TList* collectionSigmaYProfileYVsRow = new TList;
170 TList* collectionSigmaZProfileYVsRow = new TList;
172 TList* collectionQmaxProfileZVsRow = new TList;
173 TList* collectionQtotProfileZVsRow = new TList;
174 TList* collectionSigmaYProfileZVsRow = new TList;
175 TList* collectionSigmaZProfileZVsRow = new TList;
177 TList* collectionQtotVsTime = new TList;
178 TList* collectionQmaxVsTime = new TList;
180 while ((obj = iter->Next())) {
182 AliTPCRawHistograms* entry = dynamic_cast<AliTPCRawHistograms*> (obj);
186 collectionQmaxVsRow ->Add(entry->fhQmaxVsRow );
187 collectionQtotVsRow ->Add(entry->fhQtotVsRow );
188 collectionSigmaYVsRow ->Add(entry->fhSigmaYVsRow );
189 collectionSigmaZVsRow ->Add(entry->fhSigmaZVsRow );
191 collectionQmaxProfileYVsRow ->Add(entry->fhQmaxProfileYVsRow );
192 collectionQtotProfileYVsRow ->Add(entry->fhQtotProfileYVsRow );
193 collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow);
194 collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow);
196 collectionQmaxProfileZVsRow ->Add(entry->fhQmaxProfileZVsRow );
197 collectionQtotProfileZVsRow ->Add(entry->fhQtotProfileZVsRow );
198 collectionSigmaYProfileZVsRow->Add(entry->fhSigmaYProfileZVsRow);
199 collectionSigmaZProfileZVsRow->Add(entry->fhSigmaZProfileZVsRow);
201 collectionQtotVsTime->Add(entry->fhQtotVsTime);
202 collectionQmaxVsTime->Add(entry->fhQmaxVsTime);
208 fhQmaxVsRow ->Merge(collectionQmaxVsRow );
209 fhQtotVsRow ->Merge(collectionQtotVsRow );
210 fhSigmaYVsRow ->Merge(collectionSigmaYVsRow );
211 fhSigmaZVsRow ->Merge(collectionSigmaZVsRow );
213 fhQmaxProfileYVsRow ->Merge(collectionQmaxProfileYVsRow );
214 fhQtotProfileYVsRow ->Merge(collectionQtotProfileYVsRow );
215 fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow);
216 fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow);
218 fhQmaxProfileZVsRow ->Merge(collectionQmaxProfileZVsRow );
219 fhQtotProfileZVsRow ->Merge(collectionQtotProfileZVsRow );
220 fhSigmaYProfileZVsRow->Merge(collectionSigmaYProfileZVsRow);
221 fhSigmaZProfileZVsRow->Merge(collectionSigmaZProfileZVsRow);
223 fhQtotVsTime->Merge(collectionQtotVsTime);
224 fhQmaxVsTime->Merge(collectionQmaxVsTime);
226 delete collectionQmaxVsRow;
227 delete collectionQtotVsRow;
228 delete collectionSigmaYVsRow;
229 delete collectionSigmaZVsRow;
231 delete collectionQmaxProfileYVsRow;
232 delete collectionQtotProfileYVsRow;
233 delete collectionSigmaYProfileYVsRow;
234 delete collectionSigmaZProfileYVsRow;
236 delete collectionQmaxProfileZVsRow;
237 delete collectionQtotProfileZVsRow;
238 delete collectionSigmaYProfileZVsRow;
239 delete collectionSigmaZProfileZVsRow;
241 delete collectionQtotVsTime;
242 delete collectionQmaxVsTime;*/
247 //____________________________________________________________________
248 void AliTPCRawHistograms::FillDigit(AliTPCRawStream* rawStream, Int_t /*time*/)
251 // Fills the different histograms with the information from a raw digit
254 Int_t signal = rawStream->GetSignal();
255 Int_t row = rawStream->GetRow();
256 Int_t pad = rawStream->GetPad();
257 Int_t timeBin = rawStream->GetTime();
260 fhDigits->Fill(row, pad, timeBin, signal);
262 fhSignal->Fill(signal);
264 fDigitTree->Fill(row, pad, timeBin, signal);
267 //____________________________________________________________________
268 void AliTPCRawHistograms::SaveHistograms()
271 // saves the histograms
274 gDirectory->mkdir(fName.Data());
275 gDirectory->cd(fName.Data());
281 gDirectory->cd("../");
284 //____________________________________________________________________
285 TCanvas* AliTPCRawHistograms::DrawHistograms(const Char_t* /*opt*/) {
287 // Draws some histograms and save the canvas as eps and gif file.
290 TCanvas* c = new TCanvas(Form("plots_%s",fName.Data()), fName.Data(), 1200, 1000);
292 gStyle->SetOptStat(0);
293 gStyle->SetOptFit(0);
295 gStyle->SetPadLeftMargin(0.05);
303 // this is not really a nice way to do it...
304 c->GetPad(1)->Delete();
306 TLatex* name = new TLatex(0.1,0.8,fName.Data());
307 name->SetTextSize(0.02);