]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCDataPublisherComponent.h
code cleanup, removing unused functionality; fully implemented in the AliHLTTPCDataCo...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDataPublisherComponent.h
CommitLineData
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 19class AliHLTTPCClusterMCLabel;
20class AliHLTTPCClusterMCData;
21class 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 61class AliHLTTPCDataPublisherComponent : public AliHLTRawReaderPublisherComponent {
686d5523 62public:
63 /// standard constructor
d60d120c 64 AliHLTTPCDataPublisherComponent();
686d5523 65 /// destructor
d60d120c 66 ~AliHLTTPCDataPublisherComponent();
686d5523 67
68 /// inherited from AliHLTComponent: id of the component
69 virtual const char* GetComponentID();
70
71 /// inherited from AliHLTComponent: spawn function.
72 virtual AliHLTComponent* Spawn();
73
f652dd4a 74 /**
75 * @class AliRawClusterContainer
76 * Container of AliHLTTPCRawCluster, The class implements the interface to be
77 * used in the decoding of compressed TPC data.
78 * Data is decoded into an external buffer.
79 */
80 class AliRawClusterContainer : public AliHLTLogging {
81 public:
82 AliRawClusterContainer();
83 virtual ~AliRawClusterContainer();
84
85 /// set/reset the external target buffer
86 int SetTargetBuffer(AliHLTUInt8_t* pBuffer, int size);
87
88 /// merge track model clusters into partition cluster blocks
89 int Sort();
90
91 /// fill block descriptors of extracted partition cluster blocks to target list
92 int CopyBlockDescriptors(AliHLTComponentBlockDataList& target) const;
93 /// get reference to block descriptor list
94 const AliHLTComponentBlockDataList& GetBlockDescriptors() const {
95 return fDescriptors;
96 }
97
98 struct AliClusterIdBlock {
99 AliClusterIdBlock() : fIds(NULL), fSize(0) {}
100 AliHLTUInt32_t* fIds; //!
101 AliHLTUInt32_t fSize; //!
102 };
103
104 class iterator {
105 public:
106 iterator() : fClusterNo(-1), fCluster(NULL), fClusterId(kAliHLTVoidDataSpec), fContainer(NULL) {}
107 iterator(AliRawClusterContainer* pContainer) : fClusterNo(-1), fCluster(NULL), fClusterId(kAliHLTVoidDataSpec), fContainer(pContainer) {}
108 iterator(const iterator& other) : fClusterNo(other.fClusterNo), fCluster(other.fCluster), fClusterId(other.fClusterId), fContainer(other.fContainer) {}
109 iterator& operator=(const iterator& other) {
110 if (this==&other) return *this;
111 fClusterNo=other.fClusterNo; fCluster=other.fCluster, fClusterId=other.fClusterId; fContainer=other.fContainer; return *this;
112 }
113 ~iterator() {fCluster=NULL; fContainer=NULL;}
114
115 void SetPadRow(int row) {if (fCluster) fCluster->SetPadRow(row);}
116 void SetPad(float pad) {if (fCluster) fCluster->SetPad(pad);}
117 void SetTime(float time) {if (fCluster) fCluster->SetTime(time);}
118 void SetSigmaY2(float sigmaY2) {if (fCluster) fCluster->SetSigmaY2(sigmaY2);}
119 void SetSigmaZ2(float sigmaZ2) {if (fCluster) fCluster->SetSigmaZ2(sigmaZ2);}
120 void SetCharge(unsigned charge) {if (fCluster) fCluster->SetCharge(charge);}
121 void SetQMax(unsigned qmax) {if (fCluster) fCluster->SetQMax(qmax);}
122 void SetMC(const AliHLTTPCClusterMCLabel* pMC) {
123 if (!fCluster || !pMC) return;
124 }
125
126 // switch to next cluster
127 iterator& Next(int slice, int partition);
128
129 private:
130 int fClusterNo; //! cluster no in the current block
131 AliHLTTPCRawCluster* fCluster; //! pointer to current cluster
132 AliHLTUInt32_t fClusterId; //! id of the cluster, from optional cluster id blocks
133 AliRawClusterContainer* fContainer; // instance of container
134 };
135
136 /// legacy, to be removed later
137 iterator& BeginRemainingClusterBlock(int count, AliHLTUInt32_t specification) {
138 return BeginPartitionClusterBlock(count, specification);
139 }
140 /// iterator of partition clusters block of specification
141 iterator& BeginPartitionClusterBlock(int count, AliHLTUInt32_t specification);
142 /// iterator of track model clusters
143 iterator& BeginTrackModelClusterBlock(int count);
144 /// base method to start cluster iterator
145 iterator& ClusterIterator(int count, AliHLTComponentDataType dt, AliHLTUInt32_t specification, AliHLTTPCRawClusterData* &pData);
146
147 /// get block count, i.e. number of calls to create an iterator
148 int GetBlockCount() const {return fBlockCount;}
149 /// get number of decoded clusters
150 /// Note: only if there is enough space in the target buffer the clusters
151 // will be properly written
152 int GetClusterCount() const {return fTotalClusterCount;}
153 /// get the state of the cluster decoding
154 int GetState() const {return fState;}
155
156 /// internal cleanup
157 virtual void Clear(Option_t * option="");
158 /// print info
159 virtual void Print(Option_t *option=NULL) const;
160
161 protected:
162 AliHLTTPCRawCluster* NextCluster(int slice, int partition);
163
164 private:
165 AliRawClusterContainer(const AliRawClusterContainer&);
166 AliRawClusterContainer& operator=(const AliRawClusterContainer&);
167
168 int fBlockCount; //! number of data blocks with clusters
169 int fTotalClusterCount; //! total number of decoded clusters
170 int fBlockClusterCount; //! number of decoded clusters in current block
171 AliHLTUInt8_t* fpBuffer; //! target buffer for decoded data
172 int fBufferSize; //! size of target buffer
173 AliHLTComponentBlockDataList fDescriptors; //! list of block descriptors
174 AliHLTTPCRawClusterData* fCurrentBlock; // current cluster block
175 AliHLTTPCRawClusterData* fTrackModelClusters; //! track model cluster block
176 vector<AliHLTUInt32_t> fTrackModelClusterMap; //! slice-partition map for track model clusters
177 iterator fIterator; //! iterator for filling of data
178 int fState; //! state
179 };
180
686d5523 181protected:
182 /// inherited from AliHLTDataSource: get one event
183 int GetEvent( const AliHLTComponentEventData& evtData,
184 AliHLTComponentTriggerData& trigData,
185 AliHLTUInt8_t* outputPtr,
186 AliHLTUInt32_t& size,
f652dd4a 187 AliHLTComponentBlockDataList& outputBlocks );
686d5523 188
189 /// inherited from AliHLTComponent: initialize
190 int DoInit( int argc, const char** argv );
191
192 /// inherited from AliHLTComponent: cleanup
193 int DoDeinit();
194
195 /// inherited from AliHLTComponent: argument scan
196 int ScanConfigurationArgument(int argc, const char** argv);
197
f652dd4a 198 /// read cluster from HLTOUT
199 int ReadClusterFromHLTOUT(AliRawClusterContainer* pContainer);
686d5523 200
201 /// inherited from AliHLTRawReaderPublisherComponent: get specification
202 virtual int GetSpecificationFromEquipmentId(int id, AliHLTUInt32_t &specification) const;
203
204 /// inherited from AliHLTRawReaderPublisherComponent: check if a block is selected or not
205 virtual bool IsSelected(int equipmentId) const;
206
207private:
d60d120c 208 AliHLTTPCDataPublisherComponent(const AliHLTTPCDataPublisherComponent&);
209 AliHLTTPCDataPublisherComponent& operator=(const AliHLTTPCDataPublisherComponent&);
686d5523 210
211 bool* fArraySelected; //! transient
f652dd4a 212 AliRawClusterContainer* fClusters; // target for decoded clusters
213 AliHLTTPCDataCompressionDecoder* fpDecoder; // decoder for compressed cluster blocks
686d5523 214
d60d120c 215 ClassDef(AliHLTTPCDataPublisherComponent, 0)
686d5523 216};
217
d60d120c 218#endif //ALIHLTTPCDATAPUBLISHERCOMPONENT_H