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