]>
Commit | Line | Data |
---|---|---|
7ca4655f | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
1d7991a5 | 16 | /* $Id$ */ |
17 | ||
18 | // This class contains a number of histograms for diagnostics of a TPC | |
19 | // read out chamber from the raw data | |
20 | // | |
21 | // TODO: | |
22 | // | |
23 | // | |
24 | // | |
25 | ||
1d7991a5 | 26 | |
1d7991a5 | 27 | #include <TCanvas.h> |
7ca4655f | 28 | #include <TCollection.h> |
29 | #include <TFile.h> | |
1d7991a5 | 30 | #include <TH1F.h> |
7ca4655f | 31 | #include <TH3F.h> |
1d7991a5 | 32 | #include <TLatex.h> |
33 | #include <TNtuple.h> | |
7ca4655f | 34 | #include <TStyle.h> |
1d7991a5 | 35 | |
7ca4655f | 36 | #include "AliLog.h" |
37 | #include "AliTPCRawHistograms.h" | |
38 | #include "AliTPCRawStream.h" | |
1d7991a5 | 39 | |
40 | //____________________________________________________________________ | |
41 | ClassImp(AliTPCRawHistograms) | |
42 | ||
43 | //____________________________________________________________________ | |
44 | AliTPCRawHistograms::AliTPCRawHistograms() | |
45 | : TNamed(), | |
46 | fhDigits(0), | |
47 | fhSignal(0) | |
48 | { | |
49 | // default constructor | |
50 | } | |
51 | ||
52 | //____________________________________________________________________ | |
53 | AliTPCRawHistograms::AliTPCRawHistograms(Int_t detector, const Char_t* /* comment */, Int_t timeStart, Int_t timeStop) | |
54 | : TNamed(), | |
55 | fhDigits(0), | |
56 | fhSignal(0), | |
57 | fDigitTree(0) | |
58 | { | |
59 | // constructor | |
60 | ||
61 | // make name and title | |
62 | if (detector < 0 || detector >= 72) { | |
63 | AliDebug(AliLog::kError, Form("Detector %d does not exist", detector)); | |
64 | return; | |
65 | } | |
66 | ||
67 | Int_t sector = detector%18; | |
68 | TString side; | |
69 | TString inout; | |
70 | if (detector<18 || ( detector>=36 && detector<54)) | |
71 | side.Form("A"); | |
72 | else | |
73 | side.Form("B"); | |
74 | ||
75 | if (detector<36) | |
76 | inout.Form("IROC"); | |
77 | else | |
78 | inout.Form("OROC"); | |
79 | ||
80 | TString name; | |
81 | name.Form("sector_%s%d_%s", side.Data(), sector, inout.Data()); | |
82 | ||
83 | SetName(name); | |
84 | SetTitle(Form("%s (detector %d)",name.Data(), detector)); | |
85 | ||
86 | fTimeStart = timeStart; | |
87 | fTimeStop = timeStop; | |
88 | ||
89 | Float_t yRange = 45; | |
90 | Int_t nPadRows = 96; | |
91 | ||
92 | if (TString(name).Contains("IROC")) { | |
93 | yRange = 25; | |
94 | nPadRows = 63; | |
95 | } | |
96 | ||
899625a7 | 97 | // do not add this hists to the directory |
98 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
99 | TH1::AddDirectory(kFALSE); | |
1d7991a5 | 100 | |
899625a7 | 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); |
1d7991a5 | 102 | fhSignal = new TH1F("fhSignal", "fhSignal", 200, 0, 2000); |
103 | ||
104 | fDigitTree = new TNtuple("fDigitTree", "fDigitTree", "row:pad:time:signal"); | |
899625a7 | 105 | |
106 | TH1::AddDirectory(oldStatus); | |
1d7991a5 | 107 | } |
108 | ||
109 | //____________________________________________________________________ | |
110 | AliTPCRawHistograms::AliTPCRawHistograms(const AliTPCRawHistograms& c) : TNamed(c) | |
111 | { | |
112 | // copy constructor | |
113 | ||
114 | ((AliTPCRawHistograms &)c).Copy(*this); | |
115 | } | |
116 | ||
117 | //____________________________________________________________________ | |
118 | AliTPCRawHistograms::~AliTPCRawHistograms() | |
119 | { | |
120 | // | |
121 | // destructor | |
122 | // | |
123 | ||
124 | } | |
125 | ||
126 | //____________________________________________________________________ | |
127 | AliTPCRawHistograms &AliTPCRawHistograms::operator=(const AliTPCRawHistograms &c) | |
128 | { | |
129 | // assigment operator | |
130 | ||
131 | if (this != &c) | |
132 | ((AliTPCRawHistograms &) c).Copy(*this); | |
133 | ||
134 | return *this; | |
135 | } | |
136 | ||
137 | ||
138 | //____________________________________________________________________ | |
139 | Long64_t AliTPCRawHistograms::Merge(TCollection* list) | |
140 | { | |
141 | // Merge a list of AliTPCRawHistograms objects with this (needed for | |
142 | // PROOF). | |
143 | // Returns the number of merged objects (including this). | |
144 | ||
145 | if (!list) | |
146 | return 0; | |
147 | ||
148 | if (list->IsEmpty()) | |
149 | return 1; | |
150 | ||
151 | TIterator* iter = list->MakeIterator(); | |
152 | TObject* obj; | |
153 | ||
154 | Int_t count = 0; | |
155 | ||
156 | /* | |
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; | |
162 | ||
163 | TList* collectionQmaxProfileYVsRow = new TList; | |
164 | TList* collectionQtotProfileYVsRow = new TList; | |
165 | TList* collectionSigmaYProfileYVsRow = new TList; | |
166 | TList* collectionSigmaZProfileYVsRow = new TList; | |
167 | ||
168 | TList* collectionQmaxProfileZVsRow = new TList; | |
169 | TList* collectionQtotProfileZVsRow = new TList; | |
170 | TList* collectionSigmaYProfileZVsRow = new TList; | |
171 | TList* collectionSigmaZProfileZVsRow = new TList; | |
172 | ||
173 | TList* collectionQtotVsTime = new TList; | |
174 | TList* collectionQmaxVsTime = new TList; | |
175 | ||
176 | while ((obj = iter->Next())) { | |
177 | ||
178 | AliTPCRawHistograms* entry = dynamic_cast<AliTPCRawHistograms*> (obj); | |
179 | if (entry == 0) | |
180 | continue; | |
181 | ||
182 | collectionQmaxVsRow ->Add(entry->fhQmaxVsRow ); | |
183 | collectionQtotVsRow ->Add(entry->fhQtotVsRow ); | |
184 | collectionSigmaYVsRow ->Add(entry->fhSigmaYVsRow ); | |
185 | collectionSigmaZVsRow ->Add(entry->fhSigmaZVsRow ); | |
186 | ||
187 | collectionQmaxProfileYVsRow ->Add(entry->fhQmaxProfileYVsRow ); | |
188 | collectionQtotProfileYVsRow ->Add(entry->fhQtotProfileYVsRow ); | |
189 | collectionSigmaYProfileYVsRow->Add(entry->fhSigmaYProfileYVsRow); | |
190 | collectionSigmaZProfileYVsRow->Add(entry->fhSigmaZProfileYVsRow); | |
191 | ||
192 | collectionQmaxProfileZVsRow ->Add(entry->fhQmaxProfileZVsRow ); | |
193 | collectionQtotProfileZVsRow ->Add(entry->fhQtotProfileZVsRow ); | |
194 | collectionSigmaYProfileZVsRow->Add(entry->fhSigmaYProfileZVsRow); | |
195 | collectionSigmaZProfileZVsRow->Add(entry->fhSigmaZProfileZVsRow); | |
196 | ||
197 | collectionQtotVsTime->Add(entry->fhQtotVsTime); | |
198 | collectionQmaxVsTime->Add(entry->fhQmaxVsTime); | |
199 | ||
200 | ||
201 | count++; | |
202 | } | |
203 | ||
204 | fhQmaxVsRow ->Merge(collectionQmaxVsRow ); | |
205 | fhQtotVsRow ->Merge(collectionQtotVsRow ); | |
206 | fhSigmaYVsRow ->Merge(collectionSigmaYVsRow ); | |
207 | fhSigmaZVsRow ->Merge(collectionSigmaZVsRow ); | |
208 | ||
209 | fhQmaxProfileYVsRow ->Merge(collectionQmaxProfileYVsRow ); | |
210 | fhQtotProfileYVsRow ->Merge(collectionQtotProfileYVsRow ); | |
211 | fhSigmaYProfileYVsRow->Merge(collectionSigmaYProfileYVsRow); | |
212 | fhSigmaZProfileYVsRow->Merge(collectionSigmaZProfileYVsRow); | |
213 | ||
214 | fhQmaxProfileZVsRow ->Merge(collectionQmaxProfileZVsRow ); | |
215 | fhQtotProfileZVsRow ->Merge(collectionQtotProfileZVsRow ); | |
216 | fhSigmaYProfileZVsRow->Merge(collectionSigmaYProfileZVsRow); | |
217 | fhSigmaZProfileZVsRow->Merge(collectionSigmaZProfileZVsRow); | |
218 | ||
219 | fhQtotVsTime->Merge(collectionQtotVsTime); | |
220 | fhQmaxVsTime->Merge(collectionQmaxVsTime); | |
221 | ||
222 | delete collectionQmaxVsRow; | |
223 | delete collectionQtotVsRow; | |
224 | delete collectionSigmaYVsRow; | |
225 | delete collectionSigmaZVsRow; | |
226 | ||
227 | delete collectionQmaxProfileYVsRow; | |
228 | delete collectionQtotProfileYVsRow; | |
229 | delete collectionSigmaYProfileYVsRow; | |
230 | delete collectionSigmaZProfileYVsRow; | |
231 | ||
232 | delete collectionQmaxProfileZVsRow; | |
233 | delete collectionQtotProfileZVsRow; | |
234 | delete collectionSigmaYProfileZVsRow; | |
235 | delete collectionSigmaZProfileZVsRow; | |
236 | ||
237 | delete collectionQtotVsTime; | |
238 | delete collectionQmaxVsTime;*/ | |
239 | ||
240 | return count+1; | |
241 | } | |
242 | ||
243 | //____________________________________________________________________ | |
899625a7 | 244 | void AliTPCRawHistograms::FillDigit(AliTPCRawStream* rawStream, Int_t /*time*/) |
1d7991a5 | 245 | { |
246 | // | |
247 | // Fills the different histograms with the information from a raw digit | |
248 | // | |
249 | ||
250 | Int_t signal = rawStream->GetSignal(); | |
251 | Int_t row = rawStream->GetRow(); | |
252 | Int_t pad = rawStream->GetPad(); | |
253 | Int_t timeBin = rawStream->GetTime(); | |
254 | ||
255 | if (signal > 120) | |
256 | fhDigits->Fill(row, pad, timeBin, signal); | |
257 | ||
258 | fhSignal->Fill(signal); | |
259 | ||
899625a7 | 260 | fDigitTree->Fill(row, pad, timeBin, signal); |
1d7991a5 | 261 | } |
262 | ||
263 | //____________________________________________________________________ | |
264 | void AliTPCRawHistograms::SaveHistograms() | |
265 | { | |
266 | // | |
267 | // saves the histograms | |
268 | // | |
269 | ||
270 | gDirectory->mkdir(fName.Data()); | |
271 | gDirectory->cd(fName.Data()); | |
272 | ||
273 | fhDigits ->Write(); | |
274 | fhSignal ->Write(); | |
275 | fDigitTree->Write(); | |
276 | ||
277 | gDirectory->cd("../"); | |
278 | } | |
279 | ||
280 | //____________________________________________________________________ | |
899625a7 | 281 | TCanvas* AliTPCRawHistograms::DrawHistograms(const Char_t* /*opt*/) { |
1d7991a5 | 282 | // |
283 | // Draws some histograms and save the canvas as eps and gif file. | |
284 | // | |
285 | ||
286 | TCanvas* c = new TCanvas(Form("plots_%s",fName.Data()), fName.Data(), 1200, 1000); | |
287 | ||
288 | gStyle->SetOptStat(0); | |
289 | gStyle->SetOptFit(0); | |
290 | ||
291 | gStyle->SetPadLeftMargin(0.05); | |
292 | ||
293 | c->Divide(3,3); | |
294 | ||
295 | c->Draw(); | |
296 | ||
297 | c->cd(1); | |
298 | ||
299 | // this is not really a nice way to do it... | |
300 | c->GetPad(1)->Delete(); | |
301 | ||
302 | TLatex* name = new TLatex(0.1,0.8,fName.Data()); | |
303 | name->SetTextSize(0.02); | |
304 | name->DrawClone(); | |
305 | ||
306 | c->cd(2); | |
307 | fhDigits->Draw(); | |
308 | ||
309 | c->cd(3); | |
310 | fhSignal->Draw(); | |
311 | ||
312 | return c; | |
313 | } |