--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+ * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
+ * for The ALICE Off-line 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 AliHLTEMCALCalibrationComponent.cxx
+ @author Mateusz Ploskon
+ @date
+ @brief A EMCALCalibration processing component for the HLT. */
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "TTree.h"
+#include "TFile.h"
+#include "TBranch.h"
+
+#include "AliHLTEMCALCalibrationComponent.h"
+#include "AliHLTEMCALDefinitions.h"
+
+#include "AliCDBManager.h"
+#include "AliRawReaderMemory.h"
+
+#include <cstdlib>
+#include <cerrno>
+#include <string>
+
+// this is a global object used for automatic component registration, do not use this
+AliHLTEMCALCalibrationComponent gAliHLTEMCALCalibrationComponent;
+
+ClassImp(AliHLTEMCALCalibrationComponent);
+
+AliHLTEMCALCalibrationComponent::AliHLTEMCALCalibrationComponent()
+ : AliHLTCalibrationProcessor()
+ , fOutputPercentage(100) // By default we copy to the output exactly what we got as input
+ , fStrorageDBpath("local://$ALICE_ROOT")
+ , fCDB(NULL)
+{
+ // Default constructor
+}
+
+AliHLTEMCALCalibrationComponent::~AliHLTEMCALCalibrationComponent()
+{
+ // Destructor
+ ;
+}
+
+const char* AliHLTEMCALCalibrationComponent::GetComponentID()
+{
+ // Return the component ID const char *
+ return "EMCALCalibration"; // The ID of this component
+}
+
+void AliHLTEMCALCalibrationComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
+{
+ // Get the list of input data
+ list.clear(); // We do not have any requirements for our input data type(s).
+ //list.push_back( AliHLTEMCALDefinitions::fgkDDLRawDataType );
+ list.push_back( AliHLTEMCALDefinitions::fgkClusterDataType );
+ //list.push_back( AliHLTEMCALDefinitions::fgkEMCALESDDataType );
+}
+
+AliHLTComponent_DataType AliHLTEMCALCalibrationComponent::GetOutputDataType()
+{
+ // Get the output data type
+ return AliHLTEMCALDefinitions::fgkCalibrationDataType;
+}
+
+void AliHLTEMCALCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ // Get the output data size
+ constBase = 0;
+ inputMultiplier = ((double)fOutputPercentage)/100.0;
+}
+
+AliHLTComponent* AliHLTEMCALCalibrationComponent::Spawn()
+{
+ // Spawn function, return new instance of this class
+ return new AliHLTEMCALCalibrationComponent;
+};
+
+Int_t AliHLTEMCALCalibrationComponent::ScanArgument( int argc, const char** argv )
+{
+ // perform initialization. We check whether our relative output size is specified in the arguments.
+ fOutputPercentage = 100;
+ int i = 0;
+ char* cpErr;
+ while ( i < argc )
+ {
+ Logging( kHLTLogDebug, "HLT::EMCALCalibration::ScanArgument", "Arguments", "argv[%d] == %s", i, argv[i] );
+ if ( !strcmp( argv[i], "output_percentage" ) )
+ {
+ if ( i+1>=argc )
+ {
+ Logging(kHLTLogError, "HLT::EMCALCalibration::ScanArgument", "Missing Argument", "Missing output_percentage parameter");
+ return ENOTSUP;
+ }
+ Logging( kHLTLogDebug, "HLT::EMCALCalibration::ScanArgument", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
+ fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
+ if ( *cpErr )
+ {
+ Logging(kHLTLogError, "HLT::EMCALCalibration::ScanArgument", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
+ return EINVAL;
+ }
+ Logging( kHLTLogInfo, "HLT::EMCALCalibration::ScanArgument", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
+ i += 2;
+ continue;
+ }
+
+ if ( strcmp( argv[i], "-cdb" ) == 0)
+ {
+ if ( i+1 >= argc )
+ {
+ Logging(kHLTLogError, "HLT::EMCALCalibration::ScanArgument", "Missing Argument", "Missing -cdb argument");
+ return ENOTSUP;
+ }
+ fStrorageDBpath = argv[i+1];
+ Logging( kHLTLogInfo, "HLT::EMCALCalibration::ScanArgument", "DB storage set", "DB storage is %s", fStrorageDBpath.c_str() );
+ i += 2;
+ continue;
+ }
+
+ Logging(kHLTLogError, "HLT::EMCALCalibration::ScanArgument", "Unknown Option", "Unknown option '%s'", argv[i] );
+ return EINVAL;
+ }
+ return 0;
+}
+
+Int_t AliHLTEMCALCalibrationComponent::InitCalibration()
+{
+ //init the calibration
+ fCDB = AliCDBManager::Instance();
+ if (!fCDB)
+ {
+ Logging(kHLTLogError, "HLT::EMCALCalibration::InitCalibration", "Could not get CDB instance", "fCDB 0x%x", fCDB);
+ }
+ else
+ {
+ fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
+ fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
+ Logging(kHLTLogDebug, "HLT::EMCALCalibration::InitCalibration", "CDB instance", "fCDB 0x%x", fCDB);
+ }
+ return 0;
+}
+
+Int_t AliHLTEMCALCalibrationComponent::DeinitCalibration()
+{
+ // Deinitialization of the component
+ if (fCDB)
+ {
+ Logging( kHLTLogDebug, "HLT::EMCALCalibration::DeinitCalibration", "destroy", "fCDB");
+ fCDB->Destroy();
+ fCDB = 0;
+ }
+ return 0;
+}
+
+Int_t AliHLTEMCALCalibrationComponent::ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
+{
+ // Process an event
+ // Logging( kHLTLogInfo, "HLT::EMCALCalibration::ProcessCalibration", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
+ Logging( kHLTLogDebug, "HLT::EMCALCalibration::ProcessCalibration", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
+ // Process an event
+ // unsigned long totalSize = 0;
+
+ // implement a usage of the following
+ // AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
+ // AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
+ // void *triggerData = trigData.fData;
+ Logging( kHLTLogDebug, "HLT::EMCALCalibration::ProcessCalibration", "Trigger data received",
+ "Struct size %d Data size %d Data location 0x%x",
+ trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
+
+ // Loop over all input blocks in the event
+ int ibForce = 0;
+ TObject *tobjin = (TObject *)GetFirstInputObject(AliHLTEMCALDefinitions::fgkClusterDataType , "TTree", ibForce);
+ Logging( kHLTLogInfo, "HLT::EMCALCalibration::ProcessCalibration", "1stBLOCK", "Pointer = 0x%x", tobjin);
+ while (tobjin)
+ {
+ tobjin = (TObject *)GetNextInputObject( ibForce );
+ Logging( kHLTLogInfo, "HLT::EMCALCalibration::ProcessCalibration", "nextBLOCK", "Pointer = 0x%x", tobjin);
+ }
+
+ return 0;
+}
+
+Int_t AliHLTEMCALCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
+{
+ //Int_t PushToFXS(TObject* pObject, const char* pDetector, const char* pFileID, const char* pDDLNumber = "");
+ // what we will actually push depends on the calibration procedure
+ //ireturn = PushToFXS(object, "EMCAL ", "EMCALCalib", "1024 ");
+ Logging( kHLTLogDebug, "HLT::EMCALCalibration::ProcessCalibration", "Shipping data",
+ "Nothing serious");
+ Int_t ireturn = 0;
+ return ireturn;
+}
--- /dev/null
+#ifndef ALIHLTEMCALCALIBRATIONCOMPONENT_H
+#define ALIHLTEMCALCALIBRATIONCOMPONENT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/** @file AliHLTEMCALCalibrationComponent.h
+ @author Timm Steinbeck, Matthias Richter
+ @date
+ @brief Declaration of a EMCALCalibration component. */
+
+
+#include "AliHLTCalibrationProcessor.h"
+class AliCDBManager;
+
+/**
+ * @class AliHLTEMCALCalibrationComponent
+ * @brief A EMCALCalibration HLT processing component.
+ *
+ * An implementiation of a EMCALCalibration component that just copies its input data
+ * as a test, demonstration, and example of the HLT component scheme.
+ * - @ref InitCalibration (optional)
+ * - @ref ScanArgument (optional)
+ * - @ref DeinitCalibration (optional)
+ * - @ref ProcessCalibration
+ * - @ref ShipDataToFXS
+ * - @ref GetComponentID
+ * - @ref GetInputDataTypes
+ * - @ref GetOutputDataType
+ * - @ref GetOutputDataSize
+ * - @ref Spawn
+ * @ingroup alihlt_tutorial
+ */
+class AliHLTEMCALCalibrationComponent : public AliHLTCalibrationProcessor
+ {
+ public:
+ AliHLTEMCALCalibrationComponent();
+ virtual ~AliHLTEMCALCalibrationComponent();
+
+ // Public functions to implement AliHLTComponent's interface.
+ // These functions are required for the registration process
+
+ const char* GetComponentID();
+ void GetInputDataTypes( vector<AliHLTComponent_DataType>& list);
+ AliHLTComponent_DataType GetOutputDataType();
+ virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ AliHLTComponent* Spawn();
+
+ protected:
+
+ // Protected functions to implement AliHLTComponent's interface.
+ // These functions provide initialization as well as the actual processing
+ // capabilities of the component.
+
+ virtual Int_t InitCalibration();
+ virtual Int_t ScanArgument(int argc, const char** argv);
+ virtual Int_t DeinitCalibration();
+/* virtual Int_t ProcessCalibration(const AliHLTComponent_EventData& evtData, */
+/* const AliHLTComponent_BlockData* blocks, */
+/* AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, */
+/* AliHLTUInt32_t& size, */
+/* vector<AliHLTComponent_BlockData>& outputBlocks); */
+ virtual Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+ virtual Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
+
+ using AliHLTCalibrationProcessor::ProcessCalibration;
+ using AliHLTCalibrationProcessor::ShipDataToFXS;
+
+ private:
+ /** copy constructor prohibited */
+ AliHLTEMCALCalibrationComponent(const AliHLTEMCALCalibrationComponent&);
+ /** assignment operator prohibited */
+ AliHLTEMCALCalibrationComponent& operator=(const AliHLTEMCALCalibrationComponent&);
+
+ // The size of the output data produced, as a percentage of the input data's size.
+ // Can be greater than 100 (%)
+
+ unsigned fOutputPercentage; // Output volume in percentage of the input
+ string fStrorageDBpath; // Default path for OCDB
+ AliCDBManager *fCDB; //! Pointer to OCDB
+
+ ClassDef(AliHLTEMCALCalibrationComponent, 0)
+
+ };
+#endif
--- /dev/null
+/**************************************************************************
+ * 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> *
+ * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
+ * 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 AliHLTEMCALClusterizerComponent.cxx
+ @author Mateusz Ploskon
+ @date
+ @brief EMCAL clusterizer component for HLT. */
+
+#if __GNUC__== 3
+using namespace std;
+#endif
+
+#include "AliHLTEMCALClusterizerComponent.h"
+#include "AliHLTEMCALDefinitions.h"
+
+#include "TString.h"
+#include "TObjString.h"
+#include "TObjArray.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTEMCALClusterizerComponent)
+
+AliHLTEMCALClusterizerComponent::AliHLTEMCALClusterizerComponent()
+ : AliHLTProcessor()
+ , fOutputPercentage(100)
+ , fStorageDBpath("local://$ALICE_ROOT")
+ , fClusterizer(NULL)
+ , fCDB(NULL)
+ , fMemReader(NULL)
+ , fGeometryFileName("")
+ , fGeometryFile(NULL)
+ , fGeoManager(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
+}
+
+AliHLTEMCALClusterizerComponent::AliHLTEMCALClusterizerComponent(const AliHLTEMCALClusterizerComponent &/*c*/)
+ : AliHLTProcessor()
+ , fOutputPercentage(100)
+ , fStorageDBpath("local://$ALICE_ROOT")
+ , fClusterizer(NULL)
+ , fCDB(NULL)
+ , fMemReader(NULL)
+ , fGeometryFileName("")
+ , fGeometryFile(NULL)
+ , fGeoManager(NULL)
+{
+ // may not use the copy contructor
+ HLTError("May not use.");
+}
+
+AliHLTEMCALClusterizerComponent& AliHLTEMCALClusterizerComponent::operator=(const AliHLTEMCALClusterizerComponent&)
+{
+ // may not use the copy contructor
+ HLTError("May not use.");
+ return *this;
+}
+
+AliHLTEMCALClusterizerComponent::~AliHLTEMCALClusterizerComponent()
+{
+ // see header file for class documentation
+}
+
+AliHLTComponentDataType AliHLTEMCALClusterizerComponent::GetOutputDataType()
+{
+ return AliHLTEMCALDefinitions::fgkClusterDataType;
+}
+
+int AliHLTEMCALClusterizerComponent::DoInit( int argc, const char** argv )
+{
+ // see header file for class documentation
+ int iResult=0;
+ HLTInfo("parsing %d arguments", argc);
+
+ TString argument="";
+ TString configuration="";
+ int bMissingParam=0;
+ bool bHaveMandatory1=false;
+ bool bHaveMandatory2=false;
+
+ char *cpErr = 0;
+
+ for (int i=0; i<argc && iResult>=0; i++) {
+ argument=argv[i];
+ if (argument.IsNull()) continue;
+
+ // -mandatory1
+ if (argument.CompareTo("-cdb")==0) {
+ bHaveMandatory1|=1;
+ if ((bMissingParam=(++i>=argc))) break;
+ HLTInfo("got \'-cdb\' argument: %s", argv[i]);
+ fStorageDBpath = argv[i];
+ HLTInfo("CDB path is: %s", fStorageDBpath.c_str());
+ // -mandatory2
+ } else if (argument.CompareTo("-geometry")==0) {
+ bHaveMandatory2|=1;
+ HLTInfo("got \'-geometry\' argument");
+ fGeometryFileName = argv[i];
+ HLTInfo("Geometry file is: %s", fGeometryFileName.c_str());
+ // -optional1
+ } else if (argument.CompareTo("-output_percentage")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ HLTInfo("got \'-output_percentage\' argument: %s", argv[i]);
+ fOutputPercentage = strtoul(argv[i], &cpErr, 0);
+ if ( *cpErr )
+ {
+ HLTError("Unable to convert ouput_percentage to a number %s", argv[i]);
+ return -EINVAL;
+ }
+
+// // -optional2
+// } else if (argument.CompareTo("-optional2")==0) {
+// HLTInfo("got \'-optional2\' argument");
+
+ } else {
+ // the remaining arguments are treated as configuration
+ if (!configuration.IsNull()) configuration+=" ";
+ configuration+=argument;
+ }
+ }
+ if (bMissingParam) {
+ HLTError("missing parameter for argument %s", argument.Data());
+ iResult=-EINVAL;
+ }
+
+ if (iResult>=0 && !bHaveMandatory1) {
+ HLTError("mandatory argument \'-cdb\' missing");
+ iResult=-EPROTO;
+ }
+ if (iResult>=0 && !bHaveMandatory2) {
+ HLTError("mandatory argument \'-geometry\' missing");
+ iResult=-EPROTO;
+ }
+ if (iResult>=0 && !configuration.IsNull()) {
+ iResult=Configure(configuration.Data());
+ } else {
+ iResult=Reconfigure(NULL, NULL);
+ }
+
+ return iResult;
+}
+
+int AliHLTEMCALClusterizerComponent::DoDeinit()
+{
+ // see header file for class documentation
+ HLTInfo("processing cleanup");
+ return 0;
+}
+
+int AliHLTEMCALClusterizerComponent::DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) {
+ // see header file for class documentation
+ HLTInfo("processing data");
+ if (evtData.fStructSize==0 && blocks==NULL && trigData.fStructSize==0 &&
+ outputPtr==0 && size==0)
+ {
+ outputBlocks.clear();
+ // this is just to get rid of the warning "unused parameter"
+ }
+ return 0;
+}
+
+int AliHLTEMCALClusterizerComponent::Configure(const char* arguments)
+{
+ // see header file for class documentation
+ int iResult=0;
+ if (!arguments) return iResult;
+ HLTInfo("parsing configuration string \'%s\'", arguments);
+
+ TString allArgs=arguments;
+ TString argument;
+ int bMissingParam=0;
+
+ TObjArray* pTokens=allArgs.Tokenize(" ");
+ if (pTokens) {
+ for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+ argument=((TObjString*)pTokens->At(i))->GetString();
+ if (argument.IsNull()) continue;
+
+ // -config1
+ if (argument.CompareTo("-config1")==0) {
+ if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+ HLTInfo("got \'-config1\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+
+ // -config2
+ } else if (argument.CompareTo("-config2")==0) {
+ HLTInfo("got \'-config2\'");
+ } else {
+ HLTError("unknown argument %s", argument.Data());
+ iResult=-EINVAL;
+ break;
+ }
+ }
+ delete pTokens;
+ }
+ if (bMissingParam) {
+ HLTError("missing parameter for argument %s", argument.Data());
+ iResult=-EINVAL;
+ }
+ return iResult;
+}
+
+int AliHLTEMCALClusterizerComponent::Reconfigure(const char* cdbEntry, const char* chainId)
+{
+ // see header file for class documentation
+ int iResult=0;
+ const char* path="HLT/ConfigSample/EMCALClusterizerComponent";
+ const char* defaultNotify="";
+ if (cdbEntry) {
+ path=cdbEntry;
+ defaultNotify=" (default)";
+ }
+ if (path) {
+ HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+ AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+ if (pEntry) {
+ TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+ if (pString) {
+ HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
+ iResult=Configure(pString->GetString().Data());
+ } else {
+ HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+ }
+ } else {
+ HLTError("can not fetch object \"%s\" from CDB", path);
+ }
+ }
+ return iResult;
+}
+
+int AliHLTEMCALClusterizerComponent::ReadPreprocessorValues(const char* modules)
+{
+ // see header file for class documentation
+ int iResult=0;
+ TString detectors(modules!=NULL?modules:"");
+ HLTInfo("read preprocessor values for detector(s): %s", detectors.IsNull()?"none":detectors.Data());
+ return iResult;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+#ifndef ALIHLTEMCALCLUSTERIZERCOMPONENT_H
+#define ALIHLTEMCALCLUSTERIZERCOMPONENT_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 AliHLTEMCALClusterizerComponent.h
+ @author Matthias Richter, Timm Steinbeck
+ @date
+ @brief A sample processing component for the HLT.
+*/
+
+#include "AliHLTProcessor.h"
+
+/**
+ * @class AliHLTEMCALClusterizerComponent
+ */
+
+class TFile;
+class TGeoManager;
+class AliEMCALClusterizer;
+class AliCDBManager;
+class AliRawReaderMemory;
+
+class AliHLTEMCALClusterizerComponent : public AliHLTProcessor {
+public:
+ AliHLTEMCALClusterizerComponent();
+ AliHLTEMCALClusterizerComponent(const AliHLTEMCALClusterizerComponent& c);
+ virtual ~AliHLTEMCALClusterizerComponent();
+
+ AliHLTEMCALClusterizerComponent& operator=(const AliHLTEMCALClusterizerComponent&);
+
+ // AliHLTComponent interface functions
+ const char* GetComponentID() { return "EMCALClusterizer";}
+ void GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
+ list.push_back(kAliHLTAnyDataType);
+ }
+ AliHLTComponentDataType GetOutputDataType();
+ virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {constBase = 0;inputMultiplier = 100;};
+
+ // Spawn function, return new class instance
+ AliHLTComponent* Spawn() {return new AliHLTEMCALClusterizerComponent;};
+
+ protected:
+ // AliHLTComponent interface functions
+ int DoInit( int argc, const char** argv );
+ int DoDeinit();
+ int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
+ int Reconfigure(const char* cdbEntry, const char* chainId);
+ int ReadPreprocessorValues(const char* modules);
+
+ using AliHLTProcessor::DoEvent;
+
+private:
+ /**
+ * Configure the component.
+ * Parse a string for the configuration arguments and set the component
+ * properties.
+ *
+ * This function illustrates the scanning of an argument string. The string
+ * was presumably fetched from the CDB.
+ */
+ int Configure(const char* arguments);
+
+ unsigned fOutputPercentage; // Output volume in percentage of the input
+ string fStorageDBpath; // Default path for OCDB
+
+ AliEMCALClusterizer *fClusterizer; //! Offline clusterizer
+ AliCDBManager *fCDB; //! Pointer to OCDB
+ AliRawReaderMemory *fMemReader; //! Input raw data reader
+
+ string fGeometryFileName; // Path to geometry file
+ TFile *fGeometryFile; //! Pointer to the geom root file
+ TGeoManager *fGeoManager; //! Pointer to geometry manager
+
+ ClassDef(AliHLTEMCALClusterizerComponent, 1)
+};
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+ * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
+ * for The ALICE Off-line 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. *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Definitions for the HLT EMCAL components //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliHLTEMCALDefinitions.h"
+
+
+ClassImp(AliHLTEMCALDefinitions)
+
+const AliHLTComponentDataType AliHLTEMCALDefinitions::fgkDDLRawDataType = { sizeof(AliHLTComponentDataType), {'D','D','L','_','R','A','W',' '},{'E','M','C','L'}};;
+
+const AliHLTComponentDataType AliHLTEMCALDefinitions::fgkClusterDataType = { sizeof(AliHLTComponentDataType), {'C','L','U','S','T','E','R','S'},{'E','M','C','L'}};;
+
+const AliHLTComponentDataType AliHLTEMCALDefinitions::fgkESDDataType = { sizeof(AliHLTComponentDataType), {'G','L','O','B','L','E','S','D'},{'E','M','C','L'}};;
+
+const AliHLTComponentDataType AliHLTEMCALDefinitions::fgkEMCALESDDataType = { sizeof(AliHLTComponentDataType), {'E','M','C','A','L','E','S','D'},{'E','M','C','L'}};;
+
+const AliHLTComponentDataType AliHLTEMCALDefinitions::fgkCalibrationDataType = { sizeof(AliHLTComponentDataType), {'C','A','L','I','B','R','A','H'},{'E','M','C','L'}};;
+
+AliHLTEMCALDefinitions::AliHLTEMCALDefinitions()
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+}
+
+AliHLTEMCALDefinitions::~AliHLTEMCALDefinitions()
+{
+ // see header file for class documentation
+}
--- /dev/null
+// XEmacs -*-C++-*-
+#ifndef ALIHLTEMCALDEFINITIONS_H
+#define ALIHLTEMCALDEFINITIONS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* AliHLTEMCALDefinitions
+ */
+
+#include "AliHLTDataTypes.h"
+#include "Rtypes.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The HLT definitions for EMCAL //
+// //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+
+class AliHLTEMCALDefinitions
+{
+
+public:
+ AliHLTEMCALDefinitions();
+ virtual ~AliHLTEMCALDefinitions();
+
+ static const AliHLTComponentDataType fgkDDLRawDataType; // Raw Data
+ static const AliHLTComponentDataType fgkClusterDataType; // EMCAL Clusters
+ static const AliHLTComponentDataType fgkESDDataType; // global ESD data type - may change!!!
+ static const AliHLTComponentDataType fgkEMCALESDDataType; // ESD data type after emcal processing
+ static const AliHLTComponentDataType fgkCalibrationDataType; // Calibration
+
+ ClassDef(AliHLTEMCALDefinitions, 0)
+
+};
+
+#endif
--- /dev/null
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliHLTEMCALClusterizerComponent;
+#pragma link C++ class AliHLTEMCALTrackerComponent;
+#pragma link C++ class AliHLTEMCALDefinitions;
+#pragma link C++ class AliHLTEMCALCalibrationComponent;
+#endif
+
--- /dev/null
+// $Id: AliHLTEMCALTrackerComponent.cxx 23618 2008-01-29 13:07:38Z hristov $
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+ * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
+ * for The ALICE Off-line 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 AliHLTEMCALTrackerComponent.cxx
+ @author Timm Steinbeck, Matthias Richter
+ @date
+ @brief A EMCALTracker processing component for the HLT. */
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "TFolder.h"
+#include "TFile.h"
+
+#include "AliHLTEMCALTrackerComponent.h"
+#include "AliHLTEMCALDefinitions.h"
+#include "AliCDBManager.h"
+#include "AliEMCALTracker.h"
+#include "AliEMCALReconstructor.h"
+#include "AliESDEvent.h"
+#include "AliMagFMaps.h"
+#include "AliESDfriend.h"
+
+#include <cstdlib>
+#include <cerrno>
+#include <string>
+
+// this is a global object used for automatic component registration, do not use this
+AliHLTEMCALTrackerComponent gAliHLTEMCALTrackerComponent;
+
+ClassImp(AliHLTEMCALTrackerComponent);
+
+AliHLTEMCALTrackerComponent::AliHLTEMCALTrackerComponent()
+ : AliHLTProcessor()
+ , fOutputPercentage(100) // By default we copy to the output exactly what we got as input
+ , fStrorageDBpath("local://$ALICE_ROOT")
+ , fCDB(NULL)
+ , fField(NULL)
+ , fGeometryFileName("")
+ , fGeometryFile(NULL)
+ , fGeoManager(NULL)
+ , fTracker(NULL)
+ , fInputFolder(new TFolder("EMCALtrackerFolder", "EMCALtrackerFolder"))
+{
+ // Default constructor
+ fInputFolder->SetOwner(kTRUE);
+
+ fGeometryFileName = getenv("ALICE_ROOT");
+ fGeometryFileName += "/HLT/EMCAL/geometry.root";
+}
+
+AliHLTEMCALTrackerComponent::~AliHLTEMCALTrackerComponent()
+{
+ // Destructor
+ delete fInputFolder;
+ fInputFolder = NULL;
+}
+
+const char* AliHLTEMCALTrackerComponent::GetComponentID()
+{
+ // Return the component ID const char *
+ return "EMCALTracker"; // The ID of this component
+}
+
+void AliHLTEMCALTrackerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
+{
+ // Get the list of input data
+ list.clear(); // We do not have any requirements for our input data type(s).
+ list.push_back( AliHLTEMCALDefinitions::fgkClusterDataType );
+}
+
+AliHLTComponent_DataType AliHLTEMCALTrackerComponent::GetOutputDataType()
+{
+ // Get the output data type
+ return AliHLTEMCALDefinitions::fgkEMCALESDDataType;
+}
+
+void AliHLTEMCALTrackerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ // Get the output data size
+ constBase = 0;
+ inputMultiplier = ((double)fOutputPercentage)/100.0;
+}
+
+// Spawn function, return new instance of this class
+AliHLTComponent* AliHLTEMCALTrackerComponent::Spawn()
+{
+ // Spawn function, return new instance of this class
+ return new AliHLTEMCALTrackerComponent;
+};
+
+int AliHLTEMCALTrackerComponent::DoInit( int argc, const char** argv )
+{
+ // perform initialization. We check whether our relative output size is specified in the arguments.
+ fOutputPercentage = 100;
+ int i = 0;
+ char* cpErr;
+ while ( i < argc )
+ {
+ Logging( kHLTLogDebug, "HLT::EMCALTracker::DoInit", "Arguments", "argv[%d] == %s", i, argv[i] );
+ if ( !strcmp( argv[i], "output_percentage" ) )
+ {
+ if ( i+1>=argc )
+ {
+ Logging(kHLTLogError, "HLT::EMCALTracker::DoInit", "Missing Argument", "Missing output_percentage parameter");
+ return ENOTSUP;
+ }
+ Logging( kHLTLogDebug, "HLT::EMCALTracker::DoInit", "Arguments", "argv[%d+1] == %s", i, argv[i+1] );
+ fOutputPercentage = strtoul( argv[i+1], &cpErr, 0 );
+ if ( *cpErr )
+ {
+ Logging(kHLTLogError, "HLT::EMCALTracker::DoInit", "Wrong Argument", "Cannot convert output_percentage parameter '%s'", argv[i+1] );
+ return EINVAL;
+ }
+ Logging( kHLTLogInfo, "HLT::EMCALTracker::DoInit", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
+ i += 2;
+ continue;
+ }
+
+ if ( strcmp( argv[i], "-cdb" ) == 0)
+ {
+ if ( i+1 >= argc )
+ {
+ Logging(kHLTLogError, "HLT::EMCALTracker::DoInit", "Missing Argument", "Missing -cdb argument");
+ return ENOTSUP;
+ }
+ fStrorageDBpath = argv[i+1];
+ Logging( kHLTLogInfo, "HLT::EMCALTracker::DoInit", "DB storage set", "DB storage is %s", fStrorageDBpath.c_str() );
+ i += 2;
+ continue;
+ }
+
+ if ( strcmp( argv[i], "-geometry" ) == 0)
+ {
+ if ( i+1 >= argc )
+ {
+ Logging(kHLTLogError, "HLT::EMCALTracker::DoInit", "Missing Argument", "Missing -geometry argument");
+ return ENOTSUP;
+ }
+ fGeometryFileName = argv[i+1];
+ Logging( kHLTLogInfo, "HLT::EMCALTracker::DoInit", "GeomFile storage set", "GeomFile storage is %s",
+ fGeometryFileName.c_str() );
+ i += 2;
+ continue;
+ }
+
+ Logging(kHLTLogError, "HLT::EMCALTracker::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
+ return EINVAL;
+ }
+
+ //init alifield map - temporarly fixed - should come from a DB
+ fField = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
+ if (fField)
+ AliTracker::SetFieldMap(fField,1);
+ else
+ Logging(kHLTLogError, "HLT::EMCALTracker::DoInit", "Field", "Unable to init the field");
+
+ fCDB = AliCDBManager::Instance();
+ if (!fCDB)
+ {
+ Logging(kHLTLogError, "HLT::EMCALCalibration::DoInit", "Could not get CDB instance", "fCDB 0x%x", fCDB);
+ }
+ else
+ {
+ fCDB->SetRun(0); // THIS HAS TO BE RETRIEVED !!!
+ fCDB->SetDefaultStorage(fStrorageDBpath.c_str());
+ Logging(kHLTLogDebug, "HLT::EMCALCalibration::DoInit", "CDB instance", "fCDB 0x%x", fCDB);
+ }
+
+ fGeometryFile = TFile::Open(fGeometryFileName.c_str());
+ if (fGeometryFile)
+ {
+ fGeoManager = (TGeoManager *)fGeometryFile->Get("Geometry");
+ fTracker = new AliEMCALTracker;
+ }
+ else
+ {
+ Logging(kHLTLogError, "HLT::EMCALTracker::DoInit", "fGeometryFile", "Unable to open file. FATAL!");
+ return -1;
+ }
+
+ return 0;
+}
+
+int AliHLTEMCALTrackerComponent::DoDeinit()
+{
+ // Deinitialization of the component
+
+ delete fField;
+ fField = 0;
+
+ delete fTracker;
+ fTracker = 0;
+
+ if (fGeometryFile)
+ {
+ fGeometryFile->Close();
+ delete fGeometryFile;
+ fGeometryFile = 0;
+ }
+
+ fInputFolder->Clear();
+
+ return 0;
+}
+
+int AliHLTEMCALTrackerComponent::DoEvent( const AliHLTComponentEventData & evtData,
+ AliHLTComponentTriggerData & trigData )
+{
+ // Process an event
+
+ Logging( kHLTLogInfo, "HLT::EMCALTracker::DoEvent", "Output percentage set", "Output percentage set to %lu %%", fOutputPercentage );
+ Logging( kHLTLogInfo, "HLT::EMCALTracker::DoEvent", "BLOCKS", "NofBlocks %lu", evtData.fBlockCnt );
+
+ AliHLTUInt32_t dBlockSpecification = 0;
+
+ //implement a usage of the following
+// AliHLTUInt32_t triggerDataStructSize = trigData.fStructSize;
+// AliHLTUInt32_t triggerDataSize = trigData.fDataSize;
+// void *triggerData = trigData.fData;
+ Logging( kHLTLogDebug, "HLT::EMCALTracker::DoEvent", "Trigger data received",
+ "Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
+
+ AliHLTComponentBlockData *dblock = (AliHLTComponentBlockData *)GetFirstInputBlock( AliHLTEMCALDefinitions::fgkClusterDataType );
+ if (dblock != 0)
+ {
+ dBlockSpecification = dblock->fSpecification;
+ }
+ else
+ {
+ Logging( kHLTLogWarning, "HLT::EMCALTracker::DoEvent", "DATAIN", "First Input Block not found! 0x%x", dblock);
+ return -1;
+ }
+
+ fInputFolder->Clear();
+ AliESDEvent *esd = 0; // we assume we receive this one from a global merger component
+ TTree *clusterTree = 0;
+
+ int ibForce = 0;
+ TObject *tobjin = 0;
+
+ // here getfirstinput finds the first object with spec type..
+ // get the clusters tree
+ tobjin = (TObject *)GetFirstInputObject( AliHLTEMCALDefinitions::fgkClusterDataType, "TTree", ibForce);
+ while (tobjin != 0)
+ {
+ tobjin = (TObject *)GetNextInputObject( ibForce );
+ Logging( kHLTLogInfo, "HLT::EMCALTracker::DoEvent", "nextBLOCK", "Pointer = 0x%x", tobjin);
+ clusterTree = (TTree*)tobjin;
+ if (clusterTree != 0)
+ {
+ Int_t iNentries = clusterTree->GetEntries();
+ Logging( kHLTLogInfo, "HLT::EMCALTracker::DoEvent", "COUNT", "N of tree entries = %d", iNentries);
+ fTracker->LoadClusters(clusterTree);
+ fInputFolder->Add(clusterTree);
+ }
+ }
+
+ // now get the ESD(s) - should in principle be only one...
+ tobjin = (TObject *)GetFirstInputObject( AliHLTEMCALDefinitions::fgkESDDataType, "AliESDevent", ibForce);
+ while (tobjin != 0)
+ {
+ esd = (AliESDEvent *)tobjin;
+ if (esd != 0)
+ {
+ HLTInfo("Got ESDevent");
+ fInputFolder->Add(esd);
+ }
+ tobjin = (TObject *)GetNextInputObject( ibForce );
+ Logging( kHLTLogInfo, "HLT::EMCALTracker::DoEvent", "nextBLOCK", "Pointer = 0x%x", tobjin);
+ clusterTree = (TTree*)tobjin;
+ }
+
+ esd = (AliESDEvent*)fInputFolder->FindObject("AliESDevent");
+ if (esd != 0)
+ {
+ fTracker->PropagateBack(esd);
+
+ //here transport the esd tracks further
+ Int_t nTracks = esd->GetNumberOfTracks();
+ HLTInfo("Number of tracks %d", nTracks);
+ //esd->Print();
+ PushBack(esd, AliHLTEMCALDefinitions::fgkEMCALESDDataType);
+ }
+ else
+ {
+ HLTError("No ESD events received!");
+ }
+
+ fTracker->UnloadClusters();
+ fInputFolder->Clear();
+
+ HLTDebug("Event done.");
+ return 0;
+}
--- /dev/null
+#ifndef ALIHLTEMCALTRACKERCOMPONENT_H
+#define ALIHLTEMCALTRACKERCOMPONENT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/** @file AliHLTEMCALTrackerComponent.h
+ @author Mateusz Ploskon
+ @date
+ @brief Declaration of a EMCALTracker component. */
+
+
+#include "AliHLTProcessor.h"
+class TFolder;
+class TFile;
+class TGeoManager;
+
+class AliCDBManager;
+class AliMagFMaps;
+class AliEMCALTracker;
+
+/**
+ * @class AliHLTEMCALTrackerComponent
+ * @brief A EMCALTracker HLT processing component.
+ *
+ * An implementiation of a EMCALTracker component that just copies its input data
+ * as a test, demonstration, and example of the HLT component scheme.
+ * @ingroup alihlt_tutorial
+ */
+class AliHLTEMCALTrackerComponent : public AliHLTProcessor
+ {
+ public:
+ AliHLTEMCALTrackerComponent();
+ virtual ~AliHLTEMCALTrackerComponent();
+
+ // Public functions to implement AliHLTComponent's interface.
+ // These functions are required for the registration process
+
+ const char* GetComponentID();
+ void GetInputDataTypes( vector<AliHLTComponent_DataType>& list);
+ AliHLTComponent_DataType GetOutputDataType();
+ virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+ AliHLTComponent* Spawn();
+
+ protected:
+
+ // Protected functions to implement AliHLTComponent's interface.
+ // These functions provide initialization as well as the actual processing
+ // capabilities of the component.
+
+ int DoInit( int argc, const char** argv );
+ int DoDeinit();
+/* int DoEvent( const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks, */
+/* AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, */
+/* AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks ); */
+ int DoEvent( const AliHLTComponentEventData & evtData,
+ AliHLTComponentTriggerData & trigData );
+
+ using AliHLTProcessor::DoEvent;
+
+ private:
+ /** copy constructor prohibited */
+ AliHLTEMCALTrackerComponent(const AliHLTEMCALTrackerComponent&);
+ /** assignment operator prohibited */
+ AliHLTEMCALTrackerComponent& operator=(const AliHLTEMCALTrackerComponent&);
+
+ // The size of the output data produced, as a percentage of the input data's size.
+ // Can be greater than 100 (%)
+ unsigned fOutputPercentage; // Output volume in percentage of the input
+
+ string fStrorageDBpath; // Default path for OCDB
+ AliCDBManager *fCDB; //! Pointer to OCDB
+
+ AliMagFMaps* fField; //! magn. field settings
+
+ string fGeometryFileName; // Path to geometry file
+ TFile *fGeometryFile; //! // Pointer to the geom root file
+ TGeoManager *fGeoManager; //! Pointer to geometry manager
+
+ AliEMCALTracker *fTracker;//! Offline emcal tracker
+
+ TFolder *fInputFolder;//! input objects - convenient handling
+
+ ClassDef(AliHLTEMCALTrackerComponent, 0)
+ };
+#endif
--- /dev/null
+#-*- Mode: Makefile -*-
+# package definition for the libAliHLTEMCAL library
+
+# class header files, the link definition for the root dictionary
+# will be created from the names of the header files
+CLASS_HDRS:= \
+ AliHLTEMCALClusterizerComponent.h \
+ AliHLTEMCALDefinitions.h \
+ AliHLTEMCALTrackerComponent.h \
+ AliHLTEMCALCalibrationComponent.h
+
+# library sources
+MODULE_SRCS= \
+ $(CLASS_HDRS:.h=.cxx)
+
+# library headers
+# in most cases you might have already added all the header files to
+# the CLASS_HDRS variable. So we just use the content of this. You
+# can simply add more header files which don't contain classes with
+# ROOT dictionary support
+MODULE_HDRS:= $(CLASS_HDRS)
+
+# The LinkDef file required by the ROOT dictionary generation can be
+# generated automatically. For the all header files specified in
+# CLASS_HDRS an entry will be generated
+# pragma link C++ class <class-name>+;
+#
+# If the default behavior is not enough, you can provide a custom
+# *LinkDef.h to the MODULE_DHDR variable. Leave MODULE_DHDR empty to
+# enable automatic generation.
+MODULE_DHDR:=
+
+EINCLUDE := HLT/BASE HLT/BASE/util HLT/EMCAL HLT/TPC HLT/TRD EMCAL TPC TRD STEER RAW
+
+LIBRARY_DEP := -lHLTbase -lAliHLTUtil -lESD -lCDB \
+ -lEMCALrec -lEMCALbase -lTPCrec -lTPCbase -lTRDrec -lTRDbase \
+ -lSTEER -lSTEERBase -lRAWDatarec
+
+###############################################################################
+#
+# do not change anything below this line
+#
+include $(MODDIR)/hlt.conf
+
+SRCS:=$(patsubst %,EMCAL/%,$(MODULE_SRCS))
+CINTHDRS:=$(patsubst %,EMCAL/%,$(CLASS_HDRS))
+HDRS:=$(patsubst %,EMCAL/%,$(MODULE_HDRS))
+DHDR:=$(patsubst %,EMCAL/%,$(MODULE_DHDR))
+CINTAUTOLINK:= $(shell test "x$(MODULE_DHDR)" = "x" && echo 1)
+
+EDEFINE := ${HLTDEFS}
+PACKCXXFLAGS := ${HLTCXXFLAGS}
+PACKCFLAGS := ${HLTCLFAGS}
+PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
+PACKSOFLAGS := $(HLTSOFLAGS)