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 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
126 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
127 TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
129 subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
131 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
132 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) )
134 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ;
136 eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ;
137 eventSpecieDir->cd() ;
138 TIter next(list[specie]) ;
140 while ( (obj = next()) ) {
141 if (!obj->TestBit(AliQAv1::GetExpertBit()))
145 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
147 expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
150 while ( (obj = next()) ) {
151 if (!obj->TestBit(AliQAv1::GetExpertBit()))
162 //____________________________________________________________________________
163 void AliQADataMakerSim::Exec(AliQAv1::TASKINDEX_t task, TObject * data)
165 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
167 if ( task == AliQAv1::kHITS ) {
168 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Hits QA") ;
169 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
170 TClonesArray * arr = static_cast<TClonesArray *>(data) ;
172 } else if (strcmp(data->ClassName(), "TTree") == 0) {
173 TTree * tree = static_cast<TTree *>(data) ;
176 AliWarning("data are neither a TClonesArray nor a TTree") ;
178 } else if ( task == AliQAv1::kSDIGITS ) {
179 AliDebug(AliQAv1::GetQADebugLevel(), "Processing SDigits QA") ;
180 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
181 TClonesArray * arr = static_cast<TClonesArray *>(data) ;
183 } else if (strcmp(data->ClassName(), "TTree") == 0) {
184 TTree * tree = static_cast<TTree *>(data) ;
187 AliWarning("data are neither a TClonesArray nor a TTree") ;
189 } else if ( task == AliQAv1::kDIGITS ) {
190 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Digits QA") ;
191 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
192 TClonesArray * arr = static_cast<TClonesArray *>(data) ;
194 } else if (strcmp(data->ClassName(), "TTree") == 0) {
195 TTree * tree = static_cast<TTree *>(data) ;
198 AliWarning("data are neither a TClonesArray nor a TTree") ;
203 //____________________________________________________________________________
204 void AliQADataMakerSim::MakeImage(AliQAv1::TASKINDEX_t task)
206 // create a drawing of detetor defined histograms
207 TObjArray ** list = NULL ;
214 case AliQAv1::kSDIGITS:
215 list = fSDigitsQAList ;
217 case AliQAv1::kDIGITS:
218 list = fDigitsQAList ;
220 case AliQAv1::kDIGITSR:
222 case AliQAv1::kRECPOINTS:
224 case AliQAv1::kTRACKSEGMENTS:
226 case AliQAv1::kRECPARTICLES:
230 case AliQAv1::kNTASKINDEX:
236 AliFatal("data not initialized, call AliQADataMaker::Init");
239 MakeTheImage(list, task, "Sim") ;
242 //____________________________________________________________________________
243 TObjArray ** AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, Int_t cycles)
245 // general intialisation
249 TObjArray ** rv = NULL ;
250 if ( task == AliQAv1::kHITS ) {
251 if ( ! fHitsQAList ) {
252 fHitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
253 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
254 fHitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
255 fHitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
259 } else if ( task == AliQAv1::kSDIGITS ) {
260 if ( ! fSDigitsQAList ) {
261 fSDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
262 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
263 fSDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
264 fSDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
267 rv = fSDigitsQAList ;
268 } else if ( task == AliQAv1::kDIGITS ) {
269 if ( ! fDigitsQAList ) {
270 fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
271 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
272 fDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
273 fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
282 //____________________________________________________________________________
283 void AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
285 // Intialisation by passing the list of QA data booked elsewhere
291 if ( task == AliQAv1::kHITS ) {
293 } else if ( task == AliQAv1::kSDIGITS) {
294 fSDigitsQAList = list ;
295 } else if ( task == AliQAv1::kDIGITS ) {
296 fDigitsQAList = list ;
300 //____________________________________________________________________________
301 void AliQADataMakerSim::StartOfCycle(Int_t run)
303 // Finishes a cycle of QA for all tasks
304 Bool_t samecycle = kFALSE ;
305 StartOfCycle(AliQAv1::kHITS, run, samecycle) ;
307 StartOfCycle(AliQAv1::kSDIGITS, run, samecycle) ;
308 StartOfCycle(AliQAv1::kDIGITS, run, samecycle) ;
311 //____________________________________________________________________________
312 void AliQADataMakerSim::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
314 // Finishes a cycle of QA data acquistion
317 if ( !sameCycle || fCurrentCycle == -1) {
321 fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ;
324 AliDebug(AliQAv1::GetQADebugLevel(), Form(" Run %d Cycle %d task %s file %s",
325 fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ;
327 //fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
328 // if (!fDetectorDir)
329 // fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
331 // TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
333 // subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
335 // for ( Int_t index = AliRecoParam::kDefault ; index < AliRecoParam::kNSpecies ; index++ ) {
336 // TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(index)) ;
337 // if (!eventSpecieDir)
338 // eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(index)) ;
339 // TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
341 // expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
343 StartOfDetectorCycle() ;