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 fDigitsQAList->Delete() ;
66 fHitsQAList->Delete() ;
67 fSDigitsQAList->Delete() ;
68 delete fDigitsQAList ;
70 delete fSDigitsQAList ;
73 //__________________________________________________________________
74 AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm )
76 // Assignment operator.
77 this->~AliQADataMakerSim();
78 new(this) AliQADataMakerSim(qadm);
82 //____________________________________________________________________________
83 void AliQADataMakerSim::EndOfCycle(AliQA::TASKINDEX_t task)
85 // Finishes a cycle of QA data acquistion
86 TObjArray * list = 0x0 ;
88 if ( task == AliQA::kHITS )
90 else if ( task == AliQA::kSDIGITS )
91 list = fSDigitsQAList ;
92 else if ( task == AliQA::kDIGITS )
93 list = fDigitsQAList ;
95 EndOfDetectorCycle(task, list) ;
96 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
103 //____________________________________________________________________________
104 void AliQADataMakerSim::Exec(AliQA::TASKINDEX_t task, TObject * data)
106 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
108 if ( task == AliQA::kHITS ) {
109 AliDebug(1, "Processing Hits QA") ;
110 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
114 TTree * tree = dynamic_cast<TTree *>(data) ;
118 AliWarning("data are neither a TClonesArray nor a TTree") ;
121 } else if ( task == AliQA::kSDIGITS ) {
122 AliDebug(1, "Processing SDigits QA") ;
123 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
127 TTree * tree = dynamic_cast<TTree *>(data) ;
131 AliWarning("data are neither a TClonesArray nor a TTree") ;
134 } else if ( task == AliQA::kDIGITS ) {
135 AliDebug(1, "Processing Digits QA") ;
136 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
140 TTree * tree = dynamic_cast<TTree *>(data) ;
144 AliWarning("data are neither a TClonesArray nor a TTree") ;
150 //____________________________________________________________________________
151 TObjArray * AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, Int_t run, Int_t cycles)
153 // general intialisation
158 TObjArray * rv = NULL ;
159 if ( task == AliQA::kHITS ) {
160 if ( ! fHitsQAList ) {
161 fHitsQAList = new TObjArray(100) ;
165 } else if ( task == AliQA::kSDIGITS ) {
166 if ( ! fSDigitsQAList ) {
167 fSDigitsQAList = new TObjArray(100) ;
170 rv = fSDigitsQAList ;
171 } else if ( task == AliQA::kDIGITS ) {
172 if ( ! fDigitsQAList ) {
173 fDigitsQAList = new TObjArray(100) ;
182 //____________________________________________________________________________
183 void AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles)
185 // Intialisation by passing the list of QA data booked elsewhere
191 if ( task == AliQA::kHITS ) {
193 } else if ( task == AliQA::kSDIGITS) {
194 fSDigitsQAList = list ;
195 } else if ( task == AliQA::kDIGITS ) {
196 fDigitsQAList = list ;
200 //____________________________________________________________________________
201 void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX_t task, const Bool_t sameCycle)
203 // Finishes a cycle of QA data acquistion
204 if ( !sameCycle || fCurrentCycle == -1) {
208 fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ;
211 AliInfo(Form(" Run %d Cycle %d task %s file %s",
212 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
214 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
216 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
218 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
220 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
223 TObjArray * list = 0x0 ;
225 if ( task == AliQA::kHITS )
227 else if ( task == AliQA::kSDIGITS )
228 list = fSDigitsQAList ;
229 else if ( task == AliQA::kDIGITS )
230 list = fDigitsQAList ;
232 // Should be the choice of detectors
233 // TIter next(list) ;
235 // while ( (h = dynamic_cast<TH1 *>(next())) )
238 StartOfDetectorCycle() ;