mapping tracker in the AliESD format
*/
+#include <cassert>
#include "AliHLTTPCEsdWriterComponent.h"
#include "AliESDEvent.h"
#include "AliESDtrack.h"
#include "AliHLTTPCTrackArray.h"
#include "AliHLTTPCTrackletDataFormat.h"
#include "AliHLTTPCDefinitions.h"
+#include "AliHLTTPCTransform.h"
/** global instance for component registration */
-AliHLTTPCEsdWriterComponent gTPCEsdWriter;
+AliHLTTPCEsdWriterComponent::AliWriter gTPCEsdWriter;
+AliHLTTPCEsdWriterComponent::AliConverter gTPCEsdConverter;
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTPCEsdWriterComponent)
AliHLTTPCEsdWriterComponent::AliHLTTPCEsdWriterComponent()
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCEsdWriterComponent::~AliHLTTPCEsdWriterComponent()
+{
+ // see header file for class documentation
+}
+
+AliHLTTPCEsdWriterComponent::AliWriter::AliWriter()
:
fTree(NULL),
- fESD(NULL)
+ fESD(NULL),
+ fBase(new AliHLTTPCEsdWriterComponent)
{
// see header file for class documentation
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
}
-AliHLTTPCEsdWriterComponent::~AliHLTTPCEsdWriterComponent()
+AliHLTTPCEsdWriterComponent::AliWriter::~AliWriter()
+{
+ // see header file for class documentation
+ if (fBase) delete fBase;
+ fBase=NULL;
+}
+
+void AliHLTTPCEsdWriterComponent::AliWriter::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
// see header file for class documentation
+ list.push_back(AliHLTTPCDefinitions::fgkTrackSegmentsDataType);
}
-int AliHLTTPCEsdWriterComponent::InitWriter()
+int AliHLTTPCEsdWriterComponent::AliWriter::InitWriter()
{
// see header file for class documentation
int iResult=0;
return iResult;
}
-int AliHLTTPCEsdWriterComponent::CloseWriter()
+int AliHLTTPCEsdWriterComponent::AliWriter::CloseWriter()
{
// see header file for class documentation
int iResult=0;
return iResult;
}
-int AliHLTTPCEsdWriterComponent::DumpEvent( const AliHLTComponentEventData& evtData,
+int AliHLTTPCEsdWriterComponent::AliWriter::DumpEvent( const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
AliHLTComponentTriggerData& /*trigData*/ )
{
// see header file for class documentation
int iResult=0;
TTree* pTree=fTree;
- if (pTree) {
+ assert(fBase);
+ if (pTree && fBase) {
if (fESD) {
AliESDEvent* pESD=fESD;
+ iResult=fBase->ProcessBlocks(pTree, pESD, blocks, (int)evtData.fBlockCnt);
+
+ } else {
+ iResult=-ENOMEM;
+ }
+ }
+ return iResult;
+}
+
+int AliHLTTPCEsdWriterComponent::AliWriter::ScanArgument(int argc, const char** argv)
+{
+ // see header file for class documentation
+ int iResult=AliHLTRootFileWriterComponent::ScanArgument(argc, argv);
+ return iResult;
+}
+
+int AliHLTTPCEsdWriterComponent::ProcessBlocks(TTree* pTree, AliESDEvent* pESD,
+ const AliHLTComponentBlockData* blocks,
+ int nBlocks, int* pMinSlice,
+ int* pMaxSlice)
+{
+ // see header file for class documentation
+ int iResult=0;
+ if (pTree && pESD && blocks) {
const AliHLTComponentBlockData* iter = NULL;
AliHLTTPCTrackletData* inPtr=NULL;
int bIsTrackSegs=0;
- for (int ndx=0; ndx<(int)evtData.fBlockCnt && iResult>=0; ndx++) {
+ for (int ndx=0; ndx<nBlocks && iResult>=0; ndx++) {
iter = blocks+ndx;
if ( (bIsTrackSegs=(iter->fDataType == AliHLTTPCDefinitions::fgkTrackSegmentsDataType))==1 ||
iter->fDataType == AliHLTTPCDefinitions::fgkTracksDataType ) {
// slice parameter and data specification ignored, tracks already in global coordinates
minslice=-1;
maxslice=-1;
+ if (pMinSlice) *pMinSlice=0;
+ if (pMaxSlice) *pMaxSlice=AliHLTTPCTransform::GetNSlice()-1;
+ } else {
+ if (pMinSlice && (*pMinSlice==-1 || *pMinSlice>minslice)) *pMinSlice=minslice;
+ if (pMaxSlice && (*pMaxSlice==-1 || *pMaxSlice<maxslice)) *pMaxSlice=maxslice;
}
//HLTDebug("dataspec %#x minslice %d", iter->fSpecification, minslice);
- if (minslice >=-1 && minslice<36) {
+ if (minslice >=-1 && minslice<AliHLTTPCTransform::GetNSlice()) {
if (minslice!=maxslice) {
HLTWarning("data from multiple sectors in one block: "
"possible missmatch in treatment of local coordinate system");
pTree->Fill();
}
- fESD->Reset();
- } else {
- iResult=-ENOMEM;
- }
+ pESD->Reset();
+
+ } else {
+ iResult=-EINVAL;
}
return iResult;
}
-int AliHLTTPCEsdWriterComponent::ScanArgument(int argc, const char** argv)
-{
- // see header file for class documentation
- int iResult=AliHLTRootFileWriterComponent::ScanArgument(argc, argv);
- return iResult;
-}
-
int AliHLTTPCEsdWriterComponent::Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD)
{
// see header file for class documentation
}
return iResult;
}
+
+AliHLTTPCEsdWriterComponent::AliConverter::AliConverter()
+ :
+ fBase(new AliHLTTPCEsdWriterComponent)
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCEsdWriterComponent::AliConverter::~AliConverter()
+{
+ // see header file for class documentation
+ if (fBase) delete fBase;
+ fBase=NULL;
+}
+
+void AliHLTTPCEsdWriterComponent::AliConverter::GetInputDataTypes(AliHLTComponentDataTypeList& list)
+{
+ // see header file for class documentation
+ list.push_back(AliHLTTPCDefinitions::fgkTrackSegmentsDataType);
+}
+
+AliHLTComponentDataType AliHLTTPCEsdWriterComponent::AliConverter::GetOutputDataType()
+{
+ // see header file for class documentation
+ return kAliHLTDataTypeESDTree;
+}
+
+void AliHLTTPCEsdWriterComponent::AliConverter::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
+{
+ // see header file for class documentation
+ constBase=1000000;
+ inputMultiplier=1.0;
+}
+
+int AliHLTTPCEsdWriterComponent::AliConverter::DoInit(int argc, const char** argv)
+{
+ // see header file for class documentation
+ return 0;
+}
+
+int AliHLTTPCEsdWriterComponent::AliConverter::DoDeinit()
+{
+ // see header file for class documentation
+ return 0;
+}
+
+int AliHLTTPCEsdWriterComponent::AliConverter::DoEvent(const AliHLTComponentEventData& evtData,
+ const AliHLTComponentBlockData* blocks,
+ AliHLTComponentTriggerData& /*trigData*/,
+ AliHLTUInt8_t* /*outputPtr*/,
+ AliHLTUInt32_t& /*size*/,
+ AliHLTComponentBlockDataList& /*outputBlocks*/ )
+{
+ // see header file for class documentation
+ int iResult=0;
+ assert(fBase);
+ AliESDEvent* pESD = new AliESDEvent;
+ if (pESD && fBase) {
+ pESD->CreateStdContent();
+ TTree* pTree = new TTree("esdTree", "Tree with HLT ESD objects");
+ if (pTree) {
+ pESD->WriteToTree(pTree);
+
+ if ((iResult=fBase->ProcessBlocks(pTree, pESD, blocks, (int)evtData.fBlockCnt))>=0) {
+ // TODO: set the specification correctly
+ iResult=PushBack(pTree, kAliHLTDataTypeESDTree|kAliHLTDataOriginTPC, 0);
+ }
+ delete pTree;
+ }
+ delete pESD;
+ }
+ return iResult;
+}
+
*/
#include "AliHLTRootFileWriterComponent.h"
+#include "AliHLTProcessor.h"
// forward declarations
class TTree;
* This class translates incoming track segments structures from the TPC
* conformal mapping tracker (datatype TRAKSEGS/TPC) or tracks in global
* coordinates from the AliHLTTPCGlobalMergerComponent (TRACKS/TPC) into
- * the ESD fromat and writes it to a ROOT file. In case of TRAKSEGS, the
- * component can only process data block containing data of one slice, but
- * it can read an unlimeted number of data blocks.
+ * the ESD format.
*
- * componentid: TPCEsdWriter <br>
- * componentlibrary libAliHLTTPC.so <br>
- * Arguments: <br>
+ * The \em TPCEsdWriter writes it to a ROOT file, the \em TPCEsdConverter
+ * to a TTree and sends the whole object to the output stream with data
+ * type @ref kAliHLTDataTypeESDTree and origin TPC.
+ *
+ * In case of TRAKSEGS, the component can only process data block containing
+ * data of one slice, but it can read an unlimeted number of data blocks.
+ *
+ * componentid: \b TPCEsdWriter <br>
+ * componentid: \b TPCEsdConverter <br>
+ * componentlibrary: \b libAliHLTTPC.so <br>
+ * Arguments TPCEsdWriter: <br>
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
* \li -datafile <i> filename </i> <br>
* file name base
* \li -directory <i> directory </i> <br>
* target directory
*
+ * Arguments TPCEsdConverter: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ * none
+ *
* <pre>
* Example usage (HLT configuration file):
* \<Proc ID="EsdWriter" type="prc">
*
* @see AliHLTFileWriter and AliHLTRootFileWriterComponent for more parameters
*/
-class AliHLTTPCEsdWriterComponent : public AliHLTRootFileWriterComponent
+class AliHLTTPCEsdWriterComponent : public AliHLTLogging
{
public:
/** standard constructor */
/** destructor */
~AliHLTTPCEsdWriterComponent();
+ /**
+ * class AliHLTTPCEsdWriterComponent::AliWriter
+ * The writer component of the AliHLTTPCEsdWriterComponent.
+ */
+ class AliWriter : public AliHLTRootFileWriterComponent
+ {
+ public:
+ /** standard constructor */
+ AliWriter();
+ /** destructor */
+ ~AliWriter();
+
/**
* The id of the component.
* @return component id (string)
*/
const char* GetComponentID() {return "TPCEsdWriter";};
+ void GetInputDataTypes(AliHLTComponentDataTypeList& list);
+
/**
* Spawn function.
* @return new class instance
*/
- AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent;}
+ AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliWriter;}
protected:
/**
* -EPROTO parameter for argument missing <br>
*/
int ScanArgument(int argc, const char** argv);
-
private:
/** copy constructor prohibited */
- AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
+ AliWriter(const AliWriter&);
/** assignment operator prohibited */
- AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
+ AliWriter& operator=(const AliWriter&);
/**
* Init the writer.
*/
int CloseWriter();
+ /** the ESD tree */
+ TTree* fTree; //! transient value
+
+ /** the ESD */
+ AliESDEvent* fESD; //! transient value
+
+ /** pointer to the basic ESD conversion methods */
+ AliHLTTPCEsdWriterComponent* fBase; //! transient value
+ };
+
+ /**
+ * class AliHLTTPCEsdWriterComponent::AliConverter
+ * The converter component of the AliHLTTPCEsdWriterComponent.
+ *
+ */
+ class AliConverter : public AliHLTProcessor
+ {
+ public:
+ /** standard constructor */
+ AliConverter();
+ /** destructor */
+ ~AliConverter();
+
+ // interface methods of base class
+ const char* GetComponentID() {return "TPCEsdConverter";};
+ void GetInputDataTypes(AliHLTComponentDataTypeList& list);
+ AliHLTComponentDataType GetOutputDataType();
+ void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
+ AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliConverter;}
+
+ protected:
+ // interface methods of base class
+ 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,
+ AliHLTComponentBlockDataList& outputBlocks );
+
+ using AliHLTProcessor::DoEvent;
+
+ private:
+ /** copy constructor prohibited */
+ AliConverter(const AliConverter&);
+ /** assignment operator prohibited */
+ AliConverter& operator=(const AliConverter&);
+
+ /** pointer to the basic ESD conversion methods */
+ AliHLTTPCEsdWriterComponent* fBase; //! transient value
+
+ };
+
+ protected:
+ /**
+ * Process the input data blocks.
+ * @param pTree tree to be filled
+ * @param pESD ESD to be filled
+ * @param blocks data block descriptor array
+ * @param nBlocks size of the array
+ * @param pMinSize [OUT] receives the minimum slice no
+ * @param pMaxSize [OUT] receives the maximum slice no
+ * @return neg. error code if failed
+ */
+ int ProcessBlocks(TTree* pTree, AliESDEvent* pESD, const AliHLTComponentBlockData* blocks,
+ int nBlocks, int* pMinSlice=NULL, int* pMaxSlice=NULL);
+
/**
* Covert tracks to AliTPCtracks (AliKalmanTracks) and add them to ESD.
* @param pTracks array of tracks
*/
int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD);
- /** the ESD tree */
- TTree* fTree; //! transient value
-
- /** the ESD */
- AliESDEvent* fESD; //! transient value
+ private:
+ /** copy constructor prohibited */
+ AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
+ /** assignment operator prohibited */
+ AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
ClassDef(AliHLTTPCEsdWriterComponent, 1)
};