]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTSystem.cxx
adding support for xml files in AliHLTSystem (Lars)
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTSystem.cxx
index 0659ad3d34c4c97f66a831e5efd824766cd0e8d2..18c70e734db22322bc5b6163307d7cfcc4a978b5 100644 (file)
@@ -32,6 +32,7 @@ using namespace std;
 #include "AliHLTComponent.h"
 #include "AliHLTConfiguration.h"
 #include "AliHLTConfigurationHandler.h"
+#include "AliHLTOnlineConfiguration.h"
 #include "AliHLTTask.h"
 #include "AliHLTModuleAgent.h"
 #include "AliHLTOfflineInterface.h"
@@ -70,10 +71,12 @@ const char* AliHLTSystem::fgkHLTDefaultLibs[]= {
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTSystem)
 
-AliHLTSystem::AliHLTSystem(AliHLTComponentLogSeverity loglevel, const char* name)
-  :
-  fpComponentHandler(AliHLTComponentHandler::CreateHandler()),
-  fpConfigurationHandler(AliHLTConfigurationHandler::CreateHandler()),
+AliHLTSystem::AliHLTSystem(AliHLTComponentLogSeverity loglevel, const char* name,
+                          AliHLTComponentHandler* pCompHandler,
+                          AliHLTConfigurationHandler* pConfHandler
+                          )
+  : fpComponentHandler(pCompHandler==NULL?AliHLTComponentHandler::CreateHandler():pCompHandler)
+  , fpConfigurationHandler(pConfHandler==NULL?AliHLTConfigurationHandler::CreateHandler():pConfHandler),
   fTaskList(),
   fState(0),
   fChains(),
@@ -87,6 +90,7 @@ AliHLTSystem::AliHLTSystem(AliHLTComponentLogSeverity loglevel, const char* name
   fpControlTask(NULL),
   fName(name)
   , fECSParams()
+  , fUseHLTOUTComponentTypeGlobal(true)
 {
   // see header file for class documentation
   // or
@@ -1181,13 +1185,34 @@ int AliHLTSystem::ScanOptions(const char* options)
        } else if (token.Contains("config=")) {
          TString param=token.ReplaceAll("config=", "");
          Int_t error=0;
-         gROOT->Macro(param.Data(), &error);
-         if (error==0) {
-           SetStatusFlags(kConfigurationLoaded);
+         if (token.EndsWith(".xml", TString::kIgnoreCase)) {
+           Int_t filesize = 0;
+           AliHLTOnlineConfiguration conf;
+           filesize = conf.LoadConfiguration(param.Data());
+           if (filesize <= 0) {
+             HLTError("can not load config \'%s\'", param.Data());
+             iResult=-EBADF;
+           } else {
+             error = conf.Parse();
+             if (error==0) {
+               fChains = conf.GetDefaultChains();
+               libs = conf.GetComponentLibraries();
+               libs += " ";
+               SetStatusFlags(kConfigurationLoaded);
+             } else {
+               HLTError("can not parse config \'%s\'", param.Data());
+               iResult=-EBADF;
+             }
+           }
          } else {
-           HLTError("can not execute macro \'%s\'", param.Data());
-           iResult=-EBADF;
-         }
+           gROOT->Macro(param.Data(), &error);
+           if (error==0) {
+             SetStatusFlags(kConfigurationLoaded);
+           } else {
+             HLTError("can not execute macro \'%s\'", param.Data());
+             iResult=-EBADF;
+           }
+         }     
        } else if (token.Contains("chains=")) {
          TString param=token.ReplaceAll("chains=", "");
          fChains=param.ReplaceAll(",", " ");
@@ -1206,6 +1231,13 @@ int AliHLTSystem::ScanOptions(const char* options)
          }
        } else if (token.BeginsWith("ECS=")) {
          fECSParams=token.ReplaceAll("ECS=", "");
+       } else if (token.BeginsWith("hltout-mode=")) {
+         // The actual parameter for argument 'hltout-mode' is treated in AliSimulation.
+         // For AliHLTSystem the occurrence with parameter 'split' signals the use of the
+         // separated HLTOUTComponents for digit and raw data. All others indicate
+         // HLTOUTComponent type 'global' where the data generation is steered from global
+         // flags
+         fUseHLTOUTComponentTypeGlobal=token.CompareTo("hltout-mode=split")==1;
        } else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
          libs+=token;
          libs+=" ";
@@ -1416,7 +1448,19 @@ int AliHLTSystem::BuildTaskListsFromReconstructionChains(AliRawReader* rawReader
       // add the HLTOUT component
       if (fpComponentHandler->FindComponentIndex("HLTOUT")>=0 ||
          fpComponentHandler->LoadLibrary("libHLTsim.so")>=0) {
-       AliHLTConfiguration globalout("_globalout_", "HLTOUT", chains.Data(), NULL);
+       // for the default HLTOUTComponent type 'global' the data generation is steered
+       // by global flags from AliSimulation. This allows for emulation of the old
+       // AliHLTSimulation behavior where only one chain is run on either digits or
+       // simulated raw data and the HLT digits and raw files have been generated
+       // depending on the configuration
+       const char* HLTOUTComponentId="HLTOUT";
+       if (!fUseHLTOUTComponentTypeGlobal) {
+         // choose the type of output depending  on the availability of
+         // the raw reader
+         if (rawReader) HLTOUTComponentId="HLTOUTraw";
+         else HLTOUTComponentId="HLTOUTdigits";
+       }
+       AliHLTConfiguration globalout("_globalout_", HLTOUTComponentId, chains.Data(), NULL);
        iResult=BuildTaskList("_globalout_");
       } else {
        HLTError("can not load libHLTsim.so and HLTOUT component");