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(AliQA::TASKINDEX_t task)
94 // Finishes a cycle of QA data acquistion
95 TObjArray * list = 0x0 ;
97 if ( task == AliQA::kHITS )
99 else if ( task == AliQA::kSDIGITS )
100 list = fSDigitsQAList ;
101 else if ( task == AliQA::kDIGITS )
102 list = fDigitsQAList ;
104 EndOfDetectorCycle(task, list) ;
105 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
112 //____________________________________________________________________________
113 void AliQADataMakerSim::Exec(AliQA::TASKINDEX_t task, TObject * data)
115 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
117 if ( task == AliQA::kHITS ) {
118 AliDebug(1, "Processing Hits QA") ;
119 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
123 TTree * tree = dynamic_cast<TTree *>(data) ;
127 AliWarning("data are neither a TClonesArray nor a TTree") ;
130 } else if ( task == AliQA::kSDIGITS ) {
131 AliDebug(1, "Processing SDigits QA") ;
132 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
136 TTree * tree = dynamic_cast<TTree *>(data) ;
140 AliWarning("data are neither a TClonesArray nor a TTree") ;
143 } else if ( task == AliQA::kDIGITS ) {
144 AliDebug(1, "Processing Digits QA") ;
145 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
149 TTree * tree = dynamic_cast<TTree *>(data) ;
153 AliWarning("data are neither a TClonesArray nor a TTree") ;
159 //____________________________________________________________________________
160 TObjArray * AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, Int_t run, Int_t cycles)
162 // general intialisation
167 TObjArray * rv = NULL ;
168 if ( task == AliQA::kHITS ) {
169 if ( ! fHitsQAList ) {
170 fHitsQAList = new TObjArray(100) ;
174 } else if ( task == AliQA::kSDIGITS ) {
175 if ( ! fSDigitsQAList ) {
176 fSDigitsQAList = new TObjArray(100) ;
179 rv = fSDigitsQAList ;
180 } else if ( task == AliQA::kDIGITS ) {
181 if ( ! fDigitsQAList ) {
182 fDigitsQAList = new TObjArray(100) ;
191 //____________________________________________________________________________
192 void AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles)
194 // Intialisation by passing the list of QA data booked elsewhere
200 if ( task == AliQA::kHITS ) {
202 } else if ( task == AliQA::kSDIGITS) {
203 fSDigitsQAList = list ;
204 } else if ( task == AliQA::kDIGITS ) {
205 fDigitsQAList = list ;
209 //____________________________________________________________________________
210 void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX_t task, const Bool_t sameCycle)
212 // Finishes a cycle of QA data acquistion
213 if ( !sameCycle || fCurrentCycle == -1) {
217 fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ;
220 AliInfo(Form(" Run %d Cycle %d task %s file %s",
221 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
223 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
225 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
227 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
229 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
232 TObjArray * list = 0x0 ;
234 if ( task == AliQA::kHITS )
236 else if ( task == AliQA::kSDIGITS )
237 list = fSDigitsQAList ;
238 else if ( task == AliQA::kDIGITS )
239 list = fDigitsQAList ;
241 // Should be the choice of detectors
242 // TIter next(list) ;
244 // while ( (h = dynamic_cast<TH1 *>(next())) )
247 StartOfDetectorCycle() ;