]>
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 * | |
940d8e5f | 10 | * copies and that both the copyright notice and this permission notifce * |
04236e67 | 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 for Reconstruction | |
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> |
57acd2d2 | 29 | #include <TNtupleD.h> |
fb6e511e | 30 | #include <TObjArray.h> |
04236e67 | 31 | |
32 | // --- Standard library --- | |
33 | ||
34 | // --- AliRoot header files --- | |
fb6e511e | 35 | #include "AliCDBPath.h" |
36 | #include "AliCDBEntry.h" | |
37 | #include "AliDetectorRecoParam.h" | |
38 | #include "AliCDBManager.h" | |
39 | ||
04236e67 | 40 | #include "AliLog.h" |
41 | #include "AliQADataMakerRec.h" | |
04236e67 | 42 | #include "AliESDEvent.h" |
43 | #include "AliRawReader.h" | |
44 | ||
45 | ClassImp(AliQADataMakerRec) | |
46 | ||
47 | //____________________________________________________________________________ | |
48 | AliQADataMakerRec::AliQADataMakerRec(const char * name, const char * title) : | |
49 | AliQADataMaker(name, title), | |
71f27f1f | 50 | fDigitsQAList(NULL), |
a2b64fbd | 51 | fESDsQAList(NULL), |
52 | fRawsQAList(NULL), | |
53 | fRecPointsQAList(NULL), | |
57acd2d2 | 54 | fCorrNt(NULL), |
6252ceeb | 55 | fRecoParam(NULL), |
56 | fRecPointsArray(NULL) | |
04236e67 | 57 | { |
58 | // ctor | |
59 | fDetectorDirName = GetName() ; | |
60 | } | |
61 | ||
62 | //____________________________________________________________________________ | |
63 | AliQADataMakerRec::AliQADataMakerRec(const AliQADataMakerRec& qadm) : | |
b8bd1ab8 | 64 | AliQADataMaker(qadm.GetName(), qadm.GetTitle()), |
71f27f1f | 65 | fDigitsQAList(qadm.fDigitsQAList), |
b8bd1ab8 | 66 | fESDsQAList(qadm.fESDsQAList), |
67 | fRawsQAList(qadm.fRawsQAList), | |
68 | fRecPointsQAList(qadm.fRecPointsQAList), | |
57acd2d2 | 69 | fCorrNt(qadm.fCorrNt), |
6252ceeb | 70 | fRecoParam(qadm.fRecoParam), |
71 | fRecPointsArray(NULL) | |
04236e67 | 72 | { |
73 | //copy ctor | |
74 | SetName(qadm.GetName()) ; | |
75 | SetTitle(qadm.GetTitle()) ; | |
76 | fDetectorDirName = GetName() ; | |
77 | } | |
78 | ||
63c6f8ae | 79 | //____________________________________________________________________________ |
80 | AliQADataMakerRec::~AliQADataMakerRec() | |
81 | { | |
82 | //dtor: delete the TObjArray and thei content | |
7ff8385d | 83 | if ( fESDsQAList ) { |
57acd2d2 | 84 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { |
85 | if ( fESDsQAList[specie] ) { | |
86 | if ( fESDsQAList[specie]->IsOwner() ) | |
87 | fESDsQAList[specie]->Delete() ; | |
88 | } | |
89 | } | |
90 | delete[] fESDsQAList ; | |
7ff8385d | 91 | } |
92 | if ( fRawsQAList ) { | |
57acd2d2 | 93 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { |
94 | if ( fRawsQAList[specie] ) { | |
95 | if ( fRawsQAList[specie]->IsOwner() ) | |
96 | fRawsQAList[specie]->Delete() ; | |
97 | } | |
98 | } | |
99 | delete[] fRawsQAList ; | |
44ed7a66 | 100 | } |
101 | if ( fDigitsQAList ) { | |
102 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
103 | if ( fDigitsQAList[specie] ) { | |
104 | if ( fDigitsQAList[specie]->IsOwner() ) | |
105 | fDigitsQAList[specie]->Delete() ; | |
106 | } | |
107 | } | |
108 | delete[] fDigitsQAList ; | |
57acd2d2 | 109 | } |
7ff8385d | 110 | if ( fRecPointsQAList ) { |
57acd2d2 | 111 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { |
112 | if ( fRecPointsQAList[specie] ) { | |
113 | if ( fRecPointsQAList[specie]->IsOwner() ) | |
114 | fRecPointsQAList[specie]->Delete() ; | |
115 | } | |
116 | } | |
117 | delete[] fRecPointsQAList ; | |
eca4fa66 | 118 | } |
6252ceeb | 119 | if (fRecPointsArray) { |
120 | fRecPointsArray->Clear() ; | |
121 | delete fRecPointsArray ; | |
122 | } | |
63c6f8ae | 123 | } |
124 | ||
04236e67 | 125 | //__________________________________________________________________ |
126 | AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm ) | |
127 | { | |
128 | // Assignment operator. | |
129 | this->~AliQADataMakerRec(); | |
130 | new(this) AliQADataMakerRec(qadm); | |
131 | return *this; | |
132 | } | |
133 | ||
930e6e3e | 134 | //____________________________________________________________________________ |
135 | void AliQADataMakerRec::EndOfCycle() | |
136 | { | |
137 | // Finishes a cycle of QA for all the tasks | |
4e25ac79 | 138 | EndOfCycle(AliQAv1::kRAWS) ; |
44ed7a66 | 139 | EndOfCycle(AliQAv1::kDIGITSR) ; |
4e25ac79 | 140 | EndOfCycle(AliQAv1::kRECPOINTS) ; |
141 | EndOfCycle(AliQAv1::kESDS) ; | |
930e6e3e | 142 | ResetCycle() ; |
143 | } | |
144 | ||
04236e67 | 145 | //____________________________________________________________________________ |
4e25ac79 | 146 | void AliQADataMakerRec::EndOfCycle(AliQAv1::TASKINDEX_t task) |
04236e67 | 147 | { |
930e6e3e | 148 | // Finishes a cycle of QA |
04236e67 | 149 | |
57acd2d2 | 150 | TObjArray ** list = NULL ; |
04236e67 | 151 | |
4e25ac79 | 152 | if ( task == AliQAv1::kRAWS ) |
04236e67 | 153 | list = fRawsQAList ; |
44ed7a66 | 154 | else if ( task == AliQAv1::kDIGITSR ) |
155 | list = fDigitsQAList ; | |
4e25ac79 | 156 | else if ( task == AliQAv1::kRECPOINTS ) |
04236e67 | 157 | list = fRecPointsQAList ; |
4e25ac79 | 158 | else if ( task == AliQAv1::kESDS ) |
04236e67 | 159 | list = fESDsQAList ; |
7c002d48 | 160 | |
930e6e3e | 161 | |
57acd2d2 | 162 | if ( ! list && ! fCorrNt ) |
930e6e3e | 163 | return ; |
164 | //DefaultEndOfDetectorCycle(task) ; | |
0774e4a4 | 165 | EndOfDetectorCycle(task, list) ; |
eca4fa66 | 166 | fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; |
167 | if (!fDetectorDir) | |
168 | fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; | |
169 | TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ; | |
170 | if (!subDir) | |
171 | subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ; | |
172 | subDir->cd() ; | |
6252ceeb | 173 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { // skip Default |
174 | if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) || AliRecoParam::ConvertIndex(specie) == AliRecoParam::kDefault) | |
eca4fa66 | 175 | continue ; |
7822bb76 | 176 | TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ; |
177 | if (!eventSpecieDir) | |
178 | eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ; | |
179 | eventSpecieDir->cd() ; | |
af65f4c8 | 180 | if (list) { |
181 | if (list[specie]) { | |
182 | TIter next(list[specie]) ; | |
183 | TObject * obj ; | |
eca4fa66 | 184 | while( (obj = next()) ) { |
185 | if (!obj->TestBit(AliQAv1::GetExpertBit())) | |
af65f4c8 | 186 | obj->Write() ; |
187 | } | |
188 | if (WriteExpert()) { | |
189 | TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ; | |
190 | if (!expertDir) | |
191 | expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ; | |
192 | expertDir->cd() ; | |
193 | next.Reset() ; | |
194 | while( (obj = next()) ) { | |
195 | if (!obj->TestBit(AliQAv1::GetExpertBit())) | |
196 | continue ; | |
197 | obj->Write() ; | |
198 | } | |
199 | } | |
eca4fa66 | 200 | } |
af65f4c8 | 201 | } |
202 | else if ( fCorrNt ) { | |
203 | if (fCorrNt[specie] && AliQAv1::GetDetIndex(GetName()) == AliQAv1::kCORR) { | |
204 | eventSpecieDir->cd() ; | |
205 | fCorrNt[specie]->Write() ; | |
206 | } | |
207 | fOutput->Save() ; | |
7822bb76 | 208 | } |
eca4fa66 | 209 | } |
7d297381 | 210 | } |
211 | ||
04236e67 | 212 | //____________________________________________________________________________ |
4e25ac79 | 213 | void AliQADataMakerRec::Exec(AliQAv1::TASKINDEX_t task, TObject * data) |
04236e67 | 214 | { |
215 | // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs) | |
216 | ||
4e25ac79 | 217 | if ( task == AliQAv1::kRAWS ) { |
5379c4a3 | 218 | AliDebug(AliQAv1::GetQADebugLevel(), "Processing Raws QA") ; |
eca4fa66 | 219 | AliRawReader * rawReader = static_cast<AliRawReader *>(data) ; |
04236e67 | 220 | if (rawReader) |
221 | MakeRaws(rawReader) ; | |
222 | else | |
5379c4a3 | 223 | AliDebug(AliQAv1::GetQADebugLevel(), "Raw data are not processed") ; |
44ed7a66 | 224 | } else if ( task == AliQAv1::kDIGITSR ) { |
225 | AliDebug(AliQAv1::GetQADebugLevel(), "Processing Digits QA") ; | |
eca4fa66 | 226 | TTree * tree = static_cast<TTree *>(data) ; |
227 | if (strcmp(tree->ClassName(), "TTree") == 0) { | |
44ed7a66 | 228 | MakeDigits(tree) ; |
229 | } else { | |
230 | AliWarning("data are not a TTree") ; | |
231 | } | |
4e25ac79 | 232 | } else if ( task == AliQAv1::kRECPOINTS ) { |
5379c4a3 | 233 | AliDebug(AliQAv1::GetQADebugLevel(), "Processing RecPoints QA") ; |
eca4fa66 | 234 | TTree * tree = static_cast<TTree *>(data) ; |
235 | if (strcmp(tree->ClassName(), "TTree") == 0) { | |
04236e67 | 236 | MakeRecPoints(tree) ; |
237 | } else { | |
238 | AliWarning("data are not a TTree") ; | |
239 | } | |
4e25ac79 | 240 | } else if ( task == AliQAv1::kESDS ) { |
5379c4a3 | 241 | AliDebug(AliQAv1::GetQADebugLevel(), "Processing ESDs QA") ; |
eca4fa66 | 242 | AliESDEvent * esd = static_cast<AliESDEvent *>(data) ; |
243 | if (strcmp(esd->ClassName(), "AliESDEvent") == 0) | |
04236e67 | 244 | MakeESDs(esd) ; |
245 | else | |
246 | AliError("Wrong type of esd container") ; | |
247 | } | |
248 | } | |
249 | ||
250 | //____________________________________________________________________________ | |
4e25ac79 | 251 | TObjArray ** AliQADataMakerRec::Init(AliQAv1::TASKINDEX_t task, Int_t cycles) |
04236e67 | 252 | { |
253 | // general intialisation | |
fb6e511e | 254 | InitRecoParams() ; |
57acd2d2 | 255 | TObjArray ** rv = NULL ; |
04236e67 | 256 | |
04236e67 | 257 | if (cycles > 0) |
258 | SetCycle(cycles) ; | |
259 | ||
4e25ac79 | 260 | if ( task == AliQAv1::kRAWS ) { |
63c6f8ae | 261 | if (! fRawsQAList ) { |
57acd2d2 | 262 | fRawsQAList = new TObjArray *[AliRecoParam::kNSpecies] ; |
263 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
49466ea2 | 264 | fRawsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ; |
4e25ac79 | 265 | fRawsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; |
57acd2d2 | 266 | } |
63c6f8ae | 267 | } |
04236e67 | 268 | rv = fRawsQAList ; |
44ed7a66 | 269 | } else if ( task == AliQAv1::kDIGITSR ) { |
270 | if ( ! fDigitsQAList ) { | |
271 | fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ; | |
272 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
49466ea2 | 273 | fDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ; |
44ed7a66 | 274 | fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; |
275 | } | |
44ed7a66 | 276 | } |
277 | rv = fDigitsQAList ; | |
4e25ac79 | 278 | } else if ( task == AliQAv1::kRECPOINTS ) { |
63c6f8ae | 279 | if ( ! fRecPointsQAList ) { |
57acd2d2 | 280 | fRecPointsQAList = new TObjArray *[AliRecoParam::kNSpecies] ; |
281 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
49466ea2 | 282 | fRecPointsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ; |
4e25ac79 | 283 | fRecPointsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; |
57acd2d2 | 284 | } |
eca4fa66 | 285 | } |
04236e67 | 286 | rv = fRecPointsQAList ; |
4e25ac79 | 287 | } else if ( task == AliQAv1::kESDS ) { |
63c6f8ae | 288 | if ( ! fESDsQAList ) { |
57acd2d2 | 289 | fESDsQAList = new TObjArray *[AliRecoParam::kNSpecies] ; |
290 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { | |
49466ea2 | 291 | fESDsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ; |
4e25ac79 | 292 | fESDsQAList[specie]->SetName(Form("%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; |
57acd2d2 | 293 | } |
63c6f8ae | 294 | } |
04236e67 | 295 | rv = fESDsQAList ; |
296 | } | |
04236e67 | 297 | return rv ; |
298 | } | |
299 | ||
300 | //____________________________________________________________________________ | |
4e25ac79 | 301 | void AliQADataMakerRec::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles) |
04236e67 | 302 | { |
303 | // Intialisation by passing the list of QA data booked elsewhere | |
304 | ||
fb6e511e | 305 | InitRecoParams() ; |
306 | fRun = run ; | |
04236e67 | 307 | if (cycles > 0) |
308 | SetCycle(cycles) ; | |
309 | ||
4e25ac79 | 310 | if ( task == AliQAv1::kRAWS ) { |
04236e67 | 311 | fRawsQAList = list ; |
44ed7a66 | 312 | } else if ( task == AliQAv1::kDIGITSR ) { |
313 | fDigitsQAList = list ; | |
4e25ac79 | 314 | } else if ( task == AliQAv1::kRECPOINTS ) { |
04236e67 | 315 | fRecPointsQAList = list ; |
4e25ac79 | 316 | } else if ( task == AliQAv1::kESDS ) { |
04236e67 | 317 | fESDsQAList = list ; |
318 | } | |
319 | } | |
320 | ||
fb6e511e | 321 | //____________________________________________________________________________ |
322 | void AliQADataMakerRec::InitRecoParams() | |
323 | { | |
324 | if (!fRecoParam) { | |
5379c4a3 | 325 | AliDebug(AliQAv1::GetQADebugLevel(), Form("Loading reconstruction parameter objects for detector %s", GetName())); |
fb6e511e | 326 | AliCDBPath path(GetName(),"Calib","RecoParam"); |
327 | AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath()); | |
328 | if(!entry) { | |
329 | fRecoParam = NULL ; | |
55e356ec | 330 | AliDebug(AliQAv1::GetQADebugLevel(), Form("Couldn't find RecoParam entry in OCDB for detector %s",GetName())); |
fb6e511e | 331 | } |
332 | else { | |
333 | TObject * recoParamObj = entry->GetObject() ; | |
eca4fa66 | 334 | if ( strcmp(recoParamObj->ClassName(), "TObjArray") == 0 ) { |
42383dda | 335 | // The detector has only one set of reco parameters |
5379c4a3 | 336 | AliDebug(AliQAv1::GetQADebugLevel(), Form("Array of reconstruction parameters found for detector %s",GetName())); |
eca4fa66 | 337 | TObjArray *recoParamArray = static_cast<TObjArray*>(recoParamObj) ; |
42383dda | 338 | for (Int_t iRP=0; iRP<recoParamArray->GetEntriesFast(); iRP++) { |
eca4fa66 | 339 | fRecoParam = static_cast<AliDetectorRecoParam*>(recoParamArray->At(iRP)) ; |
340 | if (!fRecoParam) | |
341 | break ; | |
342 | else if (fRecoParam->IsDefault()) | |
343 | break ; | |
42383dda | 344 | } |
345 | } | |
eca4fa66 | 346 | else if (recoParamObj->InheritsFrom("AliDetectorRecoParam")) { |
347 | // The detector has only one set of reco parameters | |
fb6e511e | 348 | // Registering it in AliRecoParam |
5379c4a3 | 349 | AliDebug(AliQAv1::GetQADebugLevel(), Form("Single set of reconstruction parameters found for detector %s",GetName())); |
eca4fa66 | 350 | fRecoParam = static_cast<AliDetectorRecoParam*>(recoParamObj) ; |
351 | static_cast<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault(); | |
fb6e511e | 352 | } else { |
353 | AliError(Form("No valid RecoParam object found in the OCDB for detector %s",GetName())); | |
354 | } | |
355 | } | |
356 | } | |
357 | } | |
358 | ||
04236e67 | 359 | //____________________________________________________________________________ |
930e6e3e | 360 | void AliQADataMakerRec::StartOfCycle(Int_t run) |
361 | { | |
362 | // Finishes a cycle of QA for all the tasks | |
363 | Bool_t samecycle = kFALSE ; | |
4e25ac79 | 364 | StartOfCycle(AliQAv1::kRAWS, run, samecycle) ; |
930e6e3e | 365 | samecycle = kTRUE ; |
44ed7a66 | 366 | StartOfCycle(AliQAv1::kDIGITSR, run, samecycle) ; |
4e25ac79 | 367 | StartOfCycle(AliQAv1::kRECPOINTS, run, samecycle) ; |
368 | StartOfCycle(AliQAv1::kESDS, run, samecycle) ; | |
930e6e3e | 369 | } |
370 | ||
371 | //____________________________________________________________________________ | |
4e25ac79 | 372 | void AliQADataMakerRec::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle) |
04236e67 | 373 | { |
374 | // Finishes a cycle of QA data acquistion | |
930e6e3e | 375 | if ( run > 0 ) |
376 | fRun = run ; | |
04236e67 | 377 | if ( !sameCycle || fCurrentCycle == -1) { |
378 | ResetCycle() ; | |
379 | if (fOutput) | |
380 | fOutput->Close() ; | |
4e25ac79 | 381 | fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ; |
04236e67 | 382 | } |
5379c4a3 | 383 | AliDebug(AliQAv1::GetQADebugLevel(), Form(" Run %d Cycle %d task %s file %s", |
4e25ac79 | 384 | fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ; |
04236e67 | 385 | |
eca4fa66 | 386 | // fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; |
387 | // if (!fDetectorDir) | |
388 | // fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; | |
389 | // | |
390 | // TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ; | |
391 | // if (!subDir) | |
392 | // subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ; | |
393 | // | |
394 | // for ( Int_t specie = AliRecoParam::kDefault ; specie < AliRecoParam::kNSpecies ; specie++ ) { | |
395 | // TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ; | |
396 | // if (!eventSpecieDir) | |
397 | // eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ; | |
398 | // TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ; | |
399 | // if (!expertDir) | |
400 | // expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ; | |
401 | // } | |
04236e67 | 402 | StartOfDetectorCycle() ; |
403 | } |