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 ---
30 #include <TClonesArray.h>
32 // --- Standard library ---
34 // --- AliRoot header files ---
36 #include "AliQADataMakerSim.h"
38 ClassImp(AliQADataMakerSim)
40 //____________________________________________________________________________
41 AliQADataMakerSim::AliQADataMakerSim(const char * name, const char * title) :
42 AliQADataMaker(name, title),
48 fDetectorDirName = GetName() ;
51 //____________________________________________________________________________
52 AliQADataMakerSim::AliQADataMakerSim(const AliQADataMakerSim& qadm) :
53 AliQADataMaker(qadm.GetName(), qadm.GetTitle()),
54 fDigitsQAList(qadm.fDigitsQAList),
55 fHitsQAList(qadm.fHitsQAList),
56 fSDigitsQAList(qadm.fSDigitsQAList)
59 fDetectorDirName = GetName() ;
62 //____________________________________________________________________________
63 AliQADataMakerSim::~AliQADataMakerSim()
65 //dtor: delete the TObjArray and thei content
66 if ( fDigitsQAList ) {
67 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
68 if ( fDigitsQAList[specie]->IsOwner() )
69 fDigitsQAList[specie]->Delete() ;
71 delete[] fDigitsQAList ;
74 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
75 if ( fHitsQAList[specie]->IsOwner() )
76 fHitsQAList[specie]->Delete() ;
78 delete[] fHitsQAList ;
80 if ( fSDigitsQAList ) {
81 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
82 if ( fSDigitsQAList[specie]->IsOwner() )
83 fSDigitsQAList[specie]->Delete() ;
85 delete[] fSDigitsQAList ;
89 //__________________________________________________________________
90 AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm )
92 // Assignment operator.
93 this->~AliQADataMakerSim();
94 new(this) AliQADataMakerSim(qadm);
98 //____________________________________________________________________________
99 void AliQADataMakerSim::EndOfCycle()
101 // Finishes a cycle of QA for all tasks
102 EndOfCycle(AliQAv1::kHITS) ;
103 EndOfCycle(AliQAv1::kSDIGITS) ;
104 EndOfCycle(AliQAv1::kDIGITS) ;
108 //____________________________________________________________________________
109 void AliQADataMakerSim::EndOfCycle(AliQAv1::TASKINDEX_t task)
111 // Finishes a cycle of QA data acquistion
112 TObjArray ** list = NULL ;
114 if ( task == AliQAv1::kHITS )
116 else if ( task == AliQAv1::kSDIGITS )
117 list = fSDigitsQAList ;
118 else if ( task == AliQAv1::kDIGITS )
119 list = fDigitsQAList ;
123 EndOfDetectorCycle(task, list) ;
124 TDirectory * subDir = NULL ;
126 subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
129 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
130 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ;
131 if (eventSpecieDir) {
132 eventSpecieDir->cd() ;
133 TIter next(list[specie]) ;
135 while ( (obj = next()) ) {
136 if (!obj->TestBit(AliQAv1::GetExpertBit()))
140 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
144 while ( (obj = next()) ) {
145 if (!obj->TestBit(AliQAv1::GetExpertBit()))
159 //____________________________________________________________________________
160 void AliQADataMakerSim::Exec(AliQAv1::TASKINDEX_t task, TObject * data)
162 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
164 if ( task == AliQAv1::kHITS ) {
165 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Hits QA") ;
166 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
170 TTree * tree = dynamic_cast<TTree *>(data) ;
174 AliWarning("data are neither a TClonesArray nor a TTree") ;
177 } else if ( task == AliQAv1::kSDIGITS ) {
178 AliDebug(AliQAv1::GetQADebugLevel(), "Processing SDigits QA") ;
179 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
183 TTree * tree = dynamic_cast<TTree *>(data) ;
187 AliWarning("data are neither a TClonesArray nor a TTree") ;
190 } else if ( task == AliQAv1::kDIGITS ) {
191 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Digits QA") ;
192 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
196 TTree * tree = dynamic_cast<TTree *>(data) ;
200 AliWarning("data are neither a TClonesArray nor a TTree") ;
206 //____________________________________________________________________________
207 void AliQADataMakerSim::MakeImage(AliQAv1::TASKINDEX_t task)
209 // create a drawing of detetor defined histograms
210 TObjArray ** list = NULL ;
217 case AliQAv1::kSDIGITS:
218 list = fSDigitsQAList ;
220 case AliQAv1::kDIGITS:
221 list = fDigitsQAList ;
223 case AliQAv1::kDIGITSR:
225 case AliQAv1::kRECPOINTS:
227 case AliQAv1::kTRACKSEGMENTS:
229 case AliQAv1::kRECPARTICLES:
233 case AliQAv1::kNTASKINDEX:
239 AliFatal("data not initialized, call AliQADataMaker::Init");
242 MakeTheImage(list, task, "Sim") ;
245 //____________________________________________________________________________
246 TObjArray ** AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, Int_t cycles)
248 // general intialisation
252 TObjArray ** rv = NULL ;
253 if ( task == AliQAv1::kHITS ) {
254 if ( ! fHitsQAList ) {
255 fHitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
256 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
257 fHitsQAList[specie] = new TObjArray(100) ;
258 fHitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
263 } else if ( task == AliQAv1::kSDIGITS ) {
264 if ( ! fSDigitsQAList ) {
265 fSDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
266 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
267 fSDigitsQAList[specie] = new TObjArray(100) ;
268 fSDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
272 rv = fSDigitsQAList ;
273 } else if ( task == AliQAv1::kDIGITS ) {
274 if ( ! fDigitsQAList ) {
275 fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
276 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
277 fDigitsQAList[specie] = new TObjArray(100) ;
278 fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
288 //____________________________________________________________________________
289 void AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
291 // Intialisation by passing the list of QA data booked elsewhere
297 if ( task == AliQAv1::kHITS ) {
299 } else if ( task == AliQAv1::kSDIGITS) {
300 fSDigitsQAList = list ;
301 } else if ( task == AliQAv1::kDIGITS ) {
302 fDigitsQAList = list ;
306 //____________________________________________________________________________
307 void AliQADataMakerSim::StartOfCycle(Int_t run)
309 // Finishes a cycle of QA for all tasks
310 Bool_t samecycle = kFALSE ;
311 StartOfCycle(AliQAv1::kHITS, run, samecycle) ;
313 StartOfCycle(AliQAv1::kSDIGITS, run, samecycle) ;
314 StartOfCycle(AliQAv1::kDIGITS, run, samecycle) ;
317 //____________________________________________________________________________
318 void AliQADataMakerSim::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
320 // Finishes a cycle of QA data acquistion
323 if ( !sameCycle || fCurrentCycle == -1) {
327 fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ;
330 AliDebug(AliQAv1::GetQADebugLevel(), Form(" Run %d Cycle %d task %s file %s",
331 fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ;
333 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
335 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
337 TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
339 subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
341 for ( Int_t index = AliRecoParam::kDefault ; index < AliRecoParam::kNSpecies ; index++ ) {
342 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(index)) ;
344 eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(index)) ;
345 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
347 expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
349 StartOfDetectorCycle() ;