reorganisation of the creation of the QADataMaker solving mem leaks
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 20 Jul 2008 20:08:41 +0000 (20:08 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 20 Jul 2008 20:08:41 +0000 (20:08 +0000)
STEER/AliQADataMakerSteer.cxx
STEER/AliQADataMakerSteer.h
STEER/AliReconstruction.cxx
STEER/AliReconstruction.h
STEER/AliSimulation.cxx

index 4adfa85..9c6f249 100644 (file)
@@ -42,6 +42,7 @@
 #include "AliCDBMetaData.h"
 #include "AliESDEvent.h"
 #include "AliGeomManager.h"
+#include "AliGlobalQADataMaker.h"
 #include "AliHeader.h"
 #include "AliLog.h"
 #include "AliModule.h"
@@ -58,7 +59,7 @@
 ClassImp(AliQADataMakerSteer) 
 
 //_____________________________________________________________________________
-AliQADataMakerSteer::AliQADataMakerSteer(const char* gAliceFilename, const char * name, const char * title) :
+AliQADataMakerSteer::AliQADataMakerSteer(char * mode, const char* gAliceFilename, const char * name, const char * title) :
        TNamed(name, title), 
        fCurrentEvent(0),  
        fCycleSame(kFALSE),
@@ -66,17 +67,15 @@ AliQADataMakerSteer::AliQADataMakerSteer(const char* gAliceFilename, const char
        fDetectorsW("ALL"), 
        fESD(NULL), 
        fESDTree(NULL),
-       fFirst(kTRUE),  
        fGAliceFileName(gAliceFilename), 
        fFirstEvent(0),        
-       fMaxEvents(0),        
+       fMaxEvents(0),   
+  fMode(mode), 
        fNumberOfEvents(999999), 
-    fRunNumber(0), 
+       fRunNumber(0), 
        fRawReader(NULL), 
        fRawReaderDelete(kTRUE), 
-       fRunLoader(NULL),
-       fQADataMakers()
-
+       fRunLoader(NULL)
 {
        // default ctor
        fMaxEvents = fNumberOfEvents ; 
@@ -98,16 +97,15 @@ AliQADataMakerSteer::AliQADataMakerSteer(const AliQADataMakerSteer & qas) :
        fDetectorsW(qas.fDetectorsW), 
        fESD(NULL), 
        fESDTree(NULL), 
-       fFirst(qas.fFirst),  
        fGAliceFileName(qas.fGAliceFileName), 
        fFirstEvent(qas.fFirstEvent),        
-       fMaxEvents(qas.fMaxEvents),        
+       fMaxEvents(qas.fMaxEvents),    
+       fMode(qas.fMode), 
        fNumberOfEvents(qas.fNumberOfEvents), 
     fRunNumber(qas.fRunNumber), 
        fRawReader(NULL), 
        fRawReaderDelete(kTRUE), 
-       fRunLoader(NULL),
-       fQADataMakers()
+       fRunLoader(NULL)
 {
        // cpy ctor
        for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
@@ -135,9 +133,10 @@ AliQADataMakerSteer::~AliQADataMakerSteer()
                  fLoader[iDet] = NULL;
                  if (fQADataMaker[iDet]) {
                          (fQADataMaker[iDet])->Finish() ; 
-                         fQADataMaker[iDet] = NULL ;
                  }
                }
+               if (fQADataMaker[iDet])
+                       delete fQADataMaker[iDet] ;
        }
        if (fRawReaderDelete) { 
                fRunLoader = NULL ;
@@ -147,7 +146,7 @@ AliQADataMakerSteer::~AliQADataMakerSteer()
 }
 
 //_____________________________________________________________________________
-Bool_t AliQADataMakerSteer::DoIt(const AliQA::TASKINDEX_t taskIndex, const char * mode)
+Bool_t AliQADataMakerSteer::DoIt(const AliQA::TASKINDEX_t taskIndex)
 {
        // Runs all the QA data Maker for every detector
                
@@ -169,70 +168,70 @@ Bool_t AliQADataMakerSteer::DoIt(const AliQA::TASKINDEX_t taskIndex, const char
                                break ;
                }
                // loop  over active loaders
-               for (Int_t i = 0; i < fQADataMakers.GetEntriesFast() ; i++) {
-                       AliQADataMaker * qadm = static_cast<AliQADataMaker *>(fQADataMakers.At(i)) ;
-                       if ( qadm->IsCycleDone() ) {
-                               qadm->EndOfCycle(AliQA::kRAWS) ;
-                               qadm->StartOfCycle(AliQA::kRAWS) ;
-                       }
-                       TTree * data ; 
-                       Int_t iDet = qadm->GetUniqueID();
-                       AliLoader* loader = GetLoader(iDet);
-                       switch (taskIndex) {
-                               case AliQA::kRAWS :
-                                       qadm->Exec(taskIndex, fRawReader) ; 
-                                       break ; 
-                               case AliQA::kHITS :
-                                       loader->LoadHits() ; 
-                                       data = loader->TreeH() ; 
-                                       if ( ! data ) {
-                                               AliWarning(Form(" Hit Tree not found for  %s", AliQA::GetDetName(iDet))) ; 
-                                       } else {
-                                               qadm->Exec(taskIndex, data) ;
-                                       } 
-                                       break ;
-                                       case AliQA::kSDIGITS :
-                                       loader->LoadSDigits() ; 
-                                       data = loader->TreeS() ; 
-                                       if ( ! data ) {
-                                               AliWarning(Form(" SDigit Tree not found for  %s", AliQA::GetDetName(iDet))) ; 
-                                       } else {
-                                               qadm->Exec(taskIndex, data) ; 
-                                       }
-                                       break; 
-                                       case AliQA::kDIGITS :
-                                       loader->LoadDigits() ; 
-                                       data = loader->TreeD() ; 
-                                       if ( ! data ) {
-                                               AliWarning(Form(" Digit Tree not found for  %s", AliQA::GetDetName(iDet))) ; 
-                                       } else {
-                                               qadm->Exec(taskIndex, data) ;
-                                       }
-                                       break; 
-                                       case AliQA::kRECPOINTS :
-                                       loader->LoadRecPoints() ; 
-                                       data = loader->TreeR() ; 
-                                       if (!data) {
-                                               AliWarning(Form("RecPoints not found for %s", AliQA::GetDetName(iDet))) ; 
-                                       } else {
-                                               qadm->Exec(taskIndex, data) ; 
+               for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
+                       if (IsSelected(AliQA::GetDetName(iDet))) {
+                               AliQADataMaker * qadm = GetQADataMaker(iDet) ;
+                               if ( qadm->IsCycleDone() ) {
+                                       qadm->EndOfCycle(AliQA::kRAWS) ;
+                                       qadm->StartOfCycle(AliQA::kRAWS) ;
+                               }
+                               TTree * data ; 
+                               AliLoader* loader = GetLoader(qadm->GetUniqueID());
+                               switch (taskIndex) {
+                                       case AliQA::kRAWS :
+                                               qadm->Exec(taskIndex, fRawReader) ; 
+                                               break ; 
+                                       case AliQA::kHITS :
+                                               loader->LoadHits() ; 
+                                               data = loader->TreeH() ; 
+                                               if ( ! data ) {
+                                                       AliWarning(Form(" Hit Tree not found for  %s", AliQA::GetDetName(iDet))) ; 
+                                               } else {
+                                                       qadm->Exec(taskIndex, data) ;
+                                               } 
+                                               break ;
+                                               case AliQA::kSDIGITS :
+                                               loader->LoadSDigits() ; 
+                                               data = loader->TreeS() ; 
+                                               if ( ! data ) {
+                                                       AliWarning(Form(" SDigit Tree not found for  %s", AliQA::GetDetName(iDet))) ; 
+                                               } else {
+                                                       qadm->Exec(taskIndex, data) ; 
                                        }
-                                       break; 
-                                       case AliQA::kTRACKSEGMENTS :
-                                       break; 
-                                       case AliQA::kRECPARTICLES :
-                                       break; 
-                                       case AliQA::kESDS :
-                                       qadm->Exec(taskIndex, fESD) ;
-                                       break; 
-                                       case AliQA::kNTASKINDEX :
-                                       break; 
-                       } //task switch
-                       //qadm->Increment() ; 
+                                               break; 
+                                               case AliQA::kDIGITS :
+                                               loader->LoadDigits() ; 
+                                               data = loader->TreeD() ; 
+                                               if ( ! data ) {
+                                                       AliWarning(Form(" Digit Tree not found for  %s", AliQA::GetDetName(iDet))) ; 
+                                               } else {
+                                                       qadm->Exec(taskIndex, data) ;
+                                               }
+                                               break; 
+                                               case AliQA::kRECPOINTS :
+                                               loader->LoadRecPoints() ; 
+                                               data = loader->TreeR() ; 
+                                               if (!data) {
+                                                       AliWarning(Form("RecPoints not found for %s", AliQA::GetDetName(iDet))) ; 
+                                               } else {
+                                                       qadm->Exec(taskIndex, data) ; 
+                                               }
+                                               break; 
+                                               case AliQA::kTRACKSEGMENTS :
+                                               break; 
+                                               case AliQA::kRECPARTICLES :
+                                               break; 
+                                               case AliQA::kESDS :
+                                               qadm->Exec(taskIndex, fESD) ;
+                                               break; 
+                                               case AliQA::kNTASKINDEX :
+                                               break; 
+                               } //task switch
+                       }
                } // detector loop
        } // event loop 
-//     // Save QA data for all detectors
-       rv = Finish(taskIndex, mode) ;
+       // Save QA data for all detectors
+       rv = Finish(taskIndex) ;
        
        if ( taskIndex == AliQA::kRAWS ) 
                fRawReader->RewindEvents() ;
@@ -241,13 +240,15 @@ Bool_t AliQADataMakerSteer::DoIt(const AliQA::TASKINDEX_t taskIndex, const char
 }
 
 //_____________________________________________________________________________
-Bool_t AliQADataMakerSteer::Finish(const AliQA::TASKINDEX_t taskIndex, const char * /*mode*/) 
+Bool_t AliQADataMakerSteer::Finish(const AliQA::TASKINDEX_t taskIndex) 
 {
        // write output to file for all detectors
-       for (Int_t i = 0; i < fQADataMakers.GetEntriesFast() ; i++) {
-               AliQADataMaker * qadm = static_cast<AliQADataMaker *>(fQADataMakers.At(i));
-               qadm->EndOfCycle(taskIndex) ; 
-       }    
+       for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
+               if (IsSelected(AliQA::GetDetName(iDet))) {
+                       AliQADataMaker * qadm = GetQADataMaker(iDet) ;
+                       qadm->EndOfCycle(taskIndex) ; 
+               }
+       }
        return kTRUE ; 
 }
 
@@ -317,7 +318,7 @@ AliLoader * AliQADataMakerSteer::GetLoader(Int_t iDet)
 }
 
 //_____________________________________________________________________________
-AliQADataMaker * AliQADataMakerSteer::GetQADataMaker(const Int_t iDet, const char * mode )
+AliQADataMaker * AliQADataMakerSteer::GetQADataMaker(const Int_t iDet)
 {
        // get the quality assurance data maker for a detector
        
@@ -326,41 +327,46 @@ AliQADataMaker * AliQADataMakerSteer::GetQADataMaker(const Int_t iDet, const cha
        
        AliQADataMaker * qadm = NULL ;
        
-       if (fFirst) {
-               // load the QA data maker object
-               TPluginManager* pluginManager = gROOT->GetPluginManager() ;
-               TString detName = AliQA::GetDetName(iDet) ;
-               TString tmp(mode) ; 
-               if (tmp.Contains("sim")) 
-                       tmp.ReplaceAll("s", "S") ; 
-               else if (tmp.Contains("rec")) 
-                       tmp.ReplaceAll("r", "R") ; 
-               TString qadmName = "Ali" + detName + "QADataMaker" + tmp ;
-
-               // first check if a plugin is defined for the quality assurance data maker
-               TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
-               // if not, add a plugin for it
-               if (!pluginHandler) {
-                       AliDebug(1, Form("defining plugin for %s", qadmName.Data())) ;
-                       TString libs = gSystem->GetLibraries() ;
-                       if (libs.Contains("lib" + detName + mode + ".so") || (gSystem->Load("lib" + detName + mode + ".so") >= 0)) {
-                               pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName + "qadm", qadmName + "()") ;
-                       } else {
-                               pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName, qadmName + "()") ;
-                       }
-                       pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
-               }
-               if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
-                       qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0) ;
+       if (iDet == AliQA::kGLOBAL) { //Global QA
+               qadm = new AliGlobalQADataMaker();
+               fQADataMaker[iDet] = qadm;
+               return qadm;
+       }
+
+       // load the QA data maker object
+       TPluginManager* pluginManager = gROOT->GetPluginManager() ;
+       TString detName = AliQA::GetDetName(iDet) ;
+       TString tmp(fMode) ; 
+       if (tmp.Contains("sim")) 
+               tmp.ReplaceAll("s", "S") ; 
+       else if (tmp.Contains("rec")) 
+               tmp.ReplaceAll("r", "R") ; 
+
+       TString qadmName = "Ali" + detName + "QADataMaker" + tmp ;
+
+       // first check if a plugin is defined for the quality assurance data maker
+       TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
+       // if not, add a plugin for it
+       if (!pluginHandler) {
+               AliDebug(1, Form("defining plugin for %s", qadmName.Data())) ;
+               TString libs = gSystem->GetLibraries() ;
+               if (libs.Contains("lib" + detName + fMode + ".so") || (gSystem->Load("lib" + detName + fMode + ".so") >= 0)) {
+                       pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName + "qadm", qadmName + "()") ;
+               } else {
+                       pluginManager->AddHandler("AliQADataMaker", detName, qadmName, detName, qadmName + "()") ;
                }
-               if (qadm) 
-                       fQADataMaker[iDet] = qadm ;
+               pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName) ;
+       }
+       if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
+               qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0) ;
        }
-       return qadm ;
+       if (qadm) 
+               fQADataMaker[iDet] = qadm ;
+               return qadm ;
 }
 
 //_____________________________________________________________________________
-Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX_t taskIndex, const char * mode, const  char * input )
+Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX_t taskIndex, const  char * input )
 {
        // Initialize the event source and QA data makers
        
@@ -416,11 +422,16 @@ Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX_t taskIndex, const char
                        detArray = fRunLoader->GetAliRun()->Detectors() ;
                        fRunNumber = fRunLoader->GetHeader()->GetRun() ; 
                }
+
+       // Initialize all QA data makers for all detectors
+       fRunNumber = AliCDBManager::Instance()->GetRun() ; 
+       if ( !  AliGeomManager::GetGeometry() ) 
+               AliGeomManager::LoadGeometry() ; 
+       
        // Build array of QA data makers for all detectors
-       fQADataMakers.Clear();
        for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
                if (IsSelected(AliQA::GetDetName(iDet))) {
-                       AliQADataMaker * qadm = GetQADataMaker(iDet, mode) ;
+                       AliQADataMaker * qadm = GetQADataMaker(iDet) ;
                        if (!qadm) {
                                AliError(Form("AliQADataMaker not found for %s", AliQA::GetDetName(iDet))) ; 
                                fDetectorsW.ReplaceAll(AliQA::GetDetName(iDet), "") ; 
@@ -434,20 +445,11 @@ Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX_t taskIndex, const char
                                }
                                qadm->SetName(AliQA::GetDetName(iDet));
                                qadm->SetUniqueID(iDet);
-                               fQADataMakers.Add(qadm);
+                               qadm->Init(taskIndex, fRunNumber, GetQACycles(qadm->GetUniqueID())) ;
+                               qadm->StartOfCycle(taskIndex, fCycleSame) ;
                        }
                }
        } 
-       // Initialize all QA data makers for all detectors
-       fRunNumber = AliCDBManager::Instance()->GetRun() ; 
-       if ( !  AliGeomManager::GetGeometry() ) 
-               AliGeomManager::LoadGeometry() ; 
-       for (Int_t i = 0; i < fQADataMakers.GetEntriesFast() ; i++) {
-               AliQADataMaker * qadm = static_cast<AliQADataMaker *>(fQADataMakers.At(i));
-               qadm->Init(taskIndex, fRunNumber, GetQACycles(qadm->GetUniqueID())) ;
-               qadm->StartOfCycle(taskIndex, fCycleSame) ;
-       } 
-       fFirst = kFALSE ;
        return kTRUE ; 
 }
 
@@ -515,18 +517,9 @@ Bool_t AliQADataMakerSteer::IsSelected(const char * det)
                           fDetectors.BeginsWith(detName+" ") ||
                           fDetectors.EndsWith(" "+detName) ||
                           fDetectors.Contains(" "+detName+" ")) {
-               //              fDetectors.ReplaceAll(detName, "");
                rv = kTRUE;
        }
-       
-       // clean up the detectors string
-       //      while (fDetectors.Contains("  ")) 
-       //              fDetectors.ReplaceAll("  ", " ");
-       //      while (fDetectors.BeginsWith(" ")) 
-       //              fDetectors.Remove(0, 1);
-       //      while (fDetectors.EndsWith(" ")) 
-       //              fDetectors.Remove(fDetectors.Length()-1, 1);
-       
+               
        return rv ;
 }
 
@@ -602,9 +595,11 @@ void AliQADataMakerSteer::Reset(const Bool_t sameCycle)
 {
        // Reset the default data members
 
-       for (Int_t i = 0; i < fQADataMakers.GetEntriesFast() ; i++) {
-               AliQADataMaker * qadm = static_cast<AliQADataMaker *>(fQADataMakers.At(i));
-               qadm->Reset(sameCycle);
+       for (UInt_t iDet = 0; iDet < fgkNDetectors ; iDet++) {
+               if (IsSelected(AliQA::GetDetName(iDet))) {
+                       AliQADataMaker * qadm = GetQADataMaker(iDet);
+                       qadm->Reset(sameCycle);
+               }
        } 
        if (fRawReaderDelete) { 
                delete fRawReader ;
@@ -614,7 +609,7 @@ void AliQADataMakerSteer::Reset(const Bool_t sameCycle)
        fCycleSame      = sameCycle ; 
        fESD            = NULL ; 
        fESDTree        = NULL ; 
-       fFirst          = kTRUE ;   
+       //fFirst          = kTRUE ;   
        fNumberOfEvents = 999999 ;  
 }
 
@@ -636,11 +631,11 @@ TString AliQADataMakerSteer::Run(const char * detectors, AliRawReader * rawReade
                rawReader->RewindEvents() ;
        }       
        
-       if ( !Init(AliQA::kRAWS, "rec") ) 
+       if ( !Init(AliQA::kRAWS) ) 
                return kFALSE ; 
        fRawReaderDelete = kFALSE ; 
 
-       DoIt(AliQA::kRAWS, "rec") ; 
+       DoIt(AliQA::kRAWS) ; 
        return  fDetectorsW ;
 }
 
@@ -670,10 +665,10 @@ TString AliQADataMakerSteer::Run(const char * detectors, const char * fileName,
                }
        }
        
-       if ( !Init(AliQA::kRAWS, "rec", fileName) ) 
+       if ( !Init(AliQA::kRAWS, fileName) ) 
                return kFALSE ; 
        
-       DoIt(AliQA::kRAWS, "rec") ; 
+       DoIt(AliQA::kRAWS) ; 
        return  fDetectorsW ;
 }
 
@@ -686,16 +681,6 @@ TString AliQADataMakerSteer::Run(const char * detectors, const AliQA::TASKINDEX_
        fDetectors       = detectors ; 
        fDetectorsW      = detectors ;          
        
-       TString mode ; 
-       if ( (taskIndex == AliQA::kHITS) || (taskIndex == AliQA::kSDIGITS) || (taskIndex == AliQA::kDIGITS) ) 
-               mode = "sim" ; 
-       else if ( (taskIndex == AliQA::kRAWS) || (taskIndex == AliQA::kRECPOINTS) || (taskIndex == AliQA::kESDS) )
-               mode = "rec" ; 
-       else {
-               AliError(Form("%s not implemented", AliQA::GetTaskName(taskIndex).Data())) ; 
-               return "" ;
-       }
-
        AliCDBManager* man = AliCDBManager::Instance() ;        
        if ( man->GetRun() == -1 ) { // check if run number not set previously and set it from AliRun
                AliRunLoader * rl = AliRunLoader::Open("galice.root") ;
@@ -713,10 +698,10 @@ TString AliQADataMakerSteer::Run(const char * detectors, const AliQA::TASKINDEX_
                }
        }
        
-       if ( !Init(taskIndex, mode.Data(), fileName) ) 
+       if ( !Init(taskIndex, fileName) ) 
                return kFALSE ; 
 
-       DoIt(taskIndex, mode.Data()) ;
+       DoIt(taskIndex) ;
        
        return fDetectorsW ;
 
index 7ad0aa6..9fb8d9a 100644 (file)
@@ -30,7 +30,7 @@ class AliESDEvent ;
 
 class AliQADataMakerSteer: public TNamed {
 public:
-       AliQADataMakerSteer(const char* gAliceFilename = "galice.root", 
+       AliQADataMakerSteer(char * mode, const char* gAliceFilename = "galice.root", 
                                                const char * name = "AliQADataMakerSteer", 
                                                const char * title = "QA makers") ; 
        AliQADataMakerSteer(const AliQADataMakerSteer & qas) ; 
@@ -38,6 +38,7 @@ public:
        virtual ~AliQADataMakerSteer() ; 
        UInt_t      GetCurrentEvent() const { return fCurrentEvent ; }
        TObjArray * GetFromOCDB(AliQA::DETECTORINDEX_t det, AliQA::TASKINDEX_t task, const char * year) const ; 
+       AliQADataMaker * GetQADataMaker(const Int_t iDet) ; 
        Bool_t      Merge(const Int_t runNumber = -1) const ;  
        void        Reset(const Bool_t sameCycle = kFALSE) ;  
        TString     Run(const char * detectors, const AliQA::TASKINDEX_t taskIndex, Bool_t const sameCycle = kFALSE, const char * fileName = NULL) ; 
@@ -52,14 +53,13 @@ public:
        void        SetRunLoader(AliRunLoader * rl) { fRunLoader = rl ; }
 
 private: 
-       Bool_t                       DoIt(const AliQA::TASKINDEX_t taskIndex, const char * mode) ;
+       Bool_t                       DoIt(const AliQA::TASKINDEX_t taskIndex) ;
        AliLoader      * GetLoader(Int_t iDet) ; 
        const Int_t      GetQACycles(const Int_t iDet) { return fQACycles[iDet] ; }
-       AliQADataMaker * GetQADataMaker(const Int_t iDet, const char * mode) ; 
-       Bool_t                       Init(const AliQA::TASKINDEX_t taskIndex, const char * mode, const  char * fileName = NULL) ;
+       Bool_t                       Init(const AliQA::TASKINDEX_t taskIndex, const  char * fileName = NULL) ;
        Bool_t           InitRunLoader() ; 
        Bool_t           IsSelected(const char * detName)  ;
-       Bool_t           Finish(const AliQA::TASKINDEX_t taskIndex, const char * mode) ;
+       Bool_t           Finish(const AliQA::TASKINDEX_t taskIndex) ;
        Bool_t           SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const char * year) const ;  
 
  
@@ -69,10 +69,10 @@ private:
        TString            fDetectorsW ;                   //! list of active detectors with QA implemented 
        AliESDEvent *      fESD ;                          //! current ESD
        TTree *            fESDTree ;                      //! current ESD Tree
-       Bool_t             fFirst ;                        //! to search the detector QA data maker only once
        TString            fGAliceFileName ;               //! name of the galice file
        UInt_t             fFirstEvent ;                   //! first event to process
        Int_t              fMaxEvents ;                    //! number of events to process
+       char *             fMode ;                         //! sim or rec
        Long64_t           fNumberOfEvents ;               //! number of events in the run 
        UInt_t             fRunNumber ;                    //! current run number
        AliRawReader     * fRawReader ;                    //! current raw reader object 
@@ -81,7 +81,6 @@ private:
        static const UInt_t fgkNDetectors = AliQA::kNDET ; //! number of detectors    
        AliLoader      *   fLoader[fgkNDetectors];         //! array of detectors loader
        AliQADataMaker *   fQADataMaker[fgkNDetectors];    //! array of QA data maker objects
-       TObjArray          fQADataMakers;                  //! array of active QA data maker objects
        Int_t              fQACycles[fgkNDetectors];       //! array of QA cycle length
        
   ClassDef(AliQADataMakerSteer, 0)      // class for running the QA makers
index 1417d90..6f4462e 100644 (file)
@@ -255,6 +255,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename,
   fInitCDBCalled(kFALSE),
   fSetRunNumberFromDataCalled(kFALSE),
   fQADetectors("ALL"), 
+  fQASteer(NULL),  
   fQATasks("ALL"), 
   fRunQA(kTRUE),  
   fRunGlobalQA(kTRUE),
@@ -282,10 +283,9 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename,
     fReconstructor[iDet] = NULL;
     fLoader[iDet] = NULL;
     fTracker[iDet] = NULL;
-    fQADataMaker[iDet] = NULL;
-       fQACycles[iDet] = 999999;       
+               fQACycles[iDet] = 999999;       
   }
-  fQADataMaker[fgkNDetectors]=NULL;  //Global QA
+       fQASteer = new AliQADataMakerSteer("rec") ; 
   AliPID pid;
 }
 
@@ -347,6 +347,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
   fInitCDBCalled(rec.fInitCDBCalled),
   fSetRunNumberFromDataCalled(rec.fSetRunNumberFromDataCalled),
   fQADetectors(rec.fQADetectors), 
+       fQASteer(rec.fQASteer),  
   fQATasks(rec.fQATasks), 
   fRunQA(rec.fRunQA),  
   fRunGlobalQA(rec.fRunGlobalQA),
@@ -376,10 +377,8 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
     fReconstructor[iDet] = NULL;
     fLoader[iDet] = NULL;
     fTracker[iDet] = NULL;
-    fQADataMaker[iDet] = NULL;
-       fQACycles[iDet] = rec.fQACycles[iDet];  
+               fQACycles[iDet] = rec.fQACycles[iDet];  
   }
-  fQADataMaker[fgkNDetectors]=NULL;  //Global QA
   for (Int_t i = 0; i < rec.fSpecCDBUri.GetEntriesFast(); i++) {
     if (rec.fSpecCDBUri[i]) fSpecCDBUri.Add(rec.fSpecCDBUri[i]->Clone());
   }
@@ -406,7 +405,7 @@ AliReconstruction::~AliReconstruction()
   fOptions.Delete();
   fSpecCDBUri.Delete();
   delete fForcedFieldMap;
-
+       delete fQASteer ;
   AliCodeTimer::Instance()->Print();
 }
 
@@ -960,8 +959,7 @@ Bool_t AliReconstruction::InitRun(const char* input)
   
   //QA
   if (fRunQA && fRawReader && fQATasks.Contains(Form("%d", AliQA::kRAWS))) { 
-               AliQADataMakerSteer qas ; 
-               qas.Run(fQADetectors, fRawReader) ; 
+               fQASteer->Run(fQADetectors, fRawReader) ; 
                fSameQACycle = kTRUE ; 
   }
   //Initialize the QA and start of cycle for out-of-cycle QA
@@ -970,7 +968,7 @@ Bool_t AliReconstruction::InitRun(const char* input)
       for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
          if (!IsSelected(fgkDetectorName[iDet], detStr)) 
                         continue;
-         AliQADataMakerRec *qadm = GetQADataMaker(iDet);  
+         AliQADataMaker *qadm = fQASteer->GetQADataMaker(iDet);  
          if (!qadm) 
                         continue;
          AliInfo(Form("Initializing the QA data maker for %s", 
@@ -991,7 +989,7 @@ Bool_t AliReconstruction::InitRun(const char* input)
                 }
       }
          if (fRunGlobalQA) {
-                 AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL);
+                 AliQADataMaker *qadm = fQASteer->GetQADataMaker(AliQA::kGLOBAL);
                  AliInfo(Form("Initializing the global QA data maker"));
                  if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) {
                          TObjArray *arr=
@@ -1062,12 +1060,12 @@ Bool_t AliReconstruction::RunEvent(Int_t iEvent)
     //Start of cycle for the in-loop QA
     if (fInLoopQA) {
        if (fRunQA) {
-                 fSameQACycle = kFALSE ;
+                                fSameQACycle = kFALSE ;
           TString detStr(fQADetectors); 
           for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
              if (!IsSelected(fgkDetectorName[iDet], detStr)) 
                                 continue;
-             AliQADataMakerRec *qadm = GetQADataMaker(iDet);  
+             AliQADataMaker *qadm = fQASteer->GetQADataMaker(iDet);  
              if (!qadm) 
                                 continue;
                          if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) {
@@ -1081,7 +1079,7 @@ Bool_t AliReconstruction::RunEvent(Int_t iEvent)
           }
                   if (fRunGlobalQA) {
                           fSameQACycle = kFALSE;
-                          AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL);
+                          AliQADataMaker *qadm = fQASteer->GetQADataMaker(AliQA::kGLOBAL);
                           if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) {
                                   qadm->StartOfCycle(AliQA::kRECPOINTS, fSameQACycle);
                                   fSameQACycle = kTRUE;
@@ -1311,7 +1309,7 @@ Bool_t AliReconstruction::RunEvent(Int_t iEvent)
 
        if (fRunQA) {
                if (fRunGlobalQA) {
-                       AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL);
+                       AliQADataMaker *qadm = fQASteer->GetQADataMaker(AliQA::kGLOBAL);
                        if (qadm && fQATasks.Contains(Form("%d", AliQA::kESDS)))
                                qadm->Exec(AliQA::kESDS, fesd);
                }
@@ -1354,7 +1352,7 @@ Bool_t AliReconstruction::RunEvent(Int_t iEvent)
            for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
                           if (!IsSelected(fgkDetectorName[iDet], fQADetectors)) 
                                   continue;
-                          AliQADataMakerRec * qadm = GetQADataMaker(iDet);
+                          AliQADataMaker * qadm = fQASteer->GetQADataMaker(iDet);
                           if (!qadm)
                                   continue;
                           if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) 
@@ -1365,7 +1363,7 @@ Bool_t AliReconstruction::RunEvent(Int_t iEvent)
                   }
         }
         if (fRunGlobalQA) {
-           AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL);
+           AliQADataMaker *qadm = fQASteer->GetQADataMaker(AliQA::kGLOBAL);
            if (qadm) {
                           if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) 
                                   qadm->EndOfCycle(AliQA::kRECPOINTS);
@@ -1464,14 +1462,13 @@ Bool_t AliReconstruction::FinishRun()
   //Finish QA and end of cycle for out-of-loop QA
   if (!fInLoopQA) {
          if (fRunQA) {
-                 AliQADataMakerSteer qas;
                  if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) 
-                         qas.Run(fRunLocalReconstruction.Data(), AliQA::kRECPOINTS, fSameQACycle);
-                 //qas.Reset() ;
+                         fQASteer->Run(fRunLocalReconstruction.Data(), AliQA::kRECPOINTS, fSameQACycle);
+                 //fQASteer->Reset() ;
                  if (fQATasks.Contains(Form("%d", AliQA::kESDS))) 
-                         qas.Run(fRunLocalReconstruction.Data(), AliQA::kESDS, fSameQACycle);
+                         fQASteer->Run(fRunLocalReconstruction.Data(), AliQA::kESDS, fSameQACycle);
                  if (fRunGlobalQA) {
-                        AliQADataMakerRec *qadm = GetQADataMaker(AliQA::kGLOBAL);
+                        AliQADataMaker *qadm = fQASteer->GetQADataMaker(AliQA::kGLOBAL);
                          if (qadm) {
                                  if (fQATasks.Contains(Form("%d", AliQA::kRECPOINTS))) 
                                          qadm->EndOfCycle(AliQA::kRECPOINTS);
@@ -1579,8 +1576,8 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors)
     if (fRawReader && reconstructor->HasDigitConversion()) {
       AliInfo(Form("converting raw data digits into root objects for %s", 
                   fgkDetectorName[iDet]));
-      AliCodeTimerAuto(Form("converting raw data digits into root objects for %s", 
-                            fgkDetectorName[iDet]));
+//      AliCodeTimerAuto(Form("converting raw data digits into root objects for %s", 
+//                            fgkDetectorName[iDet]));
       loader->LoadDigits("update");
       loader->CleanDigits();
       loader->MakeDigitsContainer();
@@ -1591,7 +1588,7 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors)
     }
     // local reconstruction
     AliInfo(Form("running reconstruction for %s", fgkDetectorName[iDet]));
-    AliCodeTimerAuto(Form("running reconstruction for %s", fgkDetectorName[iDet]));
+    //AliCodeTimerAuto(Form("running reconstruction for %s", fgkDetectorName[iDet]));
     loader->LoadRecPoints("update");
     loader->CleanRecPoints();
     loader->MakeRecPointsContainer();
@@ -1611,9 +1608,9 @@ Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors)
     }
 
     // In-loop QA for local reconstrucion 
-       TString detQAStr(fQADetectors) ; 
+               TString detQAStr(fQADetectors) ; 
     if (fRunQA && fInLoopQA && IsSelected(fgkDetectorName[iDet], detQAStr) ) {
-       AliQADataMakerRec * qadm = GetQADataMaker(iDet);
+                        AliQADataMaker * qadm = fQASteer->GetQADataMaker(iDet);
        if (qadm) {
          //AliCodeTimerStart
          //(Form("Running QA data maker for %s", fgkDetectorName[iDet]));
@@ -2372,8 +2369,6 @@ void AliReconstruction::CleanUp(TFile* file, TFile* fileOld)
     fLoader[iDet] = NULL;
     delete fTracker[iDet];
     fTracker[iDet] = NULL;
-//    delete fQADataMaker[iDet];
-//    fQADataMaker[iDet] = NULL;
   }
   delete fVertexer;
   fVertexer = NULL;
@@ -2594,53 +2589,6 @@ void AliReconstruction::TNamedToFile(TTree* fTree, TString pName){
 }
   
 //_____________________________________________________________________________
-AliQADataMakerRec * AliReconstruction::GetQADataMaker(Int_t iDet)
-{
- // get the quality assurance data maker object and the loader for a detector
-
-  if (fQADataMaker[iDet]) 
-    return fQADataMaker[iDet];
-
-  AliQADataMakerRec * qadm = NULL;
-  if (iDet == fgkNDetectors) { //Global QA
-     qadm = new AliGlobalQADataMaker();
-     fQADataMaker[iDet] = qadm;
-     return qadm;
-  }
-
-  // load the QA data maker object
-  TPluginManager* pluginManager = gROOT->GetPluginManager();
-  TString detName = fgkDetectorName[iDet];
-  TString qadmName = "Ali" + detName + "QADataMakerRec";
-  if (!fIsNewRunLoader && !fRunLoader->GetLoader(detName+"Loader") && (detName != "HLT")) 
-    return NULL;
-
-  // first check if a plugin is defined for the quality assurance data maker
-  TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMakerRec", detName);
-  // if not, add a plugin for it
-  if (!pluginHandler) {
-    AliDebug(1, Form("defining plugin for %s", qadmName.Data()));
-    TString libs = gSystem->GetLibraries();
-    if (libs.Contains("lib" + detName + "base.so") ||
-       (gSystem->Load("lib" + detName + "base.so") >= 0)) {
-      pluginManager->AddHandler("AliQADataMakerRec", detName, 
-                               qadmName, detName + "qadm", qadmName + "()");
-    } else {
-      pluginManager->AddHandler("AliQADataMakerRec", detName, 
-                               qadmName, detName, qadmName + "()");
-    }
-    pluginHandler = pluginManager->FindHandler("AliQADataMakerRec", detName);
-  }
-  if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
-    qadm = (AliQADataMakerRec *) pluginHandler->ExecPlugin(0);
-  }
-
-  fQADataMaker[iDet] = qadm;
-
-  return qadm;
-}
-
-//_____________________________________________________________________________
 Bool_t AliReconstruction::RunQA(AliESDEvent *& esd)
 {
   // run the Quality Assurance data producer
@@ -2650,7 +2598,7 @@ Bool_t AliReconstruction::RunQA(AliESDEvent *& esd)
   for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
    if (!IsSelected(fgkDetectorName[iDet], detStr)) 
      continue;
-   AliQADataMakerRec * qadm = GetQADataMaker(iDet);
+   AliQADataMaker * qadm = fQASteer->GetQADataMaker(iDet);
    if (!qadm) 
      continue;
    AliCodeTimerStart(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
index 39172e4..2fb8bb8 100644 (file)
@@ -35,7 +35,7 @@ class AliVertexerTracks;
 class TFile;
 class TTree;
 class TList;
-class AliQADataMakerRec;
+class AliQADataMakerSteer; 
 class TMap;
 
 class AliReconstruction: public TNamed {
@@ -174,7 +174,6 @@ private:
 
   //Quality Assurance
   Int_t                GetDetIndex(const char * detector);
-  AliQADataMakerRec*   GetQADataMaker(Int_t iDet);
   const Int_t          GetQACycles(const char * detector) { return fQACycles[GetDetIndex(detector)] ; }
   void                 CheckQA() ;
 
@@ -250,14 +249,14 @@ private:
   Bool_t        fSetRunNumberFromDataCalled;  //! flag to check if run number is already loaded from run loader
 
   //Quality Assurance
-  AliQADataMakerRec *fQADataMaker[fgkNDetectors+1];  //! array of QA data makers
-  Int_t fQACycles[   fgkNDetectors];// # events over which QA data are accumulated
-  TString            fQADetectors ;  // list of detectors to be QA'ed  
-  TString            fQATasks ;      // list of QA tasks to be performed       
-  Bool_t             fRunQA ;        // Run QA flag
-  Bool_t             fRunGlobalQA;   // Run global QA flag
-  Bool_t             fInLoopQA;      // In-loop QA flag
-  Bool_t             fSameQACycle;   //! open a new QA data file or not
+  Int_t fQACycles[      fgkNDetectors]; // # events over which QA data are accumulated
+  TString               fQADetectors ;  // list of detectors to be QA'ed       
+       AliQADataMakerSteer * fQASteer    ;   // steering class to run QA
+  TString               fQATasks ;      // list of QA tasks to be performed    
+  Bool_t                fRunQA ;        // Run QA flag
+  Bool_t                fRunGlobalQA;   // Run global QA flag
+  Bool_t                fInLoopQA;      // In-loop QA flag
+  Bool_t                fSameQACycle;   //! open a new QA data file or not
   // Plane Efficiency Evaluation
   Bool_t         fRunPlaneEff ;      // Evaluate Plane Efficiency
 
index 00d40ae..6ae6a14 100644 (file)
@@ -1760,7 +1760,7 @@ Bool_t AliSimulation::RunQA()
 {
        // run the QA on summable hits, digits or digits
 
-       AliQADataMakerSteer qas ; 
+       AliQADataMakerSteer qas("sim") ; 
     qas.SetRunLoader(gAlice->GetRunLoader()) ;
 
        TString detectorsw("") ;