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)) ;
125 //____________________________________________________________________________
126 void AliQADataMakerSim::Exec(AliQA::TASKINDEX_t task, TObject * data)
128 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
130 if ( task == AliQA::kHITS ) {
131 AliDebug(1, "Processing Hits 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::kSDIGITS ) {
144 AliDebug(1, "Processing SDigits 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") ;
156 } else if ( task == AliQA::kDIGITS ) {
157 AliDebug(1, "Processing Digits QA") ;
158 TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
162 TTree * tree = dynamic_cast<TTree *>(data) ;
166 AliWarning("data are neither a TClonesArray nor a TTree") ;
172 //____________________________________________________________________________
173 TObjArray * AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, Int_t cycles)
175 // general intialisation
179 TObjArray * rv = NULL ;
180 if ( task == AliQA::kHITS ) {
181 if ( ! fHitsQAList ) {
182 fHitsQAList = new TObjArray(100) ;
183 fHitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
187 } else if ( task == AliQA::kSDIGITS ) {
188 if ( ! fSDigitsQAList ) {
189 fSDigitsQAList = new TObjArray(100) ;
190 fSDigitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
193 rv = fSDigitsQAList ;
194 } else if ( task == AliQA::kDIGITS ) {
195 if ( ! fDigitsQAList ) {
196 fDigitsQAList = new TObjArray(100) ;
197 fDigitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ;
206 //____________________________________________________________________________
207 void AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles)
209 // Intialisation by passing the list of QA data booked elsewhere
215 if ( task == AliQA::kHITS ) {
217 } else if ( task == AliQA::kSDIGITS) {
218 fSDigitsQAList = list ;
219 } else if ( task == AliQA::kDIGITS ) {
220 fDigitsQAList = list ;
224 //____________________________________________________________________________
225 void AliQADataMakerSim::StartOfCycle(Int_t run)
227 // Finishes a cycle of QA for all tasks
228 Bool_t samecycle = kFALSE ;
229 StartOfCycle(AliQA::kHITS, run, samecycle) ;
231 StartOfCycle(AliQA::kSDIGITS, run, samecycle) ;
232 StartOfCycle(AliQA::kDIGITS, run, samecycle) ;
235 //____________________________________________________________________________
236 void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
238 // Finishes a cycle of QA data acquistion
241 if ( !sameCycle || fCurrentCycle == -1) {
245 fOutput = AliQA::GetQADataFile(GetName(), fRun) ;
248 AliInfo(Form(" Run %d Cycle %d task %s file %s",
249 fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
251 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
253 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
255 TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
257 subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
260 StartOfDetectorCycle() ;