]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliQADataMakerSim.cxx
Use double precision everywhere (Federico)
[u/mrichter/AliRoot.git] / STEER / AliQADataMakerSim.cxx
CommitLineData
04236e67 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16
17/* $Id$ */
18
202374b1 19//
20// Base Class
21// Produces the data needed to calculate the quality assurance.
22// All data must be mergeable objects.
23// Y. Schutz CERN July 2007
24//
04236e67 25
26// --- ROOT system ---
7d297381 27#include <TCanvas.h>
04236e67 28#include <TFile.h>
04236e67 29#include <TTree.h>
30#include <TClonesArray.h>
31
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliLog.h"
36#include "AliQADataMakerSim.h"
04236e67 37
38ClassImp(AliQADataMakerSim)
39
40//____________________________________________________________________________
41AliQADataMakerSim::AliQADataMakerSim(const char * name, const char * title) :
42 AliQADataMaker(name, title),
eca4fa66 43 fDigitsQAList(NULL),
44 fHitsQAList(NULL),
45 fSDigitsQAList(NULL)
04236e67 46{
47 // ctor
48 fDetectorDirName = GetName() ;
49}
50
51//____________________________________________________________________________
52AliQADataMakerSim::AliQADataMakerSim(const AliQADataMakerSim& qadm) :
53 AliQADataMaker(qadm.GetName(), qadm.GetTitle()),
54 fDigitsQAList(qadm.fDigitsQAList),
55 fHitsQAList(qadm.fHitsQAList),
eca4fa66 56 fSDigitsQAList(qadm.fSDigitsQAList)
04236e67 57{
58 //copy ctor
59 fDetectorDirName = GetName() ;
60}
61
63c6f8ae 62//____________________________________________________________________________
63AliQADataMakerSim::~AliQADataMakerSim()
64{
65 //dtor: delete the TObjArray and thei content
7ff8385d 66 if ( fDigitsQAList ) {
57acd2d2 67 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
68 if ( fDigitsQAList[specie]->IsOwner() )
69 fDigitsQAList[specie]->Delete() ;
70 }
eca4fa66 71 delete[] fDigitsQAList ;
72 }
7ff8385d 73 if ( fHitsQAList ) {
57acd2d2 74 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
75 if ( fHitsQAList[specie]->IsOwner() )
76 fHitsQAList[specie]->Delete() ;
77 }
eca4fa66 78 delete[] fHitsQAList ;
79 }
7ff8385d 80 if ( fSDigitsQAList ) {
57acd2d2 81 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
82 if ( fSDigitsQAList[specie]->IsOwner() )
83 fSDigitsQAList[specie]->Delete() ;
84 }
eca4fa66 85 delete[] fSDigitsQAList ;
86 }
63c6f8ae 87}
88
04236e67 89//__________________________________________________________________
90AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm )
91{
92 // Assignment operator.
93 this->~AliQADataMakerSim();
94 new(this) AliQADataMakerSim(qadm);
95 return *this;
96}
97
930e6e3e 98//____________________________________________________________________________
99void AliQADataMakerSim::EndOfCycle()
100{
101 // Finishes a cycle of QA for all tasks
4e25ac79 102 EndOfCycle(AliQAv1::kHITS) ;
103 EndOfCycle(AliQAv1::kSDIGITS) ;
104 EndOfCycle(AliQAv1::kDIGITS) ;
930e6e3e 105 ResetCycle() ;
106}
107
04236e67 108//____________________________________________________________________________
4e25ac79 109void AliQADataMakerSim::EndOfCycle(AliQAv1::TASKINDEX_t task)
04236e67 110{
111 // Finishes a cycle of QA data acquistion
57acd2d2 112 TObjArray ** list = NULL ;
04236e67 113
4e25ac79 114 if ( task == AliQAv1::kHITS )
04236e67 115 list = fHitsQAList ;
4e25ac79 116 else if ( task == AliQAv1::kSDIGITS )
04236e67 117 list = fSDigitsQAList ;
4e25ac79 118 else if ( task == AliQAv1::kDIGITS )
04236e67 119 list = fDigitsQAList ;
930e6e3e 120
121 if ( ! list )
122 return ;
04236e67 123 EndOfDetectorCycle(task, list) ;
eca4fa66 124 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
125 if (!fDetectorDir)
126 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
127 TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
128 if (!subDir)
129 subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
130 subDir->cd() ;
131 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
132 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) )
133 continue ;
134 TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ;
135 if (!eventSpecieDir)
136 eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ;
137 eventSpecieDir->cd() ;
138 TIter next(list[specie]) ;
139 TObject * obj ;
140 while ( (obj = next()) ) {
141 if (!obj->TestBit(AliQAv1::GetExpertBit()))
142 obj->Write() ;
143 }
144 if (WriteExpert()) {
145 TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
146 if (!expertDir)
147 expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
148 expertDir->cd() ;
149 next.Reset() ;
150 while ( (obj = next()) ) {
151 if (!obj->TestBit(AliQAv1::GetExpertBit()))
152 continue ;
153 obj->Write() ;
154 }
6e65319c 155 }
57acd2d2 156 fOutput->Save() ;
6e65319c 157 }
fec0891b 158 if (fPrintImage)
159 MakeImage(task) ;
04236e67 160}
eca4fa66 161
04236e67 162//____________________________________________________________________________
4e25ac79 163void AliQADataMakerSim::Exec(AliQAv1::TASKINDEX_t task, TObject * data)
04236e67 164{
165 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
eca4fa66 166
4e25ac79 167 if ( task == AliQAv1::kHITS ) {
5379c4a3 168 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Hits QA") ;
eca4fa66 169 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
170 TClonesArray * arr = static_cast<TClonesArray *>(data) ;
04236e67 171 MakeHits(arr) ;
eca4fa66 172 } else if (strcmp(data->ClassName(), "TTree") == 0) {
173 TTree * tree = static_cast<TTree *>(data) ;
174 MakeHits(tree) ;
175 } else {
176 AliWarning("data are neither a TClonesArray nor a TTree") ;
177 }
4e25ac79 178 } else if ( task == AliQAv1::kSDIGITS ) {
5379c4a3 179 AliDebug(AliQAv1::GetQADebugLevel(), "Processing SDigits QA") ;
eca4fa66 180 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
181 TClonesArray * arr = static_cast<TClonesArray *>(data) ;
04236e67 182 MakeSDigits(arr) ;
eca4fa66 183 } else if (strcmp(data->ClassName(), "TTree") == 0) {
184 TTree * tree = static_cast<TTree *>(data) ;
185 MakeSDigits(tree) ;
186 } else {
187 AliWarning("data are neither a TClonesArray nor a TTree") ;
188 }
189 } else if ( task == AliQAv1::kDIGITS ) {
5379c4a3 190 AliDebug(AliQAv1::GetQADebugLevel(), "Processing Digits QA") ;
eca4fa66 191 if (strcmp(data->ClassName(), "TClonesArray") == 0) {
192 TClonesArray * arr = static_cast<TClonesArray *>(data) ;
04236e67 193 MakeDigits(arr) ;
eca4fa66 194 } else if (strcmp(data->ClassName(), "TTree") == 0) {
195 TTree * tree = static_cast<TTree *>(data) ;
196 MakeDigits(tree) ;
197 } else {
198 AliWarning("data are neither a TClonesArray nor a TTree") ;
199 }
200 }
04236e67 201}
202
7d297381 203//____________________________________________________________________________
204void AliQADataMakerSim::MakeImage(AliQAv1::TASKINDEX_t task)
205{
206 // create a drawing of detetor defined histograms
207 TObjArray ** list = NULL ;
208 switch (task) {
209 case AliQAv1::kRAWS:
210 break;
211 case AliQAv1::kHITS:
212 list = fHitsQAList ;
213 break;
214 case AliQAv1::kSDIGITS:
215 list = fSDigitsQAList ;
216 break;
217 case AliQAv1::kDIGITS:
218 list = fDigitsQAList ;
219 break;
44ed7a66 220 case AliQAv1::kDIGITSR:
221 break;
7d297381 222 case AliQAv1::kRECPOINTS:
223 break;
224 case AliQAv1::kTRACKSEGMENTS:
225 break;
226 case AliQAv1::kRECPARTICLES:
227 break;
228 case AliQAv1::kESDS:
229 break;
230 case AliQAv1::kNTASKINDEX:
231 break;
232 default:
233 break;
234 }
235 if ( !list) {
236 AliFatal("data not initialized, call AliQADataMaker::Init");
237 return ;
238 }
fec0891b 239 MakeTheImage(list, task, "Sim") ;
7d297381 240}
241
04236e67 242//____________________________________________________________________________
4e25ac79 243TObjArray ** AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, Int_t cycles)
04236e67 244{
245 // general intialisation
246
04236e67 247 if (cycles > 0)
248 SetCycle(cycles) ;
57acd2d2 249 TObjArray ** rv = NULL ;
4e25ac79 250 if ( task == AliQAv1::kHITS ) {
63c6f8ae 251 if ( ! fHitsQAList ) {
57acd2d2 252 fHitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
253 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
49466ea2 254 fHitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
4e25ac79 255 fHitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
57acd2d2 256 }
63c6f8ae 257 }
04236e67 258 rv = fHitsQAList ;
4e25ac79 259 } else if ( task == AliQAv1::kSDIGITS ) {
63c6f8ae 260 if ( ! fSDigitsQAList ) {
57acd2d2 261 fSDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
262 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
49466ea2 263 fSDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
4e25ac79 264 fSDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
57acd2d2 265 }
63c6f8ae 266 }
04236e67 267 rv = fSDigitsQAList ;
4e25ac79 268 } else if ( task == AliQAv1::kDIGITS ) {
63c6f8ae 269 if ( ! fDigitsQAList ) {
57acd2d2 270 fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
271 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
49466ea2 272 fDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ;
4e25ac79 273 fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
57acd2d2 274 }
63c6f8ae 275 }
04236e67 276 rv = fDigitsQAList ;
277 }
278
279 return rv ;
eca4fa66 280}
04236e67 281
282//____________________________________________________________________________
4e25ac79 283void AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
04236e67 284{
285 // Intialisation by passing the list of QA data booked elsewhere
286
287 fRun = run ;
288 if (cycles > 0)
289 SetCycle(cycles) ;
290
4e25ac79 291 if ( task == AliQAv1::kHITS ) {
04236e67 292 fHitsQAList = list ;
4e25ac79 293 } else if ( task == AliQAv1::kSDIGITS) {
04236e67 294 fSDigitsQAList = list ;
4e25ac79 295 } else if ( task == AliQAv1::kDIGITS ) {
04236e67 296 fDigitsQAList = list ;
297 }
298}
299
300//____________________________________________________________________________
930e6e3e 301void AliQADataMakerSim::StartOfCycle(Int_t run)
302{
303 // Finishes a cycle of QA for all tasks
304 Bool_t samecycle = kFALSE ;
4e25ac79 305 StartOfCycle(AliQAv1::kHITS, run, samecycle) ;
930e6e3e 306 samecycle = kTRUE ;
4e25ac79 307 StartOfCycle(AliQAv1::kSDIGITS, run, samecycle) ;
308 StartOfCycle(AliQAv1::kDIGITS, run, samecycle) ;
930e6e3e 309}
310
311//____________________________________________________________________________
4e25ac79 312void AliQADataMakerSim::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
04236e67 313{
314 // Finishes a cycle of QA data acquistion
930e6e3e 315 if ( run > 0 )
316 fRun = run ;
04236e67 317 if ( !sameCycle || fCurrentCycle == -1) {
318 ResetCycle() ;
319 if (fOutput)
320 fOutput->Close() ;
4e25ac79 321 fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ;
04236e67 322 }
323
5379c4a3 324 AliDebug(AliQAv1::GetQADebugLevel(), Form(" Run %d Cycle %d task %s file %s",
4e25ac79 325 fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ;
04236e67 326
eca4fa66 327 //fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
328// if (!fDetectorDir)
329// fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
330//
331// TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
332// if (!subDir)
333// subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
334//
335// for ( Int_t index = AliRecoParam::kDefault ; index < AliRecoParam::kNSpecies ; index++ ) {
336// TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(index)) ;
337// if (!eventSpecieDir)
338// eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(index)) ;
339// TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
340// if (!expertDir)
341// expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
342// }
04236e67 343 StartOfDetectorCycle() ;
344}