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()))
158 //____________________________________________________________________________
159 void AliQADataMakerSim::Exec(AliQAv1::TASKINDEX_t task, TObject * data)
161 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
163 if ( task == AliQAv1::kHITS ) {
164 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Hits QA") ;
165 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
169 TTree * tree = dynamic_cast<TTree *>(data) ;
173 AliWarning("data are neither a TClonesArray nor a TTree") ;
176 } else if ( task == AliQAv1::kSDIGITS ) {
177 AliDebug(AliQAv1::GetQADebugLevel(), "Processing SDigits QA") ;
178 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
182 TTree * tree = dynamic_cast<TTree *>(data) ;
186 AliWarning("data are neither a TClonesArray nor a TTree") ;
189 } else if ( task == AliQAv1::kDIGITS ) {
190 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Digits QA") ;
191 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
195 TTree * tree = dynamic_cast<TTree *>(data) ;
199 AliWarning("data are neither a TClonesArray nor a TTree") ;
205 //____________________________________________________________________________
206 void AliQADataMakerSim::MakeImage(AliQAv1::TASKINDEX_t task)
208 // create a drawing of detetor defined histograms
209 TObjArray ** list = NULL ;
216 case AliQAv1::kSDIGITS:
217 list = fSDigitsQAList ;
219 case AliQAv1::kDIGITS:
220 list = fDigitsQAList ;
222 case AliQAv1::kDIGITSR:
224 case AliQAv1::kRECPOINTS:
226 case AliQAv1::kTRACKSEGMENTS:
228 case AliQAv1::kRECPARTICLES:
232 case AliQAv1::kNTASKINDEX:
238 AliFatal("data not initialized, call AliQADataMaker::Init");
241 TIter next(list[0]) ;
244 while ( (hdata=dynamic_cast<TH1 *>(next())) ) {
245 if ( hdata->TestBit(AliQAv1::GetImageBit()) )
248 if ( nImages == 0 ) {
249 AliWarning(Form("No histogram will be plotted for %s %s\n", GetName(), AliQAv1::GetTaskName(task).Data())) ;
251 AliDebug(AliQAv1::GetQADebugLevel(), Form("%d histograms will be plotted for %s %s\n", nImages, GetName(), AliQAv1::GetTaskName(task).Data())) ;
254 for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
255 TCanvas * canvasQA = new TCanvas(Form("QA_%s_%s_%s",
257 AliQAv1::GetTaskName(task).Data(),
258 AliRecoParam::GetEventSpecieName(esIndex)),
259 Form("QA control plots for det=%s task=%s eventspecie=%s",
261 AliQAv1::GetTaskName(task).Data(),
262 AliRecoParam::GetEventSpecieName(esIndex)),
264 canvasQA->SetWindowSize(w + (w - canvasQA->GetWw()), h + (h - canvasQA->GetWh())) ;
265 Int_t nx = TMath::Sqrt(nImages) ;
267 if ( nx < TMath::Sqrt(nImages))
269 canvasQA->Divide(nx, ny) ;
270 TIter nexthist(list[esIndex]) ;
274 while ( (hist=dynamic_cast<TH1*>(nexthist())) ) {
275 if(hist->TestBit(AliQAv1::GetImageBit())) {
277 canvasQA->cd(++npad) ;
280 if ( AliDebugLevel() == AliQAv1::GetQADebugLevel() )
286 //____________________________________________________________________________
287 TObjArray ** AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, Int_t cycles)
289 // general intialisation
293 TObjArray ** rv = NULL ;
294 if ( task == AliQAv1::kHITS ) {
295 if ( ! fHitsQAList ) {
296 fHitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
297 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
298 fHitsQAList[specie] = new TObjArray(100) ;
299 fHitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
304 } else if ( task == AliQAv1::kSDIGITS ) {
305 if ( ! fSDigitsQAList ) {
306 fSDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
307 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
308 fSDigitsQAList[specie] = new TObjArray(100) ;
309 fSDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
313 rv = fSDigitsQAList ;
314 } else if ( task == AliQAv1::kDIGITS ) {
315 if ( ! fDigitsQAList ) {
316 fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
317 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
318 fDigitsQAList[specie] = new TObjArray(100) ;
319 fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
329 //____________________________________________________________________________
330 void AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
332 // Intialisation by passing the list of QA data booked elsewhere
338 if ( task == AliQAv1::kHITS ) {
340 } else if ( task == AliQAv1::kSDIGITS) {
341 fSDigitsQAList = list ;
342 } else if ( task == AliQAv1::kDIGITS ) {
343 fDigitsQAList = list ;
347 //____________________________________________________________________________
348 void AliQADataMakerSim::StartOfCycle(Int_t run)
350 // Finishes a cycle of QA for all tasks
351 Bool_t samecycle = kFALSE ;
352 StartOfCycle(AliQAv1::kHITS, run, samecycle) ;
354 StartOfCycle(AliQAv1::kSDIGITS, run, samecycle) ;
355 StartOfCycle(AliQAv1::kDIGITS, run, samecycle) ;
358 //____________________________________________________________________________
359 void AliQADataMakerSim::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
361 // Finishes a cycle of QA data acquistion
364 if ( !sameCycle || fCurrentCycle == -1) {
368 fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ;
371 AliDebug(AliQAv1::GetQADebugLevel(), Form(" Run %d Cycle %d task %s file %s",
372 fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ;
374 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
376 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
378 TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
380 subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
382 for ( Int_t index = AliRecoParam::kDefault ; index < AliRecoParam::kNSpecies ; index++ ) {
383 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(index)) ;
385 eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(index)) ;
386 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
388 expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
390 StartOfDetectorCycle() ;