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 = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
122 while ( (obj = dynamic_cast<TH1 *>(next())) ) {
123 TString name(obj->GetTitle()) ;
124 if (name.Contains(AliQA::GetExpert())) {
125 name.ReplaceAll(AliQA::GetExpert(), "") ;
126 obj->SetTitle(name) ;
131 TDirectory * expertDir = subDir->GetDirectory(AliQA::GetExpert()) ;
135 while ( (obj = dynamic_cast<TH1 *>(next())) ) {
136 TString name(obj->GetTitle()) ;
137 if (name.Contains(AliQA::GetExpert()))
139 name.ReplaceAll(AliQA::GetExpert(), "") ;
140 obj->SetTitle(name) ;
150 //____________________________________________________________________________
151 void AliQADataMakerSim::Exec(AliQA::TASKINDEX_t task, TObject * data)
153 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
155 if ( task == AliQA::kHITS ) {
156 AliDebug(1, "Processing Hits QA") ;
157 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
161 TTree * tree = dynamic_cast<TTree *>(data) ;
165 AliWarning("data are neither a TClonesArray nor a TTree") ;
168 } else if ( task == AliQA::kSDIGITS ) {
169 AliDebug(1, "Processing SDigits QA") ;
170 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
174 TTree * tree = dynamic_cast<TTree *>(data) ;
178 AliWarning("data are neither a TClonesArray nor a TTree") ;
181 } else if ( task == AliQA::kDIGITS ) {
182 AliDebug(1, "Processing Digits QA") ;
183 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
187 TTree * tree = dynamic_cast<TTree *>(data) ;
191 AliWarning("data are neither a TClonesArray nor a TTree") ;
197 //____________________________________________________________________________
198 TObjArray * AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, Int_t cycles)
200 // general intialisation
204 TObjArray * rv = NULL ;
205 if ( task == AliQA::kHITS ) {
206 if ( ! fHitsQAList ) {
207 fHitsQAList = new TObjArray(100) ;
208 fHitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
212 } else if ( task == AliQA::kSDIGITS ) {
213 if ( ! fSDigitsQAList ) {
214 fSDigitsQAList = new TObjArray(100) ;
215 fSDigitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
218 rv = fSDigitsQAList ;
219 } else if ( task == AliQA::kDIGITS ) {
220 if ( ! fDigitsQAList ) {
221 fDigitsQAList = new TObjArray(100) ;
222 fDigitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
231 //____________________________________________________________________________
232 void AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles)
234 // Intialisation by passing the list of QA data booked elsewhere
240 if ( task == AliQA::kHITS ) {
242 } else if ( task == AliQA::kSDIGITS) {
243 fSDigitsQAList = list ;
244 } else if ( task == AliQA::kDIGITS ) {
245 fDigitsQAList = list ;
249 //____________________________________________________________________________
250 void AliQADataMakerSim::StartOfCycle(Int_t run)
252 // Finishes a cycle of QA for all tasks
253 Bool_t samecycle = kFALSE ;
254 StartOfCycle(AliQA::kHITS, run, samecycle) ;
256 StartOfCycle(AliQA::kSDIGITS, run, samecycle) ;
257 StartOfCycle(AliQA::kDIGITS, run, samecycle) ;
260 //____________________________________________________________________________
261 void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
263 // Finishes a cycle of QA data acquistion
266 if ( !sameCycle || fCurrentCycle == -1) {
270 fOutput = AliQA::GetQADataFile(GetName(), fRun) ;
273 AliInfo(Form(" Run %d Cycle %d task %s file %s",
274 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
276 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
278 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
280 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
282 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
284 TDirectory * expertDir = subDir->GetDirectory(AliQA::GetExpert()) ;
286 expertDir = subDir->mkdir(AliQA::GetExpert()) ;
290 StartOfDetectorCycle() ;