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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // class for running the QA makers //
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); //
29 ///////////////////////////////////////////////////////////////////////////////
33 #include <TFileMerger.h>
34 #include <TPluginManager.h>
39 #include "AliCDBManager.h"
40 #include "AliCDBEntry.h"
42 #include "AliCDBMetaData.h"
43 #include "AliESDEvent.h"
44 #include "AliHeader.h"
46 #include "AliModule.h"
48 #include "AliQADataMakerRec.h"
49 #include "AliQADataMakerSim.h"
50 #include "AliQADataMakerSteer.h"
51 #include "AliRawReaderDate.h"
52 #include "AliRawReaderFile.h"
53 #include "AliRawReaderRoot.h"
55 #include "AliRunLoader.h"
57 ClassImp(AliQADataMakerSteer)
59 //_____________________________________________________________________________
60 AliQADataMakerSteer::AliQADataMakerSteer(const char* gAliceFilename, const char * name, const char * title) :
69 fGAliceFileName(gAliceFilename),
71 fNumberOfEvents(999999),
74 fRawReaderDelete(kTRUE),
78 fMaxEvents = fNumberOfEvents ;
79 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
80 if (IsSelected(AliQA::GetDetName(iDet))) {
81 fLoader[iDet] = NULL ;
82 fQADataMaker[iDet] = NULL ;
83 fQACycles[iDet] = 999999 ;
88 //_____________________________________________________________________________
89 AliQADataMakerSteer::AliQADataMakerSteer(const AliQADataMakerSteer & qas) :
91 fCurrentEvent(qas.fCurrentEvent),
93 fDetectors(qas.fDetectors),
94 fDetectorsW(qas.fDetectorsW),
98 fGAliceFileName(qas.fGAliceFileName),
99 fMaxEvents(qas.fMaxEvents),
100 fNumberOfEvents(qas.fNumberOfEvents),
101 fRunNumber(qas.fRunNumber),
103 fRawReaderDelete(kTRUE),
107 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
108 fLoader[iDet] = qas.fLoader[iDet] ;
109 fQADataMaker[iDet] = qas.fQADataMaker[iDet] ;
110 fQACycles[iDet] = qas.fQACycles[iDet] ;
114 //_____________________________________________________________________________
115 AliQADataMakerSteer & AliQADataMakerSteer::operator = (const AliQADataMakerSteer & qas)
117 // assignment operator
118 this->~AliQADataMakerSteer() ;
119 new(this) AliQADataMakerSteer(qas) ;
123 //_____________________________________________________________________________
124 AliQADataMakerSteer::~AliQADataMakerSteer()
127 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
128 if (IsSelected(AliQA::GetDetName(iDet))) {
129 fLoader[iDet] = NULL;
130 if (fQADataMaker[iDet]) {
131 (fQADataMaker[iDet])->Finish() ;
132 delete fQADataMaker[iDet] ;
133 fQADataMaker[iDet] = NULL ;
138 if (fRawReaderDelete) {
145 //_____________________________________________________________________________
146 Bool_t AliQADataMakerSteer::DoIt(const AliQA::TASKINDEX taskIndex, const char * mode)
148 // Runs all the QA data Maker for every detector
151 // Fill QA data in event loop
152 for (UInt_t iEvent = 0 ; iEvent < (UInt_t)fMaxEvents ; iEvent++) {
155 if ( iEvent%10 == 0 )
156 AliInfo(Form("processing event %d", iEvent));
157 if ( taskIndex == AliQA::kRAWS ) {
158 if ( !fRawReader->NextEvent() )
160 } else if ( taskIndex == AliQA::kESDS ) {
161 if ( fESDTree->GetEntry(iEvent) == 0 )
164 if ( fRunLoader->GetEvent(iEvent) != 0 )
167 // loop over detectors
168 TObjArray* detArray = NULL ;
169 if (fRunLoader) // check if RunLoader exists
170 if ( fRunLoader->GetAliRun() ) // check if AliRun exists in gAlice.root
171 detArray = fRunLoader->GetAliRun()->Detectors() ;
172 for (UInt_t iDet = 0 ; iDet < fgkNDetectors ; iDet++) {
174 AliModule* det = static_cast<AliModule*>(detArray->FindObject(AliQA::GetDetName(iDet))) ;
175 if (!det || !det->IsActive())
178 if (!IsSelected(AliQA::GetDetName(iDet)))
180 AliQADataMaker * qadm = GetQADataMaker(iDet, mode) ;
184 if ( qadm->IsCycleDone() ) {
185 qadm->EndOfCycle(AliQA::kRAWS) ;
186 qadm->StartOfCycle(AliQA::kRAWS) ;
191 qadm->Exec(taskIndex, fRawReader) ;
194 GetLoader(iDet)->LoadHits() ;
195 data = GetLoader(iDet)->TreeH() ;
197 AliWarning(Form(" Hit Tree not found for %s", AliQA::GetDetName(iDet))) ;
199 qadm->Exec(taskIndex, data) ;
202 case AliQA::kSDIGITS :
203 GetLoader(iDet)->LoadSDigits() ;
204 data = GetLoader(iDet)->TreeS() ;
206 AliWarning(Form(" SDigit Tree not found for %s", AliQA::GetDetName(iDet))) ;
208 qadm->Exec(taskIndex, data) ;
211 case AliQA::kDIGITS :
212 GetLoader(iDet)->LoadDigits() ;
213 data = GetLoader(iDet)->TreeD() ;
215 AliWarning(Form(" Digit Tree not found for %s", AliQA::GetDetName(iDet))) ;
217 qadm->Exec(taskIndex, data) ;
220 case AliQA::kRECPOINTS :
221 GetLoader(iDet)->LoadRecPoints() ;
222 data = GetLoader(iDet)->TreeR() ;
224 AliWarning(Form("RecPoints not found for %s", AliQA::GetDetName(iDet))) ;
226 qadm->Exec(taskIndex, data) ;
229 case AliQA::kTRACKSEGMENTS :
231 case AliQA::kRECPARTICLES :
234 qadm->Exec(taskIndex, fESD) ;
236 case AliQA::kNTASKINDEX :
239 //qadm->Increment() ;
243 // // Save QA data for all detectors
244 rv = Finish(taskIndex, mode) ;
249 //_____________________________________________________________________________
250 Bool_t AliQADataMakerSteer::Finish(const AliQA::TASKINDEX taskIndex, const char * mode)
252 // write output to file for all detectors
253 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
254 if (IsSelected(AliQA::GetDetName(iDet))) {
255 AliQADataMaker * qadm = GetQADataMaker(iDet, mode) ;
257 qadm->EndOfCycle(taskIndex) ;
264 //_____________________________________________________________________________
265 TObjArray * AliQADataMakerSteer::GetFromOCDB(AliQA::DETECTORINDEX det, AliQA::TASKINDEX task, const char * year) const
267 // Retrieve the list of QA data for a given detector and a given task
268 TObjArray * rv = NULL ;
269 TString tmp(AliQA::GetQARefStorage()) ;
270 if ( tmp.IsNull() ) {
271 AliError("No storage defined, use AliQA::SetQARefStorage") ;
274 AliCDBManager* man = AliCDBManager::Instance() ;
275 if ( ! man->IsDefaultStorageSet() ) {
276 TString tmp(AliQA::GetQARefDefaultStorage()) ;
279 man->SetDefaultStorage(tmp.Data()) ;
280 man->SetSpecificStorage(Form("%s/*", AliQA::GetQAOCDBDirName()), AliQA::GetQARefStorage()) ;
282 char detOCDBDir[10] ;
283 sprintf(detOCDBDir, "%s/%s/%s", AliQA::GetQAOCDBDirName(), AliQA::GetDetName((Int_t)det), AliQA::GetRefOCDBDirName()) ;
284 AliInfo(Form("Retrieving reference data from %s/%s for %s", AliQA::GetQARefStorage(), detOCDBDir, AliQA::GetTaskName(task).Data())) ;
285 AliCDBEntry* entry = man->Get(detOCDBDir, 0) ; //FIXME 0 --> Run Number
286 TList * listDetQAD = dynamic_cast<TList *>(entry->GetObject()) ;
288 rv = dynamic_cast<TObjArray *>(listDetQAD->FindObject(AliQA::GetTaskName(task))) ;
292 //_____________________________________________________________________________
293 AliLoader * AliQADataMakerSteer::GetLoader(Int_t iDet)
295 // get the loader for a detector
297 TString detName = AliQA::GetDetName(iDet) ;
298 fLoader[iDet] = fRunLoader->GetLoader(detName + "Loader");
300 return fLoader[iDet] ;
302 // load the QA data maker object
303 TPluginManager* pluginManager = gROOT->GetPluginManager() ;
304 TString loaderName = "Ali" + detName + "Loader" ;
306 AliLoader * loader = NULL ;
307 // first check if a plugin is defined for the quality assurance data maker
308 TPluginHandler* pluginHandler = pluginManager->FindHandler("AliLoader", detName) ;
309 // if not, add a plugin for it
310 if (!pluginHandler) {
311 AliDebug(1, Form("defining plugin for %s", loaderName.Data())) ;
312 TString libs = gSystem->GetLibraries() ;
313 if (libs.Contains("lib" + detName + "base.so") || (gSystem->Load("lib" + detName + "base.so") >= 0)) {
314 pluginManager->AddHandler("AliQADataMaker", detName, loaderName, detName + "loader", loaderName + "()") ;
316 pluginManager->AddHandler("AliLoader", detName, loaderName, detName, loaderName + "()") ;
318 pluginHandler = pluginManager->FindHandler("AliLoader", detName) ;
320 if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
321 loader = (AliLoader *) pluginHandler->ExecPlugin(0) ;
324 fLoader[iDet] = loader ;
328 //_____________________________________________________________________________
329 AliQADataMaker * AliQADataMakerSteer::GetQADataMaker(const Int_t iDet, const char * mode )
331 // get the quality assurance data maker for a detector
333 if (fQADataMaker[iDet])
334 return fQADataMaker[iDet] ;
336 AliQADataMaker * qadm = NULL ;
339 // load the QA data maker object
340 TPluginManager* pluginManager = gROOT->GetPluginManager() ;
341 TString detName = AliQA::GetDetName(iDet) ;
343 if (tmp.Contains("sim"))
344 tmp.ReplaceAll("s", "S") ;
345 else if (tmp.Contains("rec"))
346 tmp.ReplaceAll("r", "R") ;
347 TString qadmName = "Ali" + detName + "QADataMaker" + tmp ;
349 // first check if a plugin is defined for the quality assurance data maker
350 TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
351 // if not, add a plugin for it
352 if (!pluginHandler) {
353 AliDebug(1, Form("defining plugin for %s", qadmName.Data())) ;
354 TString libs = gSystem->GetLibraries() ;
355 if (libs.Contains("lib" + detName + mode + ".so") || (gSystem->Load("lib" + detName + mode + ".so") >= 0)) {
356 pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName + "qadm", qadmName + "()") ;
358 pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName, qadmName + "()") ;
360 pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
362 if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
363 qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0) ;
366 fQADataMaker[iDet] = qadm ;
371 //_____________________________________________________________________________
372 Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX taskIndex, const char * mode, const char * input )
374 // Initialize the event source and QA data makers
376 if (taskIndex == AliQA::kRAWS) {
378 TString fileName(input);
379 if (fileName.EndsWith("/")) {
380 fRawReader = new AliRawReaderFile(fileName);
381 } else if (fileName.EndsWith(".root")) {
382 fRawReader = new AliRawReaderRoot(fileName);
383 } else if (!fileName.IsNull()) {
384 fRawReader = new AliRawReaderDate(fileName);
385 fRawReader->SelectEvents(7);
390 fRawReaderDelete = kTRUE ;
391 fRawReader->NextEvent() ;
392 fRunNumber = fRawReader->GetRunNumber() ;
393 AliCDBManager::Instance()->SetRun(fRunNumber) ;
394 fRawReader->RewindEvents();
395 fNumberOfEvents = 999999 ;
396 if ( fMaxEvents < 0 )
397 fMaxEvents = fNumberOfEvents ;
398 } else if (taskIndex == AliQA::kESDS) {
399 if (!gSystem->AccessPathName("AliESDs.root")) { // AliESDs.root exists
400 TFile * esdFile = TFile::Open("AliESDs.root") ;
401 fESDTree = dynamic_cast<TTree *> (esdFile->Get("esdTree")) ;
403 AliError("esdTree not found") ;
406 fESD = new AliESDEvent() ;
407 fESD->ReadFromTree(fESDTree) ;
408 fESDTree->GetEntry(0) ;
409 fRunNumber = fESD->GetRunNumber() ;
410 fNumberOfEvents = fESDTree->GetEntries() ;
411 if ( fMaxEvents < 0 )
412 fMaxEvents = fNumberOfEvents ;
415 AliError("AliESDs.root not found") ;
419 if ( !InitRunLoader() ) {
420 AliWarning("No Run Loader not found") ;
422 fNumberOfEvents = fRunLoader->GetNumberOfEvents() ;
423 if ( fMaxEvents < 0 )
424 fMaxEvents = fNumberOfEvents ;
428 // Initialize all QA data makers for all detectors
429 for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
431 if (IsSelected(AliQA::GetDetName(iDet))) {
432 AliQADataMaker * qadm = GetQADataMaker(iDet, mode) ;
434 AliError(Form("AliQADataMaker not found for %s", AliQA::GetDetName(iDet))) ;
435 fDetectorsW.ReplaceAll(AliQA::GetDetName(iDet), "") ;
437 AliDebug(1, Form("Data Maker found for %s", qadm->GetName())) ;
438 qadm->Init(taskIndex, fRunNumber, GetQACycles(iDet)) ;
439 qadm->StartOfCycle(taskIndex, fCycleSame) ;
447 //_____________________________________________________________________________
448 Bool_t AliQADataMakerSteer::InitRunLoader()
450 // get or create the run loader
456 if (!gSystem->AccessPathName(fGAliceFileName.Data())) { // galice.root exists
457 // load all base libraries to get the loader classes
458 TString libs = gSystem->GetLibraries() ;
459 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
460 if (!IsSelected(AliQA::GetDetName(iDet)))
462 TString detName = AliQA::GetDetName(iDet) ;
463 if (detName == "HLT")
465 if (libs.Contains("lib" + detName + "base.so"))
467 gSystem->Load("lib" + detName + "base.so");
469 fRunLoader = AliRunLoader::Open(fGAliceFileName.Data());
471 AliError(Form("no run loader found in file %s", fGAliceFileName.Data()));
474 fRunLoader->CdGAFile();
475 if (fRunLoader->LoadgAlice() == 0) {
476 gAlice = fRunLoader->GetAliRun();
480 AliError(Form("no gAlice object found in file %s", fGAliceFileName.Data()));
484 } else { // galice.root does not exist
485 AliError(Form("the file %s does not exist", fGAliceFileName.Data()));
492 //_____________________________________________________________________________
493 Bool_t AliQADataMakerSteer::IsSelected(const char * det)
495 // check whether detName is contained in detectors
496 // if yes, it is removed from detectors
498 const TString detName(det) ;
499 // check if all detectors are selected
500 if ((fDetectors.CompareTo("ALL") == 0) ||
501 fDetectors.BeginsWith("ALL ") ||
502 fDetectors.EndsWith(" ALL") ||
503 fDetectors.Contains(" ALL ")) {
508 // search for the given detector
510 //AliInfo(Form("SSSSSSSSSSSSS fd = %s det = %s ", fDetectors.Data(), det)) ;
511 if ((fDetectors.CompareTo(detName) == 0) ||
512 fDetectors.BeginsWith(detName+" ") ||
513 fDetectors.EndsWith(" "+detName) ||
514 fDetectors.Contains(" "+detName+" ")) {
515 // fDetectors.ReplaceAll(detName, "");
519 // clean up the detectors string
520 // while (fDetectors.Contains(" "))
521 // fDetectors.ReplaceAll(" ", " ");
522 // while (fDetectors.BeginsWith(" "))
523 // fDetectors.Remove(0, 1);
524 // while (fDetectors.EndsWith(" "))
525 // fDetectors.Remove(fDetectors.Length()-1, 1);
530 //_____________________________________________________________________________
531 Bool_t AliQADataMakerSteer::Merge(const Int_t runNumber) const
533 // Merge all the cycles from all detectors in one single file per run
535 if ( runNumber == -1 )
536 sprintf(cmd, ".! ls *%s*.*.*.root > tempo.txt", AliQA::GetQADataFileName()) ;
538 sprintf(cmd, ".! ls *%s*.%d.*.root > tempo.txt", AliQA::GetQADataFileName(), runNumber) ;
539 gROOT->ProcessLine(cmd) ;
540 ifstream in("tempo.txt") ;
541 const Int_t runMax = 10 ;
542 TString file[AliQA::kNDET*runMax] ;
543 Int_t run[AliQA::kNDET*runMax] ;
550 AliInfo(Form("index = %d file = %s", index, (file[index]).Data())) ;
555 AliError(Form("run number %d not found", runNumber)) ;
560 Int_t runIndexMax = 0 ;
562 sprintf(stmp, ".%s.", AliQA::GetQADataFileName()) ;
563 for (Int_t ifile = 0 ; ifile < index ; ifile++) {
564 TString tmp(file[ifile]) ;
565 tmp.ReplaceAll(".root", "") ;
566 TString det = tmp(0, tmp.Index(".")) ;
567 tmp.Remove(0, tmp.Index(stmp)+4) ;
568 TString ttmp = tmp(0, tmp.Index(".")) ;
569 Int_t newRun = ttmp.Atoi() ;
570 for (Int_t irun = 0; irun <= runIndexMax; irun++) {
571 if (newRun == run[irun])
573 run[runIndex] = newRun ;
576 runIndexMax = runIndex ;
577 ttmp = tmp(tmp.Index(".")+1, tmp.Length()) ;
578 Int_t cycle = ttmp.Atoi() ;
579 AliDebug(1, Form("%s : det = %s run = %d cycle = %d \n", file[ifile].Data(), det.Data(), newRun, cycle)) ;
581 for (Int_t irun = 0 ; irun < runIndexMax ; irun++) {
583 char outFileName[20] ;
584 sprintf(outFileName, "Merged.%s.%d.root", AliQA::GetQADataFileName(), run[irun]) ;
585 merger.OutputFile(outFileName) ;
586 for (Int_t ifile = 0 ; ifile < index-1 ; ifile++) {
588 sprintf(pattern, "%s.%d.", AliQA::GetQADataFileName(), run[irun]) ;
589 TString tmp(file[ifile]) ;
590 if (tmp.Contains(pattern)) {
591 merger.AddFile(tmp) ;
600 //_____________________________________________________________________________
601 void AliQADataMakerSteer::Reset(const Bool_t sameCycle)
603 // Reset the default data members
604 for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
605 if (IsSelected(AliQA::GetDetName(iDet))) {
606 fLoader[iDet] = NULL;
607 if (fQADataMaker[iDet]) {
608 (fQADataMaker[iDet])->Reset(sameCycle) ;
609 //delete fQADataMaker[iDet] ;
610 //fQADataMaker[iDet] = NULL ;
615 if (fRawReaderDelete) {
620 fCycleSame = sameCycle ;
624 fNumberOfEvents = 999999 ;
627 //_____________________________________________________________________________
628 TString AliQADataMakerSteer::Run(const char * detectors, AliRawReader * rawReader)
630 //Runs all the QA data Maker for Raws only
632 fRawReader = rawReader ;
633 fDetectors = detectors ;
634 fDetectorsW = detectors ;
636 if ( !Init(AliQA::kRAWS, "rec") )
638 fRawReaderDelete = kFALSE ;
640 DoIt(AliQA::kRAWS, "rec") ;
644 //_____________________________________________________________________________
645 TString AliQADataMakerSteer::Run(const char * detectors, const char * fileName)
647 //Runs all the QA data Maker for Raws only
649 fDetectors = detectors ;
650 fDetectorsW = detectors ;
652 if ( !Init(AliQA::kRAWS, "rec", fileName) )
655 DoIt(AliQA::kRAWS, "rec") ;
659 //_____________________________________________________________________________
660 TString AliQADataMakerSteer::Run(const char * detectors, const AliQA::TASKINDEX taskIndex, const char * fileName )
662 // Runs all the QA data Maker for every detector
664 fDetectors = detectors ;
665 fDetectorsW = detectors ;
668 if ( (taskIndex == AliQA::kHITS) || (taskIndex == AliQA::kSDIGITS) || (taskIndex == AliQA::kDIGITS) )
670 else if ( (taskIndex == AliQA::kRAWS) || (taskIndex == AliQA::kRECPOINTS) || (taskIndex == AliQA::kESDS) )
673 AliError(Form("%s not implemented", AliQA::GetTaskName(taskIndex).Data())) ;
677 if ( !Init(taskIndex, mode, fileName) )
680 DoIt(taskIndex, mode) ;
686 //_____________________________________________________________________________
687 Bool_t AliQADataMakerSteer::Save2OCDB(const Int_t runNumber, const char * year, const Int_t cycleNumber, const char * detectors) const
689 // take the locasl QA data merge into a single file and save in OCDB
691 TString tmp(AliQA::GetQARefStorage()) ;
692 if ( tmp.IsNull() ) {
693 AliError("No storage defined, use AliQA::SetQARefStorage") ;
696 if ( !(tmp.Contains(AliQA::GetLabLocalOCDB()) || tmp.Contains(AliQA::GetLabAliEnOCDB())) ) {
697 AliError(Form("%s is a wrong storage, use %s or %s", AliQA::GetQARefStorage(), AliQA::GetLabLocalOCDB().Data(), AliQA::GetLabAliEnOCDB().Data())) ;
700 TString sdet(detectors) ;
703 if ( sdet.Contains("ALL") ) {
704 rv = Merge(runNumber) ;
707 char inputFileName[20] ;
708 sprintf(inputFileName, "Merged.%s.%d.root", AliQA::GetQADataFileName(), runNumber) ;
709 inputFile = TFile::Open(inputFileName) ;
710 rv = SaveIt2OCDB(runNumber, inputFile, year) ;
712 for (Int_t index = 0; index < AliQA::kNDET; index++) {
713 if (sdet.Contains(AliQA::GetDetName(index))) {
714 char inputFileName[20] ;
715 sprintf(inputFileName, "%s.%s.%d.%d.root", AliQA::GetDetName(index), AliQA::GetQADataFileName(), runNumber, cycleNumber) ;
716 inputFile = TFile::Open(inputFileName) ;
717 rv *= SaveIt2OCDB(runNumber, inputFile, year) ;
724 //_____________________________________________________________________________
725 Bool_t AliQADataMakerSteer::SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const char * year) const
727 // reads the TH1 from file and adds it to appropriate list before saving to OCDB
729 AliInfo(Form("Saving TH1s in %s to %s", inputFile->GetName(), AliQA::GetQARefStorage())) ;
730 AliCDBManager* man = AliCDBManager::Instance() ;
731 if ( ! man->IsDefaultStorageSet() ) {
732 TString tmp(AliQA::GetQARefDefaultStorage()) ;
734 tmp.Append("?user=alidaq") ;
735 man->SetDefaultStorage(tmp.Data()) ;
736 man->SetSpecificStorage("*", AliQA::GetQARefStorage()) ;
738 if(man->GetRun() < 0)
739 man->SetRun(runNumber);
742 mdr.SetResponsible("yves schutz");
744 for ( Int_t detIndex = 0 ; detIndex < AliQA::kNDET ; detIndex++) {
745 TDirectory * detDir = inputFile->GetDirectory(AliQA::GetDetName(detIndex)) ;
747 AliInfo(Form("Entering %s", detDir->GetName())) ;
748 char detOCDBDir[20] ;
749 sprintf(detOCDBDir, "%s/%s/%s", AliQA::GetDetName(detIndex), AliQA::GetRefOCDBDirName(), AliQA::GetRefDataDirName()) ;
750 AliCDBId idr(detOCDBDir, runNumber, AliCDBRunRange::Infinity()) ;
751 TList * listDetQAD = new TList() ;
753 sprintf(listName, "%s QA data Reference", AliQA::GetDetName(detIndex)) ;
754 mdr.SetComment("HMPID QA stuff");
755 listDetQAD->SetName(listName) ;
756 TList * taskList = detDir->GetListOfKeys() ;
757 TIter nextTask(taskList) ;
759 while ( (taskKey = dynamic_cast<TKey*>(nextTask())) ) {
760 TDirectory * taskDir = detDir->GetDirectory(taskKey->GetName()) ;
761 AliInfo(Form("Saving %s", taskDir->GetName())) ;
762 TObjArray * listTaskQAD = new TObjArray(100) ;
763 listTaskQAD->SetName(taskKey->GetName()) ;
764 listDetQAD->Add(listTaskQAD) ;
765 TList * histList = taskDir->GetListOfKeys() ;
766 TIter nextHist(histList) ;
768 while ( (histKey = dynamic_cast<TKey*>(nextHist())) ) {
769 TObject * odata = taskDir->Get(histKey->GetName()) ;
770 if ( odata->IsA()->InheritsFrom("TH1") ) {
771 AliInfo(Form("Adding %s", histKey->GetName())) ;
772 TH1 * hdata = static_cast<TH1*>(odata) ;
773 listTaskQAD->Add(hdata) ;
777 man->Put(listDetQAD, idr, &mdr) ;