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 notifce *
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 for Reconstruction
22 // All data must be mergeable objects.
23 // Y. Schutz CERN July 2007
26 // --- ROOT system ---
30 // --- Standard library ---
32 // --- AliRoot header files ---
34 #include "AliQADataMakerRec.h"
35 #include "AliESDEvent.h"
36 #include "AliRawReader.h"
38 ClassImp(AliQADataMakerRec)
40 //____________________________________________________________________________
41 AliQADataMakerRec::AliQADataMakerRec(const char * name, const char * title) :
42 AliQADataMaker(name, title),
45 fRecPointsQAList(NULL),
50 fDetectorDirName = GetName() ;
53 //____________________________________________________________________________
54 AliQADataMakerRec::AliQADataMakerRec(const AliQADataMakerRec& qadm) :
55 AliQADataMaker(qadm.GetName(), qadm.GetTitle()),
56 fESDsQAList(qadm.fESDsQAList),
57 fRawsQAList(qadm.fRawsQAList),
58 fRecPointsQAList(qadm.fRecPointsQAList),
59 fObject(qadm.fObject),
60 fRecoParam(qadm.fRecoParam)
63 SetName(qadm.GetName()) ;
64 SetTitle(qadm.GetTitle()) ;
65 fDetectorDirName = GetName() ;
68 //____________________________________________________________________________
69 AliQADataMakerRec::~AliQADataMakerRec()
71 //dtor: delete the TObjArray and thei content
73 if ( fESDsQAList->IsOwner() )
74 fESDsQAList->Delete() ;
78 if ( fRawsQAList->IsOwner() )
79 fRawsQAList->Delete() ;
82 if ( fRecPointsQAList ) {
83 if ( fRecPointsQAList->IsOwner() )
84 fRecPointsQAList->Delete() ;
85 delete fRecPointsQAList ;
89 //__________________________________________________________________
90 AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm )
92 // Assignment operator.
93 this->~AliQADataMakerRec();
94 new(this) AliQADataMakerRec(qadm);
98 //____________________________________________________________________________
99 void AliQADataMakerRec::EndOfCycle()
101 // Finishes a cycle of QA for all the tasks
102 EndOfCycle(AliQA::kRAWS) ;
103 EndOfCycle(AliQA::kRECPOINTS) ;
104 EndOfCycle(AliQA::kESDS) ;
108 //____________________________________________________________________________
109 void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX_t task)
111 // Finishes a cycle of QA
113 TObjArray * list = NULL ;
115 if ( task == AliQA::kRAWS )
117 else if ( task == AliQA::kRECPOINTS )
118 list = fRecPointsQAList ;
119 else if ( task == AliQA::kESDS )
123 if ( ! list && ! fObject )
125 //DefaultEndOfDetectorCycle(task) ;
126 EndOfDetectorCycle(task, list) ;
127 TDirectory * subDir = NULL ;
129 subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
135 while( (obj = next()) ) {
136 if (!obj->TestBit(AliQA::GetExpertBit()))
140 TDirectory * expertDir = subDir->GetDirectory(AliQA::GetExpert()) ;
141 if ( expertDir ) { // Write only if requested
144 while( (obj = next()) ) {
145 if (!obj->TestBit(AliQA::GetExpertBit()))
152 if (fObject && AliQA::GetDetIndex(GetName()) == AliQA::kCORR) {
160 //____________________________________________________________________________
161 void AliQADataMakerRec::Exec(AliQA::TASKINDEX_t task, TObject * data)
163 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
165 if ( task == AliQA::kRAWS ) {
166 AliDebug(1, "Processing Raws QA") ;
167 AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ;
169 MakeRaws(rawReader) ;
171 AliInfo("Raw data are not processed") ;
172 } else if ( task == AliQA::kRECPOINTS ) {
173 AliDebug(1, "Processing RecPoints QA") ;
174 TTree * tree = dynamic_cast<TTree *>(data) ;
176 MakeRecPoints(tree) ;
178 AliWarning("data are not a TTree") ;
180 } else if ( task == AliQA::kESDS ) {
181 AliDebug(1, "Processing ESDs QA") ;
182 AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ;
186 AliError("Wrong type of esd container") ;
190 //____________________________________________________________________________
191 TObjArray * AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t cycles)
193 // general intialisation
195 TObjArray * rv = NULL ;
200 if ( task == AliQA::kRAWS ) {
201 if (! fRawsQAList ) {
202 fRawsQAList = new TObjArray(100) ;
203 fRawsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
207 } else if ( task == AliQA::kRECPOINTS ) {
208 if ( ! fRecPointsQAList ) {
209 fRecPointsQAList = new TObjArray(100) ;
210 fRecPointsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
213 rv = fRecPointsQAList ;
214 } else if ( task == AliQA::kESDS ) {
215 if ( ! fESDsQAList ) {
216 fESDsQAList = new TObjArray(100) ;
217 fESDsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
226 //____________________________________________________________________________
227 void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles)
229 // Intialisation by passing the list of QA data booked elsewhere
235 if ( task == AliQA::kRAWS ) {
237 } else if ( task == AliQA::kRECPOINTS ) {
238 fRecPointsQAList = list ;
239 } else if ( task == AliQA::kESDS ) {
244 //____________________________________________________________________________
245 void AliQADataMakerRec::StartOfCycle(Int_t run)
247 // Finishes a cycle of QA for all the tasks
248 Bool_t samecycle = kFALSE ;
249 StartOfCycle(AliQA::kRAWS, run, samecycle) ;
251 StartOfCycle(AliQA::kRECPOINTS, run, samecycle) ;
252 StartOfCycle(AliQA::kESDS, run, samecycle) ;
255 //____________________________________________________________________________
256 void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
258 // Finishes a cycle of QA data acquistion
261 if ( !sameCycle || fCurrentCycle == -1) {
265 fOutput = AliQA::GetQADataFile(GetName(), fRun) ;
267 AliInfo(Form(" Run %d Cycle %d task %s file %s",
268 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
270 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
272 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
274 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
276 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
278 TDirectory * expertDir = subDir->GetDirectory(AliQA::GetExpert()) ;
280 expertDir = subDir->mkdir(AliQA::GetExpert()) ;
285 StartOfDetectorCycle() ;