corrected compilation warnings
[u/mrichter/AliRoot.git] / STEER / AliQualAssDataMaker.cxx
CommitLineData
421ab0fb 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
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*/
25
26// --- ROOT system ---
27#include <TSystem.h>
28#include <TFile.h>
6c18591a 29#include <TList.h>
d76c31f4 30#include <TTree.h>
421ab0fb 31
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliLog.h"
36#include "AliQualAssDataMaker.h"
d76c31f4 37#include "AliESDEvent.h"
421ab0fb 38
39ClassImp(AliQualAssDataMaker)
40
41TString AliQualAssDataMaker::fDetectorDirName("") ;
42
43
44//____________________________________________________________________________
45AliQualAssDataMaker::AliQualAssDataMaker(const char * name, const char * title) :
46 TNamed(name, title),
47 fOutput(0x0),
6c18591a 48 fDetectorDir(0x0),
49 fDigitsQAList(0x0),
50 fESDsQAList(0x0),
51 fHitsQAList(0x0),
52 fRawsQAList(0x0),
53 fRecPointsQAList(0x0),
5b188f2f 54 fSDigitsQAList(0x0),
55 fCurrentCycle(-1),
56 fCycle(9999999),
57 fCycleCounter(0),
58 fRun(0)
421ab0fb 59{
60 // ctor
a5fa6165 61 TString tmp(GetName()) ;
62 tmp.Append("QA") ;
63 SetName(tmp.Data()) ;
421ab0fb 64 fDetectorDirName = GetName() ;
65}
66
67//____________________________________________________________________________
68AliQualAssDataMaker::AliQualAssDataMaker(const AliQualAssDataMaker& qadm) :
69 TNamed(qadm.GetName(), qadm.GetTitle()),
70 fOutput(qadm.fOutput),
6c18591a 71 fDetectorDir(qadm.fDetectorDir),
72 fDigitsQAList(qadm.fDigitsQAList),
73 fESDsQAList(qadm.fESDsQAList),
74 fHitsQAList(qadm.fHitsQAList),
75 fRawsQAList(qadm.fRecPointsQAList),
76 fRecPointsQAList(qadm.fRecPointsQAList),
5b188f2f 77 fSDigitsQAList(qadm.fSDigitsQAList),
78 fCurrentCycle(qadm.fCurrentCycle),
79 fCycle(qadm.fCycle),
80 fCycleCounter(qadm.fCycleCounter),
81 fRun(qadm.fRun)
421ab0fb 82{
83 //copy ctor
84 fDetectorDirName = GetName() ;
85}
86
87//__________________________________________________________________
88AliQualAssDataMaker& AliQualAssDataMaker::operator = (const AliQualAssDataMaker& qadm )
89{
90 // Equal operator.
91 this->~AliQualAssDataMaker();
92 new(this) AliQualAssDataMaker(qadm);
93 return *this;
94}
95
5b188f2f 96//____________________________________________________________________________
97void AliQualAssDataMaker::EndOfCycle(AliQualAss::TASKINDEX task)
98{
99 // Finishes a cycle of QA data acquistion
100
101 EndOfDetectorCycle() ;
102 TDirectory * subDir = fDetectorDir->GetDirectory(AliQualAss::GetTaskName(task)) ;
103
104 switch (task) {
105
106 case AliQualAss::kRAWS:
107 subDir->cd() ;
108 fRawsQAList->Write() ;
109 break ;
110
111 case AliQualAss::kHITS:
112 subDir->cd() ;
113 fHitsQAList->Write() ;
114 break ;
115
116 case AliQualAss::kSDIGITS:
117 subDir->cd() ;
118 fSDigitsQAList->Write() ;
119 break ;
120
121 case AliQualAss::kDIGITS:
122 subDir->cd() ;
123 fDigitsQAList->Write() ;
124 break ;
125
126 case AliQualAss::kRECPOINTS:
127 subDir->cd() ;
128 fRecPointsQAList->Write() ;
129 break ;
130
131 case AliQualAss::kTRACKSEGMENTS:
132 break ;
133
134 case AliQualAss::kRECPARTICLES:
135 break ;
136
137 case AliQualAss::kESDS:
138 subDir->cd() ;
139 fESDsQAList->Write() ;
140 break ;
141 }
142}
143
421ab0fb 144//____________________________________________________________________________
d76c31f4 145void AliQualAssDataMaker::Exec(AliQualAss::TASKINDEX task, TObject * data)
421ab0fb 146{
147 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
5b188f2f 148
421ab0fb 149 switch (task) {
6c18591a 150
151 case AliQualAss::kRAWS:
152 AliInfo("Processing Raws QA") ;
153 MakeRaws(data) ;
154 break ;
155
421ab0fb 156 case AliQualAss::kHITS:
157 AliInfo("Processing Hits QA") ;
d76c31f4 158 MakeHits(data) ;
421ab0fb 159 break ;
160
d76c31f4 161 case AliQualAss::kSDIGITS:
421ab0fb 162 AliInfo("Processing SDigits QA") ;
d76c31f4 163 MakeSDigits(data) ;
421ab0fb 164 break ;
d76c31f4 165
166 case AliQualAss::kDIGITS:
167 MakeDigits(data) ;
421ab0fb 168 break ;
169
170 case AliQualAss::kRECPOINTS:
d76c31f4 171 AliInfo("Processing RecPoints QA") ;
6c18591a 172 TTree * recpoints = dynamic_cast<TTree *>(data) ;
173 if (recpoints)
174 MakeRecPoints(recpoints) ;
175 else
176 AliError("Wrong type of recpoints container") ;
421ab0fb 177 break ;
178
179 case AliQualAss::kTRACKSEGMENTS:
d76c31f4 180 AliInfo("Processing Track Segments QA: not existing anymore") ;
181// TTree * ts = dynamic_cast<TTree *>(data) ;
182// if (ts)
183// MakeTrackSegments(ts) ;
184// else
185// AliError("Wrong type of track segments container") ;
421ab0fb 186 break ;
187
d76c31f4 188 case AliQualAss::kRECPARTICLES:
189 AliInfo("Processing RecParticles QA: not existing anymore") ;
190// TTree * recpar = dynamic_cast<TTree *>(data) ;
191// if (recpar)
192// MakeRecParticles(recpar) ;
193// else
194// AliError("Wrong type of recparticles container") ;
195 break ;
196
421ab0fb 197 case AliQualAss::kESDS:
198 AliInfo("Processing ESDs QA") ;
d76c31f4 199 AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ;
200 if (esd)
201 MakeESDs(esd) ;
202 else
203 AliError("Wrong type of esd container") ;
421ab0fb 204 break ;
5b188f2f 205 }
421ab0fb 206}
207
208//____________________________________________________________________________
5b188f2f 209void AliQualAssDataMaker::Finish(AliQualAss::TASKINDEX) const
421ab0fb 210{
5b188f2f 211 // write to the output File
421ab0fb 212}
213
214//____________________________________________________________________________
5b188f2f 215TList * AliQualAssDataMaker::Init(AliQualAss::TASKINDEX task, Int_t run, Int_t cycles)
421ab0fb 216{
217 // general intialisation
421ab0fb 218
5b188f2f 219 fRun = run ;
220 if (cycles > 0)
221 SetCycle(cycles) ;
222
421ab0fb 223 switch (task) {
6c18591a 224 case AliQualAss::kRAWS:
6c18591a 225 fRawsQAList = new TList() ;
226 InitRaws() ;
227 return fRawsQAList ;
228 break ;
229
421ab0fb 230 case AliQualAss::kHITS:
6c18591a 231 fHitsQAList = new TList() ;
421ab0fb 232 InitHits() ;
6c18591a 233 return fHitsQAList ;
421ab0fb 234 break ;
235
236 case AliQualAss::kSDIGITS:
6c18591a 237 fSDigitsQAList = new TList() ;
421ab0fb 238 InitSDigits() ;
6c18591a 239 return fSDigitsQAList ;
421ab0fb 240 break ;
241
242 case AliQualAss::kDIGITS:
6c18591a 243 fDigitsQAList = new TList();
421ab0fb 244 InitDigits() ;
6c18591a 245 return fDigitsQAList ;
421ab0fb 246 break ;
247
248 case AliQualAss::kRECPOINTS:
6c18591a 249 fRecPointsQAList = new TList ;
421ab0fb 250 InitRecPoints() ;
6c18591a 251 return fRecPointsQAList ;
421ab0fb 252 break ;
253
254 case AliQualAss::kTRACKSEGMENTS:
6c18591a 255// InitTrackSegments() ;
421ab0fb 256 break ;
257
258 case AliQualAss::kRECPARTICLES:
6c18591a 259// InitRecParticles() ;
421ab0fb 260 break ;
261
262 case AliQualAss::kESDS:
6c18591a 263 fESDsQAList = new TList() ;
264 InitESDs() ;
265 return fRecPointsQAList ;
421ab0fb 266 break ;
267 }
6c18591a 268 return 0x0 ;
421ab0fb 269}
5b188f2f 270
271//____________________________________________________________________________
272void AliQualAssDataMaker::StartOfCycle(AliQualAss::TASKINDEX task, Option_t * sameCycle)
273{
274 // Finishes a cycle of QA data acquistion
275
276 if ( (strcmp(sameCycle, "same") != 0) ) {
277 fCurrentCycle++ ;
278 ResetCycle() ;
279 } else if ( !(strcmp(sameCycle, "") != 0) )
280 AliFatal(Form("%s is an invalid option, valid options are: same", sameCycle)) ;
281
282 fOutput = AliQualAss::GetQADMOutFile(fRun, fCurrentCycle) ;
283
284 AliInfo(Form(" Run %d Cycle %d task %s file %s",
285 fRun, fCurrentCycle, AliQualAss::GetTaskName(task).Data(), fOutput->GetName() )) ;
286
287 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
288 if (!fDetectorDir)
289 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
290
291 TDirectory * subDir = fDetectorDir->GetDirectory(AliQualAss::GetTaskName(task)) ;
292 if (!subDir)
293 subDir = fDetectorDir->mkdir(AliQualAss::GetTaskName(task)) ;
294 subDir->cd() ;
295
296 TList * list = 0x0 ;
297
298 switch (task) {
299 case AliQualAss::kRAWS:
300 list = fRawsQAList ;
301 break ;
302
303 case AliQualAss::kHITS:
304 list = fHitsQAList ;
305 break ;
306
307 case AliQualAss::kSDIGITS:
308 list = fSDigitsQAList ;
309 break ;
310
311 case AliQualAss::kDIGITS:
312 list = fDigitsQAList ;
313 break ;
314
315 case AliQualAss::kRECPOINTS:
316 list = fRecPointsQAList ;
317 break ;
318
319 case AliQualAss::kTRACKSEGMENTS:
320 break ;
321
322 case AliQualAss::kRECPARTICLES:
323 break ;
324
325 case AliQualAss::kESDS:
326 list = fESDsQAList ;
327 break ;
328 }
329
330 TIter next(list) ;
331 TH1 * h ;
332 while ( (h = dynamic_cast<TH1 *>(next())) )
333 h->Reset() ;
334
335 StartOfDetectorCycle() ;
336
337}