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 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
67 if ( fDigitsQAList[specie]->IsOwner() )
68 fDigitsQAList[specie]->Delete() ;
70 delete[] fDigitsQAList ;
73 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
74 if ( fHitsQAList[specie]->IsOwner() )
75 fHitsQAList[specie]->Delete() ;
77 delete[] fHitsQAList ;
79 if ( fSDigitsQAList ) {
80 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
81 if ( fSDigitsQAList[specie]->IsOwner() )
82 fSDigitsQAList[specie]->Delete() ;
84 delete[] fSDigitsQAList ;
88 //__________________________________________________________________
89 AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm )
91 // Assignment operator.
92 this->~AliQADataMakerSim();
93 new(this) AliQADataMakerSim(qadm);
97 //____________________________________________________________________________
98 void AliQADataMakerSim::EndOfCycle()
100 // Finishes a cycle of QA for all tasks
101 EndOfCycle(AliQA::kHITS) ;
102 EndOfCycle(AliQA::kSDIGITS) ;
103 EndOfCycle(AliQA::kDIGITS) ;
107 //____________________________________________________________________________
108 void AliQADataMakerSim::EndOfCycle(AliQA::TASKINDEX_t task)
110 // Finishes a cycle of QA data acquistion
111 TObjArray ** list = NULL ;
113 if ( task == AliQA::kHITS )
115 else if ( task == AliQA::kSDIGITS )
116 list = fSDigitsQAList ;
117 else if ( task == AliQA::kDIGITS )
118 list = fDigitsQAList ;
122 EndOfDetectorCycle(task, list) ;
123 TDirectory * subDir = NULL ;
125 subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
128 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
129 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ;
130 if (eventSpecieDir) {
131 eventSpecieDir->cd() ;
132 TIter next(list[specie]) ;
134 while ( (obj = next()) ) {
135 if (!obj->TestBit(AliQA::GetExpertBit()))
139 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQA::GetExpert()) ;
143 while ( (obj = next()) ) {
144 if (!obj->TestBit(AliQA::GetExpertBit()))
157 //____________________________________________________________________________
158 void AliQADataMakerSim::Exec(AliQA::TASKINDEX_t task, TObject * data)
160 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
162 if ( task == AliQA::kHITS ) {
163 AliDebug(1, "Processing Hits QA") ;
164 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
168 TTree * tree = dynamic_cast<TTree *>(data) ;
172 AliWarning("data are neither a TClonesArray nor a TTree") ;
175 } else if ( task == AliQA::kSDIGITS ) {
176 AliDebug(1, "Processing SDigits QA") ;
177 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
181 TTree * tree = dynamic_cast<TTree *>(data) ;
185 AliWarning("data are neither a TClonesArray nor a TTree") ;
188 } else if ( task == AliQA::kDIGITS ) {
189 AliDebug(1, "Processing Digits QA") ;
190 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
194 TTree * tree = dynamic_cast<TTree *>(data) ;
198 AliWarning("data are neither a TClonesArray nor a TTree") ;
204 //____________________________________________________________________________
205 TObjArray ** AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, Int_t cycles)
207 // general intialisation
211 TObjArray ** rv = NULL ;
212 if ( task == AliQA::kHITS ) {
213 if ( ! fHitsQAList ) {
214 fHitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
215 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
216 fHitsQAList[specie] = new TObjArray(100) ;
217 fHitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
222 } else if ( task == AliQA::kSDIGITS ) {
223 if ( ! fSDigitsQAList ) {
224 fSDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
225 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
226 fSDigitsQAList[specie] = new TObjArray(100) ;
227 fSDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
231 rv = fSDigitsQAList ;
232 } else if ( task == AliQA::kDIGITS ) {
233 if ( ! fDigitsQAList ) {
234 fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
235 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
236 fDigitsQAList[specie] = new TObjArray(100) ;
237 fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
247 //____________________________________________________________________________
248 void AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
250 // Intialisation by passing the list of QA data booked elsewhere
256 if ( task == AliQA::kHITS ) {
258 } else if ( task == AliQA::kSDIGITS) {
259 fSDigitsQAList = list ;
260 } else if ( task == AliQA::kDIGITS ) {
261 fDigitsQAList = list ;
265 //____________________________________________________________________________
266 void AliQADataMakerSim::StartOfCycle(Int_t run)
268 // Finishes a cycle of QA for all tasks
269 Bool_t samecycle = kFALSE ;
270 StartOfCycle(AliQA::kHITS, run, samecycle) ;
272 StartOfCycle(AliQA::kSDIGITS, run, samecycle) ;
273 StartOfCycle(AliQA::kDIGITS, run, samecycle) ;
276 //____________________________________________________________________________
277 void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
279 // Finishes a cycle of QA data acquistion
282 if ( !sameCycle || fCurrentCycle == -1) {
286 fOutput = AliQA::GetQADataFile(GetName(), fRun) ;
289 AliInfo(Form(" Run %d Cycle %d task %s file %s",
290 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
292 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
294 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
296 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
298 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
300 for ( Int_t index = AliRecoParam::kDefault ; index < AliRecoParam::kNSpecies ; index++ ) {
301 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(index)) ;
303 eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(index)) ;
304 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQA::GetExpert()) ;
306 expertDir = eventSpecieDir->mkdir(AliQA::GetExpert()) ;
308 StartOfDetectorCycle() ;