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),
49 fDetectorDirName = GetName() ;
52 //____________________________________________________________________________
53 AliQADataMakerSim::AliQADataMakerSim(const AliQADataMakerSim& qadm) :
54 AliQADataMaker(qadm.GetName(), qadm.GetTitle()),
55 fDigitsQAList(qadm.fDigitsQAList),
56 fHitsQAList(qadm.fHitsQAList),
57 fSDigitsQAList(qadm.fSDigitsQAList),
62 fDetectorDirName = GetName() ;
65 //____________________________________________________________________________
66 AliQADataMakerSim::~AliQADataMakerSim()
68 //dtor: delete the TObjArray and thei content
69 if ( fDigitsQAList ) {
70 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
71 if ( fDigitsQAList[specie]->IsOwner() )
72 fDigitsQAList[specie]->Delete() ;
74 delete[] fDigitsQAList ;
77 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
78 if ( fHitsQAList[specie]->IsOwner() )
79 fHitsQAList[specie]->Delete() ;
81 delete[] fHitsQAList ;
83 if ( fSDigitsQAList ) {
84 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
85 if ( fSDigitsQAList[specie]->IsOwner() )
86 fSDigitsQAList[specie]->Delete() ;
88 delete[] fSDigitsQAList ;
95 fSDigitsArray->Clear() ;
96 delete fSDigitsArray ;
100 //__________________________________________________________________
101 AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm )
103 // Assignment operator.
104 this->~AliQADataMakerSim();
105 new(this) AliQADataMakerSim(qadm);
109 //____________________________________________________________________________
110 void AliQADataMakerSim::EndOfCycle()
112 // Finishes a cycle of QA for all tasks
113 EndOfCycle(AliQAv1::kHITS) ;
114 EndOfCycle(AliQAv1::kSDIGITS) ;
115 EndOfCycle(AliQAv1::kDIGITS) ;
119 //____________________________________________________________________________
120 void AliQADataMakerSim::EndOfCycle(AliQAv1::TASKINDEX_t task)
122 // Finishes a cycle of QA data acquistion
123 TObjArray ** list = NULL ;
125 if ( task == AliQAv1::kHITS )
127 else if ( task == AliQAv1::kSDIGITS )
128 list = fSDigitsQAList ;
129 else if ( task == AliQAv1::kDIGITS )
130 list = fDigitsQAList ;
134 EndOfDetectorCycle(task, list) ;
135 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
137 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
138 TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
140 subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
142 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
143 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) )
145 if (list[specie]->GetEntries() != 0 ) {
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()))
173 //____________________________________________________________________________
174 void AliQADataMakerSim::Exec(AliQAv1::TASKINDEX_t task, TObject * data)
176 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
178 if ( task == AliQAv1::kHITS ) {
179 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Hits QA") ;
180 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
181 fHitsArray = 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::kSDIGITS ) {
190 AliDebug(AliQAv1::GetQADebugLevel(), "Processing SDigits QA") ;
191 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
192 fSDigitsArray = 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") ;
200 } else if ( task == AliQAv1::kDIGITS ) {
201 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Digits QA") ;
202 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
203 fDigitsArray = static_cast<TClonesArray *>(data) ;
205 } else if (strcmp(data->ClassName(), "TTree") == 0) {
206 TTree * tree = static_cast<TTree *>(data) ;
209 AliWarning("data are neither a TClonesArray nor a TTree") ;
214 //____________________________________________________________________________
215 TObjArray ** AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, Int_t cycles)
217 // general intialisation
221 TObjArray ** rv = NULL ;
222 if ( task == AliQAv1::kHITS ) {
223 if ( ! fHitsQAList ) {
224 fHitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
225 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
226 fHitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
227 fHitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
231 } else if ( task == AliQAv1::kSDIGITS ) {
232 if ( ! fSDigitsQAList ) {
233 fSDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
234 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
235 fSDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
236 fSDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
239 rv = fSDigitsQAList ;
240 } else if ( task == AliQAv1::kDIGITS ) {
241 if ( ! fDigitsQAList ) {
242 fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
243 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
244 fDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
245 fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
254 //____________________________________________________________________________
255 void AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
257 // Intialisation by passing the list of QA data booked elsewhere
263 if ( task == AliQAv1::kHITS ) {
265 } else if ( task == AliQAv1::kSDIGITS) {
266 fSDigitsQAList = list ;
267 } else if ( task == AliQAv1::kDIGITS ) {
268 fDigitsQAList = list ;
272 //____________________________________________________________________________
273 void AliQADataMakerSim::StartOfCycle(Int_t run)
275 // Finishes a cycle of QA for all tasks
276 Bool_t samecycle = kFALSE ;
277 StartOfCycle(AliQAv1::kHITS, run, samecycle) ;
279 StartOfCycle(AliQAv1::kSDIGITS, run, samecycle) ;
280 StartOfCycle(AliQAv1::kDIGITS, run, samecycle) ;
283 //____________________________________________________________________________
284 void AliQADataMakerSim::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
286 // Finishes a cycle of QA data acquistion
289 if ( !sameCycle || fCurrentCycle == -1) {
293 fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ;
296 AliDebug(AliQAv1::GetQADebugLevel(), Form(" Run %d Cycle %d task %s file %s",
297 fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ;
299 //fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
300 // if (!fDetectorDir)
301 // fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
303 // TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
305 // subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
307 // for ( Int_t index = AliRecoParam::kDefault ; index < AliRecoParam::kNSpecies ; index++ ) {
308 // TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(index)) ;
309 // if (!eventSpecieDir)
310 // eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(index)) ;
311 // TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
313 // expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
315 StartOfDetectorCycle() ;