]>
Commit | Line | Data |
---|---|---|
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 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Produces the data needed to calculate the quality assurance. // | |
21 | // All data must be mergeable objects. // | |
22 | // // | |
23 | // Author: // | |
24 | // Sylwester Radomski (radomski@physi.uni-heidelberg.de) // | |
25 | // // | |
26 | //////////////////////////////////////////////////////////////////////////// | |
27 | ||
28 | // --- ROOT system --- | |
29 | #include <TClonesArray.h> | |
30 | #include <TFile.h> | |
31 | #include <TH1F.h> | |
32 | #include <TH2F.h> | |
33 | #include <TH3F.h> | |
34 | #include <TProfile.h> | |
35 | #include <TF1.h> | |
36 | #include <TCanvas.h> | |
37 | #include <TTree.h> | |
38 | ||
39 | // --- AliRoot header files --- | |
40 | //#include "AliESDEvent.h" | |
41 | #include "AliLog.h" | |
42 | #include "AliTRDdigit.h" | |
43 | #include "AliTRDhit.h" | |
44 | //#include "AliTRDcluster.h" | |
45 | #include "AliTRDQADataMakerSim.h" | |
46 | #include "AliTRDdigitsManager.h" | |
47 | #include "AliTRDgeometry.h" | |
48 | #include "AliTRDarrayADC.h" | |
49 | #include "AliTRDarraySignal.h" | |
50 | //#include "AliTRDrawStream.h" | |
51 | ||
52 | #include "AliQAChecker.h" | |
53 | ||
54 | ClassImp(AliTRDQADataMakerSim) | |
55 | ||
56 | //____________________________________________________________________________ | |
57 | AliTRDQADataMakerSim::AliTRDQADataMakerSim() : | |
58 | AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kTRD), "TRD Quality Assurance Data Maker"), | |
59 | fTmpHits(NULL) | |
60 | { | |
61 | // | |
62 | // Default constructor | |
63 | } | |
64 | ||
65 | //____________________________________________________________________________ | |
66 | AliTRDQADataMakerSim::AliTRDQADataMakerSim(const AliTRDQADataMakerSim& qadm) : | |
67 | AliQADataMakerSim(), | |
68 | fTmpHits(NULL) | |
69 | { | |
70 | // | |
71 | // Copy constructor | |
72 | // | |
73 | ||
74 | SetName((const char*)qadm.GetName()) ; | |
75 | SetTitle((const char*)qadm.GetTitle()); | |
76 | ||
77 | } | |
78 | ||
79 | //__________________________________________________________________ | |
80 | AliTRDQADataMakerSim& AliTRDQADataMakerSim::operator=(const AliTRDQADataMakerSim& qadm) | |
81 | { | |
82 | // | |
83 | // Equal operator. | |
84 | // | |
85 | ||
86 | this->~AliTRDQADataMakerSim(); | |
87 | new(this) AliTRDQADataMakerSim(qadm); | |
88 | return *this; | |
89 | ||
90 | } | |
91 | ||
92 | //____________________________________________________________________________ | |
93 | AliTRDQADataMakerSim::~AliTRDQADataMakerSim() | |
94 | { | |
95 | if (fTmpHits) { | |
96 | fTmpHits->Clear() ; | |
97 | delete fTmpHits ; | |
98 | } | |
99 | } | |
100 | ||
101 | //____________________________________________________________________________ | |
102 | void AliTRDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list) | |
103 | { | |
104 | // | |
105 | // Detector specific actions at end of cycle | |
106 | // | |
107 | ResetEventTrigClasses(); | |
108 | //AliDebug(AliQAv1::GetQADebugLevel(), Form("EndOfCycle", "Fitting RecPoints %d", task)); | |
109 | ||
110 | // call the checker | |
111 | AliQAChecker::Instance()->Run(AliQAv1::kTRD, task, list) ; | |
112 | ||
113 | ||
114 | } | |
115 | ||
116 | //____________________________________________________________________________ | |
117 | void AliTRDQADataMakerSim::InitHits() | |
118 | { | |
119 | // | |
120 | // Create Hits histograms in Hits subdir | |
121 | // | |
122 | const Bool_t expert = kTRUE ; | |
123 | const Bool_t image = kTRUE ; | |
124 | ||
125 | const Int_t kNhist = 4; | |
126 | TH1F *hist[kNhist]; | |
127 | ||
128 | hist[0] = new TH1F("qaTRD_hits_det", "TRD hits det;Detector Id of the hit;Counts", 540, -0.5, 539.5) ; | |
129 | ||
130 | hist[1] = new TH1F("qaTRD_hist_Qdrift", "TRD hits Qdrift;Charge from tracks;Counts", 100, 0, 100); | |
131 | hist[2] = new TH1F("qaTRD_hist_Qamp", "TRD hits Qamp;Charge from TRD photon;Counts", 100, 0, 100); | |
132 | hist[3] = new TH1F("qaTRD_hist_Qphoton", "TRD hits Qphoton;Charge from TRD photon;Counts", 100, 0, 100); | |
133 | ||
134 | for(Int_t i=0; i<kNhist; i++) { | |
135 | //hist[i]->Sumw2(); | |
136 | Add2HitsList(hist[i], i, !expert, image); | |
137 | } | |
138 | // | |
139 | ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line | |
140 | } | |
141 | ||
142 | //____________________________________________________________________________ | |
143 | void AliTRDQADataMakerSim::InitDigits() | |
144 | { | |
145 | // | |
146 | // Create Digits histograms in Digits subdir | |
147 | // | |
148 | const Bool_t expert = kTRUE ; | |
149 | const Bool_t image = kTRUE ; | |
150 | ||
151 | const Int_t kNhist = 3; | |
152 | TH1F *hist[kNhist]; | |
153 | ||
154 | hist[0] = new TH1F("qaTRD_digits_det", "TRD digits det;Detector Id of the digit;Counts", 540, -0.5, 539.5); | |
155 | hist[1] = new TH1F("qaTRD_digits_time", "TRDdigits time;Time bin;Counts", 40, -0.5, 39.5); | |
156 | hist[2] = new TH1F("qaTRD_digits_amp", "TRD digits amp;Amplitude;Counts", 100, -5.5, 94.5); | |
157 | ||
158 | for(Int_t i=0; i<kNhist; i++) { | |
159 | hist[i]->Sumw2(); | |
160 | Add2DigitsList(hist[i], i, !expert, image); | |
161 | } | |
162 | // | |
163 | ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line | |
164 | } | |
165 | ||
166 | //____________________________________________________________________________ | |
167 | void AliTRDQADataMakerSim::InitSDigits() | |
168 | { | |
169 | // | |
170 | // Create SDigits histograms in SDigits subdir | |
171 | // | |
172 | const Bool_t expert = kTRUE ; | |
173 | const Bool_t image = kTRUE ; | |
174 | ||
175 | const Int_t kNhist = 3; | |
176 | TH1F *hist[kNhist]; | |
177 | ||
178 | hist[0] = new TH1F("qaTRD_sdigits_det", "TRD sdigits det;Detector Id of the digit;Counts", 540, -0.5, 539.5); | |
179 | hist[1] = new TH1F("qaTRD_sdigits_time", "TRD sdigits time;Time bin;Counts", 40, -0.5, 39.5); | |
180 | hist[2] = new TH1F("qaTRD_sdigits_amp", "TRD sdigits amp;Amplitude;Counts", 100, 0, 1e7); | |
181 | ||
182 | for(Int_t i=0; i<kNhist; i++) { | |
183 | hist[i]->Sumw2(); | |
184 | Add2SDigitsList(hist[i], i, !expert, image); | |
185 | } | |
186 | // | |
187 | ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line | |
188 | } | |
189 | ||
190 | //____________________________________________________________________________ | |
191 | void AliTRDQADataMakerSim::MakeHits() | |
192 | { | |
193 | // | |
194 | // Make QA data from Hits | |
195 | // | |
196 | ||
197 | TIter next(fHitsArray); | |
198 | AliTRDhit * hit; | |
199 | ||
200 | while ( (hit = dynamic_cast<AliTRDhit *>(next())) ) { | |
201 | FillHitsData(0,hit->GetDetector()); | |
202 | Double_t q = TMath::Abs(hit->GetCharge()); | |
203 | ||
204 | if (hit->FromDrift()) FillHitsData(1,q); | |
205 | if (hit->FromAmplification()) FillHitsData(2,q); | |
206 | if (hit->FromTRphoton()) FillHitsData(3,q); | |
207 | } | |
208 | } | |
209 | ||
210 | //____________________________________________________________________________ | |
211 | void AliTRDQADataMakerSim::MakeHits(TTree * hitTree) | |
212 | { | |
213 | // | |
214 | // Make QA data from Hits | |
215 | // | |
216 | ||
217 | if (!CheckPointer(hitTree, "TRD hits tree")) return; | |
218 | ||
219 | TBranch *branch = hitTree->GetBranch("TRD"); | |
220 | if (!CheckPointer(branch, "TRD hits branch")) return; | |
221 | ||
222 | Int_t nhits = (Int_t)(hitTree->GetTotBytes()/sizeof(AliTRDhit)); | |
223 | if (fHitsArray) | |
224 | fHitsArray->Clear() ; | |
225 | else | |
226 | fHitsArray = new TClonesArray("AliTRDhit", nhits+1000); | |
227 | ||
228 | //Int_t index = 0; | |
229 | Int_t nEntries = (Int_t)branch->GetEntries(); | |
230 | for(Int_t i = 0; i < nEntries; i++) { | |
231 | branch->GetEntry(i); | |
232 | MakeHits(); | |
233 | fHitsArray->Clear() ; | |
234 | } | |
235 | // | |
236 | IncEvCountCycleHits(); | |
237 | IncEvCountTotalHits(); | |
238 | // | |
239 | } | |
240 | ||
241 | //____________________________________________________________________________ | |
242 | void AliTRDQADataMakerSim::MakeDigits() | |
243 | { | |
244 | // | |
245 | // Makes data from Digits | |
246 | // | |
247 | ||
248 | if (!fDigitsArray) | |
249 | return ; | |
250 | ||
251 | TIter next(fDigitsArray) ; | |
252 | AliTRDdigit * digit ; | |
253 | ||
254 | // Info("Make digits", "From the arrya"); | |
255 | ||
256 | while ( (digit = dynamic_cast<AliTRDdigit *>(next())) ) { | |
257 | if (digit->GetAmp() < 1) continue; | |
258 | FillDigitsData(0,digit->GetDetector()); | |
259 | FillDigitsData(1,digit->GetTime()); | |
260 | FillDigitsData(2,digit->GetAmp()); | |
261 | } | |
262 | ||
263 | } | |
264 | ||
265 | //____________________________________________________________________________ | |
266 | void AliTRDQADataMakerSim::MakeDigits(TTree * digits) | |
267 | { | |
268 | // | |
269 | // Makes data from digits tree | |
270 | // | |
271 | // Info("Make digits", "From a tree"); | |
272 | ||
273 | AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(); | |
274 | digitsManager->CreateArrays(); | |
275 | digitsManager->ReadDigits(digits); | |
276 | static TObjArray histDet,histTime,histSignal; | |
277 | // | |
278 | GetMatchingDigitsData(0,&histDet); | |
279 | GetMatchingDigitsData(1,&histTime); | |
280 | GetMatchingDigitsData(2,&histSignal); | |
281 | ||
282 | for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) | |
283 | { | |
284 | AliTRDarrayADC *digitsIn = (AliTRDarrayADC *) digitsManager->GetDigits(i); | |
285 | ||
286 | // This is to take care of switched off super modules | |
287 | if (digitsIn->GetNtime() == 0) continue; | |
288 | ||
289 | digitsIn->Expand(); | |
290 | ||
291 | //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i); | |
292 | //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i); | |
293 | ||
294 | Int_t nRows = digitsIn->GetNrow(); | |
295 | Int_t nCols = digitsIn->GetNcol(); | |
296 | Int_t nTbins = digitsIn->GetNtime(); | |
297 | ||
298 | for(Int_t row = 0; row < nRows; row++) | |
299 | for(Int_t col = 0; col < nCols; col++) | |
300 | for(Int_t time = 0; time < nTbins; time++) | |
301 | { | |
302 | Float_t signal = digitsIn->GetData(row,col,time); | |
303 | if (signal < 1) continue; | |
304 | for (int ih=histDet.GetEntriesFast();ih--;) ((TH1*)histDet.UncheckedAt(ih))->Fill(i); | |
305 | for (int ih=histTime.GetEntriesFast();ih--;) ((TH1*)histTime.UncheckedAt(ih))->Fill(time); | |
306 | for (int ih=histSignal.GetEntriesFast();ih--;) ((TH1*)histSignal.UncheckedAt(ih))->Fill(signal); | |
307 | } | |
308 | ||
309 | //delete digitsIn; | |
310 | } | |
311 | delete digitsManager; | |
312 | // | |
313 | IncEvCountCycleDigits(); | |
314 | IncEvCountTotalDigits(); | |
315 | // | |
316 | } | |
317 | ||
318 | //____________________________________________________________________________ | |
319 | void AliTRDQADataMakerSim::MakeSDigits() | |
320 | { | |
321 | // | |
322 | // Makes data from Digits | |
323 | // | |
324 | ||
325 | if (!fSDigitsArray) | |
326 | return ; | |
327 | ||
328 | TIter next(fSDigitsArray) ; | |
329 | AliTRDdigit * digit ; | |
330 | while ( (digit = dynamic_cast<AliTRDdigit *>(next())) ) { | |
331 | FillDigitsData(0,digit->GetDetector()); | |
332 | FillDigitsData(1,digit->GetTime()); | |
333 | FillDigitsData(2,digit->GetAmp()); | |
334 | } | |
335 | ||
336 | } | |
337 | ||
338 | //____________________________________________________________________________ | |
339 | void AliTRDQADataMakerSim::MakeSDigits(TTree * digits) | |
340 | { | |
341 | // | |
342 | // Makes data from SDigits | |
343 | // | |
344 | // Check id histograms already created for this Event Specie | |
345 | if ( ! GetSDigitsData(0) ) | |
346 | InitSDigits() ; | |
347 | ||
348 | AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(); | |
349 | digitsManager->SetSDigits(kTRUE); | |
350 | digitsManager->CreateArrays(); | |
351 | digitsManager->ReadDigits(digits); | |
352 | ||
353 | static TObjArray histDet,histTime,histSignal; | |
354 | // | |
355 | GetMatchingSDigitsData(0,&histDet); | |
356 | GetMatchingSDigitsData(1,&histTime); | |
357 | GetMatchingSDigitsData(2,&histSignal); | |
358 | ||
359 | for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) | |
360 | { | |
361 | AliTRDarraySignal *digitsIn = (AliTRDarraySignal *) digitsManager->GetSDigits(i); | |
362 | ||
363 | // This is to take care of switched off super modules | |
364 | if (digitsIn->GetNtime() == 0) continue; | |
365 | ||
366 | digitsIn->Expand(); | |
367 | ||
368 | //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i); | |
369 | //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i); | |
370 | Int_t nRows = digitsIn->GetNrow(); | |
371 | Int_t nCols = digitsIn->GetNcol(); | |
372 | Int_t nTbins = digitsIn->GetNtime(); | |
373 | ||
374 | for(Int_t row = 0; row < nRows; row++) | |
375 | { | |
376 | for(Int_t col = 0; col < nCols; col++) | |
377 | { | |
378 | for(Int_t time = 0; time < nTbins; time++) | |
379 | { | |
380 | Float_t signal = digitsIn->GetData(row,col,time); | |
381 | if (signal < 1) continue; | |
382 | for (int ih=histDet.GetEntriesFast();ih--;) ((TH1*)histDet.UncheckedAt(ih))->Fill(i); | |
383 | for (int ih=histTime.GetEntriesFast();ih--;) ((TH1*)histTime.UncheckedAt(ih))->Fill(time); | |
384 | for (int ih=histSignal.GetEntriesFast();ih--;) ((TH1*)histSignal.UncheckedAt(ih))->Fill(signal); | |
385 | } | |
386 | } | |
387 | } | |
388 | // delete digitsIn; | |
389 | } | |
390 | delete digitsManager; | |
391 | // | |
392 | IncEvCountCycleSDigits(); | |
393 | IncEvCountTotalSDigits(); | |
394 | // | |
395 | } | |
396 | ||
397 | //____________________________________________________________________________ | |
398 | void AliTRDQADataMakerSim::StartOfDetectorCycle() | |
399 | { | |
400 | // | |
401 | // Detector specific actions at start of cycle | |
402 | // | |
403 | ||
404 | } | |
405 | ||
406 | //__________________________________________________________________________ | |
407 | Int_t AliTRDQADataMakerSim::CheckPointer(TObject *obj, const char *name) | |
408 | { | |
409 | // | |
410 | // Checks initialization of pointers | |
411 | // | |
412 | ||
413 | if (!obj) AliWarning(Form("null pointer: %s", name)); | |
414 | return !!obj; | |
415 | ||
416 | } |