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()
49 // default constructor
52 //____________________________________________________________________
53 AliTPCRawHistograms::AliTPCRawHistograms(Int_t detector, const Char_t* /* comment */, Int_t timeStart, Int_t timeStop)
61 // make name and title
62 if (detector < 0 || detector >= 72) {
63 AliDebug(AliLog::kError, Form("Detector %d does not exist", detector));
67 Int_t sector = detector%18;
70 if (detector<18 || ( detector>=36 && detector<54))
81 name.Form("sector_%s%d_%s", side.Data(), sector, inout.Data());
84 SetTitle(Form("%s (detector %d)",name.Data(), detector));
86 fTimeStart = timeStart;
92 if (TString(name).Contains("IROC")) {
97 // do not add this hists to the directory
98 Bool_t oldStatus = TH1::AddDirectoryStatus();
99 TH1::AddDirectory(kFALSE);
101 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);
102 fhSignal = new TH1F("fhSignal", "fhSignal", 200, 0, 2000);
104 fDigitTree = new TNtuple("fDigitTree", "fDigitTree", "row:pad:time:signal");
106 TH1::AddDirectory(oldStatus);
109 //____________________________________________________________________
110 AliTPCRawHistograms::AliTPCRawHistograms(const AliTPCRawHistograms& c) : TNamed(c)
114 ((AliTPCRawHistograms &)c).Copy(*this);
117 //____________________________________________________________________
118 AliTPCRawHistograms::~AliTPCRawHistograms()
126 //____________________________________________________________________
127 AliTPCRawHistograms &AliTPCRawHistograms::operator=(const AliTPCRawHistograms &c)
129 // assigment operator
132 ((AliTPCRawHistograms &) c).Copy(*this);
138 //____________________________________________________________________
139 Long64_t AliTPCRawHistograms::Merge(TCollection* list)
141 // Merge a list of AliTPCRawHistograms objects with this (needed for
143 // Returns the number of merged objects (including this).
151 TIterator* iter = list->MakeIterator();
157 // collections of measured and generated histograms
158 TList* collectionQmaxVsRow = new TList;
159 TList* collectionQtotVsRow = new TList;
160 TList* collectionSigmaYVsRow = new TList;
161 TList* collectionSigmaZVsRow = new TList;
163 TList* collectionQmaxProfileYVsRow = new TList;
164 TList* collectionQtotProfileYVsRow = new TList;
165 TList* collectionSigmaYProfileYVsRow = new TList;
166 TList* collectionSigmaZProfileYVsRow = new TList;
168 TList* collectionQmaxProfileZVsRow = new TList;
169 TList* collectionQtotProfileZVsRow = new TList;
170 TList* collectionSigmaYProfileZVsRow = new TList;
171 TList* collectionSigmaZProfileZVsRow = new TList;
173 TList* collectionQtotVsTime = new TList;
174 TList* collectionQmaxVsTime = new TList;
176 while ((obj = iter->Next())) {
178 AliTPCRawHistograms* entry = dynamic_cast<AliTPCRawHistograms*> (obj);
182 collectionQmaxVsRow ->Add(entry->fhQmaxVsRow );
183 collectionQtotVsRow ->Add(entry->fhQtotVsRow );
184 collectionSigmaYVsRow ->Add(entry->fhSigmaYVsRow );
185 collectionSigmaZVsRow ->Add(entry->fhSigmaZVsRow );
187 collectionQmaxProfileYVsRow ->Add(entry->fhQmaxProfileYVsRow );
188 collectionQtotProfileYVsRow ->Add(entry->fhQtotProfileYVsRow );
189 collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow);
190 collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow);
192 collectionQmaxProfileZVsRow ->Add(entry->fhQmaxProfileZVsRow );
193 collectionQtotProfileZVsRow ->Add(entry->fhQtotProfileZVsRow );
194 collectionSigmaYProfileZVsRow->Add(entry->fhSigmaYProfileZVsRow);
195 collectionSigmaZProfileZVsRow->Add(entry->fhSigmaZProfileZVsRow);
197 collectionQtotVsTime->Add(entry->fhQtotVsTime);
198 collectionQmaxVsTime->Add(entry->fhQmaxVsTime);
204 fhQmaxVsRow ->Merge(collectionQmaxVsRow );
205 fhQtotVsRow ->Merge(collectionQtotVsRow );
206 fhSigmaYVsRow ->Merge(collectionSigmaYVsRow );
207 fhSigmaZVsRow ->Merge(collectionSigmaZVsRow );
209 fhQmaxProfileYVsRow ->Merge(collectionQmaxProfileYVsRow );
210 fhQtotProfileYVsRow ->Merge(collectionQtotProfileYVsRow );
211 fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow);
212 fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow);
214 fhQmaxProfileZVsRow ->Merge(collectionQmaxProfileZVsRow );
215 fhQtotProfileZVsRow ->Merge(collectionQtotProfileZVsRow );
216 fhSigmaYProfileZVsRow->Merge(collectionSigmaYProfileZVsRow);
217 fhSigmaZProfileZVsRow->Merge(collectionSigmaZProfileZVsRow);
219 fhQtotVsTime->Merge(collectionQtotVsTime);
220 fhQmaxVsTime->Merge(collectionQmaxVsTime);
222 delete collectionQmaxVsRow;
223 delete collectionQtotVsRow;
224 delete collectionSigmaYVsRow;
225 delete collectionSigmaZVsRow;
227 delete collectionQmaxProfileYVsRow;
228 delete collectionQtotProfileYVsRow;
229 delete collectionSigmaYProfileYVsRow;
230 delete collectionSigmaZProfileYVsRow;
232 delete collectionQmaxProfileZVsRow;
233 delete collectionQtotProfileZVsRow;
234 delete collectionSigmaYProfileZVsRow;
235 delete collectionSigmaZProfileZVsRow;
237 delete collectionQtotVsTime;
238 delete collectionQmaxVsTime;*/
243 //____________________________________________________________________
244 void AliTPCRawHistograms::FillDigit(AliTPCRawStream* rawStream, Int_t /*time*/)
247 // Fills the different histograms with the information from a raw digit
250 Int_t signal = rawStream->GetSignal();
251 Int_t row = rawStream->GetRow();
252 Int_t pad = rawStream->GetPad();
253 Int_t timeBin = rawStream->GetTime();
256 fhDigits->Fill(row, pad, timeBin, signal);
258 fhSignal->Fill(signal);
260 fDigitTree->Fill(row, pad, timeBin, signal);
263 //____________________________________________________________________
264 void AliTPCRawHistograms::SaveHistograms()
267 // saves the histograms
270 gDirectory->mkdir(fName.Data());
271 gDirectory->cd(fName.Data());
277 gDirectory->cd("../");
280 //____________________________________________________________________
281 TCanvas* AliTPCRawHistograms::DrawHistograms(const Char_t* /*opt*/) {
283 // Draws some histograms and save the canvas as eps and gif file.
286 TCanvas* c = new TCanvas(Form("plots_%s",fName.Data()), fName.Data(), 1200, 1000);
288 gStyle->SetOptStat(0);
289 gStyle->SetOptFit(0);
291 gStyle->SetPadLeftMargin(0.05);
299 // this is not really a nice way to do it...
300 c->GetPad(1)->Delete();
302 TLatex* name = new TLatex(0.1,0.8,fName.Data());
303 name->SetTextSize(0.02);