]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCHWCFSpacePointContainer.h
configuration 'TPC-compression-emulation' added, to be activated in separate commit
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCHWCFSpacePointContainer.h
CommitLineData
f4ee4ed8 1//-*- Mode: C++ -*-
2// $Id$
3#ifndef ALIHLTTPCHWCFSPACEPOINTCONTAINER_H
4#define ALIHLTTPCHWCFSPACEPOINTCONTAINER_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 AliHLTTPCHWCFSpacePointContainer.h
10/// @author Matthias Richter
11/// @date 2011-08-08
12/// @brief Helper class for handling of HLT TPC cluster data blocks from the
13/// HW ClusterFinder
14/// @note Class is a duplicate of AliHLTTPCHWCFSpacePointContainer and should
15/// be merged with it in a generic way
16
17#include "AliHLTSpacePointContainer.h"
18#include "AliHLTTPCHWCFData.h"
19#include <map>
be63a64f 20#include <vector>
f4ee4ed8 21using namespace std;
22
23/**
24 * @class AliHLTTPCHWCFSpacePointContainer
25 * Handler class for HLT TPC hardware ClusterFinder space point data blocks.
26 *
27 * @ingroup alihlt_tpc
28 */
29class AliHLTTPCHWCFSpacePointContainer : public AliHLTSpacePointContainer
30{
31 public:
32 /// standard constructor
61e66346 33 AliHLTTPCHWCFSpacePointContainer(int mode=0);
f4ee4ed8 34 /// copy constructor
35 AliHLTTPCHWCFSpacePointContainer(const AliHLTTPCHWCFSpacePointContainer& c);
36 /// assignment operator
37 AliHLTTPCHWCFSpacePointContainer& operator=(const AliHLTTPCHWCFSpacePointContainer& c);
38 /// destructor
39 ~AliHLTTPCHWCFSpacePointContainer();
40
4f573ca4 41 enum {
42 kModeSingle = 0x1,
8a3426fd 43 kModeCreateMap = 0x2,
44 kModeDifferentialPadTime = 0x4
4f573ca4 45 };
46
f4ee4ed8 47 virtual bool Check(AliHLTUInt32_t clusterID) const;
48 virtual int GetClusterIDs(vector<AliHLTUInt32_t>& tgt) const;
49 virtual const vector<AliHLTUInt32_t>* GetClusterIDs(AliHLTUInt32_t mask);
50 virtual float GetX(AliHLTUInt32_t clusterID) const;
51 virtual float GetXWidth(AliHLTUInt32_t clusterID) const;
52 virtual float GetY(AliHLTUInt32_t clusterID) const;
53 virtual float GetYWidth(AliHLTUInt32_t clusterID) const;
54 virtual float GetZ(AliHLTUInt32_t clusterID) const;
55 virtual float GetZWidth(AliHLTUInt32_t clusterID) const;
56 virtual float GetCharge(AliHLTUInt32_t clusterID) const;
4f573ca4 57 virtual float GetQMax(AliHLTUInt32_t clusterID) const;
f4ee4ed8 58 virtual float GetPhi(AliHLTUInt32_t clusterID) const;
59
60 /// add input block to the collection
61 virtual int AddInputBlock(const AliHLTComponentBlockData* pDesc);
62
405bb4c5 63 virtual int PopulateAccessGrid(AliHLTSpacePointPropertyGrid* pGrid, AliHLTUInt32_t mask) const;
64 int PopulateAccessGrid(AliHLTSpacePointPropertyGrid* pGrid, AliHLTTPCHWCFData* pDecoder, int slice, int partition) const;
65 virtual const AliHLTSpacePointPropertyGrid* GetSpacePointPropertyGrid(AliHLTUInt32_t mask) const;
66 virtual int SetSpacePointPropertyGrid(AliHLTUInt32_t mask, AliHLTSpacePointPropertyGrid*);
61e66346 67
f4ee4ed8 68 /// clear the object and reset pointer references
69 virtual void Clear(Option_t * option ="");
70
71 /// print information
72 virtual void Print(ostream& out, Option_t *option="") const;
73
74 /// create a collection of clusters for a space point mask
75 virtual AliHLTSpacePointContainer* SelectByMask(AliHLTUInt32_t mask, bool bAlloc=false) const;
76
77 /// create a collection of clusters for a specific track
78 virtual AliHLTSpacePointContainer* SelectByTrack(int trackId, bool bAlloc=false) const;
79
80 /// create a collection of clusters for a specific MC track
81 virtual AliHLTSpacePointContainer* SelectByMC(int mcId, bool bAlloc=false) const;
82
83 /// create a collection of all used clusters
84 virtual AliHLTSpacePointContainer* UsedClusters(bool bAlloc=false) const;
85
86 /// create a collection of all unused clusters
87 virtual AliHLTSpacePointContainer* UnusedClusters(bool bAlloc=false) const;
88
89 virtual int MarkUsed(const AliHLTUInt32_t* clusterIDs, int arraySize);
90 virtual int SetTrackID(int trackID, const AliHLTUInt32_t* clusterIDs, int arraySize);
91 virtual int GetTrackID(AliHLTUInt32_t clusterID) const;
92 virtual int SetMCID(int clusterID, const AliHLTUInt32_t* clusterIDs, int arraySize);
93
94 virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size,
95 vector<AliHLTComponentBlockData>& outputBlocks,
ba027032 96 AliHLTDataDeflater* pDeflater,
f4ee4ed8 97 const char* option="") const;
61e66346 98 virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size, AliHLTUInt32_t offset,
99 vector<AliHLTComponentBlockData>& outputBlocks,
100 AliHLTDataDeflater* pDeflater,
101 const char* option="") const;
102
61e66346 103 int WriteSorted(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size, AliHLTUInt32_t offset,
104 vector<AliHLTComponentBlockData>& outputBlocks,
105 AliHLTDataDeflater* pDeflater,
106 const char* option="") const;
107
108 int WriteSorted(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size, AliHLTUInt32_t offset,
405bb4c5 109 AliHLTTPCHWCFData* pDecoder, AliHLTSpacePointPropertyGrid* pGrid,
61e66346 110 AliHLTUInt32_t mask,
111 vector<AliHLTComponentBlockData>& outputBlocks,
112 AliHLTDataDeflater* pDeflater,
113 const char* option) const;
f4ee4ed8 114
405bb4c5 115 /// allocate index grid, one single point to define the dimensions
116 static AliHLTSpacePointPropertyGrid* AllocateIndexGrid();
117
f4ee4ed8 118 class AliHLTTPCHWCFSpacePointProperties {
119 public:
120 AliHLTTPCHWCFSpacePointProperties();
121 AliHLTTPCHWCFSpacePointProperties(const AliHLTTPCHWCFData* pDecoder, int index);
122 AliHLTTPCHWCFSpacePointProperties(const AliHLTTPCHWCFSpacePointProperties& src);
123 AliHLTTPCHWCFSpacePointProperties& operator=(const AliHLTTPCHWCFSpacePointProperties& src);
124
125 ~AliHLTTPCHWCFSpacePointProperties() {}
126
127 const AliHLTTPCHWCFData* Decoder() const {return fDecoder;}
128 int GetSpacepointIndex() const {return fIndex;}
129 bool IsUsed() const {return fUsed;}
130 void MarkUsed(bool used=true) {fUsed=used;}
131 int GetTrackId() const {return fTrackId;}
132 void SetTrackId(int trackId) {fTrackId=trackId;}
133 int GetMCId() const {return fMCId;}
134 void SetMCId(int mcId) {fMCId=mcId;}
135
136 void Print(ostream& out, Option_t *option="") const;
137
138 private:
139 const AliHLTTPCHWCFData* fDecoder; //! decoder for data block
140 int fIndex; //! index within the decoder block
141 bool fUsed; //! transient
142 int fTrackId; //! track id from reconstruction
143 int fMCId; //! MC id
144 };
145
61e66346 146 class AliHLTTPCHWCFSpacePointBlock {
147 public:
405bb4c5 148 AliHLTTPCHWCFSpacePointBlock(AliHLTUInt32_t id=0, AliHLTTPCHWCFData* pDecoder=NULL, AliHLTSpacePointPropertyGrid* pGrid=NULL)
61e66346 149 : fDecoder(pDecoder), fGrid(pGrid), fId(id) {}
150 AliHLTTPCHWCFSpacePointBlock(const AliHLTTPCHWCFSpacePointBlock& s)
151 : fDecoder(s.fDecoder), fGrid(s.fGrid), fId(s.fId) {}
b22da46d 152 AliHLTTPCHWCFSpacePointBlock& operator=(const AliHLTTPCHWCFSpacePointBlock& s) {
153 if (this==&s) return *this;
154 fDecoder=s.fDecoder; fGrid=s.fGrid; fId=s.fId; return *this;
155 }
61e66346 156 ~AliHLTTPCHWCFSpacePointBlock() {}
157
158 int GetNofSpacepoints() const {return fDecoder?fDecoder->GetNumberOfClusters():0;}
159 AliHLTUInt32_t GetId() const {return fId;}
160 void SetId(AliHLTUInt32_t id) {fId=id;}
161 AliHLTTPCHWCFData* GetDecoder() const {return fDecoder;}
162 void SetDecoder(AliHLTTPCHWCFData* pDecoder) {fDecoder=pDecoder;}
405bb4c5 163 AliHLTSpacePointPropertyGrid* GetGrid() const {return fGrid;}
164 void SetGrid(AliHLTSpacePointPropertyGrid* pGrid) {fGrid=pGrid;}
61e66346 165
166 protected:
167 private:
168 AliHLTTPCHWCFData* fDecoder; //!
405bb4c5 169 AliHLTSpacePointPropertyGrid* fGrid; //!
61e66346 170 AliHLTUInt32_t fId; //!
171 };
172
f4ee4ed8 173 protected:
174
175 private:
176 /// map of clusters
177 std::map<AliHLTUInt32_t, AliHLTTPCHWCFSpacePointProperties> fClusters; //!
178
179 /// map of cluster id collection for different masks
180 std::map<AliHLTUInt32_t, vector<AliHLTUInt32_t>*> fSelections; //!
181
182 /// array of decoders
61e66346 183 std::map<AliHLTUInt32_t, AliHLTTPCHWCFSpacePointBlock> fBlocks; //!
184
185 /// the one instance for mode single (=1)
186 AliHLTTPCHWCFSpacePointBlock fSingleBlock;
187
188 /// mode
189 int fMode; //!
f4ee4ed8 190
be63a64f 191 /// vector of cluster ids for writing
192 vector<AliHLTUInt32_t>* fWrittenClusterIds; //!
193
f4ee4ed8 194 ClassDef(AliHLTTPCHWCFSpacePointContainer, 0)
195};
196
197ostream& operator<<(ostream &out, const AliHLTTPCHWCFSpacePointContainer::AliHLTTPCHWCFSpacePointProperties& p);
198
199#endif