]>
Commit | Line | Data |
---|---|---|
312e6f8d | 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 | /* $Id$ */ | |
202374b1 | 17 | /////////////////////////////////////////////////////////////////////////////// |
18 | // // | |
19 | // class for running the QA makers // | |
20 | // // | |
21 | // AliQADataMakerSteer qas; // | |
22 | // qas.Run(AliQA::kRAWS, rawROOTFileName); // | |
23 | // qas.Run(AliQA::kHITS); // | |
24 | // qas.Run(AliQA::kSDIGITS); // | |
25 | // qas.Run(AliQA::kDIGITS); // | |
26 | // qas.Run(AliQA::kRECPOINTS); // | |
27 | // qas.Run(AliQA::kESDS); // | |
28 | // // | |
29 | /////////////////////////////////////////////////////////////////////////////// | |
312e6f8d | 30 | |
4edbc5bc | 31 | #include <TKey.h> |
312e6f8d | 32 | #include <TFile.h> |
567d83d9 | 33 | #include <TFileMerger.h> |
312e6f8d | 34 | #include <TPluginManager.h> |
35 | #include <TROOT.h> | |
36 | #include <TString.h> | |
37 | #include <TSystem.h> | |
38 | ||
4edbc5bc | 39 | #include "AliCDBManager.h" |
40 | #include "AliCDBEntry.h" | |
41 | #include "AliCDBId.h" | |
42 | #include "AliCDBMetaData.h" | |
940d8e5f | 43 | #include "AliCodeTimer.h" |
0233bebf | 44 | #include "AliDetectorRecoParam.h" |
312e6f8d | 45 | #include "AliESDEvent.h" |
f451171e | 46 | #include "AliGeomManager.h" |
30bbd491 | 47 | #include "AliGlobalQADataMaker.h" |
6441b07a | 48 | #include "AliHeader.h" |
312e6f8d | 49 | #include "AliLog.h" |
007fcebb | 50 | #include "AliModule.h" |
312e6f8d | 51 | #include "AliQA.h" |
04236e67 | 52 | #include "AliQADataMakerRec.h" |
53 | #include "AliQADataMakerSim.h" | |
312e6f8d | 54 | #include "AliQADataMakerSteer.h" |
4ecde5fc | 55 | #include "AliRawReaderDate.h" |
56 | #include "AliRawReaderFile.h" | |
312e6f8d | 57 | #include "AliRawReaderRoot.h" |
58 | #include "AliRun.h" | |
59 | #include "AliRunLoader.h" | |
60 | ||
61 | ClassImp(AliQADataMakerSteer) | |
62 | ||
63 | //_____________________________________________________________________________ | |
30bbd491 | 64 | AliQADataMakerSteer::AliQADataMakerSteer(char * mode, const char* gAliceFilename, const char * name, const char * title) : |
312e6f8d | 65 | TNamed(name, title), |
018c2b09 | 66 | fCurrentEvent(0), |
c65c502a | 67 | fCycleSame(kFALSE), |
fff5167b | 68 | fDetectors("ALL"), |
69 | fDetectorsW("ALL"), | |
312e6f8d | 70 | fESD(NULL), |
71 | fESDTree(NULL), | |
312e6f8d | 72 | fGAliceFileName(gAliceFilename), |
e30aef00 | 73 | fFirstEvent(0), |
30bbd491 | 74 | fMaxEvents(0), |
75 | fMode(mode), | |
774ac967 | 76 | fNumberOfEvents(999999), |
940d8e5f | 77 | fRecoParam(), |
30bbd491 | 78 | fRunNumber(0), |
312e6f8d | 79 | fRawReader(NULL), |
6441b07a | 80 | fRawReaderDelete(kTRUE), |
940d8e5f | 81 | fRunLoader(NULL), |
82 | fTasks("") | |
312e6f8d | 83 | { |
84 | // default ctor | |
f0c6fb4b | 85 | fMaxEvents = fNumberOfEvents ; |
312e6f8d | 86 | for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) { |
4d52736b | 87 | if (IsSelected(AliQA::GetDetName(iDet))) { |
88 | fLoader[iDet] = NULL ; | |
89 | fQADataMaker[iDet] = NULL ; | |
90 | fQACycles[iDet] = 999999 ; | |
91 | } | |
312e6f8d | 92 | } |
93 | } | |
94 | ||
95 | //_____________________________________________________________________________ | |
96 | AliQADataMakerSteer::AliQADataMakerSteer(const AliQADataMakerSteer & qas) : | |
97 | TNamed(qas), | |
018c2b09 | 98 | fCurrentEvent(qas.fCurrentEvent), |
c65c502a | 99 | fCycleSame(kFALSE), |
fff5167b | 100 | fDetectors(qas.fDetectors), |
101 | fDetectorsW(qas.fDetectorsW), | |
312e6f8d | 102 | fESD(NULL), |
103 | fESDTree(NULL), | |
312e6f8d | 104 | fGAliceFileName(qas.fGAliceFileName), |
e30aef00 | 105 | fFirstEvent(qas.fFirstEvent), |
30bbd491 | 106 | fMaxEvents(qas.fMaxEvents), |
107 | fMode(qas.fMode), | |
312e6f8d | 108 | fNumberOfEvents(qas.fNumberOfEvents), |
940d8e5f | 109 | fRecoParam(), |
110 | fRunNumber(qas.fRunNumber), | |
312e6f8d | 111 | fRawReader(NULL), |
6441b07a | 112 | fRawReaderDelete(kTRUE), |
940d8e5f | 113 | fRunLoader(NULL), |
114 | fTasks(qas.fTasks) | |
312e6f8d | 115 | { |
116 | // cpy ctor | |
117 | for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
118 | fLoader[iDet] = qas.fLoader[iDet] ; | |
119 | fQADataMaker[iDet] = qas.fQADataMaker[iDet] ; | |
120 | fQACycles[iDet] = qas.fQACycles[iDet] ; | |
121 | } | |
122 | } | |
123 | ||
124 | //_____________________________________________________________________________ | |
125 | AliQADataMakerSteer & AliQADataMakerSteer::operator = (const AliQADataMakerSteer & qas) | |
126 | { | |
127 | // assignment operator | |
128 | this->~AliQADataMakerSteer() ; | |
129 | new(this) AliQADataMakerSteer(qas) ; | |
130 | return *this ; | |
131 | } | |
132 | ||
133 | //_____________________________________________________________________________ | |
134 | AliQADataMakerSteer::~AliQADataMakerSteer() | |
135 | { | |
136 | // dtor | |
57e8b77b | 137 | for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) { |
138 | if (IsSelected(AliQA::GetDetName(iDet))) { | |
4d52736b | 139 | fLoader[iDet] = NULL; |
140 | if (fQADataMaker[iDet]) { | |
141 | (fQADataMaker[iDet])->Finish() ; | |
fa18368b | 142 | delete fQADataMaker[iDet] ; |
4d52736b | 143 | } |
57e8b77b | 144 | } |
145 | } | |
57e8b77b | 146 | if (fRawReaderDelete) { |
147 | fRunLoader = NULL ; | |
148 | delete fRawReader ; | |
149 | fRawReader = NULL ; | |
150 | } | |
312e6f8d | 151 | } |
152 | ||
4d52736b | 153 | //_____________________________________________________________________________ |
30bbd491 | 154 | Bool_t AliQADataMakerSteer::DoIt(const AliQA::TASKINDEX_t taskIndex) |
4d52736b | 155 | { |
156 | // Runs all the QA data Maker for every detector | |
95932286 | 157 | |
4d52736b | 158 | Bool_t rv = kFALSE ; |
4d52736b | 159 | // Fill QA data in event loop |
95932286 | 160 | for (UInt_t iEvent = fFirstEvent ; iEvent < (UInt_t)fMaxEvents ; iEvent++) { |
018c2b09 | 161 | fCurrentEvent++ ; |
4d52736b | 162 | // Get the event |
a6f6970e | 163 | if ( iEvent%10 == 0 ) |
164 | AliInfo(Form("processing event %d", iEvent)); | |
4d52736b | 165 | if ( taskIndex == AliQA::kRAWS ) { |
166 | if ( !fRawReader->NextEvent() ) | |
167 | break ; | |
168 | } else if ( taskIndex == AliQA::kESDS ) { | |
774ac967 | 169 | if ( fESDTree->GetEntry(iEvent) == 0 ) |
170 | break ; | |
4d52736b | 171 | } else { |
774ac967 | 172 | if ( fRunLoader->GetEvent(iEvent) != 0 ) |
173 | break ; | |
4d52736b | 174 | } |
56f4f5f4 | 175 | // loop over active loaders |
30bbd491 | 176 | for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { |
177 | if (IsSelected(AliQA::GetDetName(iDet))) { | |
178 | AliQADataMaker * qadm = GetQADataMaker(iDet) ; | |
179 | if ( qadm->IsCycleDone() ) { | |
180 | qadm->EndOfCycle(AliQA::kRAWS) ; | |
181 | qadm->StartOfCycle(AliQA::kRAWS) ; | |
182 | } | |
183 | TTree * data ; | |
184 | AliLoader* loader = GetLoader(qadm->GetUniqueID()); | |
185 | switch (taskIndex) { | |
940d8e5f | 186 | case AliQA::kNULLTASKINDEX : |
187 | break ; | |
30bbd491 | 188 | case AliQA::kRAWS : |
189 | qadm->Exec(taskIndex, fRawReader) ; | |
190 | break ; | |
191 | case AliQA::kHITS : | |
192 | loader->LoadHits() ; | |
193 | data = loader->TreeH() ; | |
194 | if ( ! data ) { | |
195 | AliWarning(Form(" Hit Tree not found for %s", AliQA::GetDetName(iDet))) ; | |
196 | } else { | |
197 | qadm->Exec(taskIndex, data) ; | |
198 | } | |
199 | break ; | |
200 | case AliQA::kSDIGITS : | |
201 | loader->LoadSDigits() ; | |
202 | data = loader->TreeS() ; | |
203 | if ( ! data ) { | |
204 | AliWarning(Form(" SDigit Tree not found for %s", AliQA::GetDetName(iDet))) ; | |
205 | } else { | |
206 | qadm->Exec(taskIndex, data) ; | |
56f4f5f4 | 207 | } |
30bbd491 | 208 | break; |
209 | case AliQA::kDIGITS : | |
210 | loader->LoadDigits() ; | |
211 | data = loader->TreeD() ; | |
212 | if ( ! data ) { | |
213 | AliWarning(Form(" Digit Tree not found for %s", AliQA::GetDetName(iDet))) ; | |
214 | } else { | |
215 | qadm->Exec(taskIndex, data) ; | |
216 | } | |
217 | break; | |
218 | case AliQA::kRECPOINTS : | |
219 | loader->LoadRecPoints() ; | |
220 | data = loader->TreeR() ; | |
221 | if (!data) { | |
222 | AliWarning(Form("RecPoints not found for %s", AliQA::GetDetName(iDet))) ; | |
223 | } else { | |
224 | qadm->Exec(taskIndex, data) ; | |
225 | } | |
226 | break; | |
227 | case AliQA::kTRACKSEGMENTS : | |
228 | break; | |
229 | case AliQA::kRECPARTICLES : | |
230 | break; | |
231 | case AliQA::kESDS : | |
232 | qadm->Exec(taskIndex, fESD) ; | |
233 | break; | |
234 | case AliQA::kNTASKINDEX : | |
235 | break; | |
236 | } //task switch | |
237 | } | |
4d52736b | 238 | } // detector loop |
239 | } // event loop | |
30bbd491 | 240 | // Save QA data for all detectors |
241 | rv = Finish(taskIndex) ; | |
54b7165d | 242 | |
243 | if ( taskIndex == AliQA::kRAWS ) | |
244 | fRawReader->RewindEvents() ; | |
fff5167b | 245 | |
4d52736b | 246 | return rv ; |
247 | } | |
248 | ||
4edbc5bc | 249 | //_____________________________________________________________________________ |
30bbd491 | 250 | Bool_t AliQADataMakerSteer::Finish(const AliQA::TASKINDEX_t taskIndex) |
4edbc5bc | 251 | { |
252 | // write output to file for all detectors | |
30bbd491 | 253 | for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { |
254 | if (IsSelected(AliQA::GetDetName(iDet))) { | |
255 | AliQADataMaker * qadm = GetQADataMaker(iDet) ; | |
256 | qadm->EndOfCycle(taskIndex) ; | |
257 | } | |
258 | } | |
4edbc5bc | 259 | return kTRUE ; |
260 | } | |
261 | ||
262 | //_____________________________________________________________________________ | |
96d67a8d | 263 | TObjArray * AliQADataMakerSteer::GetFromOCDB(AliQA::DETECTORINDEX_t det, AliQA::TASKINDEX_t task, const char * year) const |
4edbc5bc | 264 | { |
265 | // Retrieve the list of QA data for a given detector and a given task | |
f73f556a | 266 | TObjArray * rv = NULL ; |
605cb8bb | 267 | if ( !strlen(AliQA::GetQARefStorage()) ) { |
f73f556a | 268 | AliError("No storage defined, use AliQA::SetQARefStorage") ; |
269 | return NULL ; | |
270 | } | |
4edbc5bc | 271 | AliCDBManager* man = AliCDBManager::Instance() ; |
f73f556a | 272 | if ( ! man->IsDefaultStorageSet() ) { |
11032e1d | 273 | TString tmp(AliQA::GetQARefDefaultStorage()) ; |
274 | tmp.Append(year) ; | |
275 | tmp.Append("/") ; | |
276 | man->SetDefaultStorage(tmp.Data()) ; | |
96d67a8d | 277 | man->SetSpecificStorage(Form("%s/*", AliQA::GetQAName()), AliQA::GetQARefStorage()) ; |
f73f556a | 278 | } |
614a7f99 | 279 | TString detOCDBDir(Form("%s/%s/%s", AliQA::GetQAName(), AliQA::GetDetName((Int_t)det), AliQA::GetRefOCDBDirName())) ; |
280 | AliInfo(Form("Retrieving reference data from %s/%s for %s", AliQA::GetQARefStorage(), detOCDBDir.Data(), AliQA::GetTaskName(task).Data())) ; | |
281 | AliCDBEntry* entry = man->Get(detOCDBDir.Data(), 0) ; //FIXME 0 --> Run Number | |
4edbc5bc | 282 | TList * listDetQAD = dynamic_cast<TList *>(entry->GetObject()) ; |
283 | if ( listDetQAD ) | |
f73f556a | 284 | rv = dynamic_cast<TObjArray *>(listDetQAD->FindObject(AliQA::GetTaskName(task))) ; |
4edbc5bc | 285 | return rv ; |
286 | } | |
287 | ||
312e6f8d | 288 | //_____________________________________________________________________________ |
289 | AliLoader * AliQADataMakerSteer::GetLoader(Int_t iDet) | |
290 | { | |
291 | // get the loader for a detector | |
56f4f5f4 | 292 | |
293 | if ( !fRunLoader ) | |
294 | return NULL ; | |
312e6f8d | 295 | |
296 | TString detName = AliQA::GetDetName(iDet) ; | |
297 | fLoader[iDet] = fRunLoader->GetLoader(detName + "Loader"); | |
298 | if (fLoader[iDet]) | |
299 | return fLoader[iDet] ; | |
300 | ||
301 | // load the QA data maker object | |
302 | TPluginManager* pluginManager = gROOT->GetPluginManager() ; | |
303 | TString loaderName = "Ali" + detName + "Loader" ; | |
304 | ||
305 | AliLoader * loader = NULL ; | |
306 | // first check if a plugin is defined for the quality assurance data maker | |
307 | TPluginHandler* pluginHandler = pluginManager->FindHandler("AliLoader", detName) ; | |
308 | // if not, add a plugin for it | |
309 | if (!pluginHandler) { | |
310 | AliDebug(1, Form("defining plugin for %s", loaderName.Data())) ; | |
311 | TString libs = gSystem->GetLibraries() ; | |
312 | if (libs.Contains("lib" + detName + "base.so") || (gSystem->Load("lib" + detName + "base.so") >= 0)) { | |
313 | pluginManager->AddHandler("AliQADataMaker", detName, loaderName, detName + "loader", loaderName + "()") ; | |
314 | } else { | |
315 | pluginManager->AddHandler("AliLoader", detName, loaderName, detName, loaderName + "()") ; | |
316 | } | |
317 | pluginHandler = pluginManager->FindHandler("AliLoader", detName) ; | |
318 | } | |
319 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
320 | loader = (AliLoader *) pluginHandler->ExecPlugin(0) ; | |
321 | } | |
322 | if (loader) | |
323 | fLoader[iDet] = loader ; | |
324 | return loader ; | |
325 | } | |
326 | ||
327 | //_____________________________________________________________________________ | |
30bbd491 | 328 | AliQADataMaker * AliQADataMakerSteer::GetQADataMaker(const Int_t iDet) |
312e6f8d | 329 | { |
330 | // get the quality assurance data maker for a detector | |
331 | ||
332 | if (fQADataMaker[iDet]) | |
333 | return fQADataMaker[iDet] ; | |
334 | ||
335 | AliQADataMaker * qadm = NULL ; | |
336 | ||
30bbd491 | 337 | if (iDet == AliQA::kGLOBAL) { //Global QA |
338 | qadm = new AliGlobalQADataMaker(); | |
7c37c363 | 339 | qadm->SetName(AliQA::GetDetName(iDet)); |
340 | qadm->SetUniqueID(iDet); | |
30bbd491 | 341 | fQADataMaker[iDet] = qadm; |
342 | return qadm; | |
343 | } | |
344 | ||
345 | // load the QA data maker object | |
346 | TPluginManager* pluginManager = gROOT->GetPluginManager() ; | |
347 | TString detName = AliQA::GetDetName(iDet) ; | |
348 | TString tmp(fMode) ; | |
349 | if (tmp.Contains("sim")) | |
350 | tmp.ReplaceAll("s", "S") ; | |
351 | else if (tmp.Contains("rec")) | |
352 | tmp.ReplaceAll("r", "R") ; | |
353 | ||
354 | TString qadmName = "Ali" + detName + "QADataMaker" + tmp ; | |
355 | ||
356 | // first check if a plugin is defined for the quality assurance data maker | |
357 | TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ; | |
358 | // if not, add a plugin for it | |
359 | if (!pluginHandler) { | |
360 | AliDebug(1, Form("defining plugin for %s", qadmName.Data())) ; | |
361 | TString libs = gSystem->GetLibraries() ; | |
362 | if (libs.Contains("lib" + detName + fMode + ".so") || (gSystem->Load("lib" + detName + fMode + ".so") >= 0)) { | |
363 | pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName + "qadm", qadmName + "()") ; | |
364 | } else { | |
365 | pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName, qadmName + "()") ; | |
312e6f8d | 366 | } |
30bbd491 | 367 | pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ; |
368 | } | |
369 | if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) { | |
370 | qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0) ; | |
312e6f8d | 371 | } |
940d8e5f | 372 | if (qadm) { |
940d8e5f | 373 | qadm->SetName(AliQA::GetDetName(iDet)); |
374 | qadm->SetUniqueID(iDet); | |
7c37c363 | 375 | fQADataMaker[iDet] = qadm ; |
940d8e5f | 376 | } |
377 | ||
30bbd491 | 378 | return qadm ; |
312e6f8d | 379 | } |
380 | ||
940d8e5f | 381 | //_____________________________________________________________________________ |
382 | void AliQADataMakerSteer::EndOfCycle(TObjArray * detArray) | |
383 | { | |
384 | // End of cycle QADataMakers | |
385 | ||
386 | for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { | |
387 | if (IsSelected(AliQA::GetDetName(iDet))) { | |
388 | AliQADataMaker * qadm = GetQADataMaker(iDet) ; | |
389 | if (!qadm) | |
390 | continue ; | |
391 | // skip non active detectors | |
392 | if (detArray) { | |
393 | AliModule* det = static_cast<AliModule*>(detArray->FindObject(AliQA::GetDetName(iDet))) ; | |
394 | if (!det || !det->IsActive()) | |
395 | continue ; | |
396 | } | |
397 | for (UInt_t taskIndex = 0; taskIndex < AliQA::kNTASKINDEX; taskIndex++) { | |
398 | if ( fTasks.Contains(Form("%d", taskIndex)) ) | |
399 | qadm->EndOfCycle(AliQA::GetTaskIndex(AliQA::GetTaskName(taskIndex))) ; | |
400 | } | |
401 | qadm->Finish(); | |
402 | } | |
403 | } | |
404 | } | |
405 | ||
312e6f8d | 406 | //_____________________________________________________________________________ |
30bbd491 | 407 | Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX_t taskIndex, const char * input ) |
312e6f8d | 408 | { |
409 | // Initialize the event source and QA data makers | |
410 | ||
194bc923 | 411 | //fTasks = AliQA::GetTaskName(taskIndex) ; |
940d8e5f | 412 | |
6441b07a | 413 | if (taskIndex == AliQA::kRAWS) { |
414 | if (!fRawReader) { | |
e64fcb90 | 415 | fRawReader = AliRawReader::Create(input); |
4ecde5fc | 416 | } |
940d8e5f | 417 | if ( ! fRawReader ) |
312e6f8d | 418 | return kFALSE ; |
fff5167b | 419 | fRawReaderDelete = kTRUE ; |
312e6f8d | 420 | fRawReader->NextEvent() ; |
421 | fRunNumber = fRawReader->GetRunNumber() ; | |
04236e67 | 422 | AliCDBManager::Instance()->SetRun(fRunNumber) ; |
312e6f8d | 423 | fRawReader->RewindEvents(); |
424 | fNumberOfEvents = 999999 ; | |
f0c6fb4b | 425 | if ( fMaxEvents < 0 ) |
426 | fMaxEvents = fNumberOfEvents ; | |
427 | } else if (taskIndex == AliQA::kESDS) { | |
940d8e5f | 428 | fTasks = AliQA::GetTaskName(AliQA::kESDS) ; |
ad265f3e | 429 | if (!gSystem->AccessPathName("AliESDs.root")) { // AliESDs.root exists |
430 | TFile * esdFile = TFile::Open("AliESDs.root") ; | |
431 | fESDTree = dynamic_cast<TTree *> (esdFile->Get("esdTree")) ; | |
04236e67 | 432 | if ( !fESDTree ) { |
433 | AliError("esdTree not found") ; | |
434 | return kFALSE ; | |
435 | } else { | |
436 | fESD = new AliESDEvent() ; | |
437 | fESD->ReadFromTree(fESDTree) ; | |
438 | fESDTree->GetEntry(0) ; | |
439 | fRunNumber = fESD->GetRunNumber() ; | |
440 | fNumberOfEvents = fESDTree->GetEntries() ; | |
f0c6fb4b | 441 | if ( fMaxEvents < 0 ) |
442 | fMaxEvents = fNumberOfEvents ; | |
04236e67 | 443 | } |
ad265f3e | 444 | } else { |
445 | AliError("AliESDs.root not found") ; | |
446 | return kFALSE ; | |
447 | } | |
b37ee1e8 | 448 | } else { |
774ac967 | 449 | if ( !InitRunLoader() ) { |
450 | AliWarning("No Run Loader not found") ; | |
312e6f8d | 451 | } else { |
312e6f8d | 452 | fNumberOfEvents = fRunLoader->GetNumberOfEvents() ; |
f0c6fb4b | 453 | if ( fMaxEvents < 0 ) |
454 | fMaxEvents = fNumberOfEvents ; | |
312e6f8d | 455 | } |
ad265f3e | 456 | } |
fff5167b | 457 | |
56f4f5f4 | 458 | // Get Detectors |
459 | TObjArray* detArray = NULL ; | |
460 | if (fRunLoader) // check if RunLoader exists | |
b37ee1e8 | 461 | if ( fRunLoader->GetAliRun() ) { // check if AliRun exists in gAlice.root |
56f4f5f4 | 462 | detArray = fRunLoader->GetAliRun()->Detectors() ; |
b37ee1e8 | 463 | fRunNumber = fRunLoader->GetHeader()->GetRun() ; |
464 | } | |
30bbd491 | 465 | |
466 | // Initialize all QA data makers for all detectors | |
467 | fRunNumber = AliCDBManager::Instance()->GetRun() ; | |
468 | if ( ! AliGeomManager::GetGeometry() ) | |
469 | AliGeomManager::LoadGeometry() ; | |
470 | ||
dfe289e9 | 471 | InitQADataMaker(fRunNumber, fRecoParam, fCycleSame, kTRUE, detArray) ; |
940d8e5f | 472 | return kTRUE ; |
473 | } | |
474 | ||
475 | //_____________________________________________________________________________ | |
476 | void AliQADataMakerSteer::InitQADataMaker(UInt_t run, const AliRecoParam & par, Bool_t sameCycle, Bool_t startOption, TObjArray * detArray) | |
477 | { | |
478 | // Initializes The QADataMaker for all active detectors and for all active tasks | |
479 | ||
56f4f5f4 | 480 | for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { |
4d52736b | 481 | if (IsSelected(AliQA::GetDetName(iDet))) { |
30bbd491 | 482 | AliQADataMaker * qadm = GetQADataMaker(iDet) ; |
4d52736b | 483 | if (!qadm) { |
fff5167b | 484 | AliError(Form("AliQADataMaker not found for %s", AliQA::GetDetName(iDet))) ; |
485 | fDetectorsW.ReplaceAll(AliQA::GetDetName(iDet), "") ; | |
4d52736b | 486 | } else { |
fff5167b | 487 | AliDebug(1, Form("Data Maker found for %s", qadm->GetName())) ; |
56f4f5f4 | 488 | // skip non active detectors |
489 | if (detArray) { | |
490 | AliModule* det = static_cast<AliModule*>(detArray->FindObject(AliQA::GetDetName(iDet))) ; | |
491 | if (!det || !det->IsActive()) | |
492 | continue ; | |
493 | } | |
940d8e5f | 494 | // Set default reco params |
495 | qadm->SetRecoParam(par.GetDetRecoParam(iDet)); | |
496 | for (UInt_t taskIndex = 0; taskIndex < AliQA::kNTASKINDEX; taskIndex++) { | |
497 | if ( fTasks.Contains(Form("%d", taskIndex)) ) { | |
498 | qadm->Init(AliQA::GetTaskIndex(AliQA::GetTaskName(taskIndex)), run, GetQACycles(qadm->GetUniqueID())) ; | |
499 | if (startOption) { | |
500 | qadm->StartOfCycle(AliQA::GetTaskIndex(AliQA::GetTaskName(taskIndex)), sameCycle) ; | |
501 | sameCycle = kTRUE ; | |
502 | } | |
503 | } | |
504 | } | |
4d52736b | 505 | } |
312e6f8d | 506 | } |
940d8e5f | 507 | } |
312e6f8d | 508 | } |
509 | ||
510 | //_____________________________________________________________________________ | |
511 | Bool_t AliQADataMakerSteer::InitRunLoader() | |
512 | { | |
513 | // get or create the run loader | |
514 | if (fRunLoader) { | |
c65c502a | 515 | fCycleSame = kTRUE ; |
e4a998ed | 516 | } else { |
517 | if (!gSystem->AccessPathName(fGAliceFileName.Data())) { // galice.root exists | |
518 | // load all base libraries to get the loader classes | |
519 | TString libs = gSystem->GetLibraries() ; | |
520 | for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
521 | if (!IsSelected(AliQA::GetDetName(iDet))) | |
522 | continue ; | |
523 | TString detName = AliQA::GetDetName(iDet) ; | |
524 | if (detName == "HLT") | |
525 | continue; | |
526 | if (libs.Contains("lib" + detName + "base.so")) | |
527 | continue; | |
528 | gSystem->Load("lib" + detName + "base.so"); | |
529 | } | |
530 | fRunLoader = AliRunLoader::Open(fGAliceFileName.Data()); | |
531 | if (!fRunLoader) { | |
532 | AliError(Form("no run loader found in file %s", fGAliceFileName.Data())); | |
533 | return kFALSE; | |
534 | } | |
535 | fRunLoader->CdGAFile(); | |
536 | if (fRunLoader->LoadgAlice() == 0) { | |
537 | gAlice = fRunLoader->GetAliRun(); | |
538 | } | |
539 | ||
540 | if (!gAlice) { | |
541 | AliError(Form("no gAlice object found in file %s", fGAliceFileName.Data())); | |
542 | return kFALSE; | |
543 | } | |
4d52736b | 544 | |
e4a998ed | 545 | } else { // galice.root does not exist |
546 | AliError(Form("the file %s does not exist", fGAliceFileName.Data())); | |
312e6f8d | 547 | return kFALSE; |
548 | } | |
e4a998ed | 549 | } |
312e6f8d | 550 | |
e4a998ed | 551 | if (!fRunNumber) { |
552 | fRunLoader->LoadHeader(); | |
553 | fRunNumber = fRunLoader->GetHeader()->GetRun() ; | |
554 | } | |
555 | return kTRUE; | |
312e6f8d | 556 | } |
557 | ||
04236e67 | 558 | //_____________________________________________________________________________ |
559 | Bool_t AliQADataMakerSteer::IsSelected(const char * det) | |
560 | { | |
561 | // check whether detName is contained in detectors | |
562 | // if yes, it is removed from detectors | |
563 | ||
56f4f5f4 | 564 | Bool_t rv = kFALSE; |
04236e67 | 565 | const TString detName(det) ; |
566 | // check if all detectors are selected | |
56f4f5f4 | 567 | if (fDetectors.Contains("ALL")) { |
04236e67 | 568 | fDetectors = "ALL"; |
56f4f5f4 | 569 | rv = kTRUE; |
570 | } else if ((fDetectors.CompareTo(detName) == 0) || | |
571 | fDetectors.BeginsWith(detName+" ") || | |
572 | fDetectors.EndsWith(" "+detName) || | |
573 | fDetectors.Contains(" "+detName+" ")) { | |
04236e67 | 574 | rv = kTRUE; |
575 | } | |
30bbd491 | 576 | |
04236e67 | 577 | return rv ; |
578 | } | |
579 | ||
312e6f8d | 580 | //_____________________________________________________________________________ |
4edbc5bc | 581 | Bool_t AliQADataMakerSteer::Merge(const Int_t runNumber) const |
315bba70 | 582 | { |
567d83d9 | 583 | // Merge all the cycles from all detectors in one single file per run |
614a7f99 | 584 | TString cmd ; |
4edbc5bc | 585 | if ( runNumber == -1 ) |
614a7f99 | 586 | cmd = Form(".! ls *%s*.*.*.root > tempo.txt", AliQA::GetQADataFileName()) ; |
4edbc5bc | 587 | else |
614a7f99 | 588 | cmd = Form(".! ls *%s*.%d.*.root > tempo.txt", AliQA::GetQADataFileName(), runNumber) ; |
589 | gROOT->ProcessLine(cmd.Data()) ; | |
567d83d9 | 590 | ifstream in("tempo.txt") ; |
591 | const Int_t runMax = 10 ; | |
592 | TString file[AliQA::kNDET*runMax] ; | |
95932286 | 593 | Int_t run[AliQA::kNDET*runMax] = {-1} ; |
567d83d9 | 594 | |
595 | Int_t index = 0 ; | |
596 | while ( 1 ) { | |
4edbc5bc | 597 | in >> file[index] ; |
567d83d9 | 598 | if ( !in.good() ) |
599 | break ; | |
e5dedfe2 | 600 | AliInfo(Form("index = %d file = %s", index, (file[index]).Data())) ; |
601 | index++ ; | |
4edbc5bc | 602 | } |
603 | ||
604 | if ( index == 0 ) { | |
605 | AliError(Form("run number %d not found", runNumber)) ; | |
606 | return kFALSE ; | |
567d83d9 | 607 | } |
4edbc5bc | 608 | |
fff5167b | 609 | Int_t runIndex = 0 ; |
610 | Int_t runIndexMax = 0 ; | |
614a7f99 | 611 | TString stmp(Form(".%s.", AliQA::GetQADataFileName())) ; |
dbf9dc0d | 612 | for (Int_t ifile = 0 ; ifile < index ; ifile++) { |
567d83d9 | 613 | TString tmp(file[ifile]) ; |
614 | tmp.ReplaceAll(".root", "") ; | |
615 | TString det = tmp(0, tmp.Index(".")) ; | |
4edbc5bc | 616 | tmp.Remove(0, tmp.Index(stmp)+4) ; |
567d83d9 | 617 | TString ttmp = tmp(0, tmp.Index(".")) ; |
618 | Int_t newRun = ttmp.Atoi() ; | |
fff5167b | 619 | for (Int_t irun = 0; irun <= runIndexMax; irun++) { |
436a9f16 | 620 | if (newRun == run[irun]) |
621 | break ; | |
567d83d9 | 622 | run[runIndex] = newRun ; |
567d83d9 | 623 | runIndex++ ; |
624 | } | |
fff5167b | 625 | runIndexMax = runIndex ; |
626 | ttmp = tmp(tmp.Index(".")+1, tmp.Length()) ; | |
567d83d9 | 627 | Int_t cycle = ttmp.Atoi() ; |
fff5167b | 628 | AliDebug(1, Form("%s : det = %s run = %d cycle = %d \n", file[ifile].Data(), det.Data(), newRun, cycle)) ; |
567d83d9 | 629 | } |
fff5167b | 630 | for (Int_t irun = 0 ; irun < runIndexMax ; irun++) { |
567d83d9 | 631 | TFileMerger merger ; |
614a7f99 | 632 | TString outFileName(Form("Merged.%s.%d.root",AliQA::GetQADataFileName(),run[irun])); |
633 | merger.OutputFile(outFileName.Data()) ; | |
567d83d9 | 634 | for (Int_t ifile = 0 ; ifile < index-1 ; ifile++) { |
614a7f99 | 635 | TString pattern(Form("%s.%d.", AliQA::GetQADataFileName(), run[irun])) ; |
567d83d9 | 636 | TString tmp(file[ifile]) ; |
fff5167b | 637 | if (tmp.Contains(pattern)) { |
567d83d9 | 638 | merger.AddFile(tmp) ; |
fff5167b | 639 | } |
567d83d9 | 640 | } |
641 | merger.Merge() ; | |
642 | } | |
643 | ||
644 | return kTRUE ; | |
315bba70 | 645 | } |
646 | ||
c65c502a | 647 | //_____________________________________________________________________________ |
fff5167b | 648 | void AliQADataMakerSteer::Reset(const Bool_t sameCycle) |
c65c502a | 649 | { |
650 | // Reset the default data members | |
c65c502a | 651 | |
30bbd491 | 652 | for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) { |
653 | if (IsSelected(AliQA::GetDetName(iDet))) { | |
654 | AliQADataMaker * qadm = GetQADataMaker(iDet); | |
655 | qadm->Reset(sameCycle); | |
656 | } | |
56f4f5f4 | 657 | } |
6441b07a | 658 | if (fRawReaderDelete) { |
659 | delete fRawReader ; | |
660 | fRawReader = NULL ; | |
661 | } | |
c65c502a | 662 | |
fff5167b | 663 | fCycleSame = sameCycle ; |
c65c502a | 664 | fESD = NULL ; |
665 | fESDTree = NULL ; | |
30bbd491 | 666 | //fFirst = kTRUE ; |
774ac967 | 667 | fNumberOfEvents = 999999 ; |
c65c502a | 668 | } |
669 | ||
6441b07a | 670 | //_____________________________________________________________________________ |
7c002d48 | 671 | TString AliQADataMakerSteer::Run(const char * detectors, AliRawReader * rawReader, const Bool_t sameCycle) |
6441b07a | 672 | { |
673 | //Runs all the QA data Maker for Raws only | |
7c002d48 | 674 | |
675 | fCycleSame = sameCycle ; | |
676 | fRawReader = rawReader ; | |
4d52736b | 677 | fDetectors = detectors ; |
7c002d48 | 678 | fDetectorsW = detectors ; |
679 | ||
95932286 | 680 | AliCDBManager* man = AliCDBManager::Instance() ; |
7930d770 | 681 | |
95932286 | 682 | if ( man->GetRun() == -1 ) {// check if run number not set previously and set it from raw data |
95932286 | 683 | rawReader->NextEvent() ; |
684 | man->SetRun(fRawReader->GetRunNumber()) ; | |
685 | rawReader->RewindEvents() ; | |
686 | } | |
687 | ||
30bbd491 | 688 | if ( !Init(AliQA::kRAWS) ) |
ea9ce23f | 689 | return kFALSE ; |
690 | fRawReaderDelete = kFALSE ; | |
691 | ||
30bbd491 | 692 | DoIt(AliQA::kRAWS) ; |
e5dedfe2 | 693 | return fDetectorsW ; |
04236e67 | 694 | } |
695 | ||
696 | //_____________________________________________________________________________ | |
7c002d48 | 697 | TString AliQADataMakerSteer::Run(const char * detectors, const char * fileName, const Bool_t sameCycle) |
04236e67 | 698 | { |
699 | //Runs all the QA data Maker for Raws only | |
7c002d48 | 700 | |
701 | fCycleSame = sameCycle ; | |
04236e67 | 702 | fDetectors = detectors ; |
e5dedfe2 | 703 | fDetectorsW = detectors ; |
04236e67 | 704 | |
95932286 | 705 | AliCDBManager* man = AliCDBManager::Instance() ; |
95932286 | 706 | if ( man->GetRun() == -1 ) { // check if run number not set previously and set it from AliRun |
707 | AliRunLoader * rl = AliRunLoader::Open("galice.root") ; | |
708 | if ( ! rl ) { | |
709 | AliFatal("galice.root file not found in current directory") ; | |
710 | } else { | |
711 | rl->CdGAFile() ; | |
712 | rl->LoadgAlice() ; | |
713 | if ( ! rl->GetAliRun() ) { | |
714 | AliFatal("AliRun not found in galice.root") ; | |
715 | } else { | |
716 | rl->LoadHeader() ; | |
717 | man->SetRun(rl->GetHeader()->GetRun()); | |
718 | } | |
719 | } | |
720 | } | |
721 | ||
30bbd491 | 722 | if ( !Init(AliQA::kRAWS, fileName) ) |
ea9ce23f | 723 | return kFALSE ; |
724 | ||
30bbd491 | 725 | DoIt(AliQA::kRAWS) ; |
fff5167b | 726 | return fDetectorsW ; |
6441b07a | 727 | } |
728 | ||
312e6f8d | 729 | //_____________________________________________________________________________ |
7c002d48 | 730 | TString AliQADataMakerSteer::Run(const char * detectors, const AliQA::TASKINDEX_t taskIndex, Bool_t const sameCycle, const char * fileName ) |
312e6f8d | 731 | { |
732 | // Runs all the QA data Maker for every detector | |
7c002d48 | 733 | |
734 | fCycleSame = sameCycle ; | |
735 | fDetectors = detectors ; | |
736 | fDetectorsW = detectors ; | |
737 | ||
65c771ca | 738 | AliCDBManager* man = AliCDBManager::Instance() ; |
95932286 | 739 | if ( man->GetRun() == -1 ) { // check if run number not set previously and set it from AliRun |
740 | AliRunLoader * rl = AliRunLoader::Open("galice.root") ; | |
741 | if ( ! rl ) { | |
742 | AliFatal("galice.root file not found in current directory") ; | |
743 | } else { | |
744 | rl->CdGAFile() ; | |
745 | rl->LoadgAlice() ; | |
746 | if ( ! rl->GetAliRun() ) { | |
efb37e8e | 747 | AliInfo("AliRun not found in galice.root") ; |
95932286 | 748 | } else { |
749 | rl->LoadHeader() ; | |
750 | man->SetRun(rl->GetHeader()->GetRun()) ; | |
751 | } | |
752 | } | |
753 | } | |
754 | ||
ea9ce23f | 755 | |
940d8e5f | 756 | if ( taskIndex == AliQA::kNULLTASKINDEX) { |
194bc923 | 757 | for (UInt_t task = 0; task < AliQA::kNTASKINDEX; task++) { |
758 | if ( fTasks.Contains(Form("%d", task)) ) { | |
759 | if ( !Init(AliQA::GetTaskIndex(AliQA::GetTaskName(task)), fileName) ) | |
760 | return kFALSE ; | |
940d8e5f | 761 | DoIt(AliQA::GetTaskIndex(AliQA::GetTaskName(task))) ; |
194bc923 | 762 | } |
763 | } | |
764 | } else { | |
765 | if ( !Init(taskIndex, fileName) ) | |
766 | return kFALSE ; | |
767 | DoIt(taskIndex) ; | |
768 | } | |
4d52736b | 769 | |
e5dedfe2 | 770 | return fDetectorsW ; |
6441b07a | 771 | |
14e1eccc | 772 | } |
4edbc5bc | 773 | |
940d8e5f | 774 | //_____________________________________________________________________________ |
775 | void AliQADataMakerSteer::RunOneEvent(AliRawReader * rawReader) | |
776 | { | |
777 | //Runs all the QA data Maker for Raws only and on one event only (event loop done by calling method) | |
778 | ||
779 | AliCodeTimerAuto("") ; | |
780 | for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
781 | if (!IsSelected(AliQA::GetDetName(iDet))) | |
782 | continue; | |
783 | AliQADataMaker *qadm = GetQADataMaker(iDet); | |
784 | if (!qadm) | |
785 | continue; | |
786 | if (fTasks.Contains(Form("%d", AliQA::kRAWS))){ | |
787 | AliCodeTimerStart(Form("running RAW quality assurance data maker for %s", AliQA::GetDetName(iDet))); | |
788 | qadm->Exec(AliQA::kRAWS, rawReader) ; | |
789 | AliCodeTimerStop(Form("running RAW quality assurance data maker for %s", AliQA::GetDetName(iDet))); | |
790 | } | |
791 | } | |
792 | } | |
793 | ||
794 | //_____________________________________________________________________________ | |
795 | void AliQADataMakerSteer::RunOneEvent(AliESDEvent *& esd) | |
796 | { | |
797 | //Runs all the QA data Maker for ESDs only and on one event only (event loop done by calling method) | |
798 | ||
799 | AliCodeTimerAuto("") ; | |
800 | for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) { | |
801 | if (!IsSelected(AliQA::GetDetName(iDet))) | |
802 | continue; | |
803 | AliQADataMaker *qadm = GetQADataMaker(iDet); | |
804 | if (!qadm) | |
805 | continue; | |
806 | if (fTasks.Contains(Form("%d", AliQA::kESDS))) { | |
807 | AliCodeTimerStart(Form("running ESD quality assurance data maker for %s", AliQA::GetDetName(iDet))); | |
808 | qadm->Exec(AliQA::kESDS, esd) ; | |
809 | AliCodeTimerStop(Form("running ESD quality assurance data maker for %s", AliQA::GetDetName(iDet))); | |
810 | } | |
811 | } | |
812 | } | |
813 | ||
814 | //_____________________________________________________________________________ | |
815 | void AliQADataMakerSteer::RunOneEventInOneDetector(Int_t det, TTree * tree) | |
816 | { | |
817 | // Runs all the QA data Maker for ESDs only and on one event only (event loop done by calling method) | |
818 | AliCodeTimerAuto("") ; | |
819 | if (!IsSelected(AliQA::GetDetName(det))) { | |
820 | AliQADataMaker *qadm = GetQADataMaker(det); | |
821 | if (qadm) { | |
822 | if (fTasks.Contains(Form("%d", AliQA::kRECPOINTS))) { | |
823 | AliCodeTimerStart(Form("running RecPoints quality assurance data maker for %s", AliQA::GetDetName(det))); | |
824 | qadm->Exec(AliQA::kRECPOINTS, tree) ; | |
825 | AliCodeTimerStop(Form("running RecPoints quality assurance data maker for %s", AliQA::GetDetName(det))); | |
826 | } | |
827 | } | |
828 | } | |
829 | } | |
830 | ||
4edbc5bc | 831 | //_____________________________________________________________________________ |
11032e1d | 832 | Bool_t AliQADataMakerSteer::Save2OCDB(const Int_t runNumber, const char * year, const Int_t cycleNumber, const char * detectors) const |
4edbc5bc | 833 | { |
834 | // take the locasl QA data merge into a single file and save in OCDB | |
835 | Bool_t rv = kTRUE ; | |
836 | TString tmp(AliQA::GetQARefStorage()) ; | |
837 | if ( tmp.IsNull() ) { | |
838 | AliError("No storage defined, use AliQA::SetQARefStorage") ; | |
839 | return kFALSE ; | |
840 | } | |
841 | if ( !(tmp.Contains(AliQA::GetLabLocalOCDB()) || tmp.Contains(AliQA::GetLabAliEnOCDB())) ) { | |
842 | AliError(Form("%s is a wrong storage, use %s or %s", AliQA::GetQARefStorage(), AliQA::GetLabLocalOCDB().Data(), AliQA::GetLabAliEnOCDB().Data())) ; | |
843 | return kFALSE ; | |
844 | } | |
845 | TString sdet(detectors) ; | |
846 | sdet.ToUpper() ; | |
847 | TFile * inputFile ; | |
848 | if ( sdet.Contains("ALL") ) { | |
849 | rv = Merge(runNumber) ; | |
850 | if ( ! rv ) | |
851 | return kFALSE ; | |
614a7f99 | 852 | TString inputFileName(Form("Merged.%s.%d.root", AliQA::GetQADataFileName(), runNumber)) ; |
853 | inputFile = TFile::Open(inputFileName.Data()) ; | |
11032e1d | 854 | rv = SaveIt2OCDB(runNumber, inputFile, year) ; |
4edbc5bc | 855 | } else { |
856 | for (Int_t index = 0; index < AliQA::kNDET; index++) { | |
857 | if (sdet.Contains(AliQA::GetDetName(index))) { | |
614a7f99 | 858 | TString inputFileName(Form("%s.%s.%d.%d.root", AliQA::GetDetName(index), AliQA::GetQADataFileName(), runNumber, cycleNumber)) ; |
859 | inputFile = TFile::Open(inputFileName.Data()) ; | |
11032e1d | 860 | rv *= SaveIt2OCDB(runNumber, inputFile, year) ; |
4edbc5bc | 861 | } |
862 | } | |
863 | } | |
864 | return rv ; | |
865 | } | |
866 | ||
867 | //_____________________________________________________________________________ | |
11032e1d | 868 | Bool_t AliQADataMakerSteer::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const char * year) const |
4edbc5bc | 869 | { |
870 | // reads the TH1 from file and adds it to appropriate list before saving to OCDB | |
871 | Bool_t rv = kTRUE ; | |
872 | AliInfo(Form("Saving TH1s in %s to %s", inputFile->GetName(), AliQA::GetQARefStorage())) ; | |
873 | AliCDBManager* man = AliCDBManager::Instance() ; | |
f73f556a | 874 | if ( ! man->IsDefaultStorageSet() ) { |
a681ca96 | 875 | TString tmp( AliQA::GetQARefStorage() ) ; |
876 | if ( tmp.Contains(AliQA::GetLabLocalOCDB()) ) | |
877 | man->SetDefaultStorage(AliQA::GetQARefStorage()) ; | |
878 | else { | |
605cb8bb | 879 | TString tmp1(AliQA::GetQARefDefaultStorage()) ; |
880 | tmp1.Append(year) ; | |
881 | tmp1.Append("?user=alidaq") ; | |
882 | man->SetDefaultStorage(tmp1.Data()) ; | |
a681ca96 | 883 | } |
f73f556a | 884 | } |
a681ca96 | 885 | man->SetSpecificStorage("*", AliQA::GetQARefStorage()) ; |
04236e67 | 886 | if(man->GetRun() < 0) |
887 | man->SetRun(runNumber); | |
888 | ||
11032e1d | 889 | AliCDBMetaData mdr ; |
890 | mdr.SetResponsible("yves schutz"); | |
891 | ||
4edbc5bc | 892 | for ( Int_t detIndex = 0 ; detIndex < AliQA::kNDET ; detIndex++) { |
893 | TDirectory * detDir = inputFile->GetDirectory(AliQA::GetDetName(detIndex)) ; | |
894 | if ( detDir ) { | |
895 | AliInfo(Form("Entering %s", detDir->GetName())) ; | |
614a7f99 | 896 | TString detOCDBDir(Form("%s/%s/%s", AliQA::GetDetName(detIndex), AliQA::GetRefOCDBDirName(), AliQA::GetRefDataDirName())) ; |
897 | AliCDBId idr(detOCDBDir.Data(), runNumber, AliCDBRunRange::Infinity()) ; | |
4edbc5bc | 898 | TList * listDetQAD = new TList() ; |
614a7f99 | 899 | TString listName(Form("%s QA data Reference", AliQA::GetDetName(detIndex))) ; |
11032e1d | 900 | mdr.SetComment("HMPID QA stuff"); |
4edbc5bc | 901 | listDetQAD->SetName(listName) ; |
902 | TList * taskList = detDir->GetListOfKeys() ; | |
903 | TIter nextTask(taskList) ; | |
904 | TKey * taskKey ; | |
905 | while ( (taskKey = dynamic_cast<TKey*>(nextTask())) ) { | |
906 | TDirectory * taskDir = detDir->GetDirectory(taskKey->GetName()) ; | |
907 | AliInfo(Form("Saving %s", taskDir->GetName())) ; | |
f73f556a | 908 | TObjArray * listTaskQAD = new TObjArray(100) ; |
4edbc5bc | 909 | listTaskQAD->SetName(taskKey->GetName()) ; |
910 | listDetQAD->Add(listTaskQAD) ; | |
911 | TList * histList = taskDir->GetListOfKeys() ; | |
912 | TIter nextHist(histList) ; | |
913 | TKey * histKey ; | |
914 | while ( (histKey = dynamic_cast<TKey*>(nextHist())) ) { | |
915 | TObject * odata = taskDir->Get(histKey->GetName()) ; | |
a681ca96 | 916 | if ( !odata ) { |
917 | AliError(Form("%s in %s/%s returns a NULL pointer !!", histKey->GetName(), detDir->GetName(), taskDir->GetName())) ; | |
918 | } else { | |
4edbc5bc | 919 | AliInfo(Form("Adding %s", histKey->GetName())) ; |
a681ca96 | 920 | if ( odata->IsA()->InheritsFrom("TH1") ) { |
921 | AliInfo(Form("Adding %s", histKey->GetName())) ; | |
922 | TH1 * hdata = static_cast<TH1*>(odata) ; | |
923 | listTaskQAD->Add(hdata) ; | |
924 | } | |
4edbc5bc | 925 | } |
926 | } | |
927 | } | |
4edbc5bc | 928 | man->Put(listDetQAD, idr, &mdr) ; |
929 | } | |
930 | } | |
931 | return rv ; | |
932 | } | |
a6f6970e | 933 | |
940d8e5f | 934 | //_____________________________________________________________________________ |
935 | void AliQADataMakerSteer::SetRecoParam(const char* detector, AliDetectorRecoParam *par) | |
936 | { | |
937 | // Set custom reconstruction parameters for a given detector | |
938 | // Single set of parameters for all the events | |
194bc923 | 939 | for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) { |
940d8e5f | 940 | if(!strcmp(detector, AliQA::GetDetName(iDet))) { |
941 | par->SetAsDefault(); | |
942 | fRecoParam.AddDetRecoParam(iDet,par); | |
943 | break; | |
944 | } | |
945 | } | |
946 | } | |
947 | ||
948 |