]>
Commit | Line | Data |
---|---|---|
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 --- | |
04236e67 | 27 | #include <TFile.h> |
04236e67 | 28 | #include <TTree.h> |
29 | #include <TClonesArray.h> | |
30 | ||
31 | // --- Standard library --- | |
32 | ||
33 | // --- AliRoot header files --- | |
34 | #include "AliLog.h" | |
35 | #include "AliQADataMakerSim.h" | |
04236e67 | 36 | |
37 | ClassImp(AliQADataMakerSim) | |
38 | ||
39 | //____________________________________________________________________________ | |
40 | AliQADataMakerSim::AliQADataMakerSim(const char * name, const char * title) : | |
41 | AliQADataMaker(name, title), | |
42 | fDigitsQAList(0x0), | |
43 | fHitsQAList(0x0), | |
44 | fSDigitsQAList(0x0) | |
45 | { | |
46 | // ctor | |
47 | fDetectorDirName = GetName() ; | |
48 | } | |
49 | ||
50 | //____________________________________________________________________________ | |
51 | AliQADataMakerSim::AliQADataMakerSim(const AliQADataMakerSim& qadm) : | |
52 | AliQADataMaker(qadm.GetName(), qadm.GetTitle()), | |
53 | fDigitsQAList(qadm.fDigitsQAList), | |
54 | fHitsQAList(qadm.fHitsQAList), | |
55 | fSDigitsQAList(qadm.fSDigitsQAList) | |
56 | { | |
57 | //copy ctor | |
58 | fDetectorDirName = GetName() ; | |
59 | } | |
60 | ||
63c6f8ae | 61 | //____________________________________________________________________________ |
62 | AliQADataMakerSim::~AliQADataMakerSim() | |
63 | { | |
64 | //dtor: delete the TObjArray and thei content | |
7ff8385d | 65 | if ( fDigitsQAList ) { |
b3cc11cb | 66 | if ( fDigitsQAList->IsOwner() ) |
67 | fDigitsQAList->Delete() ; | |
7ff8385d | 68 | delete fDigitsQAList ; |
69 | } | |
70 | if ( fHitsQAList ) { | |
b3cc11cb | 71 | if ( fHitsQAList->IsOwner() ) |
72 | fHitsQAList->Delete() ; | |
7ff8385d | 73 | delete fHitsQAList ; |
74 | } | |
75 | if ( fSDigitsQAList ) { | |
b3cc11cb | 76 | if ( fSDigitsQAList->IsOwner() ) |
77 | fSDigitsQAList->Delete() ; | |
7ff8385d | 78 | delete fSDigitsQAList ; |
79 | } | |
63c6f8ae | 80 | } |
81 | ||
04236e67 | 82 | //__________________________________________________________________ |
83 | AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm ) | |
84 | { | |
85 | // Assignment operator. | |
86 | this->~AliQADataMakerSim(); | |
87 | new(this) AliQADataMakerSim(qadm); | |
88 | return *this; | |
89 | } | |
90 | ||
930e6e3e | 91 | //____________________________________________________________________________ |
92 | void AliQADataMakerSim::EndOfCycle() | |
93 | { | |
94 | // Finishes a cycle of QA for all tasks | |
95 | EndOfCycle(AliQA::kHITS) ; | |
96 | EndOfCycle(AliQA::kSDIGITS) ; | |
97 | EndOfCycle(AliQA::kDIGITS) ; | |
98 | ResetCycle() ; | |
99 | } | |
100 | ||
04236e67 | 101 | //____________________________________________________________________________ |
96d67a8d | 102 | void AliQADataMakerSim::EndOfCycle(AliQA::TASKINDEX_t task) |
04236e67 | 103 | { |
104 | // Finishes a cycle of QA data acquistion | |
105 | TObjArray * list = 0x0 ; | |
106 | ||
107 | if ( task == AliQA::kHITS ) | |
108 | list = fHitsQAList ; | |
109 | else if ( task == AliQA::kSDIGITS ) | |
110 | list = fSDigitsQAList ; | |
111 | else if ( task == AliQA::kDIGITS ) | |
112 | list = fDigitsQAList ; | |
930e6e3e | 113 | |
114 | if ( ! list ) | |
115 | return ; | |
04236e67 | 116 | EndOfDetectorCycle(task, list) ; |
117 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
ccbf0759 | 118 | if (subDir) { |
119 | subDir->cd() ; | |
120 | list->Write() ; | |
121 | } | |
930e6e3e | 122 | ResetCycle() ; |
04236e67 | 123 | } |
124 | ||
125 | //____________________________________________________________________________ | |
96d67a8d | 126 | void AliQADataMakerSim::Exec(AliQA::TASKINDEX_t task, TObject * data) |
04236e67 | 127 | { |
128 | // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs) | |
129 | ||
130 | if ( task == AliQA::kHITS ) { | |
131 | AliDebug(1, "Processing Hits QA") ; | |
132 | TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ; | |
133 | if (arr) { | |
134 | MakeHits(arr) ; | |
135 | } else { | |
136 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
137 | if (tree) { | |
138 | MakeHits(tree) ; | |
139 | } else { | |
140 | AliWarning("data are neither a TClonesArray nor a TTree") ; | |
141 | } | |
142 | } | |
143 | } else if ( task == AliQA::kSDIGITS ) { | |
144 | AliDebug(1, "Processing SDigits QA") ; | |
145 | TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ; | |
146 | if (arr) { | |
147 | MakeSDigits(arr) ; | |
148 | } else { | |
149 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
150 | if (tree) { | |
151 | MakeSDigits(tree) ; | |
152 | } else { | |
153 | AliWarning("data are neither a TClonesArray nor a TTree") ; | |
154 | } | |
155 | } | |
156 | } else if ( task == AliQA::kDIGITS ) { | |
157 | AliDebug(1, "Processing Digits QA") ; | |
158 | TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ; | |
159 | if (arr) { | |
160 | MakeDigits(arr) ; | |
161 | } else { | |
162 | TTree * tree = dynamic_cast<TTree *>(data) ; | |
163 | if (tree) { | |
164 | MakeDigits(tree) ; | |
165 | } else { | |
166 | AliWarning("data are neither a TClonesArray nor a TTree") ; | |
167 | } | |
168 | } | |
169 | } | |
170 | } | |
171 | ||
172 | //____________________________________________________________________________ | |
930e6e3e | 173 | TObjArray * AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, Int_t cycles) |
04236e67 | 174 | { |
175 | // general intialisation | |
176 | ||
04236e67 | 177 | if (cycles > 0) |
178 | SetCycle(cycles) ; | |
179 | TObjArray * rv = NULL ; | |
180 | if ( task == AliQA::kHITS ) { | |
63c6f8ae | 181 | if ( ! fHitsQAList ) { |
182 | fHitsQAList = new TObjArray(100) ; | |
a2b64fbd | 183 | fHitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ; |
63c6f8ae | 184 | InitHits() ; |
185 | } | |
04236e67 | 186 | rv = fHitsQAList ; |
187 | } else if ( task == AliQA::kSDIGITS ) { | |
63c6f8ae | 188 | if ( ! fSDigitsQAList ) { |
189 | fSDigitsQAList = new TObjArray(100) ; | |
a2b64fbd | 190 | fSDigitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ; |
63c6f8ae | 191 | InitSDigits() ; |
192 | } | |
04236e67 | 193 | rv = fSDigitsQAList ; |
194 | } else if ( task == AliQA::kDIGITS ) { | |
63c6f8ae | 195 | if ( ! fDigitsQAList ) { |
196 | fDigitsQAList = new TObjArray(100) ; | |
a2b64fbd | 197 | fDigitsQAList->SetName(Form("%s/%s", GetName(), AliQA::GetTaskName(task).Data())) ; |
63c6f8ae | 198 | InitDigits() ; |
199 | } | |
04236e67 | 200 | rv = fDigitsQAList ; |
201 | } | |
202 | ||
203 | return rv ; | |
204 | } | |
205 | ||
206 | //____________________________________________________________________________ | |
96d67a8d | 207 | void AliQADataMakerSim::Init(AliQA::TASKINDEX_t task, TObjArray * list, Int_t run, Int_t cycles) |
04236e67 | 208 | { |
209 | // Intialisation by passing the list of QA data booked elsewhere | |
210 | ||
211 | fRun = run ; | |
212 | if (cycles > 0) | |
213 | SetCycle(cycles) ; | |
214 | ||
215 | if ( task == AliQA::kHITS ) { | |
216 | fHitsQAList = list ; | |
217 | } else if ( task == AliQA::kSDIGITS) { | |
218 | fSDigitsQAList = list ; | |
219 | } else if ( task == AliQA::kDIGITS ) { | |
220 | fDigitsQAList = list ; | |
221 | } | |
222 | } | |
223 | ||
224 | //____________________________________________________________________________ | |
930e6e3e | 225 | void AliQADataMakerSim::StartOfCycle(Int_t run) |
226 | { | |
227 | // Finishes a cycle of QA for all tasks | |
228 | Bool_t samecycle = kFALSE ; | |
229 | StartOfCycle(AliQA::kHITS, run, samecycle) ; | |
230 | samecycle = kTRUE ; | |
231 | StartOfCycle(AliQA::kSDIGITS, run, samecycle) ; | |
232 | StartOfCycle(AliQA::kDIGITS, run, samecycle) ; | |
233 | } | |
234 | ||
235 | //____________________________________________________________________________ | |
236 | void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle) | |
04236e67 | 237 | { |
238 | // Finishes a cycle of QA data acquistion | |
930e6e3e | 239 | if ( run > 0 ) |
240 | fRun = run ; | |
04236e67 | 241 | if ( !sameCycle || fCurrentCycle == -1) { |
242 | ResetCycle() ; | |
243 | if (fOutput) | |
244 | fOutput->Close() ; | |
930e6e3e | 245 | fOutput = AliQA::GetQADataFile(GetName(), fRun) ; |
04236e67 | 246 | } |
247 | ||
248 | AliInfo(Form(" Run %d Cycle %d task %s file %s", | |
249 | fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ; | |
250 | ||
251 | fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; | |
252 | if (!fDetectorDir) | |
253 | fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; | |
254 | ||
255 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; | |
256 | if (!subDir) | |
257 | subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ; | |
258 | subDir->cd() ; | |
930e6e3e | 259 | |
04236e67 | 260 | StartOfDetectorCycle() ; |
261 | } |