- HLTOUT data handler base class extended, handler for AliRawReaderHLT data redi
rection added
- HLTOUT data handler added for TPC raw data
- ROOTFileWriter: added default file extension '.root'; documentation updated
- TPC macros corrected according to new parameters of slice tracker
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTModuleAgent)
-AliHLTModuleAgent::AliHLTModuleAgent()
+AliHLTModuleAgent::AliHLTModuleAgent(const char* id)
:
fpNext(NULL),
- fpComponentHandler(NULL)
+ fpComponentHandler(NULL),
+ fModuleId(id)
{
// see header file for class documentation
// or
Unregister(this);
}
+const char* AliHLTModuleAgent::GetModuleId() const
+{
+ // see header file for function documentation
+ return fModuleId.Data();
+}
+
void AliHLTModuleAgent::PrintStatus(const char* agent)
{
// see header file for function documentation
int AliHLTModuleAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
AliHLTUInt32_t /*spec*/,
- AliHLTOUTHandlerDesc* /*pDesc*/) const
+ AliHLTOUTHandlerDesc& /*desc*/) const
{
// default method, nothing to be done, child classes can overload
return 0;
* standard constructor. The agent is automatically registered in the
* global agent manager
*/
- AliHLTModuleAgent();
+ AliHLTModuleAgent(const char* id);
/** destructor */
virtual ~AliHLTModuleAgent();
+ /**
+ * Get module id.
+ * The module id is a string specifying the detector, or module. The
+ * library must follow the naming scheme \it libAliHLTModule.so, e.g.
+ * \it libAliHLTTPC.so if the module is 'TPC'
+ */
+ const char* GetModuleId() const;
+
/**
* Print status info.
* Short summary on registered agents. This function acts globally on the
AliHLTOUTHandlerDesc(AliHLTOUTHandlerType handlerType, AliHLTComponentDataType dt, const char* module)
: fHType(handlerType), fDt(dt), fModule(module) {}
+ AliHLTOUTHandlerDesc(const AliHLTOUTHandlerDesc& src)
+ : fHType(src.fHType), fDt(src.fDt), fModule(src.fModule) {}
+
+ const AliHLTOUTHandlerDesc& operator=(const AliHLTOUTHandlerDesc& src) {
+ fHType=src.fHType; fDt=src.fDt; fModule=src.fModule;
+ }
+
~AliHLTOUTHandlerDesc() {}
private:
* Get handler description for a data block.
* @param dt [in] data type of the block
* @param spec [in] specification of the block
- * @param pDesc [out] handler description
+ * @param desc [out] handler description
* @return 1 if the agent can provide a handler, 0 if not
*/
virtual int GetHandlerDescription(AliHLTComponentDataType dt,
AliHLTUInt32_t spec,
- AliHLTOUTHandlerDesc* pDesc) const;
+ AliHLTOUTHandlerDesc& pDesc) const;
/**
* Get handler for a data block of the HLTOUT data.
protected:
private:
+ /** standard constructor prohibited */
+ AliHLTModuleAgent();
/** copy constructor prohibited */
AliHLTModuleAgent(const AliHLTModuleAgent&);
/** assignment operator prohibited */
/** number of agents */
static int fCount; //! transient
- /* instance of the active component handler */
+ /** instance of the active component handler */
AliHLTComponentHandler* fpComponentHandler; //! transient
- ClassDef(AliHLTModuleAgent, 2);
+ /** id of the module */
+ TString fModuleId; //! transient
+
+ ClassDef(AliHLTModuleAgent, 3);
};
#endif
return iResult;
}
+AliHLTOUTHandler* AliHLTOUT::GetHandler()
+{
+ // see header file for class documentation
+ AliHLTOUTHandler* pHandler=NULL;
+ pHandler=FindHandlerDesc(GetDataBlockIndex());
+ return pHandler;
+}
+
int AliHLTOUT::AddBlockDescriptor(const AliHLTOUTBlockDescriptor desc)
{
// see header file for class documentation
if ((iResult=GetDataBlockDescription(dt, spec))<0) break;
for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent(); pAgent && iResult>=0; pAgent=AliHLTModuleAgent::GetNextAgent()) {
AliHLTModuleAgent::AliHLTOUTHandlerDesc handlerDesc;
- if (pAgent->GetHandlerDescription(dt, spec, &handlerDesc)>0) {
+ if (pAgent->GetHandlerDescription(dt, spec, handlerDesc)>0) {
AliHLTOUTHandlerListEntry entry(pAgent->GetOutputHandler(dt, spec), handlerDesc, pAgent, GetDataBlockIndex());
iResult=InsertHandler(entry);
remnants.pop_back();
return iResult;
}
+AliHLTOUT::AliHLTOUTHandlerListEntry AliHLTOUT::FindHandlerDesc(AliHLTUInt32_t blockIndex)
+{
+ // see header file for class documentation
+ int iResult=0;
+ vector<AliHLTOUTHandlerListEntry>::iterator element=fDataHandlers.begin();
+ while (element!=fDataHandlers.end()) {
+ if (element->HasIndex(blockIndex)) {
+ return *element;
+ }
+ element++;
+ }
+ return AliHLTOUT::AliHLTOUTHandlerListEntry::fgkVoidHandlerListEntry;
+}
+
+AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry()
+ :
+ fpHandler(NULL),
+ fpHandlerDesc(NULL),
+ fpAgent(NULL),
+ fBlocks()
+{
+ // see header file for class documentation
+}
+
AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry(AliHLTOUTHandler* pHandler,
AliHLTModuleAgent::AliHLTOUTHandlerDesc& handlerDesc,
AliHLTModuleAgent* pAgent,
AliHLTUInt32_t index)
:
fpHandler(pHandler),
- fHandlerDesc(handlerDesc),
+ fpHandlerDesc(new AliHLTModuleAgent::AliHLTOUTHandlerDesc),
fpAgent(pAgent),
fBlocks()
{
// see header file for class documentation
+ *fpHandlerDesc=handlerDesc;
fBlocks.push_back(index);
}
AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry(const AliHLTOUTHandlerListEntry& src)
:
fpHandler(src.fpHandler),
- fHandlerDesc(src.fHandlerDesc),
+ fpHandlerDesc(new AliHLTModuleAgent::AliHLTOUTHandlerDesc),
fpAgent(src.fpAgent),
fBlocks()
{
// see header file for class documentation
+ *fpHandlerDesc=*src.fpHandlerDesc;
fBlocks.assign(src.fBlocks.begin(), src.fBlocks.end());
}
AliHLTOUT::AliHLTOUTHandlerListEntry::~AliHLTOUTHandlerListEntry()
{
// see header file for class documentation
+ if (fpHandlerDesc) delete fpHandlerDesc;
+ fpHandlerDesc=NULL;
}
AliHLTOUT::AliHLTOUTHandlerListEntry& AliHLTOUT::AliHLTOUTHandlerListEntry::operator=(const AliHLTOUTHandlerListEntry& src)
{
// see header file for class documentation
fpHandler=src.fpHandler;
- fHandlerDesc=src.fHandlerDesc;
+ *fpHandlerDesc=*src.fpHandlerDesc;
fpAgent=src.fpAgent;
fBlocks.assign(src.fBlocks.begin(), src.fBlocks.end());
return *this;
// see header file for class documentation
fBlocks.push_back(index);
}
+
+const AliHLTOUT::AliHLTOUTHandlerListEntry AliHLTOUT::AliHLTOUTHandlerListEntry::fgkVoidHandlerListEntry;
*/
int ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer);
+ /**
+ * Get handler for the selected data block.
+ */
+ AliHLTOUTHandler* GetHandler();
+
/**
* Locking guard for the AliHLTOUT object.
* If the object is locked, the selection of data blocks can not be changed.
~AliHLTOUTHandlerListEntry();
+ static const AliHLTOUTHandlerListEntry fgkVoidHandlerListEntry;
+
operator AliHLTOUTHandler*() const {return fpHandler;}
- operator AliHLTModuleAgent::AliHLTOUTHandlerDesc&() {return fHandlerDesc;}
+ operator AliHLTModuleAgent::AliHLTOUTHandlerDesc&() {return *fpHandlerDesc;}
operator AliHLTModuleAgent*() const {return fpAgent;}
bool operator==(const AliHLTOUTHandlerListEntry& entry) const;
void AddIndex(AliHLTUInt32_t index);
+ bool HasIndex(AliHLTUInt32_t index);
+
private:
/** standard constructor prohibited */
AliHLTOUTHandlerListEntry();
AliHLTOUTHandler* fpHandler; //! transient
/** pointer to handler description */
- AliHLTModuleAgent::AliHLTOUTHandlerDesc& fHandlerDesc; //! transient
+ AliHLTModuleAgent::AliHLTOUTHandlerDesc* fpHandlerDesc; //! transient
/** pointer to module agent */
AliHLTModuleAgent* fpAgent; //! transient
/** list of block indexes */
AliHLTOUTIndexList fBlocks; //!transient
};
-
+
/**
* Generate the index of the HLTOUT data.
* Must be implemented by the child classes.
*/
int InsertHandler(const AliHLTOUTHandlerListEntry &entry);
+ /**
+ * Find handler description for a certain block index.
+ */
+ AliHLTOUTHandlerListEntry FindHandlerDesc(AliHLTUInt32_t blockIndex);
+
/** data type for the current block search, set from @ref SelectFirstDataBlock */
AliHLTComponentDataType fSearchDataType; //!transient
// $Id$
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project *
- * ALICE Experiment at CERN, All rights reserved. *
- * *
- * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
- * for The ALICE HLT Project. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* for The ALICE HLT Project. *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
/** @file AliHLTOUTHandler.cxx
@author Matthias Richter
@date
- @brief Base class implementation of HLTOUT handlers. */
-
- // see header file for class documentation
- // or
- // refer to README to build package
- // or
- // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+ @brief Base class implementation of HLTOUT handlers.
+*/
#include "AliHLTOUTHandler.h"
}
AliHLTOUTHandler::~AliHLTOUTHandler()
-{
+{
+ // see header file for class documentation
+}
+
+int AliHLTOUTHandler::GetProcessedData(const AliHLTUInt8_t* &pData)
+{
+ // see header file for class documentation
+ pData=NULL;
+ return 0;
+}
+
+int AliHLTOUTHandler::ReleaseProcessedData(const AliHLTUInt8_t* pData, int size)
+{
// see header file for class documentation
+ return 0;
}
/** standard destructor */
virtual ~AliHLTOUTHandler();
- protected:
-
/**
* Process the data.
+ * The data and it's properties can be retrieved by the following member
+ * functions of AliHLTOUT:
+ * - AliHLTOUT::GetDataBlockDescription(AliHLTComponentDataType& dt, AliHLTUInt32_t& spec)
+ * - AliHLTOUT::GetDataBlockIndex()
+ * - AliHLTOUT::GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size)
+ * - AliHLTOUT::ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer)
+ *
+ * The handler might decode the data block and produce new data as a
+ * replacement, see GetProcessedData()
+ * @param pData instance of the AliHLTOUT data
+ * @return depending on the overloaded function, neg. error code if failed
*/
virtual int ProcessData(AliHLTOUT* pData) = 0;
+ /**
+ * Get the output data, if available.
+ * Some of the handlers might produce data to replace the original data
+ * block. The handler must ensure the internal storage of the buffer and
+ * is also responsible for cleaning the buffer. The buffer must be valid
+ * until the next call of ProcessData() or ReleaseProcessedData().
+ *
+ * The default implementation just returns a NULL pointer to indicate
+ * 'no data'.
+ * @param pData target to receive data pointer
+ * @return size of the buffer
+ */
+ virtual int GetProcessedData(const AliHLTUInt8_t* &pData);
+
+ /**
+ * Release the buffer of processed data.
+ * The handler implementation can do cleanup here.
+ * @param pData pointer to buffer
+ * @param size size of the buffer
+ * @return neg. error code if failed
+ */
+ virtual int ReleaseProcessedData(const AliHLTUInt8_t* pData, int size);
+
+ protected:
+
private:
/** copy constructor prohibited */
AliHLTOUTHandler(const AliHLTOUTHandler&);
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* for The ALICE HLT Project. *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/** @file AliHLTOUTHandlerEquId.cxx
+ @author Matthias Richter
+ @date
+ @brief HLTOUT handler returning equipment id from data type and spec.
+*/
+
+#include "AliHLTOUTHandlerEquId.h"
+#include "AliHLTOUT.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTOUTHandlerEquId)
+
+AliHLTOUTHandlerEquId::AliHLTOUTHandlerEquId()
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTOUTHandlerEquId::~AliHLTOUTHandlerEquId()
+{
+ // see header file for class documentation
+}
+
+int AliHLTOUTHandlerEquId::ProcessData(AliHLTOUT* pData)
+{
+ // see header file for class documentation
+ if (!pData) return -EINVAL;
+ AliHLTComponentDataType dt=kAliHLTVoidDataType;
+ AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+ int iResult=pData->GetDataBlockDescription(dt, spec);
+ if (iResult>=0) {
+ iResult=(int)spec;
+ }
+ return iResult;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+#ifndef ALIHLTOUTHANDLEREQUID_H
+#define ALIHLTOUTHANDLEREQUID_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 AliHLTOUTHandlerEquId.h
+ @author Matthias Richter
+ @date
+ @brief HLTOUT handler returning equipment id from data type and spec.
+*/
+
+#include "AliHLTOUTHandler.h"
+
+/**
+ * @class AliHLTOUTHandlerEquId
+ * HLT output handler returning equipment ids for redirection of data blocks
+ * of the HLTOUT stream to the original detector streams.
+ *
+ * The class introduces a layer in the HLTOUT handler hierarchy in order to
+ * collect all handlers which can be used by the AliRawReaderHLT for
+ * redirection of HLTOUT data blocks and replacement of original detector
+ * data. The common denominator of all those handlers is the data format.
+ * The data block itsself or the decoded data produced by the handler have
+ * exactly the detector raw data format. Thus, the data streams can be
+ * transparently replaced in the AliRoot reconstruction.
+ *
+ * The handler might produce decoded data from the data block in order
+ * the get the right data format. The AliRawReaderHLT will try to fetch
+ * those data by calling AliHLTOUTHandler::GetProcessedData(). If no data
+ * is provided, the input block itsself is treated as the data to redirect.
+ */
+class AliHLTOUTHandlerEquId : public AliHLTOUTHandler {
+ public:
+ /** standard constructor */
+ AliHLTOUTHandlerEquId();
+ /** standard destructor */
+ virtual ~AliHLTOUTHandlerEquId();
+
+ /**
+ * Process a data block.
+ * The handler retrieves the data and it's properties and derives the
+ * equipment id from it. The default behavior returns the specification as
+ * equipment id and does not touch the data itsself.
+ * @return equipment id the block should be used for.
+ */
+ virtual int ProcessData(AliHLTOUT* pData);
+
+ private:
+ /** copy constructor prohibited */
+ AliHLTOUTHandlerEquId(const AliHLTOUTHandlerEquId&);
+ /** assignment operator prohibited */
+ AliHLTOUTHandlerEquId& operator=(const AliHLTOUTHandlerEquId&);
+
+ ClassDef(AliHLTOUTHandlerEquId, 0)
+};
+#endif
ClassImp(AliHLTAgentUtil)
AliHLTAgentUtil::AliHLTAgentUtil()
+ :
+ AliHLTModuleAgent("Util")
{
// see header file for class documentation
// or
*/
int CheckMode(Short_t mode) const;
+ /**
+ * Get the currently set file extension.
+ */
+ TString GetExtension() {return fExtension;}
+
+ /**
+ * Set the file extension.
+ */
+ void SetExtension(const char* extension) {fExtension=extension!=NULL?extension:"";}
+
/**
* Working modes of the writer
* @internal
#include "AliHLTRootFileWriterComponent.h"
#include "TFile.h"
#include "TString.h"
+#include "TObjectTable.h" // for root object validity
/** the global object for component registration */
AliHLTRootFileWriterComponent gAliHLTRootFileWriterComponent;
SetMode(kConcatenateBlocks);
}
-AliHLTRootFileWriterComponent::AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&)
- :
- AliHLTFileWriter(),
- fEventID(kAliHLTVoidEventID),
- fCurrentFile(NULL)
+AliHLTRootFileWriterComponent::~AliHLTRootFileWriterComponent()
{
// see header file for class documentation
- HLTFatal("copy constructor untested");
}
-AliHLTRootFileWriterComponent& AliHLTRootFileWriterComponent::operator=(const AliHLTRootFileWriterComponent&)
+int AliHLTRootFileWriterComponent::InitWriter()
{
// see header file for class documentation
- HLTFatal("assignment operator untested");
- return *this;
-}
-AliHLTRootFileWriterComponent::~AliHLTRootFileWriterComponent()
-{
- // see header file for class documentation
+ // choose .root as default extension
+ if (GetExtension().IsNull()) SetExtension("root");
+ return 0;
}
int AliHLTRootFileWriterComponent::CloseWriter()
* The RootFileWriter provides a stand alone component to write incoming
* TObject like structures into a Root file. Furthermore it functions as
* base class for customized writers.
- * @see AliHLTFileWriter for parameters
+ *
+ * Component ID: \b ROOTFileWriter <br>
+ * Library: \b libAliHLTUtil.so
+ *
+ * Mandatory arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ *
+ * Optional arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ *
+ * See AliHLTFileWriter for full list of arguments.
*/
class AliHLTRootFileWriterComponent : public AliHLTFileWriter
{
public:
/** standard constructor */
AliHLTRootFileWriterComponent();
- /** not a valid copy constructor, defined according to effective C++ style */
- AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&);
- /** not a valid assignment op, but defined according to effective C++ style */
- AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&);
/** destructor */
virtual ~AliHLTRootFileWriterComponent();
virtual AliHLTComponent* Spawn() {return new AliHLTRootFileWriterComponent;}
protected:
- /**
- * Close the writer.
- * Cleanup and others.
- */
+ // interface functions
+ int InitWriter();
int CloseWriter();
/**
/** the name of the current file */
TFile* fCurrentFile; //! transient value
+private:
+ /** copy constructor prohibited */
+ AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&);
+ /** assignment operator prohibited */
+ AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&);
ClassDef(AliHLTRootFileWriterComponent, 0)
};
ClassImp(AliHLTMUONAgent);
-AliHLTMUONAgent::AliHLTMUONAgent() : AliHLTModuleAgent()
+AliHLTMUONAgent::AliHLTMUONAgent() : AliHLTModuleAgent("MUON")
{
///
/// Default constructor.
ClassImp(AliHLTRCUAgent)
AliHLTRCUAgent::AliHLTRCUAgent()
+ :
+ AliHLTModuleAgent("RCU")
{
// see header file for class documentation
// or
ClassImp(AliHLTAgentSample)
AliHLTAgentSample::AliHLTAgentSample()
+ :
+ AliHLTModuleAgent("Sample")
{
// see header file for class documentation
// or
#include "AliHLTTPCAgent.h"
#include "AliHLTConfiguration.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTOUT.h"
/** global instance for agent registration */
AliHLTTPCAgent gAliHLTTPCAgent;
ClassImp(AliHLTTPCAgent)
AliHLTTPCAgent::AliHLTTPCAgent()
+ :
+ AliHLTModuleAgent("TPC"),
+ fRawDataHandler(NULL),
+ fNofRawDataHandler(0)
{
// see header file for class documentation
// or
return 0;
}
+
+int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
+ AliHLTUInt32_t spec,
+ AliHLTOUTHandlerDesc& desc) const
+{
+ // see header file for class documentation
+ if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
+ int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
+ int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
+ if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
+ part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
+ desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
+ return 1;
+ } else {
+ HLTWarning("handler can not process merged data from multiple ddls:"
+ " min slice %d, max slice %d, min part %d, max part %d",
+ slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
+ part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
+ return 0;
+ }
+ }
+ return 0;
+}
+
+AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
+ AliHLTUInt32_t spec)
+{
+ // see header file for class documentation
+ if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
+ if (!fRawDataHandler) {
+ fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
+ }
+ fNofRawDataHandler++;
+ return fRawDataHandler;
+ }
+ return NULL;
+}
+
+int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
+{
+ // see header file for class documentation
+ if (pInstance==NULL) return -EINVAL;
+
+ if (pInstance==fRawDataHandler) {
+ if (--fNofRawDataHandler<=0) {
+ delete fRawDataHandler;
+ fRawDataHandler=NULL;
+ }
+ }
+ return 0;
+}
+
+AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
+{
+ // see header file for class documentation
+}
+
+AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
+{
+ // see header file for class documentation
+}
+
+int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
+{
+ // see header file for class documentation
+ if (!pData) return -EINVAL;
+ AliHLTComponentDataType dt=kAliHLTVoidDataType;
+ AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+ int iResult=pData->GetDataBlockDescription(dt, spec);
+ if (iResult>=0) {
+ int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
+ int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
+ if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
+ part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
+ iResult=768;
+ if (part>1) iResult+=72+4*slice+(part-2);
+ else iResult+=2*slice+part;
+ } else {
+ HLTError("handler can not process merged data from multiple ddls:"
+ " min slice %d, max slice %d, min part %d, max part %d",
+ slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
+ part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
+ iResult=-EBADMSG;
+ }
+ }
+ return iResult;
+}
*/
#include "AliHLTModuleAgent.h"
+#include "AliHLTOUTHandlerEquId.h"
/**
* @class AliHLTTPCAgent
* @param pHandler [in] instance of the component handler
*/
int RegisterComponents(AliHLTComponentHandler* pHandler) const;
+
+ /**
+ * Get handler decription for TPC data in the HLTOUT data stream.
+ * @param dt [in] data type of the block
+ * @param spec [in] specification of the block
+ * @param pDesc [out] handler description
+ * @return 1 if the agent can provide a handler, 0 if not
+ */
+ int GetHandlerDescription(AliHLTComponentDataType dt,
+ AliHLTUInt32_t spec,
+ AliHLTOUTHandlerDesc& desc) const;
+
+ /**
+ * Get specific handler for TPC data in the HLTOUT data stream.
+ * @param dt [in] data type of the block
+ * @param spec [in] specification of the block
+ * @return pointer to handler
+ */
+ AliHLTOUTHandler* GetOutputHandler(AliHLTComponentDataType dt,
+ AliHLTUInt32_t spec);
+
+ /**
+ * Delete an HLTOUT handler.
+ * @param pInstance pointer to handler
+ */
+ int DeleteOutputHandler(AliHLTOUTHandler* pInstance);
+
+ /**
+ * The handler for TPC RAW data in the HLTOUT stream.
+ */
+ class AliHLTTPCRawDataHandler : public AliHLTOUTHandlerEquId {
+ public:
+ /** constructor */
+ AliHLTTPCRawDataHandler();
+ /** destructor */
+ ~AliHLTTPCRawDataHandler();
+
+ /**
+ * Process a data block.
+ * Decode specification and return equipment id of the data block.
+ * The data itsself i untouched.
+ * @return equipment id the block should be used for.
+ */
+ int ProcessData(AliHLTOUT* pData);
+
+ private:
+
+ };
+
protected:
private:
- ClassDef(AliHLTTPCAgent, 0);
+ /** copy constructor prohibited */
+ AliHLTTPCAgent(const AliHLTTPCAgent&);
+ /** assignment operator prohibited */
+ AliHLTTPCAgent& operator=(const AliHLTTPCAgent&);
+
+ /** handler for TPC raw data in the HLTOUT stream */
+ AliHLTTPCRawDataHandler* fRawDataHandler; //!transient
+ /** nof requests for TPC raw data handler */
+ int fNofRawDataHandler; //!transient
+
+ ClassDef(AliHLTTPCAgent, 1);
};
#endif
TString tracker;
// tracker finder components
tracker.Form("TR_%02d", slice);
- AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "pp-run bfield 0.5");
+ AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
if (mergerInput.Length()>0) mergerInput+=" ";
mergerInput+=tracker;
TString tracker;
// tracker components
tracker.Form("TR_%02d", slice);
- AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "pp-run bfield 0.5");
+ AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
//add all trackers to writer input. Include if you would like all slice tracks written.
//if (writerInput.Length()>0) writerInput+=" ";
ClassImp(AliHLTCompAgent)
AliHLTCompAgent::AliHLTCompAgent()
+ :
+ AliHLTModuleAgent("Comp")
{
// see header file for class documentation
// or
AliHLTOUT.h \
AliHLTOUTHomerBuffer.h \
AliHLTOUTHandler.h \
+ AliHLTOUTHandlerEquId.h \
AliHLTMemoryFile.h \
AliHLTMessage.h
#include "AliRawReaderHLT.h"
#include "AliHLTOUTRawReader.h"
#include "AliHLTModuleAgent.h"
+#include "AliHLTOUTHandler.h"
+#include "AliHLTOUTHandlerEquId.h"
#include "AliLog.h"
#include "AliDAQ.h" // RAW, for detector names and equipment ids
#include "TObjString.h"
fEquipmentId(-1),
fbHaveHLTData(false),
fDetectors(),
- fpHLTOUT(NULL)
+ fpHLTOUT(NULL),
+ fpDataHandler(NULL)
{
// see header file for class documentation
// or
AliRawReaderHLT::~AliRawReaderHLT()
{
// see header file for class documentation
+ if (fpHLTOUT) {
+ if (fpDataHandler) fpDataHandler->ReleaseProcessedData(fpData, fDataSize);
+ else fpHLTOUT->ReleaseDataBuffer(fpData);
+ fpDataHandler=NULL;
+ delete fpHLTOUT;
+ fpHLTOUT=NULL;
+ }
}
UInt_t AliRawReaderHLT::GetType() const
}
fbHaveHLTData=detector!=fDetectors.end();
}
+
+ if (fpHLTOUT) {
+ if (fpDataHandler) fpDataHandler->ReleaseProcessedData(fpData, fDataSize);
+ else fpHLTOUT->ReleaseDataBuffer(fpData);
+ fpDataHandler=NULL;
+ delete fpHLTOUT;
+ fpHLTOUT=NULL;
+ }
+
return result;
}
}
}
} else {
- fpHLTOUT->ReleaseDataBuffer(fpData);
+ // first release the data buffer
+ if (fpDataHandler) fpDataHandler->ReleaseProcessedData(fpData, fDataSize);
+ else fpHLTOUT->ReleaseDataBuffer(fpData);
+ fpDataHandler=NULL;
if (!(result=fpHLTOUT->SelectNextDataBlock()>=0)) {
delete fpHLTOUT;
fpHLTOUT=NULL;
}
}
if (result) {
+ AliHLTComponentDataType dt=kAliHLTVoidDataType;
+ AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+ fpHLTOUT->GetDataBlockDescription(dt, spec);
AliHLTUInt32_t size=0;
- result=fpHLTOUT->GetDataBuffer(fpData, size)>=0;
- fDataSize=(int)size;
- fEquipmentId=-1;
+ AliHLTOUTHandler* pHandler=fpHLTOUT->GetHandler();
+ if (pHandler) {
+ if (dynamic_cast<AliHLTOUTHandlerEquId*>(pHandler)!=NULL) {
+ AliHLTOUT::AliHLTOUTLockGuard g(fpHLTOUT);
+ fEquipmentId=pHandler->ProcessData(fpHLTOUT);
+ fpData=NULL;
+ fDataSize=pHandler->GetProcessedData(fpData);
+ if (!fpData) {
+ result=fpHLTOUT->GetDataBuffer(fpData, size)>=0;
+ AliDebug(AliLog::kDebug, Form("forward data block from HLTOUT stream to equipment %d", fEquipmentId));
+ fDataSize=(int)size;
+ } else {
+ // remember the current handler in order to properly release the data buffer
+ fpDataHandler=pHandler;
+ AliDebug(AliLog::kDebug, Form("forward decoded data block provided by handler to equipment %d", fEquipmentId));
+ }
+ } else {
+ AliError(Form("handler is not of type AliHLTOUTHandlerEquId for block %x data type %s spec %#x; data block skipped",
+ fpHLTOUT->GetDataBlockIndex(), AliHLTComponent::DataType2Text(dt).c_str(), spec));
+ }
+ } else {
+ AliWarning(Form("no data handler found for block %x data type %s spec %#x; data block skipped",
+ fpHLTOUT->GetDataBlockIndex(), AliHLTComponent::DataType2Text(dt).c_str(), spec));
+ }
} else {
fpData=NULL;
fDataSize=0;
#include <vector>
class AliHLTOUT;
+class AliHLTOUTHandler;
+
/**
* @class AliRawReaderHLT
* Handler of HLTOUT data for AliRawReader input.
/** instance of the HLTOUT handler */
AliHLTOUT* fpHLTOUT; // !transient
- ClassDef(AliRawReaderHLT, 1)
+ /** instance of the data handler providing the current data buffer */
+ AliHLTOUTHandler* fpDataHandler; // !transient
+
+ ClassDef(AliRawReaderHLT, 2)
};
#define ALIHLTREC_LIBRARY "libHLTrec.so"
ClassImp(AliHLTAgentSim)
AliHLTAgentSim::AliHLTAgentSim()
+ :
+ AliHLTModuleAgent("sim")
{
// see header file for class documentation
// or