--- /dev/null
+// $Id$
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// class for HLT reconstruction //
+// <Cvetan.Cheshkov@cern.ch> //
+// <loizides@ikf.uni-frankfurt.de> //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TSystem.h>
+#include <TObjString.h>
+#include "AliHLTReconstructor.h"
+#include "AliLog.h"
+#include "AliHLTSystem.h"
+
+ClassImp(AliHLTReconstructor)
+
+AliHLTReconstructor::AliHLTReconstructor()
+ :
+ AliReconstructor(),
+ fpSystem(NULL)
+{
+ //constructor
+}
+
+AliHLTReconstructor::~AliHLTReconstructor()
+{
+ //destructor
+ if (fpSystem) {
+ delete fpSystem;
+ }
+ fpSystem=NULL;
+}
+
+void AliHLTReconstructor::Init()
+{
+ // init the reconstructor
+ if (!fpSystem) fpSystem=new AliHLTSystem;
+ if (!fpSystem) {
+ AliError("can not create AliHLTSystem object");
+ return;
+ }
+ if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+ AliError("HLT system in error state");
+ return;
+ }
+
+ // 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.
+ TString libs("");
+ TString option = GetOption();
+ TObjArray* pTokens=option.Tokenize(" ");
+ option="";
+ if (pTokens) {
+ int iEntries=pTokens->GetEntries();
+ for (int i=0; i<iEntries; i++) {
+ TString token=(((TObjString*)pTokens->At(i))->GetString());
+ if (token.Contains("loglevel=")) {
+ TString param=token.ReplaceAll("loglevel=", "");
+ if (param.IsDigit()) {
+ fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)param.Atoi());
+ } else if (param.BeginsWith("0x") &&
+ param.Replace(0,2,"",0).IsHex()) {
+ int severity=0;
+ sscanf(param.Data(),"%x", &severity);
+ fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)severity);
+ } else {
+ AliWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
+ }
+ } else if (token.Contains("alilog=off")) {
+ fpSystem->SwitchAliLog(0);
+ } else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
+ libs+=token;
+ libs+=" ";
+ } else {
+ if (option.Length()>0) option+=" ";
+ option+=token;
+ }
+ }
+ delete pTokens;
+ }
+
+ if (!libs.IsNull() &&
+ (!fpSystem->CheckStatus(AliHLTSystem::kLibrariesLoaded)) &&
+ (fpSystem->LoadComponentLibraries(libs.Data())<0)) {
+ AliError("error while loading HLT libraries");
+ return;
+ }
+
+ if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
+ typedef int (*AliHLTSystemSetOptions)(AliHLTSystem* pInstance, const char* options);
+ gSystem->Load("libHLTinterface.so");
+ AliHLTSystemSetOptions pFunc=(AliHLTSystemSetOptions)(gSystem->DynFindSymbol("libHLTinterface.so", "AliHLTSystemSetOptions"));
+ if (pFunc) {
+ if ((pFunc)(fpSystem, option.Data())<0) {
+ AliError("error setting options for HLT system");
+ return;
+ }
+ } else if (option.Length()>0) {
+ AliError(Form("version of HLT system does not support the options \'%s\'", option.Data()));
+ return;
+ }
+ if ((fpSystem->Configure())<0) {
+ AliError("error during HLT system configuration");
+ return;
+ }
+ }
+}
+
+void AliHLTReconstructor::Reconstruct(AliRawReader* /*rawReader*/, TTree* /*clustersTree*/) const
+{
+ // reconstruction of real data without writing of ESD
+
+ // all reconstruction has been moved to FillESD
+// int iResult=0;
+// if (fpSystem) {
+// if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+// AliError("HLT system in error state");
+// return;
+// }
+// if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
+// }
+// }
+}
+
+void AliHLTReconstructor::FillESD(AliRawReader* rawReader, TTree* /*clustersTree*/,
+ AliESDEvent* esd) const
+{
+ // reconstruct real data and fill ESD
+ int iResult=0;
+ if (fpSystem) {
+ if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+ AliError("HLT system in error state");
+ return;
+ }
+ if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
+ AliError("HLT system in wrong state");
+ return;
+ }
+ if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
+ fpSystem->FillESD(-1, NULL, esd);
+ }
+ }
+}
--- /dev/null
+// @(#) $Id$
+
+#ifndef ALIHLTRECONSTRUCTOR_H
+#define ALIHLTRECONSTRUCTOR_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+#include "AliReconstructor.h"
+
+class AliHLTSystem;
+class AliRawReader;
+class AliESDEvent;
+
+/**
+ * @class AliHLTReconstructor
+ * AliHLTReconstructor AliRoot event reconstruction plugin for the HLT.
+ * The AliHLTReconstructor holds an instance of the @ref AliHLTSystem
+ * steering class. The actual reconstruction depends on the loaded component
+ * libraries. Each library must implement a module agent (@ref AliHLTModuleAgent)
+ * in order to provide information on the supported features and the
+ * configurations to be run.
+ *
+ * The default component libraries which are loaded through the initialization
+ * are determined by the @ref kHLTDefaultLibs array. The library loading can
+ * be overridden by an option to the AliHLTReconstructor through the
+ * <tt>SetOption</tt> method of <tt>AliReconstruction</tt>, e.g.
+ * <pre>
+ * AliReconstruction rec;
+ * rec.SetOption("HLT", "libAliHLTSample.so");
+ * </pre>
+ * will only load <tt>libAliHLTSample.so</tt>
+ *
+ * Optional arguments:<br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ * \li loglevel=<i>level</i><br>
+ * level can be a hex number encoding the @ref AliHLTComponentLogSeverity
+ * \li alilog=off <br>
+ * disables the logging of HLT log messages through <tt>AliLog</tt> <br>
+ *
+ * For further information on the AliRoot reconstruction refer to the AliRoot
+ * documentation, namely <tt>AliReconstruction</tt>.
+ */
+class AliHLTReconstructor: public AliReconstructor {
+public:
+ AliHLTReconstructor();
+ /** destructor */
+ virtual ~AliHLTReconstructor();
+
+ /** init the reconstructor */
+ void Init();
+
+ /**
+ * This Reconstructor function is not applicable for the AliHLTReconstructor
+ * as it gets a detector specific digits tree. But HLT processes all detectors.
+ * Furthermore it's purely simulated data.
+ */
+ void Reconstruct(TTree* digitsTree, TTree* clustersTree) const{
+ AliReconstructor::Reconstruct(digitsTree,clustersTree);
+ }
+
+ /**
+ * Reconstruction from RAW data.
+ * The rawReader holds data for all detectors and this version of Reconstruct
+ * is thus applicable for the HLT. The clustersTree is just ignored.
+ */
+ void Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const;
+
+ /**
+ * This function is purely for simulated data and not applicable for HLT.
+ * HLT reconstruction on simulated data is processed at the end of
+ * simulation.
+ */
+ void FillESD(TTree* digitsTree, TTree* clustersTree, AliESDEvent* esd) const {
+ AliReconstructor::FillESD(digitsTree,clustersTree,esd);
+ }
+
+ /**
+ * Fill the ESD from RAW data.
+ * This is the main entry for HLT reconstruction of RAW data. It performs both
+ * the analysis by the defined chains and the filling of the ESD.
+ */
+ void FillESD(AliRawReader* rawReader, TTree* clustersTree, AliESDEvent* esd) const;
+
+private:
+ /** copy constructor prohibited */
+ AliHLTReconstructor(const AliHLTReconstructor& src);
+ /** assignment operator prohibited */
+ AliHLTReconstructor& operator=(const AliHLTReconstructor& src);
+
+ AliHLTSystem* fpSystem; //! HLT steering object
+
+ ClassDef(AliHLTReconstructor, 3) // class for the HLT reconstruction
+};
+
+typedef AliHLTReconstructor AliL3Reconstructor; // for backward compatibility
+
+#endif