]>
Commit | Line | Data |
---|---|---|
686d5523 | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
d60d120c | 3 | #ifndef ALIHLTTPCDATAPUBLISHERCOMPONENT_H |
4 | #define ALIHLTTPCDATAPUBLISHERCOMPONENT_H | |
f652dd4a | 5 | //* This file is property of and copyright by the * |
686d5523 | 6 | //* ALICE Experiment at CERN, All rights reserved. * |
7 | //* See cxx source for full Copyright notice * | |
8 | ||
d60d120c | 9 | /// @file AliHLTTPCDataPublisherComponent.h |
686d5523 | 10 | /// @author Matthias Richter |
11 | /// @date 2011-11-18 | |
12 | /// @brief Specific publisher for TPC raw data from the AliRawReader | |
13 | /// | |
14 | ||
15 | #include "AliHLTRawReaderPublisherComponent.h" | |
f652dd4a | 16 | #include "AliHLTTPCRawCluster.h" |
686d5523 | 17 | #include <map> |
18 | ||
f652dd4a | 19 | class AliHLTTPCClusterMCLabel; |
20 | class AliHLTTPCClusterMCData; | |
21 | class AliHLTTPCDataCompressionDecoder; | |
22 | ||
686d5523 | 23 | /** |
d60d120c | 24 | * @class AliHLTTPCDataPublisherComponent |
686d5523 | 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. | |
28 | * | |
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. | |
33 | * | |
34 | * <h2>General properties:</h2> | |
35 | * | |
36 | * Component ID: \b TPCRawReaderPublisher <br> | |
37 | * Library: \b libAliHLTTPC.so <br> | |
38 | * Input Data Types: <br> | |
39 | * Output Data Types: <br> | |
40 | * | |
41 | * <h2>Mandatory arguments:</h2> | |
42 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
43 | * | |
44 | * <h2>Optional arguments:</h2> | |
45 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
46 | ||
47 | * <h2>Configuration:</h2> | |
48 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
49 | * | |
50 | * <h2>Default CDB entries:</h2> | |
51 | * | |
52 | * <h2>Performance:</h2> | |
53 | * | |
54 | * <h2>Memory consumption:</h2> | |
55 | * | |
56 | * <h2>Output size:</h2> | |
57 | * | |
58 | * | |
59 | * @ingroup alihlt_tpc | |
60 | */ | |
d60d120c | 61 | class AliHLTTPCDataPublisherComponent : public AliHLTRawReaderPublisherComponent { |
686d5523 | 62 | public: |
63 | /// standard constructor | |
d60d120c | 64 | AliHLTTPCDataPublisherComponent(); |
686d5523 | 65 | /// destructor |
d60d120c | 66 | ~AliHLTTPCDataPublisherComponent(); |
686d5523 | 67 | |
749f85ed | 68 | enum { |
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 | |
74 | kLastContainerMode | |
75 | }; | |
76 | ||
77 | /// set mode | |
78 | void SetMode(int mode) {fMode=mode;} | |
79 | ||
80 | bool CheckMode(int flag) const {return (fMode&flag)==flag;} | |
81 | ||
686d5523 | 82 | /// inherited from AliHLTComponent: id of the component |
83 | virtual const char* GetComponentID(); | |
84 | ||
85 | /// inherited from AliHLTComponent: spawn function. | |
86 | virtual AliHLTComponent* Spawn(); | |
87 | ||
f652dd4a | 88 | /** |
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. | |
93 | */ | |
94 | class AliRawClusterContainer : public AliHLTLogging { | |
95 | public: | |
96 | AliRawClusterContainer(); | |
97 | virtual ~AliRawClusterContainer(); | |
98 | ||
99 | /// set/reset the external target buffer | |
100 | int SetTargetBuffer(AliHLTUInt8_t* pBuffer, int size); | |
101 | ||
102 | /// merge track model clusters into partition cluster blocks | |
103 | int Sort(); | |
104 | ||
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 { | |
109 | return fDescriptors; | |
110 | } | |
111 | ||
112 | struct AliClusterIdBlock { | |
113 | AliClusterIdBlock() : fIds(NULL), fSize(0) {} | |
114 | AliHLTUInt32_t* fIds; //! | |
115 | AliHLTUInt32_t fSize; //! | |
116 | }; | |
117 | ||
118 | class iterator { | |
119 | public: | |
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; | |
126 | } | |
127 | ~iterator() {fCluster=NULL; fContainer=NULL;} | |
128 | ||
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; | |
138 | } | |
139 | ||
140 | // switch to next cluster | |
141 | iterator& Next(int slice, int partition); | |
142 | ||
143 | private: | |
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 | |
148 | }; | |
149 | ||
150 | /// legacy, to be removed later | |
151 | iterator& BeginRemainingClusterBlock(int count, AliHLTUInt32_t specification) { | |
152 | return BeginPartitionClusterBlock(count, specification); | |
153 | } | |
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); | |
160 | ||
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;} | |
169 | ||
170 | /// internal cleanup | |
171 | virtual void Clear(Option_t * option=""); | |
172 | /// print info | |
173 | virtual void Print(Option_t *option=NULL) const; | |
174 | ||
175 | protected: | |
176 | AliHLTTPCRawCluster* NextCluster(int slice, int partition); | |
177 | ||
178 | private: | |
179 | AliRawClusterContainer(const AliRawClusterContainer&); | |
180 | AliRawClusterContainer& operator=(const AliRawClusterContainer&); | |
181 | ||
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 | |
193 | }; | |
194 | ||
686d5523 | 195 | protected: |
196 | /// inherited from AliHLTDataSource: get one event | |
197 | int GetEvent( const AliHLTComponentEventData& evtData, | |
198 | AliHLTComponentTriggerData& trigData, | |
199 | AliHLTUInt8_t* outputPtr, | |
200 | AliHLTUInt32_t& size, | |
f652dd4a | 201 | AliHLTComponentBlockDataList& outputBlocks ); |
686d5523 | 202 | |
203 | /// inherited from AliHLTComponent: initialize | |
204 | int DoInit( int argc, const char** argv ); | |
205 | ||
206 | /// inherited from AliHLTComponent: cleanup | |
207 | int DoDeinit(); | |
208 | ||
209 | /// inherited from AliHLTComponent: argument scan | |
210 | int ScanConfigurationArgument(int argc, const char** argv); | |
211 | ||
f652dd4a | 212 | /// read cluster from HLTOUT |
213 | int ReadClusterFromHLTOUT(AliRawClusterContainer* pContainer); | |
686d5523 | 214 | |
215 | /// inherited from AliHLTRawReaderPublisherComponent: get specification | |
216 | virtual int GetSpecificationFromEquipmentId(int id, AliHLTUInt32_t &specification) const; | |
217 | ||
218 | /// inherited from AliHLTRawReaderPublisherComponent: check if a block is selected or not | |
219 | virtual bool IsSelected(int equipmentId) const; | |
220 | ||
221 | private: | |
d60d120c | 222 | AliHLTTPCDataPublisherComponent(const AliHLTTPCDataPublisherComponent&); |
223 | AliHLTTPCDataPublisherComponent& operator=(const AliHLTTPCDataPublisherComponent&); | |
686d5523 | 224 | |
749f85ed | 225 | int fMode; //! operation mode |
686d5523 | 226 | bool* fArraySelected; //! transient |
f652dd4a | 227 | AliRawClusterContainer* fClusters; // target for decoded clusters |
228 | AliHLTTPCDataCompressionDecoder* fpDecoder; // decoder for compressed cluster blocks | |
686d5523 | 229 | |
d60d120c | 230 | ClassDef(AliHLTTPCDataPublisherComponent, 0) |
686d5523 | 231 | }; |
232 | ||
d60d120c | 233 | #endif //ALIHLTTPCDATAPUBLISHERCOMPONENT_H |