AliHLTCaloGeometry::AliHLTCaloGeometry(TString det) :
AliHLTCaloConstantsHandler(det)
,AliHLTLogging()
+ ,fIsInitialised(kFALSE)
{
//see header file for class documentation
}
virtual void GetGlobalCoordinates(AliHLTCaloRecPointDataStruct &recPoint, AliHLTCaloGlobalCoordinate &globalCoord, Int_t iParticle ) = 0;
virtual void GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId) = 0; //COMMENT
+
+ virtual void GetLocalCoordinatesFromAbsId(Int_t AbsId, Int_t &module, Int_t &x, Int_t &z) = 0; //COMMENT
+
+ virtual Int_t InitialiseGeometry() = 0;
+
+protected:
+ Bool_t fIsInitialised;
private:
--- /dev/null
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Primary Authors: Oystein Djuvsland <oysteind@ift.uib.no> *
+ * for The ALICE HLT Project. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+#include "AliHLTCaloDigitHandler.h"
+#include "AliHLTCaloDigitDataStruct.h"
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+#include "TTree.h"
+#include "TClonesArray.h"
+#include "AliHLTCaloGeometry.h"
+#include "AliDigitNew.h"
+
+ClassImp(AliHLTCaloDigitHandler);
+
+AliHLTCaloDigitHandler::AliHLTCaloDigitHandler(TString detName) : AliHLTLogging(), AliHLTCaloConstantsHandler(detName.Data())
+ ,fRunLoader(0)
+ ,fDetLoader(0)
+ ,fNumberOfEvents(0)
+ ,fDigitTree(0)
+ ,fDigits(0)
+ ,fDigitsInModule(0)
+ ,fGeometry(0)
+ ,fCurrentEvent(999999)
+{
+ // See header file for class documentation
+}
+
+AliHLTCaloDigitHandler::~AliHLTCaloDigitHandler()
+{
+ // See header file for class documentation
+ if (fDigits)
+ {
+ for (Int_t m = 0; m < fCaloConstants->GetNMODULES(); m++)
+ {
+ delete [] fDigits[m];
+ }
+ }
+ if (fDigitsInModule)
+ {
+ delete [] fDigitsInModule;
+ }
+}
+
+Int_t AliHLTCaloDigitHandler::Init(AliRunLoader *runLoader)
+{
+ // See header file for class documentation
+
+ fGeometry->InitialiseGeometry();
+
+ fRunLoader = runLoader;
+
+ if (!fRunLoader)
+ {
+ HLTFatal("Run loader is NULL pointer");
+ return -1;
+ }
+
+ fNumberOfEvents = fRunLoader->GetNumberOfEvents();
+ HLTInfo("Found %d events", fNumberOfEvents);
+
+ InitDigitArray();
+
+ return fNumberOfEvents;
+
+}
+
+
+Int_t AliHLTCaloDigitHandler::GetDigits(Int_t module, AliHLTCaloDigitDataStruct* buffer)
+{
+ for (Int_t iDig = 0; iDig < fDigitsInModule[module]; iDig++)
+ {
+ buffer[iDig] = fDigits[module][iDig];
+ }
+ return fDigitsInModule[module];
+}
+
+
+void AliHLTCaloDigitHandler::InitDigitArray()
+{
+
+ // See header file for class documentation
+
+ fDigitsInModule = new Int_t[fCaloConstants->GetNMODULES()];
+
+ fDigits = new AliHLTCaloDigitDataStruct*[fCaloConstants->GetNMODULES()];
+ for (Int_t m = 0; m < fCaloConstants->GetNMODULES(); m++)
+ {
+ fDigits[m] = new AliHLTCaloDigitDataStruct[fCaloConstants->GetNXCOLUMNSMOD()*fCaloConstants->GetNZROWSMOD()];
+ }
+}
+
+void AliHLTCaloDigitHandler::ResetDigitArray()
+{
+ // See header file for class documentation
+
+ for (Int_t m = 0; m < fCaloConstants->GetNMODULES(); m++)
+ {
+ fDigitsInModule[m] = 0;
+ }
+}
+
+
+Int_t AliHLTCaloDigitHandler::ProcessEvent(UInt_t ev)
+{
+ if (fCurrentEvent != ev)
+ {
+ ResetDigitArray();
+ fCurrentEvent = ev;
+ if (fRunLoader)
+ {
+ fRunLoader->GetEvent(ev);
+ fDetLoader->LoadDigits("read");
+ TTree *tree = fDetLoader->TreeD();
+ if (!tree)
+ {
+ HLTFatal("Could not get digit tree");
+ return -1;
+ }
+ TClonesArray *digits = 0;
+ tree->SetBranchAddress(fCaloConstants->GetDETNAME(), &digits);
+ tree->GetEvent(0);
+ Int_t nDigits = digits->GetEntries();
+ HLTDebug("Found %d digits for branch: %s", nDigits, fCaloConstants->GetDETNAME().Data());
+ for (Int_t iDig = 0; iDig < nDigits; iDig++)
+ {
+ ConvertDigit(dynamic_cast<AliDigitNew*>(digits->At(iDig)));
+ }
+ }
+ }
+ return 0;
+}
--- /dev/null
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Primary Authors: Oystein Djuvsland <oysteind@ift.uib.no> *
+ * for The ALICE HLT Project. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+#ifndef ALIHLTCALODIGITHANDLER_H
+#define ALIHLTCALODIGITHANDLER_H
+
+#include "Rtypes.h"
+#include "AliHLTLogging.h"
+#include "../AliHLTCaloConstantsHandler.h"
+
+class AliDigitNew;
+class AliHLTCaloGeometry;
+class TTree;
+class AliRunLoader;
+class AliHLTCaloDigitDataStruct;
+class AliLoader;
+
+class AliHLTCaloDigitHandler : public AliHLTLogging, public AliHLTCaloConstantsHandler
+{
+
+public:
+
+ /** Constructor */
+ AliHLTCaloDigitHandler(TString detName);
+
+ /** Destructor */
+ virtual ~AliHLTCaloDigitHandler();
+
+ /**
+ * Initialise the digit handler
+ * @param runLoader is a pointer to the run loader we're going
+ * to use.
+ * @return number of events on success, negative on error
+ */
+ virtual Int_t Init(AliRunLoader *runLoader);
+
+ /**
+ * Get digits for the specified module
+ * @param module is the module number
+ * @param buffer is the data buffer to fill the digits
+ * @param return number of digits
+ */
+ Int_t GetDigits(Int_t module, AliHLTCaloDigitDataStruct *buffer);
+
+ /**
+ * Process event
+ * @param ev is the event number
+ * @return 0 on success
+ */
+ virtual Int_t ProcessEvent(UInt_t ev);
+
+ /** Return the data type produced */
+ virtual AliHLTComponentDataType GetDataType() = 0;
+
+protected:
+
+ /** Convert an offline digit to a HLT digit */
+ virtual Int_t ConvertDigit(AliDigitNew *digit) = 0;
+
+ /** Initialise the digit array */
+ void InitDigitArray();
+
+ /** Reset the digit array */
+ void ResetDigitArray();
+
+ /** Run loader */
+ AliRunLoader *fRunLoader;
+
+ /** Detector loader */
+ AliLoader *fDetLoader;
+
+ /** Number of events */
+ UInt_t fNumberOfEvents;
+
+ /** Tree of digits */
+ TTree *fDigitTree;
+
+ /** Array of translated digits for each module */
+ AliHLTCaloDigitDataStruct **fDigits;
+
+ /** Number of digits in each module */
+ Int_t *fDigitsInModule;
+
+ /** Geometry class, must be initialised by child class */
+ AliHLTCaloGeometry *fGeometry;
+
+ /** The current event */
+ UInt_t fCurrentEvent;
+
+private:
+
+
+ /** Constructor Prohibited*/
+ AliHLTCaloDigitHandler();
+
+ /** Prohibited */
+ AliHLTCaloDigitHandler(const AliHLTCaloDigitHandler& );
+
+ /** Prohibited */
+ AliHLTCaloDigitHandler& operator=(const AliHLTCaloDigitHandler& );
+
+ ClassDef(AliHLTCaloDigitHandler, 0);
+};
+
+#endif // ALIHLTCALODIGITHANDLER_H
--- /dev/null
+// @(#) $Id$
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Primary Authors: Oystein Djuvsland <oysteind@ift.uib.no> *
+ * for The ALICE HLT Project. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/** @file AliHLTCaloDigitPublisherComponent.cxx
+ @author Oystein Djuvsland
+ @date
+ @brief Calo digit publisher component (input from offline).
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliHLTCaloDigitPublisherComponent.h"
+#include "AliRunLoader.h"
+#include "AliLog.h"
+#include "TTree.h"
+#include "AliHLTTPCDigitData.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTTPCFileHandler.h"
+#include "AliHLTCaloDigitDataStruct.h"
+#include "AliHLTCaloDefinitions.h"
+#include "offline/AliHLTEMCALDigitHandler.h"
+#include "offline/AliHLTPHOSDigitHandler.h"
+#include "AliHLTEMCALDefinitions.h"
+#include "AliHLTPHOSDefinitions.h"
+
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTCaloDigitPublisherComponent)
+
+AliHLTCaloDigitPublisherComponent gAliHLTCaloDigitPublisherComponent;
+
+AliHLTCaloDigitPublisherComponent::AliHLTCaloDigitPublisherComponent() : AliHLTOfflineDataSource()
+ ,fDigitHandler(0)
+ ,fSpecification(0)
+ ,fDataType(kAliHLTAnyDataType)
+ ,fModule(-1)
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTCaloDigitPublisherComponent::~AliHLTCaloDigitPublisherComponent()
+{
+ // see header file for class documentation
+ DoDeinit();
+}
+
+const char* AliHLTCaloDigitPublisherComponent::GetComponentID()
+{
+ // see header file for class documentation
+ return "CaloDigitPublisher";
+}
+
+AliHLTComponentDataType AliHLTCaloDigitPublisherComponent::GetOutputDataType()
+{
+ return fDataType;
+}
+
+void AliHLTCaloDigitPublisherComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ constBase=1000;
+ inputMultiplier=10;
+}
+
+AliHLTComponent* AliHLTCaloDigitPublisherComponent::Spawn()
+{
+ // see header file for class documentation
+ return new AliHLTCaloDigitPublisherComponent;
+}
+
+int AliHLTCaloDigitPublisherComponent::DoInit( int argc, const char** argv )
+{
+ // see header file for class documentation
+ // scan arguments
+ for (Int_t i = 0; i < argc; i++)
+ {
+ if (!strcmp(argv[i], "-detector"))
+ {
+ if (!strcmp(argv[i + 1], "EMCAL"))
+ {
+
+ fDigitHandler = AliHLTEMCALDigitHandler::Instance();
+ if (fDigitHandler) fDigitHandler->Init(AliRunLoader::Instance());
+ else
+ {
+ HLTFatal("Could not create EMCAL digit handler");
+ return -1;
+ }
+ fDataType = fDigitHandler->GetDataType();
+ }
+ else if (!strcmp(argv[i + 1], "PHOS"))
+ {
+ fDigitHandler = AliHLTPHOSDigitHandler::Instance();
+ if (fDigitHandler) fDigitHandler->Init(AliRunLoader::Instance());
+ else
+ {
+ HLTFatal("Could not create PHOS digit handler");
+ return -1;
+ }
+ fDataType = fDigitHandler->GetDataType();
+ }
+ }
+ if(!strcmp(argv[i], "-module"))
+ {
+ fModule = atoi(argv[i+1]);
+ }
+ if(!strcmp(argv[i], "-spec"))
+ {
+ fSpecification = atoi(argv[i+1]);
+ HLTDebug("Data specification: 0x%x", fSpecification);
+ }
+ }
+ return 0;
+}
+
+int AliHLTCaloDigitPublisherComponent::DoDeinit()
+{
+ // see header file for class documentation
+ int iResult=0;
+ return iResult;
+}
+
+int AliHLTCaloDigitPublisherComponent::GetEvent(const AliHLTComponentEventData& /*evtData*/,
+ AliHLTComponentTriggerData& /*trigData*/,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& osize,
+ vector<AliHLTComponentBlockData>& outputBlocks)
+{
+
+ // see header file for class documentation
+ int iResult=0;
+ AliHLTUInt32_t capacity=osize;
+ osize=0;
+
+ AliHLTCaloDigitDataStruct *digOut = reinterpret_cast<AliHLTCaloDigitDataStruct*>(outputPtr);
+
+ // process data events only
+ if (!IsDataEvent()) return 0;
+
+ if (outputPtr==NULL || capacity==0)
+ {
+ HLTError("no target buffer provided");
+ return -EFAULT;
+ }
+
+ int event=GetEventCount();
+
+ fDigitHandler->ProcessEvent(event);
+
+ Int_t nDigs = fDigitHandler->GetDigits(fModule, digOut);
+ if (nDigs > 0)
+ {
+ AliHLTComponentBlockData bd;
+ FillBlockData( bd );
+ bd.fOffset = 0;
+ bd.fSize = nDigs*sizeof(AliHLTCaloDigitDataStruct);
+ bd.fDataType = fDataType;
+ bd.fSpecification = fSpecification;
+ outputBlocks.push_back(bd);
+ }
+
+ return iResult;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// @(#) $Id$
+
+#ifndef ALIHLTCALODIGITPUBLISHERCOMPONENT_H
+#define ALIHLTCALODIGITPUBLISHERCOMPONENT_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 AliHLTCaloDigitPublisherComponent.h
+ @author Matthias Richter
+ @date
+ @brief TPC digit publisher component (input from offline).
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliHLTOfflineDataSource.h"
+
+class AliHLTCaloDigitHandler;
+class AliHLTTPCFileHandler;
+
+/**
+ * @class AliHLTCaloDigitPublisherComponent
+ * A digit publisher component for the TPC.
+ *
+ * Component ID: \b CaloDigitPublisher <br>
+ * Library: \b libAliHLTCalo.
+ *
+ * Mandatory arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * Optional arguments:<br>
+ *
+ *
+ * @ingroup alihlt_system
+ */
+class AliHLTCaloDigitPublisherComponent : public AliHLTOfflineDataSource {
+ public:
+ /** standard constructor */
+ AliHLTCaloDigitPublisherComponent();
+ /** destructor */
+ virtual ~AliHLTCaloDigitPublisherComponent();
+
+ /**
+ * Get the id of the component.
+ * Each component is identified by a unique id.
+ * The function is pure virtual and must be implemented by the child class.
+ * @return component id (string)
+ */
+ const char* GetComponentID();
+
+ /**
+ * Get the output data type of the component.
+ * The function is pure virtual and must be implemented by the child class.
+ * @return output data type
+ */
+ AliHLTComponentDataType GetOutputDataType();
+
+ /**
+ * Get a ratio by how much the data volume is shrinked or enhanced.
+ * The function is pure virtual and must be implemented by the child class.
+ * @param [out] constBase Additive part, independent of the input data volume.
+ * @param [out] inputMultiplier Multiplication ratio.
+ * @return values in the reference variables
+ */
+ void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+
+ /**
+ * Spawn function.
+ * Each component must implement a spawn function to create a new instance of
+ * the class. Basically the function must return <i>new <b>my_class_name</b></i>.
+ * @return new class instance
+ */
+ virtual AliHLTComponent* Spawn();
+
+ protected:
+
+ using AliHLTOfflineDataSource::GetEvent;
+
+ /**
+ * Init method.
+ */
+ int DoInit( int argc, const char** argv );
+
+ /**
+ * Deinit method.
+ */
+ int DoDeinit();
+
+ /**
+ * Data source method.
+ * @param [in] evtData event data structure
+ * @param [in] trigData trigger data structure
+ * @param [in] outputPtr pointer to target buffer
+ * @param [in,out] size <i>input</i>: size of target buffer
+ * <i>output</i>:size of produced data
+ * @param [in] outputBlocks list to receive output block descriptors
+ * @return neg. error code if failed
+ */
+ int GetEvent( const AliHLTComponentEventData& evtData,
+ AliHLTComponentTriggerData& trigData,
+ AliHLTUInt8_t* outputPtr,
+ AliHLTUInt32_t& size,
+ vector<AliHLTComponentBlockData>& outputBlocks );
+
+ private:
+
+ /** Digit handler */
+ AliHLTCaloDigitHandler *fDigitHandler;
+
+ /** Data specification */
+ AliHLTUInt32_t fSpecification;
+
+ /** Data type */
+ AliHLTComponentDataType fDataType;
+
+ /** Module number */
+ Int_t fModule;
+
+ /** copy constructor prohibited */
+ AliHLTCaloDigitPublisherComponent(const AliHLTCaloDigitPublisherComponent&);
+ /** assignment operator prohibited */
+ AliHLTCaloDigitPublisherComponent& operator=(const AliHLTCaloDigitPublisherComponent&);
+
+ ClassDef(AliHLTCaloDigitPublisherComponent, 0);
+};
+
+#endif