Initialization of some data members (Christian)
[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),
54 fSDigitsQAList(0x0)
421ab0fb 55{
56 // ctor
a5fa6165 57 TString tmp(GetName()) ;
58 tmp.Append("QA") ;
59 SetName(tmp.Data()) ;
421ab0fb 60 fOutput = AliQualAss::GetQADMOutFile() ;
61 fDetectorDirName = GetName() ;
62}
63
64//____________________________________________________________________________
65AliQualAssDataMaker::AliQualAssDataMaker(const AliQualAssDataMaker& qadm) :
66 TNamed(qadm.GetName(), qadm.GetTitle()),
67 fOutput(qadm.fOutput),
6c18591a 68 fDetectorDir(qadm.fDetectorDir),
69 fDigitsQAList(qadm.fDigitsQAList),
70 fESDsQAList(qadm.fESDsQAList),
71 fHitsQAList(qadm.fHitsQAList),
72 fRawsQAList(qadm.fRecPointsQAList),
73 fRecPointsQAList(qadm.fRecPointsQAList),
74 fSDigitsQAList(qadm.fSDigitsQAList)
421ab0fb 75{
76 //copy ctor
77 fDetectorDirName = GetName() ;
78}
79
80//__________________________________________________________________
81AliQualAssDataMaker& AliQualAssDataMaker::operator = (const AliQualAssDataMaker& qadm )
82{
83 // Equal operator.
84 this->~AliQualAssDataMaker();
85 new(this) AliQualAssDataMaker(qadm);
86 return *this;
87}
88
89//____________________________________________________________________________
d76c31f4 90void AliQualAssDataMaker::Exec(AliQualAss::TASKINDEX task, TObject * data)
421ab0fb 91{
92 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
93
94 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
95 if (!fDetectorDir)
96 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
97
98 switch (task) {
6c18591a 99
100 case AliQualAss::kRAWS:
101 AliInfo("Processing Raws QA") ;
102 MakeRaws(data) ;
103 break ;
104
421ab0fb 105 case AliQualAss::kHITS:
106 AliInfo("Processing Hits QA") ;
d76c31f4 107 MakeHits(data) ;
421ab0fb 108 break ;
109
d76c31f4 110 case AliQualAss::kSDIGITS:
421ab0fb 111 AliInfo("Processing SDigits QA") ;
d76c31f4 112 MakeSDigits(data) ;
421ab0fb 113 break ;
d76c31f4 114
115 case AliQualAss::kDIGITS:
116 MakeDigits(data) ;
421ab0fb 117 break ;
118
119 case AliQualAss::kRECPOINTS:
d76c31f4 120 AliInfo("Processing RecPoints QA") ;
6c18591a 121 TTree * recpoints = dynamic_cast<TTree *>(data) ;
122 if (recpoints)
123 MakeRecPoints(recpoints) ;
124 else
125 AliError("Wrong type of recpoints container") ;
421ab0fb 126 break ;
127
128 case AliQualAss::kTRACKSEGMENTS:
d76c31f4 129 AliInfo("Processing Track Segments QA: not existing anymore") ;
130// TTree * ts = dynamic_cast<TTree *>(data) ;
131// if (ts)
132// MakeTrackSegments(ts) ;
133// else
134// AliError("Wrong type of track segments container") ;
421ab0fb 135 break ;
136
d76c31f4 137 case AliQualAss::kRECPARTICLES:
138 AliInfo("Processing RecParticles QA: not existing anymore") ;
139// TTree * recpar = dynamic_cast<TTree *>(data) ;
140// if (recpar)
141// MakeRecParticles(recpar) ;
142// else
143// AliError("Wrong type of recparticles container") ;
144 break ;
145
421ab0fb 146 case AliQualAss::kESDS:
147 AliInfo("Processing ESDs QA") ;
d76c31f4 148 AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ;
149 if (esd)
150 MakeESDs(esd) ;
151 else
152 AliError("Wrong type of esd container") ;
421ab0fb 153 break ;
154 }
155}
156
157//____________________________________________________________________________
158void AliQualAssDataMaker::Finish(AliQualAss::TASKINDEX task) const
159{
160 // write to the output File
161
162 fDetectorDir->cd() ;
163 TDirectory * subDir = 0x0 ;
164
a5fa6165 165// switch (task) {
166// case AliQualAss::kHITS:
167 subDir = fDetectorDir->GetDirectory(AliQualAss::GetTaskName(task)) ;
168// break ;
169
170// case AliQualAss::kSDIGITS:
171// subDir = fDetectorDir->GetDirectory("SDigits") ;
172// break ;
173
174// case AliQualAss::kDIGITS:
175// subDir = fDetectorDir->GetDirectory("Digits") ;
176// break ;
421ab0fb 177
a5fa6165 178// case AliQualAss::kRECPOINTS:
179// subDir = fDetectorDir->GetDirectory("RecPoints") ;
180// break ;
421ab0fb 181
a5fa6165 182// case AliQualAss::kTRACKSEGMENTS:
183// subDir = fDetectorDir->GetDirectory("TrackSegments") ;
184// break ;
421ab0fb 185
a5fa6165 186// case AliQualAss::kRECPARTICLES:
187// subDir = fDetectorDir->GetDirectory("RecParticles") ;
188// break ;
421ab0fb 189
a5fa6165 190// case AliQualAss::kESDS:
191// subDir = fDetectorDir->GetDirectory("ESDs") ;
192// break ;
193// }
421ab0fb 194 subDir->Write() ;
195}
196
197//____________________________________________________________________________
6c18591a 198TList * AliQualAssDataMaker::Init(AliQualAss::TASKINDEX task)
421ab0fb 199{
200 // general intialisation
421ab0fb 201 TDirectory * subDir = 0x0 ;
202
203 switch (task) {
6c18591a 204 case AliQualAss::kRAWS:
205 subDir = fDetectorDir->GetDirectory("Raws") ;
206 if (!subDir)
207 subDir = fDetectorDir->mkdir("Raws") ;
208 subDir->cd() ;
209 fRawsQAList = new TList() ;
210 InitRaws() ;
211 return fRawsQAList ;
212 break ;
213
421ab0fb 214 case AliQualAss::kHITS:
215 subDir = fDetectorDir->GetDirectory("Hits") ;
216 if (!subDir)
217 subDir = fDetectorDir->mkdir("Hits") ;
218 subDir->cd() ;
6c18591a 219 fHitsQAList = new TList() ;
421ab0fb 220 InitHits() ;
6c18591a 221 return fHitsQAList ;
421ab0fb 222 break ;
223
224 case AliQualAss::kSDIGITS:
225 subDir = fDetectorDir->GetDirectory("SDigits") ;
226 if (!subDir)
227 subDir = fDetectorDir->mkdir("SDigits") ;
228 subDir->cd() ;
6c18591a 229 fSDigitsQAList = new TList() ;
421ab0fb 230 InitSDigits() ;
6c18591a 231 return fSDigitsQAList ;
421ab0fb 232 break ;
233
234 case AliQualAss::kDIGITS:
235 subDir = fDetectorDir->GetDirectory("Digits") ;
236 if (!subDir)
237 subDir = fDetectorDir->mkdir("Digits") ;
6c18591a 238 subDir->cd() ;
239 fDigitsQAList = new TList();
421ab0fb 240 InitDigits() ;
6c18591a 241 return fDigitsQAList ;
421ab0fb 242 break ;
243
244 case AliQualAss::kRECPOINTS:
245 subDir = fDetectorDir->GetDirectory("RecPoints") ;
246 if(!subDir)
247 subDir = fDetectorDir->mkdir("RecPoints") ;
248 subDir->cd() ;
6c18591a 249 fRecPointsQAList = new TList ;
421ab0fb 250 InitRecPoints() ;
6c18591a 251 return fRecPointsQAList ;
421ab0fb 252 break ;
253
254 case AliQualAss::kTRACKSEGMENTS:
6c18591a 255// subDir = fDetectorDir->GetDirectory("TrackSegments") ;
256// if (!subDir)
257// subDir = fDetectorDir->mkdir("TrackSegments") ;
258// subDir->cd() ;
259// InitTrackSegments() ;
421ab0fb 260 break ;
261
262 case AliQualAss::kRECPARTICLES:
6c18591a 263// subDir = fDetectorDir->GetDirectory("RecParticles") ;
264// if (!subDir)
265// subDir = fDetectorDir->mkdir("RecParticles") ;
266// subDir->cd() ;
267// InitRecParticles() ;
421ab0fb 268 break ;
269
270 case AliQualAss::kESDS:
271 subDir = fDetectorDir->GetDirectory("ESDs") ;
272 if (!subDir)
273 subDir = fDetectorDir->mkdir("ESDs") ;
274 subDir->cd() ;
6c18591a 275 fESDsQAList = new TList() ;
276 InitESDs() ;
277 return fRecPointsQAList ;
421ab0fb 278 break ;
279 }
6c18591a 280 return 0x0 ;
421ab0fb 281}