3 #ifndef ALIHLTTPCDATAPUBLISHERCOMPONENT_H
4 #define ALIHLTTPCDATAPUBLISHERCOMPONENT_H
5 //* This file is property of and copyright by the *
6 //* ALICE Experiment at CERN, All rights reserved. *
7 //* See cxx source for full Copyright notice *
9 /// @file AliHLTTPCDataPublisherComponent.h
10 /// @author Matthias Richter
12 /// @brief Specific publisher for TPC raw data from the AliRawReader
15 #include "AliHLTRawReaderPublisherComponent.h"
16 #include "AliHLTTPCRawCluster.h"
19 class AliHLTTPCClusterMCLabel;
20 class AliHLTTPCClusterMCData;
21 class AliHLTTPCDataCompressionDecoder;
24 * @class AliHLTTPCDataPublisherComponent
25 * This component uses the functionality of AliHLTRawReaderPublisherComponent
26 * and overloads IsSelected and GetSpecificationFromEquipmentId. Blocks are
27 * only generated if the corresponding partition is missing in HLTOUT.
29 * It is used in an emulation chain which produces all compressed cluster
30 * blocks which are missing in HLTOUT. If TPC reconstruction requires HLT
31 * clusters, the emulator is automatically executed and the compressed
32 * data produced if raw data is available.
34 * <h2>General properties:</h2>
36 * Component ID: \b TPCRawReaderPublisher <br>
37 * Library: \b libAliHLTTPC.so <br>
38 * Input Data Types: <br>
39 * Output Data Types: <br>
41 * <h2>Mandatory arguments:</h2>
42 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
44 * <h2>Optional arguments:</h2>
45 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
47 * <h2>Configuration:</h2>
48 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
50 * <h2>Default CDB entries:</h2>
52 * <h2>Performance:</h2>
54 * <h2>Memory consumption:</h2>
56 * <h2>Output size:</h2>
61 class AliHLTTPCDataPublisherComponent : public AliHLTRawReaderPublisherComponent {
63 /// standard constructor
64 AliHLTTPCDataPublisherComponent();
66 ~AliHLTTPCDataPublisherComponent();
69 kPublisherModeDefault = 0,
70 kRegisterClusterBlocks= 0x1, // only register data blocks
71 kPublishClustersAll = 0x2, // unpack data blocks
72 kPublishRawAll = 0x4, // publish all raw data
73 kPublishRawFiltered = 0x8, // publish raw data filtered by existence of clusters
78 void SetMode(int mode) {fMode=mode;}
80 bool CheckMode(int flag) const {return (fMode&flag)==flag;}
82 /// inherited from AliHLTComponent: id of the component
83 virtual const char* GetComponentID();
85 /// inherited from AliHLTComponent: spawn function.
86 virtual AliHLTComponent* Spawn();
89 * @class AliRawClusterContainer
90 * Container of AliHLTTPCRawCluster, The class implements the interface to be
91 * used in the decoding of compressed TPC data.
92 * Data is decoded into an external buffer.
94 class AliRawClusterContainer : public AliHLTLogging {
96 AliRawClusterContainer();
97 virtual ~AliRawClusterContainer();
99 /// set/reset the external target buffer
100 int SetTargetBuffer(AliHLTUInt8_t* pBuffer, int size);
102 /// merge track model clusters into partition cluster blocks
105 /// fill block descriptors of extracted partition cluster blocks to target list
106 int CopyBlockDescriptors(AliHLTComponentBlockDataList& target) const;
107 /// get reference to block descriptor list
108 const AliHLTComponentBlockDataList& GetBlockDescriptors() const {
112 struct AliClusterIdBlock {
113 AliClusterIdBlock() : fIds(NULL), fSize(0) {}
114 AliHLTUInt32_t* fIds; //!
115 AliHLTUInt32_t fSize; //!
120 iterator() : fClusterNo(-1), fCluster(NULL), fClusterId(kAliHLTVoidDataSpec), fContainer(NULL) {}
121 iterator(AliRawClusterContainer* pContainer) : fClusterNo(-1), fCluster(NULL), fClusterId(kAliHLTVoidDataSpec), fContainer(pContainer) {}
122 iterator(const iterator& other) : fClusterNo(other.fClusterNo), fCluster(other.fCluster), fClusterId(other.fClusterId), fContainer(other.fContainer) {}
123 iterator& operator=(const iterator& other) {
124 if (this==&other) return *this;
125 fClusterNo=other.fClusterNo; fCluster=other.fCluster, fClusterId=other.fClusterId; fContainer=other.fContainer; return *this;
127 ~iterator() {fCluster=NULL; fContainer=NULL;}
129 void SetPadRow(int row) {if (fCluster) fCluster->SetPadRow(row);}
130 void SetPad(float pad) {if (fCluster) fCluster->SetPad(pad);}
131 void SetTime(float time) {if (fCluster) fCluster->SetTime(time);}
132 void SetSigmaY2(float sigmaY2) {if (fCluster) fCluster->SetSigmaY2(sigmaY2);}
133 void SetSigmaZ2(float sigmaZ2) {if (fCluster) fCluster->SetSigmaZ2(sigmaZ2);}
134 void SetCharge(unsigned charge) {if (fCluster) fCluster->SetCharge(charge);}
135 void SetQMax(unsigned qmax) {if (fCluster) fCluster->SetQMax(qmax);}
136 void SetMC(const AliHLTTPCClusterMCLabel* pMC) {
137 if (!fCluster || !pMC) return;
140 // switch to next cluster
141 iterator& Next(int slice, int partition);
144 int fClusterNo; //! cluster no in the current block
145 AliHLTTPCRawCluster* fCluster; //! pointer to current cluster
146 AliHLTUInt32_t fClusterId; //! id of the cluster, from optional cluster id blocks
147 AliRawClusterContainer* fContainer; // instance of container
150 /// legacy, to be removed later
151 iterator& BeginRemainingClusterBlock(int count, AliHLTUInt32_t specification) {
152 return BeginPartitionClusterBlock(count, specification);
154 /// iterator of partition clusters block of specification
155 iterator& BeginPartitionClusterBlock(int count, AliHLTUInt32_t specification);
156 /// iterator of track model clusters
157 iterator& BeginTrackModelClusterBlock(int count);
158 /// base method to start cluster iterator
159 iterator& ClusterIterator(int count, AliHLTComponentDataType dt, AliHLTUInt32_t specification, AliHLTTPCRawClusterData* &pData);
161 /// get block count, i.e. number of calls to create an iterator
162 int GetBlockCount() const {return fBlockCount;}
163 /// get number of decoded clusters
164 /// Note: only if there is enough space in the target buffer the clusters
165 // will be properly written
166 int GetClusterCount() const {return fTotalClusterCount;}
167 /// get the state of the cluster decoding
168 int GetState() const {return fState;}
171 virtual void Clear(Option_t * option="");
173 virtual void Print(Option_t *option=NULL) const;
176 AliHLTTPCRawCluster* NextCluster(int slice, int partition);
179 AliRawClusterContainer(const AliRawClusterContainer&);
180 AliRawClusterContainer& operator=(const AliRawClusterContainer&);
182 int fBlockCount; //! number of data blocks with clusters
183 int fTotalClusterCount; //! total number of decoded clusters
184 int fBlockClusterCount; //! number of decoded clusters in current block
185 AliHLTUInt8_t* fpBuffer; //! target buffer for decoded data
186 int fBufferSize; //! size of target buffer
187 AliHLTComponentBlockDataList fDescriptors; //! list of block descriptors
188 AliHLTTPCRawClusterData* fCurrentBlock; // current cluster block
189 AliHLTTPCRawClusterData* fTrackModelClusters; //! track model cluster block
190 vector<AliHLTUInt32_t> fTrackModelClusterMap; //! slice-partition map for track model clusters
191 iterator fIterator; //! iterator for filling of data
192 int fState; //! state
196 /// inherited from AliHLTDataSource: get one event
197 int GetEvent( const AliHLTComponentEventData& evtData,
198 AliHLTComponentTriggerData& trigData,
199 AliHLTUInt8_t* outputPtr,
200 AliHLTUInt32_t& size,
201 AliHLTComponentBlockDataList& outputBlocks );
203 /// inherited from AliHLTComponent: initialize
204 int DoInit( int argc, const char** argv );
206 /// inherited from AliHLTComponent: cleanup
209 /// inherited from AliHLTComponent: argument scan
210 int ScanConfigurationArgument(int argc, const char** argv);
212 /// read cluster from HLTOUT
213 int ReadClusterFromHLTOUT(AliRawClusterContainer* pContainer);
215 /// inherited from AliHLTRawReaderPublisherComponent: get specification
216 virtual int GetSpecificationFromEquipmentId(int id, AliHLTUInt32_t &specification) const;
218 /// inherited from AliHLTRawReaderPublisherComponent: check if a block is selected or not
219 virtual bool IsSelected(int equipmentId) const;
222 AliHLTTPCDataPublisherComponent(const AliHLTTPCDataPublisherComponent&);
223 AliHLTTPCDataPublisherComponent& operator=(const AliHLTTPCDataPublisherComponent&);
225 int fMode; //! operation mode
226 bool* fArraySelected; //! transient
227 AliRawClusterContainer* fClusters; // target for decoded clusters
228 AliHLTTPCDataCompressionDecoder* fpDecoder; // decoder for compressed cluster blocks
230 ClassDef(AliHLTTPCDataPublisherComponent, 0)
233 #endif //ALIHLTTPCDATAPUBLISHERCOMPONENT_H