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, TObjArray * list)
98 // Set histograms memory resident and add to the list
99 hist->SetDirectory(0) ;
100 list->AddAtAndExpand(hist, index) ;
101 return list->GetLast() ;
104 //____________________________________________________________________________
105 void AliQADataMaker::EndOfCycle(AliQA::TASKINDEX task)
107 // Finishes a cycle of QA data acquistion
109 TObjArray * list = 0x0 ;
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:
143 case AliQA::kNTASKINDEX:
147 EndOfDetectorCycle(task, list) ;
148 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
153 //____________________________________________________________________________
154 void AliQADataMaker::Exec(AliQA::TASKINDEX task, TObject * data)
156 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
162 AliDebug(1, "Processing Raws QA") ;
163 AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ;
165 MakeRaws(rawReader) ;
167 AliError("Wrong data type") ;
172 AliDebug(1, "Processing Hits QA") ;
173 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
177 TTree * tree = dynamic_cast<TTree *>(data) ;
181 AliWarning("data are neither a TClonesArray nor a TTree") ;
186 case AliQA::kSDIGITS:
188 AliDebug(1, "Processing SDigits QA") ;
189 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
193 TTree * tree = dynamic_cast<TTree *>(data) ;
197 AliWarning("data are neither a TClonesArray nor a TTree") ;
204 AliDebug(1, "Processing Digits QA") ;
205 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
209 TTree * tree = dynamic_cast<TTree *>(data) ;
213 AliWarning("data are neither a TClonesArray nor a TTree") ;
218 case AliQA::kRECPOINTS:
220 AliDebug(1, "Processing RecPoints QA") ;
221 TTree * tree = dynamic_cast<TTree *>(data) ;
223 MakeRecPoints(tree) ;
225 AliWarning("data are not a TTree") ;
229 case AliQA::kTRACKSEGMENTS:
230 AliInfo("Processing Track Segments QA: not existing anymore") ;
231 // MakeTrackSegments(ts) ;
234 case AliQA::kRECPARTICLES:
235 AliInfo("Processing RecParticles QA: not existing anymore") ;
236 // MakeRecParticles(recpar) ;
240 AliDebug(1, "Processing ESDs QA") ;
241 AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ;
245 AliError("Wrong type of esd container") ;
248 case AliQA::kNTASKINDEX:
253 //____________________________________________________________________________
254 void AliQADataMaker::Finish() const
256 // write to the output File
260 //____________________________________________________________________________
261 TObjArray * AliQADataMaker::Init(AliQA::TASKINDEX task, Int_t run, Int_t cycles)
263 // general intialisation
272 fRawsQAList = new TObjArray(100) ;
279 fHitsQAList = new TObjArray(100) ;
284 case AliQA::kSDIGITS:
286 fSDigitsQAList = new TObjArray(100) ;
288 return fSDigitsQAList ;
293 fDigitsQAList = new TObjArray(100);
295 return fDigitsQAList ;
298 case AliQA::kRECPOINTS:
300 fRecPointsQAList = new TObjArray(100) ;
302 return fRecPointsQAList ;
305 case AliQA::kTRACKSEGMENTS:
306 // InitTrackSegments() ;
309 case AliQA::kRECPARTICLES:
310 // InitRecParticles() ;
315 fESDsQAList = new TObjArray(100) ;
320 case AliQA::kNTASKINDEX:
326 //____________________________________________________________________________
327 void AliQADataMaker::Init(AliQA::TASKINDEX task, TObjArray * list, Int_t run, Int_t cycles)
329 // Intialisation by passing the list of QA data booked elsewhere
346 case AliQA::kSDIGITS:
348 fSDigitsQAList = list ;
353 fDigitsQAList = list ;
356 case AliQA::kRECPOINTS:
358 fRecPointsQAList = list ;
361 case AliQA::kTRACKSEGMENTS:
364 case AliQA::kRECPARTICLES:
372 case AliQA::kNTASKINDEX:
377 //____________________________________________________________________________
378 void AliQADataMaker::Reset()
380 // Resets defaut value of data members
385 //____________________________________________________________________________
386 void AliQADataMaker::StartOfCycle(AliQA::TASKINDEX task, const Bool_t sameCycle)
388 // Finishes a cycle of QA data acquistion
390 if ( !sameCycle || fCurrentCycle == -1) {
394 fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ;
396 AliInfo(Form(" Run %d Cycle %d task %s file %s",
397 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
399 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
401 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
403 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
405 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
408 TObjArray * list = 0x0 ;
419 case AliQA::kSDIGITS:
420 list = fSDigitsQAList ;
424 list = fDigitsQAList ;
427 case AliQA::kRECPOINTS:
428 list = fRecPointsQAList ;
431 case AliQA::kTRACKSEGMENTS:
434 case AliQA::kRECPARTICLES:
441 case AliQA::kNTASKINDEX:
447 while ( (h = dynamic_cast<TH1 *>(next())) )
450 StartOfDetectorCycle() ;