1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include <TFileMerger.h>
21 #include <TPluginManager.h>
26 #include "AliCDBManager.h"
27 #include "AliCDBEntry.h"
29 #include "AliCDBMetaData.h"
30 #include "AliESDEvent.h"
31 #include "AliHeader.h"
33 #include "AliModule.h"
35 #include "AliQADataMakerRec.h"
36 #include "AliQADataMakerSim.h"
37 #include "AliQADataMakerSteer.h"
38 #include "AliRawReaderDate.h"
39 #include "AliRawReaderFile.h"
40 #include "AliRawReaderRoot.h"
42 #include "AliRunLoader.h"
44 ClassImp(AliQADataMakerSteer)
46 //_____________________________________________________________________________
47 AliQADataMakerSteer::AliQADataMakerSteer(const char* gAliceFilename, const char * name, const char * title) :
54 fGAliceFileName(gAliceFilename),
56 fNumberOfEvents(999999),
58 fRawReaderDelete(kTRUE),
62 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
63 if (IsSelected(AliQA::GetDetName(iDet))) {
64 fLoader[iDet] = NULL ;
65 fQADataMaker[iDet] = NULL ;
66 fQACycles[iDet] = 999999 ;
71 //_____________________________________________________________________________
72 AliQADataMakerSteer::AliQADataMakerSteer(const AliQADataMakerSteer & qas) :
75 fDetectors(qas.fDetectors),
79 fGAliceFileName(qas.fGAliceFileName),
80 fRunNumber(qas.fRunNumber),
81 fNumberOfEvents(qas.fNumberOfEvents),
83 fRawReaderDelete(kTRUE),
87 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
88 fLoader[iDet] = qas.fLoader[iDet] ;
89 fQADataMaker[iDet] = qas.fQADataMaker[iDet] ;
90 fQACycles[iDet] = qas.fQACycles[iDet] ;
94 //_____________________________________________________________________________
95 AliQADataMakerSteer & AliQADataMakerSteer::operator = (const AliQADataMakerSteer & qas)
97 // assignment operator
98 this->~AliQADataMakerSteer() ;
99 new(this) AliQADataMakerSteer(qas) ;
103 //_____________________________________________________________________________
104 AliQADataMakerSteer::~AliQADataMakerSteer()
107 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
108 if (IsSelected(AliQA::GetDetName(iDet))) {
109 fLoader[iDet] = NULL;
110 if (fQADataMaker[iDet]) {
111 (fQADataMaker[iDet])->Finish() ;
112 delete fQADataMaker[iDet] ;
113 fQADataMaker[iDet] = NULL ;
118 if (fRawReaderDelete) {
125 //_____________________________________________________________________________
126 Bool_t AliQADataMakerSteer::DoIt(const AliQA::TASKINDEX taskIndex, const char * mode)
128 // Runs all the QA data Maker for every detector
131 // Fill QA data in event loop
132 for (UInt_t iEvent = 0 ; iEvent < fNumberOfEvents ; iEvent++) {
134 AliDebug(1, Form("processing event %d", iEvent));
135 if ( taskIndex == AliQA::kRAWS ) {
136 if ( !fRawReader->NextEvent() )
138 } else if ( taskIndex == AliQA::kESDS ) {
139 if ( fESDTree->GetEntry(iEvent) == 0 )
142 if ( fRunLoader->GetEvent(iEvent) != 0 )
145 // loop over detectors
146 TObjArray* detArray = NULL ;
147 if (fRunLoader) // check if RunLoader exists
148 if ( fRunLoader->GetAliRun() ) // check if AliRun exists in gAlice.root
149 detArray = fRunLoader->GetAliRun()->Detectors() ;
150 for (UInt_t iDet = 0 ; iDet < fgkNDetectors ; iDet++) {
152 AliModule* det = static_cast<AliModule*>(detArray->FindObject(AliQA::GetDetName(iDet))) ;
153 if (!det || !det->IsActive())
156 if (!IsSelected(AliQA::GetDetName(iDet)))
158 AliQADataMaker * qadm = GetQADataMaker(iDet, mode) ;
162 if ( qadm->IsCycleDone() ) {
163 qadm->EndOfCycle(AliQA::kRAWS) ;
164 qadm->StartOfCycle(AliQA::kRAWS) ;
169 qadm->Exec(taskIndex, fRawReader) ;
172 GetLoader(iDet)->LoadHits() ;
173 data = GetLoader(iDet)->TreeH() ;
175 AliWarning(Form(" Hit Tree not found for %s", AliQA::GetDetName(iDet))) ;
177 qadm->Exec(taskIndex, data) ;
180 case AliQA::kSDIGITS :
181 GetLoader(iDet)->LoadSDigits() ;
182 data = GetLoader(iDet)->TreeS() ;
184 AliWarning(Form(" SDigit Tree not found for %s", AliQA::GetDetName(iDet))) ;
186 qadm->Exec(taskIndex, data) ;
189 case AliQA::kDIGITS :
190 GetLoader(iDet)->LoadDigits() ;
191 data = GetLoader(iDet)->TreeD() ;
193 AliWarning(Form(" Digit Tree not found for %s", AliQA::GetDetName(iDet))) ;
195 qadm->Exec(taskIndex, data) ;
198 case AliQA::kRECPOINTS :
199 GetLoader(iDet)->LoadRecPoints() ;
200 data = GetLoader(iDet)->TreeR() ;
202 AliWarning(Form("RecPoints not found for %s", AliQA::GetDetName(iDet))) ;
204 qadm->Exec(taskIndex, data) ;
207 case AliQA::kTRACKSEGMENTS :
209 case AliQA::kRECPARTICLES :
212 qadm->Exec(taskIndex, fESD) ;
214 case AliQA::kNTASKINDEX :
221 // Save QA data for all detectors
222 rv = Finish(taskIndex, mode) ;
226 //_____________________________________________________________________________
227 Bool_t AliQADataMakerSteer::Finish(const AliQA::TASKINDEX taskIndex, const char * mode)
229 // write output to file for all detectors
230 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
231 if (IsSelected(AliQA::GetDetName(iDet))) {
232 AliQADataMaker * qadm = GetQADataMaker(iDet, mode) ;
234 qadm->EndOfCycle(taskIndex) ;
241 //_____________________________________________________________________________
242 TObjArray * AliQADataMakerSteer::GetFromOCDB(AliQA::DETECTORINDEX det, AliQA::TASKINDEX task) const
244 // Retrieve the list of QA data for a given detector and a given task
245 TObjArray * rv = NULL ;
246 TString tmp(AliQA::GetQARefStorage()) ;
247 if ( tmp.IsNull() ) {
248 AliError("No storage defined, use AliQA::SetQARefStorage") ;
251 AliCDBManager* man = AliCDBManager::Instance() ;
252 if ( ! man->IsDefaultStorageSet() ) {
253 man->SetDefaultStorage(AliQA::GetQARefDefaultStorage()) ;
254 man->SetSpecificStorage(Form("%s/*", AliQA::GetQAOCDBDirName()), AliQA::GetQARefStorage()) ;
256 char detOCDBDir[10] ;
257 sprintf(detOCDBDir, "%s/%s/%s", AliQA::GetQAOCDBDirName(), AliQA::GetDetName((Int_t)det), AliQA::GetRefOCDBDirName()) ;
258 AliInfo(Form("Retrieving reference data from %s/%s for %s", AliQA::GetQARefStorage(), detOCDBDir, AliQA::GetTaskName(task).Data())) ;
259 AliCDBEntry* entry = man->Get(detOCDBDir, 0) ; //FIXME 0 --> Run Number
260 TList * listDetQAD = dynamic_cast<TList *>(entry->GetObject()) ;
262 rv = dynamic_cast<TObjArray *>(listDetQAD->FindObject(AliQA::GetTaskName(task))) ;
266 //_____________________________________________________________________________
267 AliLoader * AliQADataMakerSteer::GetLoader(Int_t iDet)
269 // get the loader for a detector
271 TString detName = AliQA::GetDetName(iDet) ;
272 fLoader[iDet] = fRunLoader->GetLoader(detName + "Loader");
274 return fLoader[iDet] ;
276 // load the QA data maker object
277 TPluginManager* pluginManager = gROOT->GetPluginManager() ;
278 TString loaderName = "Ali" + detName + "Loader" ;
280 AliLoader * loader = NULL ;
281 // first check if a plugin is defined for the quality assurance data maker
282 TPluginHandler* pluginHandler = pluginManager->FindHandler("AliLoader", detName) ;
283 // if not, add a plugin for it
284 if (!pluginHandler) {
285 AliDebug(1, Form("defining plugin for %s", loaderName.Data())) ;
286 TString libs = gSystem->GetLibraries() ;
287 if (libs.Contains("lib" + detName + "base.so") || (gSystem->Load("lib" + detName + "base.so") >= 0)) {
288 pluginManager->AddHandler("AliQADataMaker", detName, loaderName, detName + "loader", loaderName + "()") ;
290 pluginManager->AddHandler("AliLoader", detName, loaderName, detName, loaderName + "()") ;
292 pluginHandler = pluginManager->FindHandler("AliLoader", detName) ;
294 if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
295 loader = (AliLoader *) pluginHandler->ExecPlugin(0) ;
298 fLoader[iDet] = loader ;
302 //_____________________________________________________________________________
303 AliQADataMaker * AliQADataMakerSteer::GetQADataMaker(const Int_t iDet, const char * mode )
305 // get the quality assurance data maker for a detector
307 if (fQADataMaker[iDet])
308 return fQADataMaker[iDet] ;
310 AliQADataMaker * qadm = NULL ;
313 // load the QA data maker object
314 TPluginManager* pluginManager = gROOT->GetPluginManager() ;
315 TString detName = AliQA::GetDetName(iDet) ;
316 TString qadmName = "Ali" + detName + "QADataMaker" + mode ;
318 // first check if a plugin is defined for the quality assurance data maker
319 TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
320 // if not, add a plugin for it
321 if (!pluginHandler) {
322 AliDebug(1, Form("defining plugin for %s", qadmName.Data())) ;
323 TString libs = gSystem->GetLibraries() ;
324 if (libs.Contains("lib" + detName + mode + ".so") || (gSystem->Load("lib" + detName + mode + ".so") >= 0)) {
325 pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName + "qadm", qadmName + "()") ;
327 pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName, qadmName + "()") ;
329 pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
331 if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
332 qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0) ;
335 fQADataMaker[iDet] = qadm ;
340 //_____________________________________________________________________________
341 Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX taskIndex, const char * mode, const char * input )
343 // Initialize the event source and QA data makers
345 if (taskIndex == AliQA::kRAWS) {
347 TString fileName(input);
348 if (fileName.EndsWith("/")) {
349 fRawReader = new AliRawReaderFile(fileName);
350 } else if (fileName.EndsWith(".root")) {
351 fRawReader = new AliRawReaderRoot(fileName);
352 } else if (!fileName.IsNull()) {
353 fRawReader = new AliRawReaderDate(fileName);
354 fRawReader->SelectEvents(7);
359 fRawReaderDelete = kFALSE ;
360 fRawReader->NextEvent() ;
361 fRunNumber = fRawReader->GetRunNumber() ;
362 AliCDBManager::Instance()->SetRun(fRunNumber) ;
363 fRawReader->RewindEvents();
364 fNumberOfEvents = 999999 ;
365 } else if (taskIndex == AliQA::kESDS) {
366 if (!gSystem->AccessPathName("AliESDs.root")) { // AliESDs.root exists
367 TFile * esdFile = TFile::Open("AliESDs.root") ;
368 fESDTree = dynamic_cast<TTree *> (esdFile->Get("esdTree")) ;
370 AliError("esdTree not found") ;
373 fESD = new AliESDEvent() ;
374 fESD->ReadFromTree(fESDTree) ;
375 fESDTree->GetEntry(0) ;
376 fRunNumber = fESD->GetRunNumber() ;
377 fNumberOfEvents = fESDTree->GetEntries() ;
380 AliError("AliESDs.root not found") ;
384 if ( !InitRunLoader() ) {
385 AliWarning("No Run Loader not found") ;
387 fNumberOfEvents = fRunLoader->GetNumberOfEvents() ;
390 // Initialize all QA data makers for all detectors
391 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
392 if (IsSelected(AliQA::GetDetName(iDet))) {
393 AliQADataMaker * qadm = GetQADataMaker(iDet, mode) ;
395 AliWarning(Form("AliQADataMaker not found for %s", AliQA::GetDetName(iDet))) ;
397 AliInfo(Form("Data Maker found for %s", qadm->GetName())) ;
398 qadm->Init(taskIndex, fRunNumber, GetQACycles(iDet)) ;
399 qadm->StartOfCycle(taskIndex, fCycleSame) ;
407 //_____________________________________________________________________________
408 Bool_t AliQADataMakerSteer::InitRunLoader()
410 // get or create the run loader
416 if (!gSystem->AccessPathName(fGAliceFileName.Data())) { // galice.root exists
417 // load all base libraries to get the loader classes
418 TString libs = gSystem->GetLibraries() ;
419 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
420 if (!IsSelected(AliQA::GetDetName(iDet)))
422 TString detName = AliQA::GetDetName(iDet) ;
423 if (detName == "HLT")
425 if (libs.Contains("lib" + detName + "base.so"))
427 gSystem->Load("lib" + detName + "base.so");
429 fRunLoader = AliRunLoader::Open(fGAliceFileName.Data());
431 AliError(Form("no run loader found in file %s", fGAliceFileName.Data()));
434 fRunLoader->CdGAFile();
435 if (fRunLoader->LoadgAlice() == 0) {
436 gAlice = fRunLoader->GetAliRun();
440 AliError(Form("no gAlice object found in file %s", fGAliceFileName.Data()));
444 } else { // galice.root does not exist
445 AliError(Form("the file %s does not exist", fGAliceFileName.Data()));
452 //_____________________________________________________________________________
453 Bool_t AliQADataMakerSteer::IsSelected(const char * det)
455 // check whether detName is contained in detectors
456 // if yes, it is removed from detectors
458 const TString detName(det) ;
459 // check if all detectors are selected
460 if ((fDetectors.CompareTo("ALL") == 0) ||
461 fDetectors.BeginsWith("ALL ") ||
462 fDetectors.EndsWith(" ALL") ||
463 fDetectors.Contains(" ALL ")) {
468 // search for the given detector
470 if ((fDetectors.CompareTo(detName) == 0) ||
471 fDetectors.BeginsWith(detName+" ") ||
472 fDetectors.EndsWith(" "+detName) ||
473 fDetectors.Contains(" "+detName+" ")) {
474 // fDetectors.ReplaceAll(detName, "");
478 // clean up the detectors string
479 // while (fDetectors.Contains(" "))
480 // fDetectors.ReplaceAll(" ", " ");
481 // while (fDetectors.BeginsWith(" "))
482 // fDetectors.Remove(0, 1);
483 // while (fDetectors.EndsWith(" "))
484 // fDetectors.Remove(fDetectors.Length()-1, 1);
489 //_____________________________________________________________________________
490 Bool_t AliQADataMakerSteer::Merge(const Int_t runNumber) const
492 // Merge all the cycles from all detectors in one single file per run
494 if ( runNumber == -1 )
495 sprintf(cmd, ".! ls *%s*.*.*.root > tempo.txt", AliQA::GetQADataFileName()) ;
497 sprintf(cmd, ".! ls *%s*.%d.*.root > tempo.txt", AliQA::GetQADataFileName(), runNumber) ;
498 gROOT->ProcessLine(cmd) ;
499 ifstream in("tempo.txt") ;
500 const Int_t runMax = 10 ;
501 TString file[AliQA::kNDET*runMax] ;
502 Int_t run[AliQA::kNDET*runMax] ;
513 AliError(Form("run number %d not found", runNumber)) ;
517 Int_t previousRun = -1 ;
520 sprintf(stmp, ".%s.", AliQA::GetQADataFileName()) ;
521 for (Int_t ifile = 0 ; ifile < index-1 ; ifile++) {
522 TString tmp(file[ifile]) ;
523 tmp.ReplaceAll(".root", "") ;
524 TString det = tmp(0, tmp.Index(".")) ;
525 tmp.Remove(0, tmp.Index(stmp)+4) ;
526 TString ttmp = tmp(0, tmp.Index(".")) ;
527 Int_t newRun = ttmp.Atoi() ;
528 if (newRun != previousRun) {
529 run[runIndex] = newRun ;
530 previousRun = newRun ;
533 ttmp = tmp(tmp.Index("."), tmp.Length()) ;
534 Int_t cycle = ttmp.Atoi() ;
535 AliInfo(Form("%s : det = %s run = %d cycle = %d \n", file[ifile].Data(), det.Data(), newRun, cycle)) ;
537 for (Int_t irun = 0 ; irun < runIndex ; irun++) {
539 char outFileName[20] ;
540 sprintf(outFileName, "Merged.%s.%d.root", AliQA::GetQADataFileName(), runIndex-1) ;
541 merger.OutputFile(outFileName) ;
542 for (Int_t ifile = 0 ; ifile < index-1 ; ifile++) {
544 sprintf(pattern, "%s.%d.", AliQA::GetQADataFileName(), runIndex-1) ;
545 TString tmp(file[ifile]) ;
546 if (tmp.Contains(pattern))
547 merger.AddFile(tmp) ;
555 //_____________________________________________________________________________
556 void AliQADataMakerSteer::Reset()
558 // Reset the default data members
559 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
560 if (IsSelected(AliQA::GetDetName(iDet))) {
561 fLoader[iDet] = NULL;
562 if (fQADataMaker[iDet]) {
563 (fQADataMaker[iDet])->Reset() ;
564 //delete fQADataMaker[iDet] ;
565 //fQADataMaker[iDet] = NULL ;
570 if (fRawReaderDelete) {
575 fCycleSame = kFALSE ;
579 fNumberOfEvents = 999999 ;
582 //_____________________________________________________________________________
583 Bool_t AliQADataMakerSteer::Run(const char * detectors, AliRawReader * rawReader)
585 //Runs all the QA data Maker for Raws only
586 fRawReader = rawReader ;
587 fRawReaderDelete = kFALSE ;
589 fDetectors = detectors ;
591 // Initialize all QA data makers for all detectors
592 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
593 if (IsSelected(AliQA::GetDetName(iDet))) {
594 AliQADataMaker * qadm = GetQADataMaker(iDet, "rec") ;
596 AliWarning(Form("AliQADataMaker not found for %s", AliQA::GetDetName(iDet))) ;
598 AliInfo(Form("Data Maker found for %s", qadm->GetName())) ;
599 qadm->Init(AliQA::kRAWS, fRunNumber, GetQACycles(iDet)) ;
600 qadm->StartOfCycle(AliQA::kRAWS, fCycleSame) ;
606 return DoIt(AliQA::kRAWS, "rec") ;
609 //_____________________________________________________________________________
610 Bool_t AliQADataMakerSteer::Run(const char * detectors, const char * fileName)
612 //Runs all the QA data Maker for Raws only
614 fDetectors = detectors ;
616 if ( !Init(AliQA::kRAWS, "rec", fileName) )
619 // Initialize all QA data makers for all detectors
620 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
621 if (IsSelected(AliQA::GetDetName(iDet))) {
622 AliQADataMaker * qadm = GetQADataMaker(iDet, "rec") ;
624 AliWarning(Form("AliQADataMaker not found for %s", AliQA::GetDetName(iDet))) ;
626 AliInfo(Form("Data Maker found for %s", qadm->GetName())) ;
627 qadm->Init(AliQA::kRAWS, fRunNumber, GetQACycles(iDet)) ;
628 qadm->StartOfCycle(AliQA::kRAWS, fCycleSame) ;
634 return DoIt(AliQA::kRAWS, "rec") ;
637 //_____________________________________________________________________________
638 Bool_t AliQADataMakerSteer::Run(const char * detectors, const AliQA::TASKINDEX taskIndex, const char * fileName )
640 // Runs all the QA data Maker for every detector
643 fDetectors = detectors ;
646 if ( (taskIndex == AliQA::kHITS) || (taskIndex == AliQA::kSDIGITS) || (taskIndex == AliQA::kDIGITS) )
648 else if ( (taskIndex == AliQA::kRAWS) || (taskIndex == AliQA::kRECPOINTS) || (taskIndex == AliQA::kESDS) )
651 AliError(Form("%s not implemented", AliQA::GetTaskName(taskIndex).Data())) ;
655 if ( !Init(taskIndex, mode, fileName) )
658 rv = DoIt(taskIndex, mode) ;
664 //_____________________________________________________________________________
665 Bool_t AliQADataMakerSteer::Save2OCDB(const Int_t runNumber, const Int_t cycleNumber, const char * detectors) const
667 // take the locasl QA data merge into a single file and save in OCDB
669 TString tmp(AliQA::GetQARefStorage()) ;
670 if ( tmp.IsNull() ) {
671 AliError("No storage defined, use AliQA::SetQARefStorage") ;
674 if ( !(tmp.Contains(AliQA::GetLabLocalOCDB()) || tmp.Contains(AliQA::GetLabAliEnOCDB())) ) {
675 AliError(Form("%s is a wrong storage, use %s or %s", AliQA::GetQARefStorage(), AliQA::GetLabLocalOCDB().Data(), AliQA::GetLabAliEnOCDB().Data())) ;
678 TString sdet(detectors) ;
681 if ( sdet.Contains("ALL") ) {
682 rv = Merge(runNumber) ;
685 char inputFileName[20] ;
686 sprintf(inputFileName, "Merged.%s.%d.root", AliQA::GetQADataFileName(), runNumber) ;
687 inputFile = TFile::Open(inputFileName) ;
688 rv = SaveIt2OCDB(runNumber, inputFile) ;
690 for (Int_t index = 0; index < AliQA::kNDET; index++) {
691 if (sdet.Contains(AliQA::GetDetName(index))) {
692 char inputFileName[20] ;
693 sprintf(inputFileName, "%s.%s.%d.%d.root", AliQA::GetDetName(index), AliQA::GetQADataFileName(), runNumber, cycleNumber) ;
694 inputFile = TFile::Open(inputFileName) ;
695 rv *= SaveIt2OCDB(runNumber, inputFile) ;
702 //_____________________________________________________________________________
703 Bool_t AliQADataMakerSteer::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile) const
705 // reads the TH1 from file and adds it to appropriate list before saving to OCDB
707 AliInfo(Form("Saving TH1s in %s to %s", inputFile->GetName(), AliQA::GetQARefStorage())) ;
708 AliCDBManager* man = AliCDBManager::Instance() ;
709 if ( ! man->IsDefaultStorageSet() ) {
710 man->SetDefaultStorage(AliQA::GetQARefDefaultStorage()) ;
711 man->SetSpecificStorage(Form("%s/*", AliQA::GetQAOCDBDirName()), AliQA::GetQARefStorage()) ;
713 if(man->GetRun() < 0)
714 man->SetRun(runNumber);
716 for ( Int_t detIndex = 0 ; detIndex < AliQA::kNDET ; detIndex++) {
717 TDirectory * detDir = inputFile->GetDirectory(AliQA::GetDetName(detIndex)) ;
719 AliInfo(Form("Entering %s", detDir->GetName())) ;
720 char detOCDBDir[20] ;
721 sprintf(detOCDBDir, "%s/%s/%s", AliQA::GetQAOCDBDirName(), AliQA::GetDetName(detIndex), AliQA::GetRefOCDBDirName()) ;
722 AliCDBId idr(detOCDBDir, runNumber, 999999999) ;
723 TList * listDetQAD = new TList() ;
725 sprintf(listName, "%s QA data Reference", AliQA::GetDetName(detIndex)) ;
726 listDetQAD->SetName(listName) ;
727 TList * taskList = detDir->GetListOfKeys() ;
728 TIter nextTask(taskList) ;
730 while ( (taskKey = dynamic_cast<TKey*>(nextTask())) ) {
731 TDirectory * taskDir = detDir->GetDirectory(taskKey->GetName()) ;
732 AliInfo(Form("Saving %s", taskDir->GetName())) ;
733 TObjArray * listTaskQAD = new TObjArray(100) ;
734 listTaskQAD->SetName(taskKey->GetName()) ;
735 listDetQAD->Add(listTaskQAD) ;
736 TList * histList = taskDir->GetListOfKeys() ;
737 TIter nextHist(histList) ;
739 while ( (histKey = dynamic_cast<TKey*>(nextHist())) ) {
740 TObject * odata = taskDir->Get(histKey->GetName()) ;
741 if ( odata->IsA()->InheritsFrom("TH1") ) {
742 AliInfo(Form("Adding %s", histKey->GetName())) ;
743 TH1 * hdata = static_cast<TH1*>(odata) ;
744 listTaskQAD->Add(hdata) ;
749 man->Put(listDetQAD, idr, &mdr) ;