]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/rec/AliHLTReconstructor.cxx
bugfix: instead of unloading from the cache, retrieve the latest version and subversi...
[u/mrichter/AliRoot.git] / HLT / rec / AliHLTReconstructor.cxx
index 5a35dc4b5398dfe1922accb3f550b579c7b07486..2910ea86f21c34ca5692e7b8d7df854b73d0a604 100644 (file)
 #include "AliHLTOUTRawReader.h"
 #include "AliHLTOUTDigitReader.h"
 #include "AliHLTEsdManager.h"
+#include "AliHLTPluginBase.h"
 
 ClassImp(AliHLTReconstructor)
 
 AliHLTReconstructor::AliHLTReconstructor()
   : 
   AliReconstructor(),
-  AliHLTReconstructorBase(),
   fFctProcessHLTOUT(NULL),
-  fpEsdManager(NULL)
+  fpEsdManager(NULL),
+  fpPluginBase(new AliHLTPluginBase)
 { 
   //constructor
 }
@@ -49,9 +50,9 @@ AliHLTReconstructor::AliHLTReconstructor()
 AliHLTReconstructor::AliHLTReconstructor(const char* options)
   : 
   AliReconstructor(),
-  AliHLTReconstructorBase(),
   fFctProcessHLTOUT(NULL),
-  fpEsdManager(NULL)
+  fpEsdManager(NULL),
+  fpPluginBase(new AliHLTPluginBase)
 { 
   //constructor
   if (options) Init(options);
@@ -61,14 +62,18 @@ AliHLTReconstructor::~AliHLTReconstructor()
 { 
   //destructor
 
-  AliHLTSystem* pSystem=GetInstance();
+  if (fpPluginBase) {
+  AliHLTSystem* pSystem=fpPluginBase->GetInstance();
   if (pSystem) {
-    AliDebug(0, Form("delete HLT system: status %#x", pSystem->GetStatusFlags()));
+    AliDebug(0, Form("terminate HLT system: status %#x", pSystem->GetStatusFlags()));
     if (pSystem->CheckStatus(AliHLTSystem::kStarted)) {
       // send specific 'event' to execute the stop sequence
       pSystem->Reconstruct(0, NULL, NULL);
     }
   }
+  delete fpPluginBase;
+  }
+  fpPluginBase=NULL;
 
   if (fpEsdManager) AliHLTEsdManager::Delete(fpEsdManager);
   fpEsdManager=NULL;
@@ -84,7 +89,12 @@ void AliHLTReconstructor::Init(const char* options)
 void AliHLTReconstructor::Init()
 {
   // init the reconstructor
-  AliHLTSystem* pSystem=GetInstance();
+  if (!fpPluginBase) {
+    AliError("internal memory error: can not get AliHLTSystem instance from plugin");
+    return;
+  }
+
+  AliHLTSystem* pSystem=fpPluginBase->GetInstance();
   if (!pSystem) {
     AliError("can not create AliHLTSystem object");
     return;
@@ -94,6 +104,8 @@ void AliHLTReconstructor::Init()
     return;
   }
 
+  TString esdManagerOptions;
+
   // the options scan has been moved to AliHLTSystem, the old code
   // here is kept to be able to run an older version of the HLT code
   // with newer AliRoot versions.
@@ -119,6 +131,11 @@ void AliHLTReconstructor::Init()
        }
       } else if (token.Contains("alilog=off")) {
        pSystem->SwitchAliLog(0);
+      } else if (token.Contains("esdmanager=")) {
+       token.ReplaceAll("esdmanager=", "");
+       token.ReplaceAll(","," ");
+       token.ReplaceAll("'","");
+       esdManagerOptions=token;
       } else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
        libs+=token;
        libs+=" ";
@@ -160,6 +177,7 @@ void AliHLTReconstructor::Init()
   fFctProcessHLTOUT=(void (*)())gSystem->DynFindSymbol("libHLTinterface.so", "AliHLTSystemProcessHLTOUT");
 
   fpEsdManager=AliHLTEsdManager::New();
+  fpEsdManager->SetOption(esdManagerOptions.Data());
 }
 
 void AliHLTReconstructor::Reconstruct(AliRawReader* rawReader, TTree* /*clustersTree*/) const 
@@ -168,8 +186,13 @@ void AliHLTReconstructor::Reconstruct(AliRawReader* rawReader, TTree* /*clusters
   // For each event, HLT reconstruction chains can be executed and
   // added to the existing HLTOUT data
   // The HLTOUT data is finally processed in FillESD
+  if (!fpPluginBase) {
+    AliError("internal memory error: can not get AliHLTSystem instance from plugin");
+    return;
+  }
+
   int iResult=0;
-  AliHLTSystem* pSystem=GetInstance();
+  AliHLTSystem* pSystem=fpPluginBase->GetInstance();
 
   if (pSystem) {
     if (pSystem->CheckStatus(AliHLTSystem::kError)) {
@@ -194,7 +217,12 @@ void AliHLTReconstructor::FillESD(AliRawReader* rawReader, TTree* /*clustersTree
     return;
   }
 
-  AliHLTSystem* pSystem=GetInstance();
+  if (!fpPluginBase) {
+    AliError("internal memory error: can not get AliHLTSystem instance from plugin");
+    return;
+  }
+
+  AliHLTSystem* pSystem=fpPluginBase->GetInstance();
 
   if (pSystem) {
     if (pSystem->CheckStatus(AliHLTSystem::kError)) {
@@ -250,7 +278,12 @@ void AliHLTReconstructor::FillESD(TTree* /*digitsTree*/, TTree* /*clustersTree*/
                    "        sim.Run();\n"
                    "        /*********************************************************/", option.Data()));
   }
-  AliHLTSystem* pSystem=GetInstance();
+  if (!fpPluginBase) {
+    AliError("internal memory error: can not get AliHLTSystem instance from plugin");
+    return;
+  }
+
+  AliHLTSystem* pSystem=fpPluginBase->GetInstance();
   if (pSystem) {
     if (pSystem->CheckStatus(AliHLTSystem::kError)) {
       AliError("HLT system in error state");
@@ -275,7 +308,12 @@ void AliHLTReconstructor::ProcessHLTOUT(AliHLTOUT* pHLTOUT, AliESDEvent* esd, bo
 {
   // treatment of simulated or real HLTOUT data
   if (!pHLTOUT) return;
-  AliHLTSystem* pSystem=GetInstance();
+  if (!fpPluginBase) {
+    AliError("internal memory error: can not get AliHLTSystem instance from plugin");
+    return;
+  }
+
+  AliHLTSystem* pSystem=fpPluginBase->GetInstance();
   if (!pSystem) {
     AliError("error getting HLT system instance");
     return;