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 ////////////////////////////////////////////////////////////////////////////
20 // Produces the data needed to calculate the quality assurance. //
21 // All data must be mergeable objects. //
24 // Sylwester Radomski (radomski@physi.uni-heidelberg.de) //
26 ////////////////////////////////////////////////////////////////////////////
28 // --- ROOT system ---
29 #include <TClonesArray.h>
39 // --- AliRoot header files ---
40 //#include "AliESDEvent.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"
52 #include "AliQAChecker.h"
54 ClassImp(AliTRDQADataMakerSim)
56 //____________________________________________________________________________
57 AliTRDQADataMakerSim::AliTRDQADataMakerSim() :
58 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kTRD), "TRD Quality Assurance Data Maker"),
62 // Default constructor
65 //____________________________________________________________________________
66 AliTRDQADataMakerSim::AliTRDQADataMakerSim(const AliTRDQADataMakerSim& qadm) :
74 SetName((const char*)qadm.GetName()) ;
75 SetTitle((const char*)qadm.GetTitle());
79 //__________________________________________________________________
80 AliTRDQADataMakerSim& AliTRDQADataMakerSim::operator=(const AliTRDQADataMakerSim& qadm)
86 this->~AliTRDQADataMakerSim();
87 new(this) AliTRDQADataMakerSim(qadm);
92 //____________________________________________________________________________
93 AliTRDQADataMakerSim::~AliTRDQADataMakerSim()
101 //____________________________________________________________________________
102 void AliTRDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
105 // Detector specific actions at end of cycle
107 ResetEventTrigClasses();
108 //AliDebug(AliQAv1::GetQADebugLevel(), Form("EndOfCycle", "Fitting RecPoints %d", task));
111 AliQAChecker::Instance()->Run(AliQAv1::kTRD, task, list) ;
116 //____________________________________________________________________________
117 void AliTRDQADataMakerSim::InitHits()
120 // Create Hits histograms in Hits subdir
122 const Bool_t expert = kTRUE ;
123 const Bool_t image = kTRUE ;
125 const Int_t kNhist = 4;
128 hist[0] = new TH1F("qaTRD_hits_det", "TRD hits det;Detector Id of the hit;Counts", 540, -0.5, 539.5) ;
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);
134 for(Int_t i=0; i<kNhist; i++) {
136 Add2HitsList(hist[i], i, !expert, image);
139 ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
142 //____________________________________________________________________________
143 void AliTRDQADataMakerSim::InitDigits()
146 // Create Digits histograms in Digits subdir
148 const Bool_t expert = kTRUE ;
149 const Bool_t image = kTRUE ;
151 const Int_t kNhist = 3;
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);
158 for(Int_t i=0; i<kNhist; i++) {
160 Add2DigitsList(hist[i], i, !expert, image);
163 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
166 //____________________________________________________________________________
167 void AliTRDQADataMakerSim::InitSDigits()
170 // Create SDigits histograms in SDigits subdir
172 const Bool_t expert = kTRUE ;
173 const Bool_t image = kTRUE ;
175 const Int_t kNhist = 3;
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);
182 for(Int_t i=0; i<kNhist; i++) {
184 Add2SDigitsList(hist[i], i, !expert, image);
187 ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
190 //____________________________________________________________________________
191 void AliTRDQADataMakerSim::MakeHits()
194 // Make QA data from Hits
197 TIter next(fHitsArray);
200 while ( (hit = dynamic_cast<AliTRDhit *>(next())) ) {
201 FillHitsData(0,hit->GetDetector());
202 Double_t q = TMath::Abs(hit->GetCharge());
204 if (hit->FromDrift()) FillHitsData(1,q);
205 if (hit->FromAmplification()) FillHitsData(2,q);
206 if (hit->FromTRphoton()) FillHitsData(3,q);
210 //____________________________________________________________________________
211 void AliTRDQADataMakerSim::MakeHits(TTree * hitTree)
214 // Make QA data from Hits
217 if (!CheckPointer(hitTree, "TRD hits tree")) return;
219 TBranch *branch = hitTree->GetBranch("TRD");
220 if (!CheckPointer(branch, "TRD hits branch")) return;
222 Int_t nhits = (Int_t)(hitTree->GetTotBytes()/sizeof(AliTRDhit));
224 fHitsArray->Clear() ;
226 fHitsArray = new TClonesArray("AliTRDhit", nhits+1000);
229 Int_t nEntries = (Int_t)branch->GetEntries();
230 for(Int_t i = 0; i < nEntries; i++) {
233 fHitsArray->Clear() ;
236 IncEvCountCycleHits();
237 IncEvCountTotalHits();
241 //____________________________________________________________________________
242 void AliTRDQADataMakerSim::MakeDigits()
245 // Makes data from Digits
251 TIter next(fDigitsArray) ;
252 AliTRDdigit * digit ;
254 // Info("Make digits", "From the arrya");
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());
265 //____________________________________________________________________________
266 void AliTRDQADataMakerSim::MakeDigits(TTree * digits)
269 // Makes data from digits tree
271 // Info("Make digits", "From a tree");
273 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
274 digitsManager->CreateArrays();
275 digitsManager->ReadDigits(digits);
276 static TObjArray histDet,histTime,histSignal;
278 GetMatchingDigitsData(0,&histDet);
279 GetMatchingDigitsData(1,&histTime);
280 GetMatchingDigitsData(2,&histSignal);
282 for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++)
284 AliTRDarrayADC *digitsIn = (AliTRDarrayADC *) digitsManager->GetDigits(i);
286 // This is to take care of switched off super modules
287 if (digitsIn->GetNtime() == 0) continue;
291 //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i);
292 //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i);
294 Int_t nRows = digitsIn->GetNrow();
295 Int_t nCols = digitsIn->GetNcol();
296 Int_t nTbins = digitsIn->GetNtime();
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++)
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);
311 delete digitsManager;
313 IncEvCountCycleDigits();
314 IncEvCountTotalDigits();
318 //____________________________________________________________________________
319 void AliTRDQADataMakerSim::MakeSDigits()
322 // Makes data from Digits
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());
338 //____________________________________________________________________________
339 void AliTRDQADataMakerSim::MakeSDigits(TTree * digits)
342 // Makes data from SDigits
344 // Check id histograms already created for this Event Specie
345 if ( ! GetSDigitsData(0) )
348 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
349 digitsManager->SetSDigits(kTRUE);
350 digitsManager->CreateArrays();
351 digitsManager->ReadDigits(digits);
353 static TObjArray histDet,histTime,histSignal;
355 GetMatchingSDigitsData(0,&histDet);
356 GetMatchingSDigitsData(1,&histTime);
357 GetMatchingSDigitsData(2,&histSignal);
359 for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++)
361 AliTRDarraySignal *digitsIn = (AliTRDarraySignal *) digitsManager->GetSDigits(i);
363 // This is to take care of switched off super modules
364 if (digitsIn->GetNtime() == 0) continue;
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();
374 for(Int_t row = 0; row < nRows; row++)
376 for(Int_t col = 0; col < nCols; col++)
378 for(Int_t time = 0; time < nTbins; time++)
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);
390 delete digitsManager;
392 IncEvCountCycleSDigits();
393 IncEvCountTotalSDigits();
397 //____________________________________________________________________________
398 void AliTRDQADataMakerSim::StartOfDetectorCycle()
401 // Detector specific actions at start of cycle
406 //__________________________________________________________________________
407 Int_t AliTRDQADataMakerSim::CheckPointer(TObject *obj, const char *name)
410 // Checks initialization of pointers
413 if (!obj) AliWarning(Form("null pointer: %s", name));