From 4cbaf07b8f735c347ed2512c9493d0188d09f410 Mon Sep 17 00:00:00 2001 From: richterm Date: Thu, 4 Oct 2007 13:11:12 +0000 Subject: [PATCH] added libHLTsim and libHLTrec --- HLT/Makefile.am | 5 ++ HLT/configure.ac | 2 + HLT/libHLTrec.pkg | 27 ++++++ HLT/libHLTsim.pkg | 27 ++++++ HLT/sim/AliHLTSimulation.cxx | 159 +++++++++++++++++++++++++++++++++++ HLT/sim/AliHLTSimulation.h | 109 ++++++++++++++++++++++++ 6 files changed, 329 insertions(+) create mode 100644 HLT/libHLTrec.pkg create mode 100644 HLT/libHLTsim.pkg create mode 100644 HLT/sim/AliHLTSimulation.cxx create mode 100644 HLT/sim/AliHLTSimulation.h diff --git a/HLT/Makefile.am b/HLT/Makefile.am index 43203a40a1d..bece5f19d3f 100644 --- a/HLT/Makefile.am +++ b/HLT/Makefile.am @@ -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 \ diff --git a/HLT/configure.ac b/HLT/configure.ac index e74194a6705..5ea004c1edf 100644 --- a/HLT/configure.ac +++ b/HLT/configure.ac @@ -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 index 00000000000..c22840e1dbe --- /dev/null +++ b/HLT/libHLTrec.pkg @@ -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 index 00000000000..7f0c6a3a3f9 --- /dev/null +++ b/HLT/libHLTsim.pkg @@ -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 index 00000000000..cc1cb1072cf --- /dev/null +++ b/HLT/sim/AliHLTSimulation.cxx @@ -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 * + * 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 +#include +#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 index 00000000000..8766f0a7774 --- /dev/null +++ b/HLT/sim/AliHLTSimulation.h @@ -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 -- 2.43.0