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),
50 fDetectorDirName = GetName() ;
53 //____________________________________________________________________________
54 AliQADataMakerSim::AliQADataMakerSim(const AliQADataMakerSim& qadm) :
55 AliQADataMaker(qadm.GetName(), qadm.GetTitle()),
56 fDigitsQAList(qadm.fDigitsQAList),
57 fHitsQAList(qadm.fHitsQAList),
58 fSDigitsQAList(qadm.fSDigitsQAList),
63 fDetectorDirName = GetName() ;
66 //____________________________________________________________________________
67 AliQADataMakerSim::~AliQADataMakerSim()
69 //dtor: delete the TObjArray and thei content
70 if ( fDigitsQAList ) {
71 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
72 if ( fDigitsQAList[specie]->IsOwner() )
73 fDigitsQAList[specie]->Delete() ;
75 delete[] fDigitsQAList ;
78 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
79 if ( fHitsQAList[specie]->IsOwner() )
80 fHitsQAList[specie]->Delete() ;
82 delete[] fHitsQAList ;
84 if ( fSDigitsQAList ) {
85 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
86 if ( fSDigitsQAList[specie]->IsOwner() )
87 fSDigitsQAList[specie]->Delete() ;
89 delete[] fSDigitsQAList ;
96 fSDigitsArray->Clear() ;
97 delete fSDigitsArray ;
101 //__________________________________________________________________
102 AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm )
104 // Assignment operator.
105 this->~AliQADataMakerSim();
106 new(this) AliQADataMakerSim(qadm);
110 //____________________________________________________________________________
111 void AliQADataMakerSim::EndOfCycle()
113 // Finishes a cycle of QA for all tasks
114 EndOfCycle(AliQAv1::kHITS) ;
115 EndOfCycle(AliQAv1::kSDIGITS) ;
116 EndOfCycle(AliQAv1::kDIGITS) ;
120 //____________________________________________________________________________
121 void AliQADataMakerSim::EndOfCycle(AliQAv1::TASKINDEX_t task)
123 // Finishes a cycle of QA data acquistion
124 TObjArray ** list = NULL ;
126 if ( task == AliQAv1::kHITS )
128 else if ( task == AliQAv1::kSDIGITS )
129 list = fSDigitsQAList ;
130 else if ( task == AliQAv1::kDIGITS )
131 list = fDigitsQAList ;
135 EndOfDetectorCycle(task, list) ;
136 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
138 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
139 TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
141 subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
143 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
144 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) )
146 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ;
148 eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ;
149 eventSpecieDir->cd() ;
150 TIter next(list[specie]) ;
152 while ( (obj = next()) ) {
153 if (!obj->TestBit(AliQAv1::GetExpertBit()))
157 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
159 expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
162 while ( (obj = next()) ) {
163 if (!obj->TestBit(AliQAv1::GetExpertBit()))
174 //____________________________________________________________________________
175 void AliQADataMakerSim::Exec(AliQAv1::TASKINDEX_t task, TObject * data)
177 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
179 if ( task == AliQAv1::kHITS ) {
180 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Hits QA") ;
181 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
182 fHitsArray = static_cast<TClonesArray *>(data) ;
184 } else if (strcmp(data->ClassName(), "TTree") == 0) {
185 TTree * tree = static_cast<TTree *>(data) ;
188 AliWarning("data are neither a TClonesArray nor a TTree") ;
190 } else if ( task == AliQAv1::kSDIGITS ) {
191 AliDebug(AliQAv1::GetQADebugLevel(), "Processing SDigits QA") ;
192 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
193 fSDigitsArray = static_cast<TClonesArray *>(data) ;
195 } else if (strcmp(data->ClassName(), "TTree") == 0) {
196 TTree * tree = static_cast<TTree *>(data) ;
199 AliWarning("data are neither a TClonesArray nor a TTree") ;
201 } else if ( task == AliQAv1::kDIGITS ) {
202 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Digits QA") ;
203 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
204 fDigitsArray = static_cast<TClonesArray *>(data) ;
206 } else if (strcmp(data->ClassName(), "TTree") == 0) {
207 TTree * tree = static_cast<TTree *>(data) ;
210 AliWarning("data are neither a TClonesArray nor a TTree") ;
215 //____________________________________________________________________________
216 void AliQADataMakerSim::MakeImage(AliQAv1::TASKINDEX_t task)
218 // create a drawing of detetor defined histograms
219 TObjArray ** list = NULL ;
226 case AliQAv1::kSDIGITS:
227 list = fSDigitsQAList ;
229 case AliQAv1::kDIGITS:
230 list = fDigitsQAList ;
232 case AliQAv1::kDIGITSR:
234 case AliQAv1::kRECPOINTS:
236 case AliQAv1::kTRACKSEGMENTS:
238 case AliQAv1::kRECPARTICLES:
242 case AliQAv1::kNTASKINDEX:
248 AliFatal("data not initialized, call AliQADataMaker::Init");
251 MakeTheImage(list, task, "Sim") ;
254 //____________________________________________________________________________
255 TObjArray ** AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, Int_t cycles)
257 // general intialisation
261 TObjArray ** rv = NULL ;
262 if ( task == AliQAv1::kHITS ) {
263 if ( ! fHitsQAList ) {
264 fHitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
265 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
266 fHitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
267 fHitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
271 } else if ( task == AliQAv1::kSDIGITS ) {
272 if ( ! fSDigitsQAList ) {
273 fSDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
274 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
275 fSDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
276 fSDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
279 rv = fSDigitsQAList ;
280 } else if ( task == AliQAv1::kDIGITS ) {
281 if ( ! fDigitsQAList ) {
282 fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
283 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
284 fDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
285 fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
294 //____________________________________________________________________________
295 void AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
297 // Intialisation by passing the list of QA data booked elsewhere
303 if ( task == AliQAv1::kHITS ) {
305 } else if ( task == AliQAv1::kSDIGITS) {
306 fSDigitsQAList = list ;
307 } else if ( task == AliQAv1::kDIGITS ) {
308 fDigitsQAList = list ;
312 //____________________________________________________________________________
313 void AliQADataMakerSim::StartOfCycle(Int_t run)
315 // Finishes a cycle of QA for all tasks
316 Bool_t samecycle = kFALSE ;
317 StartOfCycle(AliQAv1::kHITS, run, samecycle) ;
319 StartOfCycle(AliQAv1::kSDIGITS, run, samecycle) ;
320 StartOfCycle(AliQAv1::kDIGITS, run, samecycle) ;
323 //____________________________________________________________________________
324 void AliQADataMakerSim::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
326 // Finishes a cycle of QA data acquistion
329 if ( !sameCycle || fCurrentCycle == -1) {
333 fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ;
336 AliDebug(AliQAv1::GetQADebugLevel(), Form(" Run %d Cycle %d task %s file %s",
337 fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ;
339 //fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
340 // if (!fDetectorDir)
341 // fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
343 // TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
345 // subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
347 // for ( Int_t index = AliRecoParam::kDefault ; index < AliRecoParam::kNSpecies ; index++ ) {
348 // TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(index)) ;
349 // if (!eventSpecieDir)
350 // eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(index)) ;
351 // TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
353 // expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
355 StartOfDetectorCycle() ;