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 **************************************************************************/
21 Produces the data needed to calculate the quality assurance.
22 All data must be mergeable objects.
23 Y. Schutz CERN July 2007
26 // --- ROOT system ---
31 #include <TClonesArray.h>
33 // --- Standard library ---
35 // --- AliRoot header files ---
37 #include "AliQADataMaker.h"
38 #include "AliQAChecker.h"
39 #include "AliESDEvent.h"
40 #include "AliRawReader.h"
42 ClassImp(AliQADataMaker)
44 //____________________________________________________________________________
45 AliQADataMaker::AliQADataMaker(const char * name, const char * title) :
54 fRecPointsQAList(0x0),
62 fDetectorDirName = GetName() ;
65 //____________________________________________________________________________
66 AliQADataMaker::AliQADataMaker(const AliQADataMaker& qadm) :
67 TNamed(qadm.GetName(), qadm.GetTitle()),
68 fOutput(qadm.fOutput),
69 fDetectorDir(qadm.fDetectorDir),
70 fDetectorDirName(qadm.fDetectorDirName),
71 fDigitsQAList(qadm.fDigitsQAList),
72 fESDsQAList(qadm.fESDsQAList),
73 fHitsQAList(qadm.fHitsQAList),
74 fRawsQAList(qadm.fRawsQAList),
75 fRecPointsQAList(qadm.fRecPointsQAList),
76 fSDigitsQAList(qadm.fSDigitsQAList),
77 fCurrentCycle(qadm.fCurrentCycle),
79 fCycleCounter(qadm.fCycleCounter),
83 fDetectorDirName = GetName() ;
86 //__________________________________________________________________
87 AliQADataMaker& AliQADataMaker::operator = (const AliQADataMaker& qadm )
89 // Assignment operator.
90 this->~AliQADataMaker();
91 new(this) AliQADataMaker(qadm);
95 //____________________________________________________________________________
96 Int_t AliQADataMaker::Add2List(TH1 * hist, const Int_t index, TList * list)
98 // Set histograms memory resident and add to the list
99 hist->SetDirectory(0) ;
100 list->AddAt(hist, index) ;
101 return list->LastIndex() ;
104 //____________________________________________________________________________
105 void AliQADataMaker::EndOfCycle(AliQA::TASKINDEX task)
107 // Finishes a cycle of QA data acquistion
121 case AliQA::kSDIGITS:
122 list = fSDigitsQAList ;
126 list = fDigitsQAList ;
129 case AliQA::kRECPOINTS:
130 list = fRecPointsQAList ;
133 case AliQA::kTRACKSEGMENTS:
136 case AliQA::kRECPARTICLES:
144 EndOfDetectorCycle(task, list) ;
145 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
150 //____________________________________________________________________________
151 void AliQADataMaker::Exec(AliQA::TASKINDEX task, TObject * data)
153 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
159 AliDebug(1, "Processing Raws QA") ;
160 AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ;
162 MakeRaws(rawReader) ;
164 AliError("Wrong data type") ;
169 AliDebug(1, "Processing Hits QA") ;
170 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
174 TTree * tree = dynamic_cast<TTree *>(data) ;
178 AliWarning("data are neither a TClonesArray nor a TTree") ;
183 case AliQA::kSDIGITS:
185 AliDebug(1, "Processing SDigits QA") ;
186 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
190 TTree * tree = dynamic_cast<TTree *>(data) ;
194 AliWarning("data are neither a TClonesArray nor a TTree") ;
201 AliDebug(1, "Processing Digits QA") ;
202 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
206 TTree * tree = dynamic_cast<TTree *>(data) ;
210 AliWarning("data are neither a TClonesArray nor a TTree") ;
215 case AliQA::kRECPOINTS:
217 AliDebug(1, "Processing RecPoints QA") ;
218 TTree * tree = dynamic_cast<TTree *>(data) ;
220 MakeRecPoints(tree) ;
222 AliWarning("data are not a TTree") ;
226 case AliQA::kTRACKSEGMENTS:
227 AliInfo("Processing Track Segments QA: not existing anymore") ;
228 // MakeTrackSegments(ts) ;
231 case AliQA::kRECPARTICLES:
232 AliInfo("Processing RecParticles QA: not existing anymore") ;
233 // MakeRecParticles(recpar) ;
237 AliDebug(1, "Processing ESDs QA") ;
238 AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ;
242 AliError("Wrong type of esd container") ;
248 //____________________________________________________________________________
249 void AliQADataMaker::Finish() const
251 // write to the output File
255 //____________________________________________________________________________
256 TList * AliQADataMaker::Init(AliQA::TASKINDEX task, Int_t run, Int_t cycles)
258 // general intialisation
267 fRawsQAList = new TList() ;
274 fHitsQAList = new TList() ;
279 case AliQA::kSDIGITS:
281 fSDigitsQAList = new TList() ;
283 return fSDigitsQAList ;
288 fDigitsQAList = new TList();
290 return fDigitsQAList ;
293 case AliQA::kRECPOINTS:
295 fRecPointsQAList = new TList() ;
297 return fRecPointsQAList ;
300 case AliQA::kTRACKSEGMENTS:
301 // InitTrackSegments() ;
304 case AliQA::kRECPARTICLES:
305 // InitRecParticles() ;
310 fESDsQAList = new TList() ;
319 //____________________________________________________________________________
320 void AliQADataMaker::Init(AliQA::TASKINDEX task, TList * list, Int_t run, Int_t cycles)
322 // Intialisation by passing the list of QA data booked elsewhere
339 case AliQA::kSDIGITS:
341 fSDigitsQAList = list ;
346 fDigitsQAList = list ;
349 case AliQA::kRECPOINTS:
351 fRecPointsQAList = list ;
354 case AliQA::kTRACKSEGMENTS:
357 case AliQA::kRECPARTICLES:
368 //____________________________________________________________________________
369 void AliQADataMaker::Reset()
371 // Resets defaut value of data members
376 //____________________________________________________________________________
377 void AliQADataMaker::StartOfCycle(AliQA::TASKINDEX task, const Bool_t sameCycle)
379 // Finishes a cycle of QA data acquistion
381 if ( !sameCycle || fCurrentCycle == -1) {
385 fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ;
387 AliInfo(Form(" Run %d Cycle %d task %s file %s",
388 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
390 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
392 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
394 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
396 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
410 case AliQA::kSDIGITS:
411 list = fSDigitsQAList ;
415 list = fDigitsQAList ;
418 case AliQA::kRECPOINTS:
419 list = fRecPointsQAList ;
422 case AliQA::kTRACKSEGMENTS:
425 case AliQA::kRECPARTICLES:
435 while ( (h = dynamic_cast<TH1 *>(next())) )
438 StartOfDetectorCycle() ;