]>
Commit | Line | Data |
---|---|---|
7ab8209c | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | #ifndef ALIHLTTPCDATACOMPRESSIONCOMPONENT_H | |
4 | #define ALIHLTTPCDATACOMPRESSIONCOMPONENT_H | |
5 | //* This file is property of and copyright by the ALICE HLT Project * | |
6 | //* ALICE Experiment at CERN, All rights reserved. * | |
7 | //* See cxx source for full Copyright notice * | |
8 | ||
9 | /// @file AliHLTTPCDataCompressionComponent.h | |
10 | /// @author Matthias Richter | |
11 | /// @date 2011-08-08 | |
12 | /// @brief TPC component for data compression | |
13 | /// | |
14 | ||
15 | #include "AliHLTProcessor.h" | |
8b1d554b | 16 | #include "TString.h" |
0fa10601 | 17 | #include "AliHLTTrackGeometry.h" |
18 | #include "AliHLTSpacePointContainer.h" | |
9b72add5 | 19 | #include <vector> |
7ab8209c | 20 | |
0fa10601 | 21 | class AliHLTGlobalBarrelTrack; |
7ab8209c | 22 | class AliHLTComponentBenchmark; |
23 | class AliHLTSpacePointContainer; | |
8b1d554b | 24 | class AliHLTDataDeflater; |
9b72add5 | 25 | class AliHLTTPCClusterTransformation; |
8b1d554b | 26 | class TH1F; |
7ab8209c | 27 | |
28 | /** | |
29 | * @class AliHLTTPCDataCompressionComponent | |
30 | * One single component to carry out different types and levels of compression | |
31 | * of TPC data. | |
32 | * | |
33 | * <h2>General properties:</h2> | |
34 | * | |
35 | * Component ID: \b TPCDataCompressor <br> | |
36 | * Library: \b libAliHLTTPC.so <br> | |
37 | * Input Data Types: <br> | |
38 | * - AliHLTTPCDefinitions::fgkHWClustersDataType | |
39 | * - AliHLTTPCDefinitions::fgkClustersDataType | |
40 | * - kAliHLTDataTypeTrack|kAliHLTDataOriginTPC | |
41 | * Output Data Types: none <br> | |
42 | * | |
43 | * <h2>Mandatory arguments:</h2> | |
44 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
45 | * | |
46 | * <h2>Optional arguments:</h2> | |
47 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
8b1d554b | 48 | * \li -mode <i> number </i> <br> |
49 | * compression mode | |
50 | * \li -deflater-mode <i> number </i> <br> | |
51 | * data deflater mode | |
52 | * \li -histogram-file <i> file </i> <br> | |
53 | * file to store internal histograms at the end | |
7ab8209c | 54 | * |
55 | * <h2>Configuration:</h2> | |
56 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> | |
57 | * | |
58 | * <h2>Default CDB entries:</h2> | |
59 | * | |
60 | * <h2>Performance:</h2> | |
61 | * | |
62 | * <h2>Memory consumption:</h2> | |
63 | * | |
64 | * <h2>Output size:</h2> | |
65 | * | |
66 | * | |
67 | * @ingroup alihlt_tpc | |
68 | */ | |
69 | class AliHLTTPCDataCompressionComponent : public AliHLTProcessor { | |
70 | public: | |
71 | /// standard constructor | |
72 | AliHLTTPCDataCompressionComponent(); | |
73 | /// destructor | |
74 | ~AliHLTTPCDataCompressionComponent(); | |
75 | ||
76 | /// inherited from AliHLTComponent: id of the component | |
77 | virtual const char* GetComponentID(); | |
78 | ||
79 | /// inherited from AliHLTComponent: list of data types in the vector reference | |
80 | void GetInputDataTypes( AliHLTComponentDataTypeList& ); | |
81 | ||
82 | /// inherited from AliHLTComponent: output data type of the component. | |
83 | AliHLTComponentDataType GetOutputDataType(); | |
84 | ||
85 | /// inherited from AliHLTComponent: multiple output data types of the component. | |
86 | int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList); | |
87 | ||
88 | /// inherited from AliHLTComponent: output data size estimator | |
89 | void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); | |
90 | ||
91 | /// inherited from AliHLTComponent: spawn function. | |
92 | virtual AliHLTComponent* Spawn(); | |
93 | ||
94 | protected: | |
95 | /// inherited from AliHLTProcessor: data processing | |
96 | int DoEvent( const AliHLTComponentEventData& evtData, | |
97 | const AliHLTComponentBlockData* blocks, | |
98 | AliHLTComponentTriggerData& trigData, | |
99 | AliHLTUInt8_t* outputPtr, | |
100 | AliHLTUInt32_t& size, | |
101 | AliHLTComponentBlockDataList& outputBlocks ); | |
102 | using AliHLTProcessor::DoEvent; | |
103 | ||
104 | /// inherited from AliHLTComponent: component initialisation and argument scan. | |
105 | int DoInit( int argc, const char** argv ); | |
106 | ||
107 | /// inherited from AliHLTComponent: component cleanup | |
108 | int DoDeinit(); | |
109 | ||
110 | /// inherited from AliHLTComponent: argument scan | |
111 | int ScanConfigurationArgument(int argc, const char** argv); | |
112 | ||
0fa10601 | 113 | int ForwardMCLabels(const AliHLTComponentBlockData& pDesc, |
114 | AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* pIndex, | |
115 | AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size, AliHLTUInt32_t offset, | |
116 | vector<AliHLTComponentBlockData>& outputBlocks) const; | |
117 | ||
4f573ca4 | 118 | int ProcessTrackClusters(AliHLTGlobalBarrelTrack* pTracks, unsigned nofTracks, |
119 | AliHLTTrackGeometry::AliHLTTrackGrid* pTrackIndex, | |
120 | AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* pClusterIndex, | |
121 | AliHLTSpacePointContainer* pClusters, | |
122 | int slice, int partition) const; | |
123 | ||
124 | int ProcessRemainingClusters(AliHLTGlobalBarrelTrack* pTracks, unsigned nofTracks, | |
125 | AliHLTTrackGeometry::AliHLTTrackGrid* pTrackIndex, | |
126 | AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* pClusterIndex, | |
127 | AliHLTSpacePointContainer* pClusters, | |
128 | int slice, int partition) const; | |
129 | ||
130 | int FindCellClusters(int trackId, int padrow, float pad, float time, | |
131 | AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* pClusterIndex, | |
132 | AliHLTSpacePointContainer* pClusters, | |
133 | AliHLTTrackGeometry::AliHLTTrackPoint* pTrackPoint) const; | |
134 | ||
135 | int WriteTrackClusters(const vector<AliHLTGlobalBarrelTrack>& tracks, | |
136 | AliHLTSpacePointContainer* pSpacePoints, | |
137 | AliHLTDataDeflater* pDeflater, | |
138 | AliHLTUInt8_t* outputPtr, | |
139 | AliHLTUInt32_t capacity) const; | |
140 | ||
7ab8209c | 141 | private: |
142 | AliHLTTPCDataCompressionComponent(const AliHLTTPCDataCompressionComponent&); | |
143 | AliHLTTPCDataCompressionComponent& operator=(const AliHLTTPCDataCompressionComponent&); | |
144 | ||
8b1d554b | 145 | int InitDeflater(int mode); |
146 | ||
9b72add5 | 147 | /// calculate correction factor and offset for a linear approximation of the |
148 | /// drift time transformation, separately for A and C side | |
149 | int InitDriftTimeTransformation(); | |
150 | /// calculate correction factor and offset for a linear approximation of the | |
151 | /// drift time transformation by just probing the range of timebins | |
152 | int CalculateDriftTimeTransformation(AliHLTTPCClusterTransformation& transform, int slice, int padrow, | |
153 | float& m, float& n) const; | |
154 | ||
7ab8209c | 155 | AliHLTComponentBenchmark* GetBenchmarkInstance() const {return fpBenchmark;} |
156 | ||
157 | int fMode; //! mode | |
8b1d554b | 158 | int fDeflaterMode; //! deflater mode |
9b72add5 | 159 | int fVerificationMode; //! mode for verification and unit tests |
7ab8209c | 160 | |
0fa10601 | 161 | float fMaxDeltaPad; //! maximum deviation in pad |
162 | float fMaxDeltaTime; //! maximum deviation in time | |
163 | ||
7ab8209c | 164 | /// input raw cluster handler |
165 | AliHLTSpacePointContainer* fRawInputClusters; //! input raw cluster handler | |
166 | /// input cluster handler | |
167 | AliHLTSpacePointContainer* fInputClusters; //! input cluster handler | |
168 | ||
0fa10601 | 169 | /// index grid for tracks store track id for padrow crossings |
170 | AliHLTTrackGeometry::AliHLTTrackGrid* fTrackGrid; //! index grid for tracks | |
171 | ||
172 | /// index grid for clusters | |
173 | AliHLTSpacePointContainer::AliHLTSpacePointPropertyGrid* fSpacePointGrid; //! index grid for clusters | |
174 | ||
8b1d554b | 175 | /// deflater |
176 | AliHLTDataDeflater* fpDataDeflater; //! deflater for raw clusters | |
177 | ||
178 | /// compression factor histogram | |
179 | TH1F* fHistoCompFactor; //! histogram of compression factor | |
4f573ca4 | 180 | TH1F* fHistoResidualPad; //! histogram for pad residual |
181 | TH1F* fHistoResidualTime; //! histogram for time residual | |
182 | TH1F* fHistoClustersOnTracks; //! clusters on tracks for track model compression | |
183 | TH1F* fHistoClusterRatio; //! fraction of clusters assigned to the track model compression | |
184 | TH1F* fHistoTrackClusterRatio; //! fraction of track clusters assigned to the track model compression | |
8b1d554b | 185 | TString fHistogramFile; //! file to save histogram |
80ae4557 | 186 | TString fTrainingTableOutput; //! output file for huffman tables in training mode |
8b1d554b | 187 | |
7ab8209c | 188 | /// benchmark |
189 | AliHLTComponentBenchmark* fpBenchmark; //! benchmark instance | |
190 | ||
9b72add5 | 191 | /// temporary array of ids of associated cluster ids |
192 | vector<AliHLTUInt32_t>* fpWrittenAssociatedClusterIds; //! | |
193 | ||
194 | float fDriftTimeFactorA; //! drift time A side | |
195 | float fDriftTimeOffsetA; //! drift time A side | |
196 | float fDriftTimeFactorC; //! drift time C side | |
197 | float fDriftTimeOffsetC; //! drift time C side | |
198 | ||
4f573ca4 | 199 | /// verbosity |
200 | int fVerbosity; // verbosity for debug printout | |
201 | ||
7ab8209c | 202 | ClassDef(AliHLTTPCDataCompressionComponent, 0) |
203 | }; | |
204 | ||
205 | #endif //ALIHLTTPCDATACOMPRESSIONCOMPONENT_H |