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 ---
31 // --- Standard library ---
33 // --- AliRoot header files ---
35 #include "AliQADataMakerRec.h"
36 #include "AliESDEvent.h"
37 #include "AliRawReader.h"
39 ClassImp(AliQADataMakerRec)
41 //____________________________________________________________________________
42 AliQADataMakerRec::AliQADataMakerRec(const char * name, const char * title) :
43 AliQADataMaker(name, title),
46 fRecPointsQAList(NULL),
51 fDetectorDirName = GetName() ;
54 //____________________________________________________________________________
55 AliQADataMakerRec::AliQADataMakerRec(const AliQADataMakerRec& qadm) :
56 AliQADataMaker(qadm.GetName(), qadm.GetTitle()),
57 fESDsQAList(qadm.fESDsQAList),
58 fRawsQAList(qadm.fRawsQAList),
59 fRecPointsQAList(qadm.fRecPointsQAList),
60 fCorrNt(qadm.fCorrNt),
61 fRecoParam(qadm.fRecoParam)
64 SetName(qadm.GetName()) ;
65 SetTitle(qadm.GetTitle()) ;
66 fDetectorDirName = GetName() ;
69 //____________________________________________________________________________
70 AliQADataMakerRec::~AliQADataMakerRec()
72 //dtor: delete the TObjArray and thei content
74 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
75 if ( fESDsQAList[specie] ) {
76 if ( fESDsQAList[specie]->IsOwner() )
77 fESDsQAList[specie]->Delete() ;
80 delete[] fESDsQAList ;
83 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
84 if ( fRawsQAList[specie] ) {
85 if ( fRawsQAList[specie]->IsOwner() )
86 fRawsQAList[specie]->Delete() ;
89 delete[] fRawsQAList ;
91 if ( fRecPointsQAList ) {
92 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
93 if ( fRecPointsQAList[specie] ) {
94 if ( fRecPointsQAList[specie]->IsOwner() )
95 fRecPointsQAList[specie]->Delete() ;
98 delete[] fRecPointsQAList ;
102 //__________________________________________________________________
103 AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm )
105 // Assignment operator.
106 this->~AliQADataMakerRec();
107 new(this) AliQADataMakerRec(qadm);
111 //____________________________________________________________________________
112 void AliQADataMakerRec::EndOfCycle()
114 // Finishes a cycle of QA for all the tasks
115 EndOfCycle(AliQA::kRAWS) ;
116 EndOfCycle(AliQA::kRECPOINTS) ;
117 EndOfCycle(AliQA::kESDS) ;
121 //____________________________________________________________________________
122 void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX_t task)
124 // Finishes a cycle of QA
126 TObjArray ** list = NULL ;
128 if ( task == AliQA::kRAWS )
130 else if ( task == AliQA::kRECPOINTS )
131 list = fRecPointsQAList ;
132 else if ( task == AliQA::kESDS )
136 if ( ! list && ! fCorrNt )
138 //DefaultEndOfDetectorCycle(task) ;
139 EndOfDetectorCycle(task, list) ;
140 TDirectory * subDir = NULL ;
142 subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
145 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
146 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ;
147 if (eventSpecieDir) {
148 eventSpecieDir->cd() ;
150 TIter next(list[specie]) ;
152 while( (obj = next()) ) {
153 if (!obj->TestBit(AliQA::GetExpertBit()))
157 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQA::GetExpert()) ;
158 if ( expertDir ) { // Write only if requested
161 while( (obj = next()) ) {
162 if (!obj->TestBit(AliQA::GetExpertBit()))
171 if (fCorrNt[specie] && AliQA::GetDetIndex(GetName()) == AliQA::kCORR) {
172 eventSpecieDir->cd() ;
173 fCorrNt[specie]->Write() ;
181 //____________________________________________________________________________
182 void AliQADataMakerRec::Exec(AliQA::TASKINDEX_t task, TObject * data)
184 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
186 if ( task == AliQA::kRAWS ) {
187 AliDebug(1, "Processing Raws QA") ;
188 AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ;
190 MakeRaws(rawReader) ;
192 AliInfo("Raw data are not processed") ;
193 } else if ( task == AliQA::kRECPOINTS ) {
194 AliDebug(1, "Processing RecPoints QA") ;
195 TTree * tree = dynamic_cast<TTree *>(data) ;
197 MakeRecPoints(tree) ;
199 AliWarning("data are not a TTree") ;
201 } else if ( task == AliQA::kESDS ) {
202 AliDebug(1, "Processing ESDs QA") ;
203 AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ;
207 AliError("Wrong type of esd container") ;
211 //____________________________________________________________________________
212 TObjArray ** AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t cycles)
214 // general intialisation
216 TObjArray ** rv = NULL ;
221 if ( task == AliQA::kRAWS ) {
222 if (! fRawsQAList ) {
223 fRawsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
224 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
225 fRawsQAList[specie] = new TObjArray(100) ;
226 fRawsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
231 } else if ( task == AliQA::kRECPOINTS ) {
232 if ( ! fRecPointsQAList ) {
233 fRecPointsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
234 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
235 fRecPointsQAList[specie] = new TObjArray(100) ;
236 fRecPointsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
240 rv = fRecPointsQAList ;
241 } else if ( task == AliQA::kESDS ) {
242 if ( ! fESDsQAList ) {
243 fESDsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
244 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
245 fESDsQAList[specie] = new TObjArray(100) ;
246 fESDsQAList[specie]->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
255 //____________________________________________________________________________
256 void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
258 // Intialisation by passing the list of QA data booked elsewhere
264 if ( task == AliQA::kRAWS ) {
266 } else if ( task == AliQA::kRECPOINTS ) {
267 fRecPointsQAList = list ;
268 } else if ( task == AliQA::kESDS ) {
273 //____________________________________________________________________________
274 void AliQADataMakerRec::StartOfCycle(Int_t run)
276 // Finishes a cycle of QA for all the tasks
277 Bool_t samecycle = kFALSE ;
278 StartOfCycle(AliQA::kRAWS, run, samecycle) ;
280 StartOfCycle(AliQA::kRECPOINTS, run, samecycle) ;
281 StartOfCycle(AliQA::kESDS, run, samecycle) ;
284 //____________________________________________________________________________
285 void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
287 // Finishes a cycle of QA data acquistion
290 if ( !sameCycle || fCurrentCycle == -1) {
294 fOutput = AliQA::GetQADataFile(GetName(), fRun) ;
296 AliInfo(Form(" Run %d Cycle %d task %s file %s",
297 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
299 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
301 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
303 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
305 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
307 for ( Int_t specie = AliRecoParam::kDefault ; specie < AliRecoParam::kNSpecies ; specie++ ) {
308 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ;
310 eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ;
311 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQA::GetExpert()) ;
313 expertDir = eventSpecieDir->mkdir(AliQA::GetExpert()) ;
315 StartOfDetectorCycle() ;