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 ---
29 #include <TClonesArray.h>
31 // --- Standard library ---
33 // --- AliRoot header files ---
35 #include "AliQADataMakerSim.h"
37 ClassImp(AliQADataMakerSim)
39 //____________________________________________________________________________
40 AliQADataMakerSim::AliQADataMakerSim(const char * name, const char * title) :
41 AliQADataMaker(name, title),
47 fDetectorDirName = GetName() ;
50 //____________________________________________________________________________
51 AliQADataMakerSim::AliQADataMakerSim(const AliQADataMakerSim& qadm) :
52 AliQADataMaker(qadm.GetName(), qadm.GetTitle()),
53 fDigitsQAList(qadm.fDigitsQAList),
54 fHitsQAList(qadm.fHitsQAList),
55 fSDigitsQAList(qadm.fSDigitsQAList)
58 fDetectorDirName = GetName() ;
61 //____________________________________________________________________________
62 AliQADataMakerSim::~AliQADataMakerSim()
64 //dtor: delete the TObjArray and thei content
65 if ( fDigitsQAList ) {
66 if ( fDigitsQAList->IsOwner() )
67 fDigitsQAList->Delete() ;
68 delete fDigitsQAList ;
71 if ( fHitsQAList->IsOwner() )
72 fHitsQAList->Delete() ;
75 if ( fSDigitsQAList ) {
76 if ( fSDigitsQAList->IsOwner() )
77 fSDigitsQAList->Delete() ;
78 delete fSDigitsQAList ;
82 //__________________________________________________________________
83 AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm )
85 // Assignment operator.
86 this->~AliQADataMakerSim();
87 new(this) AliQADataMakerSim(qadm);
91 //____________________________________________________________________________
92 void AliQADataMakerSim::EndOfCycle()
94 // Finishes a cycle of QA for all tasks
95 EndOfCycle(AliQA::kHITS) ;
96 EndOfCycle(AliQA::kSDIGITS) ;
97 EndOfCycle(AliQA::kDIGITS) ;
101 //____________________________________________________________________________
102 void AliQADataMakerSim::EndOfCycle(AliQA::TASKINDEX_t task)
104 // Finishes a cycle of QA data acquistion
105 TObjArray * list = 0x0 ;
107 if ( task == AliQA::kHITS )
109 else if ( task == AliQA::kSDIGITS )
110 list = fSDigitsQAList ;
111 else if ( task == AliQA::kDIGITS )
112 list = fDigitsQAList ;
116 EndOfDetectorCycle(task, list) ;
117 TDirectory * subDir = NULL ;
119 subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
124 while ( (obj = dynamic_cast<TH1 *>(next())) ) {
125 if (!obj->TestBit(AliQA::GetExpertBit()))
129 TDirectory * expertDir = subDir->GetDirectory(AliQA::GetExpert()) ;
133 while ( (obj = dynamic_cast<TH1 *>(next())) ) {
134 if (!obj->TestBit(AliQA::GetExpertBit()))
145 //____________________________________________________________________________
146 void AliQADataMakerSim::Exec(AliQA::TASKINDEX_t task, TObject * data)
148 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
150 if ( task == AliQA::kHITS ) {
151 AliDebug(1, "Processing Hits QA") ;
152 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
156 TTree * tree = dynamic_cast<TTree *>(data) ;
160 AliWarning("data are neither a TClonesArray nor a TTree") ;
163 } else if ( task == AliQA::kSDIGITS ) {
164 AliDebug(1, "Processing SDigits 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 == AliQA::kDIGITS ) {
177 AliDebug(1, "Processing Digits 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") ;
192 //____________________________________________________________________________
193 TObjArray * AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, Int_t cycles)
195 // general intialisation
199 TObjArray * rv = NULL ;
200 if ( task == AliQA::kHITS ) {
201 if ( ! fHitsQAList ) {
202 fHitsQAList = new TObjArray(100) ;
203 fHitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
207 } else if ( task == AliQA::kSDIGITS ) {
208 if ( ! fSDigitsQAList ) {
209 fSDigitsQAList = new TObjArray(100) ;
210 fSDigitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
213 rv = fSDigitsQAList ;
214 } else if ( task == AliQA::kDIGITS ) {
215 if ( ! fDigitsQAList ) {
216 fDigitsQAList = new TObjArray(100) ;
217 fDigitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
226 //____________________________________________________________________________
227 void AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles)
229 // Intialisation by passing the list of QA data booked elsewhere
235 if ( task == AliQA::kHITS ) {
237 } else if ( task == AliQA::kSDIGITS) {
238 fSDigitsQAList = list ;
239 } else if ( task == AliQA::kDIGITS ) {
240 fDigitsQAList = list ;
244 //____________________________________________________________________________
245 void AliQADataMakerSim::StartOfCycle(Int_t run)
247 // Finishes a cycle of QA for all tasks
248 Bool_t samecycle = kFALSE ;
249 StartOfCycle(AliQA::kHITS, run, samecycle) ;
251 StartOfCycle(AliQA::kSDIGITS, run, samecycle) ;
252 StartOfCycle(AliQA::kDIGITS, run, samecycle) ;
255 //____________________________________________________________________________
256 void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
258 // Finishes a cycle of QA data acquistion
261 if ( !sameCycle || fCurrentCycle == -1) {
265 fOutput = AliQA::GetQADataFile(GetName(), fRun) ;
268 AliInfo(Form(" Run %d Cycle %d task %s file %s",
269 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
271 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
273 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
275 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
277 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
279 TDirectory * expertDir = subDir->GetDirectory(AliQA::GetExpert()) ;
281 expertDir = subDir->mkdir(AliQA::GetExpert()) ;
285 StartOfDetectorCycle() ;