added libHLTsim and libHLTrec
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Oct 2007 13:11:12 +0000 (13:11 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Oct 2007 13:11:12 +0000 (13:11 +0000)
HLT/Makefile.am
HLT/configure.ac
HLT/libHLTrec.pkg [new file with mode: 0644]
HLT/libHLTsim.pkg [new file with mode: 0644]
HLT/sim/AliHLTSimulation.cxx [new file with mode: 0644]
HLT/sim/AliHLTSimulation.h [new file with mode: 0644]

index 43203a40a1dcc4328226c0ecc6a0c9de08b51368..bece5f19d3ff31e5c6c1400a5586b4db5a2ea22e 100644 (file)
@@ -23,6 +23,8 @@ MUON_DIR=MUON
 endif
 
 SUBDIRS                = BASE \
+                         sim \
+                         rec \
                          $(SAMPLE_DIR) \
                          $(TPC_DIR) \
                          $(PHOS_DIR) \
@@ -32,6 +34,9 @@ SUBDIRS               = BASE \
 
 EXTRA_DIST             = libHLTbase.pkg \
                          libHLTinterface.pkg \
+                         libHLTsim.pkg \
+                         libHLTrec.pkg \
+                         libAliHLTHOMER.pkg \
                          libAliHLTUtil.pkg \
                          libAliHLTSample.pkg \
                          libAliHLTPHOS.pkg \
index e74194a6705e3fb80d503f014fb131147f551a60..5ea004c1edf83f1d99101e1c4f9c65a4f27f0244 100644 (file)
@@ -708,6 +708,8 @@ AC_CONFIG_FILES([Makefile
                 BASE/HOMER/Makefile
                 BASE/util/Makefile
                 BASE/interface/Makefile
+                sim/Makefile
+                rec/Makefile
                 SampleLib/Makefile
                 TPCLib/Makefile
                 TPCLib/mapping2array.cxx
diff --git a/HLT/libHLTrec.pkg b/HLT/libHLTrec.pkg
new file mode 100644 (file)
index 0000000..c22840e
--- /dev/null
@@ -0,0 +1,27 @@
+#-*- Mode: Makefile -*-
+# $Id$
+
+include $(MODDIR)/hlt.conf
+
+LIBHLTREC_VERSION := 0
+
+MODULE_SRCS:=  AliHLTReconstructor.cxx
+
+CLASS_HDRS:=   $(MODULE_SRCS:.cxx=.h)
+
+MODULE_HDRS:=  $(CLASS_HDRS)
+
+MODULE_DHDR:=          
+
+SRCS:=$(patsubst %,rec/%,$(MODULE_SRCS))
+CINTHDRS:=$(patsubst %,rec/%,$(CLASS_HDRS))
+HDRS:=$(patsubst %,rec/%,$(MODULE_HDRS))
+DHDR:=$(patsubst %,rec/%,$(MODULE_DHDR))
+CINTAUTOLINK:= $(shell test "x$(MODULE_DHDR)" = "x" && echo 1)
+
+EDEFINE      := ${HLTDEFS}
+PACKCXXFLAGS := ${HLTCXXFLAGS} -DLIBHLTREC_VERSION=$(LIBHLTREC_VERSION)
+PACKCFLAGS   := ${HLTCLFAGS}
+PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
+
+EINCLUDE := HLT/rec HLT/BASE STEER
diff --git a/HLT/libHLTsim.pkg b/HLT/libHLTsim.pkg
new file mode 100644 (file)
index 0000000..7f0c6a3
--- /dev/null
@@ -0,0 +1,27 @@
+#-*- Mode: Makefile -*-
+# $Id$
+
+include $(MODDIR)/hlt.conf
+
+LIBHLTSIM_VERSION := 0
+
+MODULE_SRCS=   AliHLTSimulation.cxx
+
+CLASS_HDRS:=   $(MODULE_SRCS:.cxx=.h)
+
+MODULE_HDRS:=  $(CLASS_HDRS)
+
+MODULE_DHDR:=          
+
+SRCS:=$(patsubst %,sim/%,$(MODULE_SRCS))
+CINTHDRS:=$(patsubst %,sim/%,$(CLASS_HDRS))
+HDRS:=$(patsubst %,sim/%,$(MODULE_HDRS))
+DHDR:=$(patsubst %,sim/%,$(MODULE_DHDR))
+CINTAUTOLINK:= $(shell test "x$(MODULE_DHDR)" = "x" && echo 1)
+
+EDEFINE      := ${HLTDEFS}
+PACKCXXFLAGS := ${HLTCXXFLAGS} -DLIBHLTSIM_VERSION=$(LIBHLTSIM_VERSION)
+PACKCFLAGS   := ${HLTCLFAGS}
+PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
+
+EINCLUDE := HLT/sim HLT/BASE STEER
diff --git a/HLT/sim/AliHLTSimulation.cxx b/HLT/sim/AliHLTSimulation.cxx
new file mode 100644 (file)
index 0000000..cc1cb10
--- /dev/null
@@ -0,0 +1,159 @@
+// $Id$
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLTSimulation.cxx
+    @author Matthias Richter
+    @date   
+    @brief  Binding class for HLT simulation in AliRoot. */
+
+#include <cassert>
+#include <cerrno>
+#include "AliHLTSimulation.h"
+#include "AliLog.h"
+#include "AliRunLoader.h"
+#include "AliHLTSystem.h"
+
+#if ALIHLTSIMULATION_LIBRARY_VERSION != LIBHLTSIM_VERSION
+#error library version in header file and lib*.pkg do not match
+#endif
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTSimulation);
+
+AliHLTSimulation::AliHLTSimulation()
+  :
+  fOptions(),
+  fpSystem(NULL)
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTSimulation::~AliHLTSimulation()
+{
+  // see header file for function documentation
+  if (fpSystem) {
+    delete fpSystem;
+  }
+  fpSystem=NULL;
+}
+
+AliHLTSimulation* AliHLTSimulation::CreateInstance()
+{
+  // see header file for function documentation
+  return new AliHLTSimulation;
+}
+
+int AliHLTSimulation::DeleteInstance(AliHLTSimulation* pSim)
+{
+  // see header file for function documentation
+  assert(pSim!=NULL);
+  delete pSim;
+  return 0;
+}
+
+int AliHLTSimulation::Init(AliRunLoader* pRunLoader, const char* options)
+{
+  // init the simulation
+  fOptions=options;
+
+  if (!fpSystem) fpSystem=new AliHLTSystem;
+  if (!fpSystem) {
+    AliError("can not create AliHLTSystem object");
+    return -ENOMEM;
+  }
+  if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+    AliError("HLT system in error state");
+    return -EFAULT;
+  }
+
+  if (fpSystem->ScanOptions(options)<0) {
+    AliError("error setting options for HLT system");
+    return -EINVAL;    
+  }
+
+  if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
+    if ((fpSystem->Configure(pRunLoader))<0) {
+      AliError("error during HLT system configuration");
+      return -EFAULT;
+    }
+  }
+
+  return 0;
+}
+
+
+int AliHLTSimulation::Run(AliRunLoader* pRunLoader)
+{
+  // HLT reconstruction for simulated data  
+  if(!pRunLoader) {
+    AliError("Missing RunLoader! 0x0");
+    return -EINVAL;
+  }
+
+  Int_t nEvents = pRunLoader->GetNumberOfEvents();
+  int iResult=0;
+
+  if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
+    AliError("HLT system in error state");
+    return -EFAULT;
+  }
+  if ((iResult=fpSystem->Reconstruct(nEvents, pRunLoader, NULL))>=0) {
+  }
+  return iResult;
+}
+
+
+AliHLTSimulation* AliHLTSimulationCreateInstance()
+{
+  // see header file for function documentation
+  return AliHLTSimulation::CreateInstance();
+}
+
+int AliHLTSimulationDeleteInstance(AliHLTSimulation* pSim)
+{
+  // see header file for function documentation
+  return AliHLTSimulation::DeleteInstance(pSim);
+}
+
+int AliHLTSimulationInit(AliHLTSimulation* pSim, AliRunLoader* pRunLoader, const char* options)
+{
+  assert(pSim!=NULL);
+  if (pSim) {
+    return pSim->Init(pRunLoader, options);
+  }
+  return -ENODEV;
+}
+
+int AliHLTSimulationRun(AliHLTSimulation* pSim, AliRunLoader* pRunLoader)
+{
+  assert(pSim!=NULL);
+  if (pSim) {
+    return pSim->Run(pRunLoader);
+  }
+  return -ENODEV;
+}
+
+int AliHLTSimulationGetLibraryVersion()
+{
+  // see header file for function documentation
+  return LIBHLTSIM_VERSION;
+}
diff --git a/HLT/sim/AliHLTSimulation.h b/HLT/sim/AliHLTSimulation.h
new file mode 100644 (file)
index 0000000..8766f0a
--- /dev/null
@@ -0,0 +1,109 @@
+//-*- Mode: C++ -*-
+// @(#) $Id$
+
+#ifndef ALIHLTSIMULATION_H
+#define ALIHLTSIMULATION_H
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTSimulation.h
+    @author Matthias Richter
+    @date   
+    @brief  Binding class for HLT simulation in AliRoot
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+                                                                          */
+/**
+ * @defgroup alihlt_simulation HLT simulation in AliRoot
+ * This section describes the the simulation of the HLT in AliRoot.
+ */
+
+#include "TObject.h"
+#include "TString.h"
+class AliRunLoader;
+class AliHLTSystem;
+
+/**
+ * @class AliHLTSimulation
+ * Base class of HLT data processing simulations.
+ */
+class AliHLTSimulation : public TObject {
+ public:
+  /** create an instance of the class */
+  static AliHLTSimulation* CreateInstance();
+
+  /** delete an instance */
+  static int DeleteInstance(AliHLTSimulation* pSim);
+
+  /** init simulation */
+  int Init(AliRunLoader* pRunLoader, const char* options);
+
+  /** run simulation with an instance of the run loader */
+  int Run(AliRunLoader* pRunLoader);
+
+ private:
+  /** standard constructor */
+  AliHLTSimulation();
+  /** copy constructor prohibited */
+  AliHLTSimulation(const AliHLTSimulation&);
+  /** assignment operator prohibited */
+  AliHLTSimulation& operator=(const AliHLTSimulation&);
+  /** standard destructor */
+  ~AliHLTSimulation();
+
+  /* current options */
+  TString fOptions;                                                   //!transient
+
+  /*  HLT steering object */
+  AliHLTSystem* fpSystem;                                             //!transient
+
+  ClassDef(AliHLTSimulation, 0)
+};
+
+#define ALIHLTSIMULATION_LIBRARY             "libHLTsim.so"
+#define ALIHLTSIMULATION_LIBRARY_VERSION     0
+#define ALIHLTSIMULATION_CREATE_INSTANCE     "AliHLTSimulationCreateInstance"
+#define ALIHLTSIMULATION_DELETE_INSTANCE     "AliHLTSimulationDeleteInstance"
+#define ALIHLTSIMULATION_INIT                "AliHLTSimulationInit"
+#define ALIHLTSIMULATION_RUN                 "AliHLTSimulationRun"
+#define ALIHLTSIMULATION_GET_LIBRARY_VERSION "AliHLTSimulationGetLibraryVersion"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+  typedef AliHLTSimulation* (*AliHLTSimulationCreateInstance_t)();
+  typedef int (*AliHLTSimulationDeleteInstance_t)(AliHLTSimulation* pSim);
+  typedef int (*AliHLTSimulationInit_t)(AliHLTSimulation* pSim, AliRunLoader* pRunLoader, const char* options);
+  typedef int (*AliHLTSimulationRun_t)(AliHLTSimulation* pSim, AliRunLoader* pRunLoader);
+  typedef int (*AliHLTSimulationGetLibraryVersion_t)();
+
+  /**
+   * Create an instance of the AliHLTSimulation class
+   */
+  AliHLTSimulation* AliHLTSimulationCreateInstance();
+  /**
+   * Delete an instance of the AliHLTSimulation class
+   */
+  int AliHLTSimulationDeleteInstance(AliHLTSimulation* pSim);
+  /**
+   * Set options for an instance
+   */
+  int AliHLTSimulationInit(AliHLTSimulation* pSim, AliRunLoader* pRunLoader, const char* options);
+  /**
+   * Run simulation for an instance and run loader
+   */
+  int AliHLTSimulationRun(AliHLTSimulation* pSim, AliRunLoader* pRunLoader);
+  /**
+   * Get version no of the library/class interface
+   */
+  int AliHLTSimulationGetLibraryVersion();
+#ifdef __cplusplus
+}
+#endif
+
+#endif