New QA classes (Yves)
[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>
29
30// --- Standard library ---
31
32// --- AliRoot header files ---
33#include "AliLog.h"
34#include "AliQualAssDataMaker.h"
35
36ClassImp(AliQualAssDataMaker)
37
38TString AliQualAssDataMaker::fDetectorDirName("") ;
39
40
41//____________________________________________________________________________
42AliQualAssDataMaker::AliQualAssDataMaker(const char * name, const char * title) :
43 TNamed(name, title),
44 fOutput(0x0),
45 fDetectorDir(0x0),
46 fData(0x0)
47{
48 // ctor
49 fOutput = AliQualAss::GetQADMOutFile() ;
50 fDetectorDirName = GetName() ;
51}
52
53//____________________________________________________________________________
54AliQualAssDataMaker::AliQualAssDataMaker(const AliQualAssDataMaker& qadm) :
55 TNamed(qadm.GetName(), qadm.GetTitle()),
56 fOutput(qadm.fOutput),
57 fDetectorDir(qadm.fDetectorDir),
58 fData(qadm.fData)
59{
60 //copy ctor
61 fDetectorDirName = GetName() ;
62}
63
64//__________________________________________________________________
65AliQualAssDataMaker& AliQualAssDataMaker::operator = (const AliQualAssDataMaker& qadm )
66{
67 // Equal operator.
68 this->~AliQualAssDataMaker();
69 new(this) AliQualAssDataMaker(qadm);
70 return *this;
71}
72
73//____________________________________________________________________________
74void AliQualAssDataMaker::Exec(AliQualAss::TASKINDEX task)
75{
76 // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
77
78 fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
79 if (!fDetectorDir)
80 fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
81
82 switch (task) {
83 case AliQualAss::kHITS:
84 AliInfo("Processing Hits QA") ;
85 MakeHits() ;
86 break ;
87
88 case AliQualAss::kSDIGITS:
89 AliInfo("Processing SDigits QA") ;
90 MakeSDigits() ;
91 break ;
92
93 case AliQualAss::kDIGITS:
94 AliInfo("Processing Digits QA") ;
95 MakeDigits() ;
96 break ;
97
98 case AliQualAss::kRECPOINTS:
99 AliInfo("Processing RecPoints QA") ;
100 MakeRecPoints() ;
101 break ;
102
103 case AliQualAss::kTRACKSEGMENTS:
104 AliInfo("Processing Track Segments QA") ;
105 MakeTrackSegments() ;
106 break ;
107
108 case AliQualAss::kRECPARTICLES:
109 AliInfo("Processing RecParticles QA") ;
110 MakeRecParticles() ;
111 break ;
112
113 case AliQualAss::kESDS:
114 AliInfo("Processing ESDs QA") ;
115 MakeESDs() ;
116 break ;
117 }
118}
119
120//____________________________________________________________________________
121void AliQualAssDataMaker::Finish(AliQualAss::TASKINDEX task) const
122{
123 // write to the output File
124
125 fDetectorDir->cd() ;
126 TDirectory * subDir = 0x0 ;
127
128 switch (task) {
129 case AliQualAss::kHITS:
130 subDir = fDetectorDir->GetDirectory("Hits") ;
131 break ;
132
133 case AliQualAss::kSDIGITS:
134 subDir = fDetectorDir->GetDirectory("SDigits") ;
135 break ;
136
137 case AliQualAss::kDIGITS:
138 subDir = fDetectorDir->GetDirectory("Digits") ;
139 break ;
140
141 case AliQualAss::kRECPOINTS:
142 subDir = fDetectorDir->GetDirectory("RecPoints") ;
143 break ;
144
145 case AliQualAss::kTRACKSEGMENTS:
146 subDir = fDetectorDir->GetDirectory("TrackSegments") ;
147 break ;
148
149 case AliQualAss::kRECPARTICLES:
150 subDir = fDetectorDir->GetDirectory("RecParticles") ;
151 break ;
152
153 case AliQualAss::kESDS:
154 subDir = fDetectorDir->GetDirectory("ESDs") ;
155 break ;
156 }
157 subDir->Write() ;
158}
159
160//____________________________________________________________________________
161void AliQualAssDataMaker::Init(AliQualAss::TASKINDEX task)
162{
163 // general intialisation
164
165 TDirectory * subDir = 0x0 ;
166
167 switch (task) {
168 case AliQualAss::kHITS:
169 subDir = fDetectorDir->GetDirectory("Hits") ;
170 if (!subDir)
171 subDir = fDetectorDir->mkdir("Hits") ;
172 subDir->cd() ;
173 InitHits() ;
174 break ;
175
176 case AliQualAss::kSDIGITS:
177 subDir = fDetectorDir->GetDirectory("SDigits") ;
178 if (!subDir)
179 subDir = fDetectorDir->mkdir("SDigits") ;
180 subDir->cd() ;
181 InitSDigits() ;
182 break ;
183
184 case AliQualAss::kDIGITS:
185 subDir = fDetectorDir->GetDirectory("Digits") ;
186 if (!subDir)
187 subDir = fDetectorDir->mkdir("Digits") ;
188 subDir->cd() ;
189 InitDigits() ;
190 break ;
191
192 case AliQualAss::kRECPOINTS:
193 subDir = fDetectorDir->GetDirectory("RecPoints") ;
194 if(!subDir)
195 subDir = fDetectorDir->mkdir("RecPoints") ;
196 subDir->cd() ;
197 InitRecPoints() ;
198 break ;
199
200 case AliQualAss::kTRACKSEGMENTS:
201 subDir = fDetectorDir->GetDirectory("TrackSegments") ;
202 if (!subDir)
203 subDir = fDetectorDir->mkdir("TrackSegments") ;
204 subDir->cd() ;
205 InitTrackSegments() ;
206 break ;
207
208 case AliQualAss::kRECPARTICLES:
209 subDir = fDetectorDir->GetDirectory("RecParticles") ;
210 if (!subDir)
211 subDir = fDetectorDir->mkdir("RecParticles") ;
212 subDir->cd() ;
213 InitRecParticles() ;
214 break ;
215
216 case AliQualAss::kESDS:
217 subDir = fDetectorDir->GetDirectory("ESDs") ;
218 if (!subDir)
219 subDir = fDetectorDir->mkdir("ESDs") ;
220 subDir->cd() ;
221 InitESDs() ;
222 break ;
223 }
224}