From 33daad3dbd620fdb6a2da10852226d20d58eb790 Mon Sep 17 00:00:00 2001 From: jthaeder Date: Wed, 11 Mar 2009 12:35:03 +0000 Subject: [PATCH] First Checkin for JET library in the HLT * so far only in aliroot build system * classes are dummies --- HLT/JET/AliHLTJETAgent.cxx | 221 ++++++++++++++++++++++++ HLT/JET/AliHLTJETAgent.h | 167 ++++++++++++++++++ HLT/JET/AliHLTJETConeJetComponent.cxx | 240 ++++++++++++++++++++++++++ HLT/JET/AliHLTJETConeJetComponent.h | 136 +++++++++++++++ HLT/JET/AliHLTJETFastJetComponent.cxx | 233 +++++++++++++++++++++++++ HLT/JET/AliHLTJETFastJetComponent.h | 142 +++++++++++++++ HLT/JET/Makefile.am | 75 ++++++++ HLT/JET/jet.conf | 14 ++ HLT/JET/macros/HLTJetReconstruction.C | 68 ++++++++ HLT/Makefile.am | 6 + HLT/configure.ac | 58 +++++++ HLT/libAliHLTJET.pkg | 55 ++++++ 12 files changed, 1415 insertions(+) create mode 100644 HLT/JET/AliHLTJETAgent.cxx create mode 100644 HLT/JET/AliHLTJETAgent.h create mode 100644 HLT/JET/AliHLTJETConeJetComponent.cxx create mode 100644 HLT/JET/AliHLTJETConeJetComponent.h create mode 100644 HLT/JET/AliHLTJETFastJetComponent.cxx create mode 100644 HLT/JET/AliHLTJETFastJetComponent.h create mode 100644 HLT/JET/Makefile.am create mode 100644 HLT/JET/jet.conf create mode 100644 HLT/JET/macros/HLTJetReconstruction.C create mode 100644 HLT/libAliHLTJET.pkg diff --git a/HLT/JET/AliHLTJETAgent.cxx b/HLT/JET/AliHLTJETAgent.cxx new file mode 100644 index 00000000000..d43d8169669 --- /dev/null +++ b/HLT/JET/AliHLTJETAgent.cxx @@ -0,0 +1,221 @@ +//-*- Mode: C++ -*- + +// $Id: AliHLTJETAgent.cxx $ + +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: Jochen Thaeder * +//* 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 AliHLTJETAgent.cxx + @author Jochen Thaeder + @date 13.02.2009 + @brief Agent of the libAliHLTJET library +*/ + +#include +#include "AliHLTJETAgent.h" +#include "AliHLTConfiguration.h" +#include "AliHLTOUT.h" + +// component header file +#include "AliHLTJETConeJetComponent.h" + +#ifdef HAVE_FASTJET +#include "AliHLTJETFastJetComponent.h" +#endif + + + +/** global instance for agent registration */ +AliHLTJETAgent gAliHLTJETAgent; + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTJETAgent) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +AliHLTJETAgent::AliHLTJETAgent() + : + AliHLTModuleAgent("JET"), + fRawDataHandler(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 +} + +// ################################################################################# +AliHLTJETAgent::~AliHLTJETAgent() { + // see header file for class documentation +} + +/* + * --------------------------------------------------------------------------------- + * + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/, + AliRawReader* /*rawReader*/, + AliRunLoader* /*runloader*/) const { + // see header file for class documentation + return 0; +} + +// ################################################################################# +const Char_t* AliHLTJETAgent::GetReconstructionChains(AliRawReader* /*rawReader*/, + AliRunLoader* /*runloader*/) const { + // see header file for class documentation + + return ""; +} + +// ################################################################################# +const Char_t* AliHLTJETAgent::GetRequiredComponentLibraries() const { + // see header file for class documentation + return ""; +} + +// ################################################################################# +Int_t AliHLTJETAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const { + // see header file for class documentation + + assert(pHandler); + if (!pHandler) return -EINVAL; + + pHandler->AddComponent(new AliHLTJETConeJetComponent); +#ifdef HAVE_FASTJET + pHandler->AddComponent(new AliHLTJETFastJetComponent); +#endif + + return 0; +} + +/* + * --------------------------------------------------------------------------------- + * + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +AliHLTModulePreprocessor* AliHLTJETAgent::GetPreprocessor() { + // see header file for class documentation + return NULL; +} + +/* + * --------------------------------------------------------------------------------- + * + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/, + AliHLTUInt32_t /*spec*/, + AliHLTOUTHandlerDesc& /*desc*/) const { + // see header file for class documentation + + // Handlers for JET data. + /* + if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD)) { + desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId()); + HLTInfo("module %s handles data block type %s specification %d (0x%x)", + GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec); + return 1; + } + */ + return 0; +} + +// ################################################################################# +AliHLTOUTHandler* AliHLTJETAgent::GetOutputHandler(AliHLTComponentDataType /*dt*/, + AliHLTUInt32_t /*spec*/) { + /* + // see header file for class documentation + if (dt==(kAliHLTDataTypeJet|kAliHLTDataOriginANY)) { + // use the default handler + if (!fRawDataHandler) { + fRawDataHandler=new AliHLTOUTSDDRawDataHandler; + } + return fRawDataHandler; + } + */ + return NULL; +} + +// ################################################################################# +Int_t AliHLTJETAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance) { + // see header file for class documentation + if (pInstance==NULL) return -EINVAL; + + /** + if (pInstance==fRawDataHandler) { + delete fRawDataHandler; + fRawDataHandler=NULL; + return 0; + } + + delete pInstance; + */ + return 0; +} + +/* +int AliHLTJETAgent::AliHLTOUTSDDRawDataHandler::ProcessData(AliHLTOUT* pData) +{ + // see header file for class documentation + if (!pData) return -EINVAL; + static int errorCount=0; + const int maxErrorCount=10; + AliHLTComponentDataType dt=kAliHLTVoidDataType; + AliHLTUInt32_t spec=kAliHLTVoidDataSpec; + int iResult=pData->GetDataBlockDescription(dt, spec); + if (iResult>=0) { + if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD)) { + int ddlOffset=256;//AliDAQ::DdlIDOffset("JETSDD"); + int numberOfDDLs=24;//AliDAQ::NumberOfDdls("JETSDD"); + int ddlNo=0; + for (;ddlNo<32 && ddlNo=32 || ddlNo>=numberOfDDLs) { + HLTError("invalid specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str()); + iResult=-ENODEV; + } else if (spec^(0x1< + * + * @ingroup alihlt_jet + */ +class AliHLTJETAgent : public AliHLTModuleAgent { + public: + + /* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + + /** + * standard constructor. The agent is automatically registered in the + * global agent manager + */ + AliHLTJETAgent(); + + /** destructor */ + virtual ~AliHLTJETAgent(); + + /* + * --------------------------------------------------------------------------------- + * + * --------------------------------------------------------------------------------- + */ + + /** + * Register all configurations belonging to the sample library with the + * AliHLTConfigurationHandler. The agent can adapt the configurations + * to be registered to the current AliRoot setup by checking the + * runloader. + * @param handler [in] the configuration handler + * @param rawReader [in] AliRoot RawReader instance + * @param runloader [in] AliRoot runloader + * @return neg. error code if failed + */ + Int_t CreateConfigurations(AliHLTConfigurationHandler* handler, + AliRawReader* rawReader=NULL, + AliRunLoader* runloader=NULL) const; + + /** + * Get the top configurations for local event reconstruction. + * A top configuration describes a processing chain. It can simply be + * described by the last configuration(s) in the chain. + * The agent can adapt the configurations to be registered to the current + * AliRoot setup by checking the runloader. + * @param rawReader [in] AliRoot RawReader instance + * @param runloader [in] AliRoot runloader + * @return string containing the top configurations separated by blanks + */ + const Char_t* GetReconstructionChains(AliRawReader* rawReader=NULL, + AliRunLoader* runloader=NULL) const; + + /** + * Component libraries which the configurations of this agent depend on. + * @return list of component libraries as a blank-separated string. + */ + const Char_t* GetRequiredComponentLibraries() const; + + /** + * Register components for the AliHLTSample library. + * @param pHandler [in] instance of the component handler + */ + Int_t RegisterComponents(AliHLTComponentHandler* pHandler) const; + + /* + * --------------------------------------------------------------------------------- + * + * --------------------------------------------------------------------------------- + */ + + /** + * + */ + AliHLTModulePreprocessor* GetPreprocessor(); + + /* + * --------------------------------------------------------------------------------- + * + * --------------------------------------------------------------------------------- + */ + + /** + * + */ + Int_t GetHandlerDescription(AliHLTComponentDataType dt, + AliHLTUInt32_t spec, + AliHLTOUTHandlerDesc& desc) const; + + /** + * + */ + AliHLTOUTHandler* GetOutputHandler(AliHLTComponentDataType dt, + AliHLTUInt32_t spec); + + /** + * + */ + Int_t DeleteOutputHandler(AliHLTOUTHandler* pInstance); + + /* + class AliHLTOUTSDDRawDataHandler: public AliHLTOUTHandlerEquId { + public: + AliHLTOUTSDDRawDataHandler() {} + ~AliHLTOUTSDDRawDataHandler() {} + int ProcessData(AliHLTOUT* pData); + private: + }; + */ + + protected: + + private: + + /* + * --------------------------------------------------------------------------------- + * Private functions to implement AliHLTComponent's interface. + * These functions provide initialization as well as the actual processing + * capabilities of the component. + * --------------------------------------------------------------------------------- + */ + + /** Copy constructor prohibited */ + AliHLTJETAgent(const AliHLTJETAgent&); + + /** Assignment operator prohibited */ + AliHLTJETAgent& operator=(const AliHLTJETAgent&); + + /* + * --------------------------------------------------------------------------------- + * Members + * --------------------------------------------------------------------------------- + */ + + /** Handler for JET data in the HLTOUT stream */ + AliHLTOUTHandlerEquId* fRawDataHandler; //!transient + + /** ROOT specific member definition */ + ClassDef(AliHLTJETAgent, 0); +}; + +#endif diff --git a/HLT/JET/AliHLTJETConeJetComponent.cxx b/HLT/JET/AliHLTJETConeJetComponent.cxx new file mode 100644 index 00000000000..205669d454a --- /dev/null +++ b/HLT/JET/AliHLTJETConeJetComponent.cxx @@ -0,0 +1,240 @@ +//-*- Mode: C++ -*- +// $Id: $ + +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: Jochen Thaeder * +//* 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 AliHLTJETConeJetComponent.cxx + @author Jochen Thaeder + @date + @brief Component to run the ConeJet jetfinder +*/ + +#if __GNUC__>= 3 +using namespace std; +#endif + +#include +#include +#include + +#include "AliHLTJETConeJetComponent.h" + +//#include "AliJetESDReader.h" +//#include "AliJetESDReaderHeader.h" + +//#include "AliJetKineReaderHeader.h" +//#include "AliJetKineReader.h" + +#include "AliCDBEntry.h" +#include "AliCDBManager.h" +#include "AliMCEvent.h" +#include "AliHeader.h" + +#include "TString.h" +#include "TObjString.h" + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTJETConeJetComponent) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +AliHLTJETConeJetComponent::AliHLTJETConeJetComponent() +//: + /* fJetFinder(NULL), + fJetHeader(NULL),*/ + // fJetReader(NULL), + // fJetReaderHeader(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 +} + +// ################################################################################# +AliHLTJETConeJetComponent::~AliHLTJETConeJetComponent() { + // see header file for class documentation +} + +/* + * --------------------------------------------------------------------------------- + * Public functions to implement AliHLTComponent's interface. + * These functions are required for the registration process + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +const Char_t* AliHLTJETConeJetComponent::GetComponentID() { + // see header file for class documentation + return "JETConeJetFinder"; +} + +// ################################################################################# +void AliHLTJETConeJetComponent::GetInputDataTypes( vector& list) { + // see header file for class documentation + list.clear(); + list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline ); + list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline ); + list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT ); +} + +// ################################################################################# +AliHLTComponentDataType AliHLTJETConeJetComponent::GetOutputDataType() { + // see header file for class documentation + return (kAliHLTDataTypeESDObject| kAliHLTDataOriginHLT); +} + +// ################################################################################# +void AliHLTJETConeJetComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) { + // see header file for class documentation + + constBase = 0; + inputMultiplier = 0.3; +} + +// ################################################################################# +AliHLTComponent* AliHLTJETConeJetComponent::Spawn() { + // see header file for class documentation + return new AliHLTJETConeJetComponent(); +} + +/* + * --------------------------------------------------------------------------------- + * Protected functions to implement AliHLTComponent's interface. + * These functions provide initialization as well as the actual processing + * capabilities of the component. + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETConeJetComponent::DoInit( Int_t /*argc*/, const Char_t** /*argv*/ ) { + // see header file for class documentation + + // if ( fJetFinder || fJetReader || fJetHeader || fJetReader ) + // if ( fJetHeader || fJetReader ) + // return EINPROGRESS; + +#ifdef HAVE_FASTJET + printf("HAVE FASTJET"); +#else + printf("NO FASTJET"); +#endif + + /* +#if 1 + fJetReaderHeader = new AliJetKineReaderHeader(); + fJetReaderHeader->SetComment("MC full Kinematics"); + fJetReaderHeader->SetFastSimTPC(kFALSE); + fJetReaderHeader->SetFastSimEMCAL(kFALSE); + fJetReaderHeader->SetPtCut(0.); + + // Define reader and set its header + fJetReader = new AliJetKineReader(); + fJetReader->SetReaderHeader(fJetReaderHeader); + +#else + fJetReaderHeader = new AliJetESDReaderHeader(); + fJetReaderHeader->SetComment("Testing"); + fJetReaderHeader->SetFirstEvent(0); + fJetReaderHeader->SetLastEvent(4); + + fJetReader = new AliJetESDReader(); + fJetReader->SetReaderHeader(fJetReaderHeader); +#endif + + */ + /* + fJetHeader = new AliConeJetHeader(); + fJetHeader->SetRparam(0.7); + + fJetFinder = new AliConeJetFinder(); + fJetFinder->SetJetHeader(fJetHeader); + fJetFinder->SetJetReader(fJetReader); + fJetFinder->SetOutputFile("jets.root"); + */ + return 0; +} + +// ################################################################################# +Int_t AliHLTJETConeJetComponent::DoDeinit() { + // see header file for class documentation + + /* + if ( fJetFinder ) + delete fJetFinder; + fJetFinder = NULL; + + if ( fJetHeader ) + delete fJetHeader; + fJetHeader = NULL; + */ + /* + if ( fJetReader ) + delete fJetReader; + fJetReader = NULL; + + if ( fJetReaderHeader ) + delete fJetReaderHeader; + fJetReaderHeader = NULL; + */ + return 0; +} + +// ################################################################################# +Int_t AliHLTJETConeJetComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, + AliHLTComponentTriggerData& /*trigData*/ ) { + // see header file for class documentation + + const TObject* iter = NULL; + + for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline); iter != NULL; iter=GetNextInputObject() ) { + + // ADD MC Object + + AliMCEvent* foo = ( AliMCEvent* ) iter; + cout << foo->GetNumberOfTracks() << " -- " + << foo->Stack() << " -- " + << foo->Header()->Stack() << " -- " + << foo->Header() << endl; + + printf (" --- MC --- \n"); + } + + for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline); iter != NULL; iter=GetNextInputObject() ) { + // ADD ESD Object -- Offline + + printf (" --- ESD-Offline --- \n"); + } + + for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); iter != NULL; iter=GetNextInputObject() ) { + // ADD ESD Object -- HLT + printf (" --- ESD-HLT --- \n"); + } + + + // ** PushBack ** \\ + // ----------- ** \\ + // ** PushBack ** \\ + + return 0; +} diff --git a/HLT/JET/AliHLTJETConeJetComponent.h b/HLT/JET/AliHLTJETConeJetComponent.h new file mode 100644 index 00000000000..f2bb69dfc93 --- /dev/null +++ b/HLT/JET/AliHLTJETConeJetComponent.h @@ -0,0 +1,136 @@ +//-*- Mode: C++ -*- + +// $Id: AliHLTJETConeJetComponent.h $ + +#ifndef ALIHLTJETCONEJETCOMPONENT_H +#define ALIHLTJETCONEJETCOMPONENT_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 AliHLTJETConeJetComponent.h + @author Jochen Thaeder + @date + @brief Component to run the ConeJet jetfinder +*/ + +#include "AliHLTProcessor.h" + +/** + * @class AliHLTJETConeJetComponent + * Component to run the ConeJet jetfinder + * + * @ingroup alihlt_jet + */ + +class AliHLTJETConeJetComponent : public AliHLTProcessor { +public: + + /* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + + /** constructor */ + AliHLTJETConeJetComponent(); + + /** destructor */ + virtual ~AliHLTJETConeJetComponent(); + + /* + * --------------------------------------------------------------------------------- + * Public functions to implement AliHLTComponent's interface. + * These functions are required for the registration process + * --------------------------------------------------------------------------------- + */ + + /** interface function, see @ref AliHLTComponent for description */ + const Char_t* GetComponentID(); + + /** interface function, see @ref AliHLTComponent for description */ + void GetInputDataTypes( vector& list); + + /** interface function, see @ref AliHLTComponent for description */ + AliHLTComponentDataType GetOutputDataType(); + + /** interface function, see @ref AliHLTComponent for description */ + virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); + + /** interface function, see @ref AliHLTComponent for description */ + AliHLTComponent* Spawn(); + +protected: + + /* + * --------------------------------------------------------------------------------- + * Protected functions to implement AliHLTComponent's interface. + * These functions provide initialization as well as the actual processing + * capabilities of the component. + * --------------------------------------------------------------------------------- + */ + + /** Initialization + * Overwrites the AliHLTProcessor::DoInit() method. + * @param argc size of the argument array + * @param argv agument array for component initialization + * @return number of processed members of the argv
+ * -EINVAL unknown argument
+ * -EPROTO parameter for argument missing + */ + Int_t DoInit( Int_t argc, const Char_t** argv ); + + /** DeInitialization + * Calls also the one of AliHLTProcessor. + */ + Int_t DoDeinit(); + + /** EventLoop + * Data processing method for the component. + * The component uses the @ref alihltcomponent-high-level-interface + * to retrieve and put serialized Root object into the output stream. + * @param evtData event data structure + * @param trigData trigger data structure + * @return + */ + Int_t DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ); + + using AliHLTProcessor::DoEvent; + + /////////////////////////////////////////////////////////////////////////////////// + +private: + /* + * --------------------------------------------------------------------------------- + * Private functions to implement AliHLTComponent's interface. + * These functions provide initialization as well as the actual processing + * capabilities of the component. + * --------------------------------------------------------------------------------- + */ + + /** copy constructor prohibited */ + AliHLTJETConeJetComponent(const AliHLTJETConeJetComponent&); + + /** assignment operator prohibited */ + AliHLTJETConeJetComponent& operator=(const AliHLTJETConeJetComponent&); + + /* + * --------------------------------------------------------------------------------- + * Members - private + * --------------------------------------------------------------------------------- + */ + + /** pointer to the jet finder object*/ + /* AliConeJetFinder* fJetFinder; //!transient + + AliConeJetHeader* fJetHeader; //!transient + */ + // AliJetKineReader* fJetReader; //!transient + + // AliJetKineReaderHeader* fJetReaderHeader; //!transient + + ClassDef(AliHLTJETConeJetComponent, 0) + +}; +#endif diff --git a/HLT/JET/AliHLTJETFastJetComponent.cxx b/HLT/JET/AliHLTJETFastJetComponent.cxx new file mode 100644 index 00000000000..df920fa80a9 --- /dev/null +++ b/HLT/JET/AliHLTJETFastJetComponent.cxx @@ -0,0 +1,233 @@ +//-*- Mode: C++ -*- +// $Id: $ + +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: Jochen Thaeder * +//* 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 AliHLTJETFastJetComponent.cxx + @author Jochen Thaeder + @date + @brief Component to run the FastJet jetfinder +*/ + +#if __GNUC__>= 3 +using namespace std; +#endif + +#include +#include +#include + +#include "AliHLTJETFastJetComponent.h" + +//#include "AliJetESDReader.h" +//#include "AliJetESDReaderHeader.h" + +#include "AliCDBEntry.h" +#include "AliCDBManager.h" + +#include "AliMCEvent.h" +#include "AliHeader.h" + +#include "TString.h" +#include "TObjString.h" + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTJETFastJetComponent) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +AliHLTJETFastJetComponent::AliHLTJETFastJetComponent() + : + fJetFinder(NULL), + fJetHeader(NULL), + fJetReader(NULL), + fJetReaderHeader(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 +} + +// ################################################################################# +AliHLTJETFastJetComponent::~AliHLTJETFastJetComponent() { + // see header file for class documentation +} + +/* + * --------------------------------------------------------------------------------- + * Public functions to implement AliHLTComponent's interface. + * These functions are required for the registration process + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +const Char_t* AliHLTJETFastJetComponent::GetComponentID() { + // see header file for class documentation + return "JETFastJetFinder"; +} + +// ################################################################################# +void AliHLTJETFastJetComponent::GetInputDataTypes( vector& list) { + // see header file for class documentation + list.clear(); + list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline ); + list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline ); + list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT ); +} + +// ################################################################################# +AliHLTComponentDataType AliHLTJETFastJetComponent::GetOutputDataType() { + // see header file for class documentation + return (kAliHLTDataTypeESDObject| kAliHLTDataOriginHLT); +} + +// ################################################################################# +void AliHLTJETFastJetComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) { + // see header file for class documentation + + constBase = 0; + inputMultiplier = 0.3; +} + +// ################################################################################# +AliHLTComponent* AliHLTJETFastJetComponent::Spawn() { + // see header file for class documentation + return new AliHLTJETFastJetComponent(); +} + +/* + * --------------------------------------------------------------------------------- + * Protected functions to implement AliHLTComponent's interface. + * These functions provide initialization as well as the actual processing + * capabilities of the component. + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETFastJetComponent::DoInit( Int_t /*argc*/, const Char_t** /*argv*/ ) { + // see header file for class documentation + + if ( fJetFinder || fJetReader || fJetHeader || fJetReader ) + return EINPROGRESS; + +#ifdef HAVE_FASTJET + printf("HAVE FASTJET"); +#else + printf("NO FASTJET"); +#endif + +#if 1 + fJetReaderHeader = new AliJetKineReaderHeader(); + fJetReaderHeader->SetComment("MC full Kinematics"); + fJetReaderHeader->SetFastSimTPC(kFALSE); + fJetReaderHeader->SetFastSimEMCAL(kFALSE); + fJetReaderHeader->SetPtCut(0.); + + // Define reader and set its header + fJetReader = new AliJetKineReader(); + fJetReader->SetReaderHeader(fJetReaderHeader); + +#else + fJetReaderHeader = new AliJetESDReaderHeader(); + fJetReaderHeader->SetComment("Testing"); + fJetReaderHeader->SetFirstEvent(0); + fJetReaderHeader->SetLastEvent(4); + + fJetReader = new AliJetESDReader(); + fJetReader->SetReaderHeader(fJetReaderHeader); +#endif + + fJetHeader = new AliFastJetHeader(); + fJetHeader->SetRparam(0.7); + + fJetFinder = new AliFastJetFinder(); + fJetFinder->SetJetHeader(fJetHeader); + fJetFinder->SetJetReader(fJetReader); + fJetFinder->SetOutputFile("jets.root"); + + return 0; +} + +// ################################################################################# +Int_t AliHLTJETFastJetComponent::DoDeinit() { + // see header file for class documentation + + /* + if ( fJetFinder ) + delete fJetFinder; + fJetFinder = NULL; + + if ( fJetHeader ) + delete fJetHeader; + fJetHeader = NULL; + */ + /* + if ( fJetReader ) + delete fJetReader; + fJetReader = NULL; + + if ( fJetReaderHeader ) + delete fJetReaderHeader; + fJetReaderHeader = NULL; + */ + return 0; +} + +// ################################################################################# +Int_t AliHLTJETFastJetComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, + AliHLTComponentTriggerData& /*trigData*/ ) { + // see header file for class documentation + + const TObject* iter = NULL; + + for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline); iter != NULL; iter=GetNextInputObject() ) { + + // ADD MC Object + + AliMCEvent* foo = ( AliMCEvent* ) iter; + cout << foo->GetNumberOfTracks() << " -- " + << foo->Stack() << " -- " + << foo->Header()->Stack() << " -- " + << foo->Header() << endl; + + printf (" --- MC --- \n"); + } + + for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline); iter != NULL; iter=GetNextInputObject() ) { + // ADD ESD Object -- Offline + + printf (" --- ESD-Offline --- \n"); + } + + for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); iter != NULL; iter=GetNextInputObject() ) { + // ADD ESD Object -- HLT + printf (" --- ESD-HLT --- \n"); + } + + + // ** PushBack ** \\ + // ----------- ** \\ + // ** PushBack ** \\ + + return 0; +} diff --git a/HLT/JET/AliHLTJETFastJetComponent.h b/HLT/JET/AliHLTJETFastJetComponent.h new file mode 100644 index 00000000000..80f8cb06b48 --- /dev/null +++ b/HLT/JET/AliHLTJETFastJetComponent.h @@ -0,0 +1,142 @@ +//-*- Mode: C++ -*- + +// $Id: AliHLTJETFastJetComponent.h $ + +#ifndef ALIHLTJETFASTJETCOMPONENT_H +#define ALIHLTJETFASTJETCOMPONENT_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 AliHLTJETFastJetComponent.h + @author Jochen Thaeder + @date + @brief Component to run the FastJet jetfinder +*/ + +#include "AliHLTProcessor.h" + +#include "AliFastJetFinder.h" +#include "AliFastJetHeader.h" + +#include "AliJetKineReader.h" +#include "AliJetKineReaderHeader.h" + +/** + * @class AliHLTJETFastJetComponent + * Component to run the FastJet jetfinder + * + * @ingroup alihlt_jet + */ + +class AliHLTJETFastJetComponent : public AliHLTProcessor { +public: + + /* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + + /** constructor */ + AliHLTJETFastJetComponent(); + + /** destructor */ + virtual ~AliHLTJETFastJetComponent(); + + /* + * --------------------------------------------------------------------------------- + * Public functions to implement AliHLTComponent's interface. + * These functions are required for the registration process + * --------------------------------------------------------------------------------- + */ + + /** interface function, see @ref AliHLTComponent for description */ + const Char_t* GetComponentID(); + + /** interface function, see @ref AliHLTComponent for description */ + void GetInputDataTypes( vector& list); + + /** interface function, see @ref AliHLTComponent for description */ + AliHLTComponentDataType GetOutputDataType(); + + /** interface function, see @ref AliHLTComponent for description */ + virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); + + /** interface function, see @ref AliHLTComponent for description */ + AliHLTComponent* Spawn(); + +protected: + + /* + * --------------------------------------------------------------------------------- + * Protected functions to implement AliHLTComponent's interface. + * These functions provide initialization as well as the actual processing + * capabilities of the component. + * --------------------------------------------------------------------------------- + */ + + /** Initialization + * Overwrites the AliHLTProcessor::DoInit() method. + * @param argc size of the argument array + * @param argv agument array for component initialization + * @return number of processed members of the argv
+ * -EINVAL unknown argument
+ * -EPROTO parameter for argument missing + */ + Int_t DoInit( Int_t argc, const Char_t** argv ); + + /** DeInitialization + * Calls also the one of AliHLTProcessor. + */ + Int_t DoDeinit(); + + /** EventLoop + * Data processing method for the component. + * The component uses the @ref alihltcomponent-high-level-interface + * to retrieve and put serialized Root object into the output stream. + * @param evtData event data structure + * @param trigData trigger data structure + * @return + */ + Int_t DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData ); + + using AliHLTProcessor::DoEvent; + + /////////////////////////////////////////////////////////////////////////////////// + +private: + /* + * --------------------------------------------------------------------------------- + * Private functions to implement AliHLTComponent's interface. + * These functions provide initialization as well as the actual processing + * capabilities of the component. + * --------------------------------------------------------------------------------- + */ + + /** copy constructor prohibited */ + AliHLTJETFastJetComponent(const AliHLTJETFastJetComponent&); + + /** assignment operator prohibited */ + AliHLTJETFastJetComponent& operator=(const AliHLTJETFastJetComponent&); + + /* + * --------------------------------------------------------------------------------- + * Members - private + * --------------------------------------------------------------------------------- + */ + + /** pointer to the jet finder object*/ + AliFastJetFinder* fJetFinder; //!transient + + AliFastJetHeader* fJetHeader; //!transient + + AliJetKineReader* fJetReader; //!transient + + AliJetKineReaderHeader* fJetReaderHeader; //!transient + + ClassDef(AliHLTJETFastJetComponent, 0) + +}; +#endif diff --git a/HLT/JET/Makefile.am b/HLT/JET/Makefile.am new file mode 100644 index 00000000000..a038963a1a6 --- /dev/null +++ b/HLT/JET/Makefile.am @@ -0,0 +1,75 @@ +# $Id: Makefile.am $ +# Makefile for the AliHLTJET library. + +MODULE = AliHLTJET + +################################################################### + +EXTRA_DIST = + +MODDIR = $(top_srcdir) +PKGDEF = $(MODDIR)/libAliHLTJET.pkg +include $(top_srcdir)/libAliHLTJET.pkg + +################################################################### + +# library definition +lib_LTLIBRARIES = libAliHLTJET.la + +# version info for the library +LIBRARY_VERSION = '0:0:0' + +# library sources +libAliHLTJET_la_SOURCES = $(MODULE_SRCS) + +# library headers +pkginclude_HEADERS = $(MODULE_HDRS) + +################################################################### + +# compiler flags +AM_CPPFLAGS = -DMODULE=$(MODULE) \ + @HLTBASE_CPPFLAGS@ \ + @ALIROOT_CPPFLAGS@ \ + @ROOTCFLAGS@ \ + $(foreach i, $(EINCLUDE), \ + $(shell echo $(i) | sed -e "/HLT\//!d" -e "s|HLT/|-I$(top_srcdir)/|")) \ + $(foreach i, $(EINCLUDE), \ + $(shell echo $(i) | sed -e "/HLT\//d" -e "s|^|-I$(ALICE_ROOT)/|")) + +################################################################### + +# linker flags +libAliHLTJET_la_LIBADD = $(top_builddir)/BASE/util/libAliHLTUtil.la +libAliHLTJET_la_LDFLAGS = -L@ROOTLIBDIR@ \ + @ROOTLIBS@ \ + @HLTBASE_LDFLAGS@ \ + @ALIROOT_LDFLAGS@ \ + @ALIROOT_LIBS@ \ + @ALIJET_LIBS@ \ + -version-info $(LIBRARY_VERSION) + +################################################################### + +# automatic generation of data and time of library build +COMPILE_INFO = AliHLTJETCompileInfo.cxx + +# set the file name for the generated root dictionary +DICTCPP = AliHLTJET-DICT.cxx +nodist_libAliHLTJET_la_SOURCES = $(COMPILE_INFO) \ + $(DICTCPP) + +CLEANFILES = $(COMPILE_INFO) + +################################################################### + +include $(top_srcdir)/make.dict + +################################################################### + +$(COMPILE_INFO): $(libAliHLTJET_la_SOURCES) $(pkginclude_HEADERS) $(noinst_HEADERS) Makefile.am + @echo '//automatically generated compilation info' > $@ + @echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@ + @echo '//add changes in Makefile.am' >> $@ + @echo 'extern "C" void CompileInfo(const char*& date, const char*& time)' >> $@ + @echo '{date=__DATE__; time=__TIME__; return;}' >> $@ diff --git a/HLT/JET/jet.conf b/HLT/JET/jet.conf new file mode 100644 index 00000000000..6c5a8551467 --- /dev/null +++ b/HLT/JET/jet.conf @@ -0,0 +1,14 @@ +#-*- Mode: Makefile -*- +# $Id: $ + +ifneq ($(FASTJET),) + + CLASS_HDRS += $(CLASS_HDRS_FJ) + + HLTCXXFLAGS_FASTJET := -I${FASTJET}/include + HLTDEF_FASTJET := -DHAVE_FASTJET -DWITHFASTJE + HLTSOFLAGS_FASTJET := -lCGAL -L$(FASTJET)/lib -lfastjet + + CINTFLAGS += ${HLTCXXFLAGS_FASTJET} ${HLTDEF_FASTJET} + +endif diff --git a/HLT/JET/macros/HLTJetReconstruction.C b/HLT/JET/macros/HLTJetReconstruction.C new file mode 100644 index 00000000000..882cdb716e6 --- /dev/null +++ b/HLT/JET/macros/HLTJetReconstruction.C @@ -0,0 +1,68 @@ +/** + * @file HLTJetReconstruction.C + * @brief Macro for testing HLT Jet Reconstruction + * + * This macro uses the ESDMCEventPublisher to publish AliMCEvents and AliESDEvents. + * The processing is done be JetFinder's + * Results are written to disk by a rootfile writer + * + * @author thaeder@kip.uni-heidelberg.de + * @ingroup alihlt_jet + */ + +/** HLTJetReconstruction test macro + * @param nEvents Number of events which should be processed + */ +void HLTJetReconstruction(Int_t nEvents=1) { + + TString writerInput; + TString arg; + + // this is just a tool to switch the logging systems + AliHLTLogging log; + log.SwitchAliLog(1); + + AliHLTSystem gHLT; + gHLT.SetGlobalLoggingLevel(0x7F); + gHLT.LoadComponentLibraries("libAliHLTUtil.so"); + gHLT.LoadComponentLibraries("libAliHLTJET.so"); + + // - - // + // -- Publisher Components -- // + // - - // + + arg.Form("-entrytype MCFAST -dataspec 0x0000001F -datapath /home/jthaeder/jet/data/v4-16-Rev-01/FastGen/kPythia6Jets104_125_14TeV/JET-ETA=-0.2,0.2_JET-ET=50,1000_R=0.4_500ev"); + + // -- The ESDMCEventPublisher + AliHLTConfiguration ESDMCEventPublisher("ESDMCEventPublisher", "ESDMCEventPublisher", + NULL, arg.Data() ); + + if (!writerInput.IsNull()) writerInput+=" "; + writerInput+="ESDMCEventPublisher"; + + // - - // + // -- Processing Components -- // + // - - // + AliHLTConfiguration jetFinder("JETConeJet", "JETConeJetFinder", + "ESDMCEventPublisher",""); + + if (!writerInput.IsNull()) writerInput+=" "; + writerInput+="JETConeJet"; + + // - - // + // -- Sink Components -- // + // - - // + + // -- The RootFileWriter + AliHLTConfiguration rootWriter("RootWriter", "ROOTFileWriter", + writerInput.Data(), "-datafile event"); + + + // - - // + // -- Run -- // + // - - // + + gHLT.BuildTaskList("RootWriter"); + gHLT.Run(nEvents); + +} diff --git a/HLT/Makefile.am b/HLT/Makefile.am index 1448b4ee913..dad52894c21 100644 --- a/HLT/Makefile.am +++ b/HLT/Makefile.am @@ -57,6 +57,10 @@ if EN_HLT_GLOBAL GLOBAL_DIR=global endif +if EN_HLT_JET +JET_DIR=JET +endif + SUBDIRS = BASE \ $(ALIROOT_DEP) \ @@ -72,6 +76,7 @@ SUBDIRS = BASE \ $(ITS_DIR) \ $(EMCAL_DIR) \ $(GLOBAL_DIR) \ + $(JET_DIR) \ doc EXTRA_DIST = libHLTbase.pkg \ @@ -94,6 +99,7 @@ EXTRA_DIST = libHLTbase.pkg \ libAliHLTITS.pkg \ libAliHLTEMCAL.pkg \ libAliHLTGlobal.pkg \ + libAliHLTJet.pkg \ exa/sample-component1.C \ exa/monitoring.C \ hlt.conf \ diff --git a/HLT/configure.ac b/HLT/configure.ac index a4d521ccb48..f4c884c392f 100644 --- a/HLT/configure.ac +++ b/HLT/configure.ac @@ -935,6 +935,59 @@ AC_MSG_CHECKING([whether to compile Global library]) AC_MSG_RESULT([$enable_module]) AC_SUBST([ALIGLOBAL_LIBS]) +dnl ------------------------------------------------------------------ +AH_TEMPLATE([HLT_JET],[hlt jet library]) + +if test ! "x$FASTJET" = "x" ; then + enable_fastjet="yes" +else + enable_fastjet="no" +fi + +if test "x$enable_fastjet" = "xyes"; then + ALIJET_LIBS= CHECK_HLTMODULE([jet], + [], [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/JETAN -I${FASTJET}/include], + [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS], + [AOD ESD ANALYSIS ANALYSISalice CGAL fastjet JETAN JETANMC], + [-L$ROOTLIBDIR $ALIROOT_LDFLAGS -L$ALICE_ROOT/lib/tgt_$ALICE_TARGET -L${FASTJET}/lib], + [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS]) +else + ALIJET_LIBS= CHECK_HLTMODULE([jet], + [], [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/JETAN], + [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS], + [AOD ESD ANALYSIS ANALYSISalice JETAN JETANMC], + [-L$ROOTLIBDIR $ALIROOT_LDFLAGS -L$ALICE_ROOT/lib/tgt_$ALICE_TARGET], + [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS]) +fi + +if test "x$enable_module" = "xmissheader"; then + enable_module="no...header.missing" + enable_jet=$enable_module +elif test "x$enable_module" = "xforce"; then + enable_jet="yes" +else + enable_jet=$enable_module +fi + +if test "x$enable_jet" = "xyes" ; then + AC_DEFINE(HLT_JET) + ALIJET_LIBS="$ALIHLTMODULE_LIBS" +else + enable_module=$enable_jet +fi + +AC_MSG_NOTICE([++ ------------------------------]) +AC_MSG_NOTICE([++ HAS _FASTJET = $enable_fastjet]) +AC_MSG_NOTICE([++ MODULE ENABLE = $enable_module]) +AC_MSG_NOTICE([++ MODULE JET = $enable_jet]) +AC_MSG_NOTICE([++ ALIJET_LIBS = $ALIHLTMODULE_LIBS]) +AC_MSG_NOTICE([++ ------------------------------]) + +AM_CONDITIONAL(EN_HLT_JET, test x$enable_jet = xyes) +AC_MSG_CHECKING([whether to compile Jet library]) +AC_MSG_RESULT([$enable_module]) +AC_SUBST([ALIJET_LIBS]) + dnl ------------------------------------------------------------------ AH_TEMPLATE([HLT_ITS],[hlt its library]) @@ -1247,6 +1300,11 @@ if test "x$enable_global" = "xyes"; then AC_CONFIG_FILES([global/Makefile]) fi +AC_MSG_NOTICE([compile jet library: $enable_jet]) +if test "x$enable_jet" = "xyes"; then + AC_CONFIG_FILES([JET/Makefile]) +fi + AC_MSG_NOTICE([compile comp library: $enable_comp]) if test "x$enable_comp" = "xyes"; then AC_CONFIG_FILES([comp/Makefile]) diff --git a/HLT/libAliHLTJET.pkg b/HLT/libAliHLTJET.pkg new file mode 100644 index 00000000000..7933d943100 --- /dev/null +++ b/HLT/libAliHLTJET.pkg @@ -0,0 +1,55 @@ +#-*- Mode: Makefile -*- +# $Id: libAliHLTJET.pkg 28356 2008-08-30 08:52:32Z hristov $ + +CLASS_HDRS := AliHLTJETAgent.h \ + AliHLTJETConeJetComponent.h + +CLASS_HDRS_FJ := AliHLTJETFastJetComponent.h + +############################################################################### + +include $(MODDIR)/JET/jet.conf + +############################################################################### + +MODULE_SRCS := $(CLASS_HDRS:.h=.cxx) + +MODULE_HDRS := $(CLASS_HDRS) + +MODULE_DHDR := + +EINCLUDE := HLT/BASE \ + HLT/JET \ + JETAN \ + STEER + +LIBRARY_DEP := -lHLTbase -lAliHLTUtil \ + -lESD -lSTEER -lSTEERBase -lAOD -lESD \ + -lANALYSIS -lANALYSISalice \ + -lJETAN -lJETANMC \ + -L$(shell root-config --libdir) -lEG + +############################################################################### +include $(MODDIR)/hlt.conf + +SRCS := $(patsubst %,JET/%,$(MODULE_SRCS)) +CINTHDRS := $(patsubst %,JET/%,$(CLASS_HDRS)) +HDRS := $(patsubst %,JET/%,$(MODULE_HDRS)) +DHDR := $(patsubst %,JET/%,$(MODULE_DHDR)) +CINTAUTOLINK := $(shell test "x$(MODULE_DHDR)" = "x" && echo 1) + +# For : Creating HLT/tgt_linuxx8664gcc/G__AliHLTJET.cxx +# Added ${HLTCXXFLAGS_FASTJET} to CINTFLAGS +# but +# Added ${HLTCXXFLAGS_FASTJET} to EDEFINE +# would be sufficient + +# For : Compiling HLT/tgt_linuxx8664gcc/G__AliHLTJET.cxx +# Added ${HLTCXXFLAGS_FASTJET} to EDEFINE + +EDEFINE := ${HLTDEFS} ${HLTDEF_FASTJET} ${HLTCXXFLAGS_FASTJET} +PACKCXXFLAGS := ${HLTCXXFLAGS} ${HLTCXXFLAGS_FASTJET} +PACKCFLAGS := ${HLTCLFAGS} +PACKDCXXFLAGS := ${HLTDCXXFLAGS} +PACKSOFLAGS := ${HLTSOFLAGS_FASTJET} $(HLTSOFLAGS) +############################################################################### -- 2.43.0