Line data Source code
1 : //-*- Mode: C++ -*-
2 : // $Id$
3 : #ifndef ALIHLTTPCRAWSPACEPOINTCONTAINER_H
4 : #define ALIHLTTPCRAWSPACEPOINTCONTAINER_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 AliHLTTPCRawSpacePointContainer.h
10 : /// @author Matthias Richter, Sergey Gorbunov
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 AliHLTTPCRawSpacePointContainer and should
15 : /// be merged with it in a generic way
16 :
17 : #include "AliHLTSpacePointContainer.h"
18 : #include "AliHLTTPCRawCluster.h"
19 : #include <map>
20 : #include <vector>
21 : using namespace std;
22 :
23 : /**
24 : * @class AliHLTTPCRawSpacePointContainer
25 : * Handler class for HLT TPC hardware ClusterFinder space point data blocks.
26 : *
27 : * @ingroup alihlt_tpc
28 : */
29 : class AliHLTTPCRawSpacePointContainer : public AliHLTSpacePointContainer
30 : {
31 : public:
32 : /// standard constructor
33 : AliHLTTPCRawSpacePointContainer(int mode=0, int createFlags=0);
34 : /// copy constructor
35 : AliHLTTPCRawSpacePointContainer(const AliHLTTPCRawSpacePointContainer& c);
36 : /// assignment operator
37 : AliHLTTPCRawSpacePointContainer& operator=(const AliHLTTPCRawSpacePointContainer& c);
38 : /// destructor
39 : ~AliHLTTPCRawSpacePointContainer();
40 :
41 : enum {
42 : kModeSingle = 0x1,
43 : kModeCreateMap = 0x2,
44 : kModeDifferentialPadTime = 0x4
45 : };
46 :
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;
57 : virtual float GetQMax(AliHLTUInt32_t clusterID) const;
58 0 : virtual float GetMaxSignal(AliHLTUInt32_t clusterID) const {return GetQMax(clusterID);}
59 : virtual float GetPhi(AliHLTUInt32_t clusterID) const;
60 :
61 : /// add input block to the collection
62 : virtual int AddInputBlock(const AliHLTComponentBlockData* pDesc);
63 :
64 : virtual int PopulateAccessGrid(AliHLTSpacePointPropertyGrid* pGrid, AliHLTUInt32_t mask) const;
65 : int PopulateAccessGrid(AliHLTSpacePointPropertyGrid* pGrid, AliHLTTPCRawClusterData * pDecoder, int slice, int partition) const;
66 : virtual const AliHLTSpacePointPropertyGrid* GetSpacePointPropertyGrid(AliHLTUInt32_t mask) const;
67 : virtual int SetSpacePointPropertyGrid(AliHLTUInt32_t mask, AliHLTSpacePointPropertyGrid*);
68 :
69 : // Define whether to create the optional structure with cluster flags or not
70 :
71 :
72 : /// clear the object and reset pointer references
73 : virtual void Clear(Option_t * option ="");
74 :
75 : /// print information
76 : virtual void Print(ostream& out, Option_t *option="") const;
77 :
78 : /// create a collection of clusters for a space point mask
79 : virtual AliHLTSpacePointContainer* SelectByMask(AliHLTUInt32_t mask, bool bAlloc=false) const;
80 :
81 : /// create a collection of clusters for a specific track
82 : virtual AliHLTSpacePointContainer* SelectByTrack(int trackId, bool bAlloc=false) const;
83 :
84 : /// create a collection of clusters for a specific MC track
85 : virtual AliHLTSpacePointContainer* SelectByMC(int mcId, bool bAlloc=false) const;
86 :
87 : /// create a collection of all used clusters
88 : virtual AliHLTSpacePointContainer* UsedClusters(bool bAlloc=false) const;
89 :
90 : /// create a collection of all unused clusters
91 : virtual AliHLTSpacePointContainer* UnusedClusters(bool bAlloc=false) const;
92 :
93 : virtual int MarkUsed(const AliHLTUInt32_t* clusterIDs, int arraySize);
94 : virtual int SetTrackID(int trackID, const AliHLTUInt32_t* clusterIDs, int arraySize);
95 : virtual int GetTrackID(AliHLTUInt32_t clusterID) const;
96 : virtual int SetMCID(int clusterID, const AliHLTUInt32_t* clusterIDs, int arraySize);
97 :
98 : virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size,
99 : vector<AliHLTComponentBlockData>& outputBlocks,
100 : AliHLTDataDeflater* pDeflater,
101 : const char* option="") const;
102 : virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size, AliHLTUInt32_t offset,
103 : vector<AliHLTComponentBlockData>& outputBlocks,
104 : AliHLTDataDeflater* pDeflater,
105 : const char* option="") const;
106 :
107 : int WriteSorted(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size, AliHLTUInt32_t offset,
108 : vector<AliHLTComponentBlockData>& outputBlocks,
109 : AliHLTDataDeflater* pDeflater,
110 : const char* option="") const;
111 :
112 : int WriteSorted(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size, AliHLTUInt32_t offset,
113 : AliHLTTPCRawClusterData* pDecoder, AliHLTSpacePointPropertyGrid* pGrid,
114 : AliHLTUInt32_t mask,
115 : vector<AliHLTComponentBlockData>& outputBlocks,
116 : AliHLTDataDeflater* pDeflater,
117 : const char* option) const;
118 :
119 : /// allocate index grid, one single point to define the dimensions
120 : static AliHLTSpacePointPropertyGrid* AllocateIndexGrid();
121 :
122 : class AliHLTTPCRawSpacePointProperties {
123 : public:
124 : AliHLTTPCRawSpacePointProperties();
125 : AliHLTTPCRawSpacePointProperties(const AliHLTTPCRawCluster* pCluster);
126 : AliHLTTPCRawSpacePointProperties(const AliHLTTPCRawSpacePointProperties& src);
127 : AliHLTTPCRawSpacePointProperties& operator=(const AliHLTTPCRawSpacePointProperties& src);
128 :
129 0 : ~AliHLTTPCRawSpacePointProperties() {}
130 :
131 0 : const AliHLTTPCRawCluster* GetCluster() const {return fpCluster;}
132 0 : bool IsUsed() const {return fUsed;}
133 0 : void MarkUsed(bool used=true) {fUsed=used;}
134 0 : int GetTrackId() const {return fTrackId;}
135 0 : void SetTrackId(int trackId) {fTrackId=trackId;}
136 0 : int GetMCId() const {return fMCId;}
137 0 : void SetMCId(int mcId) {fMCId=mcId;}
138 :
139 : void Print(ostream& out, Option_t *option="") const;
140 :
141 : private:
142 : const AliHLTTPCRawCluster* fpCluster; //! decoder for data block
143 : bool fUsed; //! transient
144 : int fTrackId; //! track id from reconstruction
145 : int fMCId; //! MC id
146 : };
147 :
148 : class AliHLTTPCRawSpacePointBlock {
149 : public:
150 : AliHLTTPCRawSpacePointBlock(AliHLTUInt32_t id=0, AliHLTTPCRawClusterData *pDecoder=NULL, AliHLTSpacePointPropertyGrid* pGrid=NULL)
151 0 : : fDecoder(pDecoder), fGrid(pGrid), fId(id) {}
152 : AliHLTTPCRawSpacePointBlock(const AliHLTTPCRawSpacePointBlock& s)
153 : : fDecoder(s.fDecoder), fGrid(s.fGrid), fId(s.fId) {}
154 : AliHLTTPCRawSpacePointBlock& operator=(const AliHLTTPCRawSpacePointBlock& s) {
155 0 : if (this==&s) return *this;
156 0 : fDecoder=s.fDecoder; fGrid=s.fGrid; fId=s.fId; return *this;
157 0 : }
158 0 : ~AliHLTTPCRawSpacePointBlock() {}
159 :
160 : int GetNofSpacepoints() const {return fDecoder?fDecoder->fCount:0;}
161 0 : AliHLTUInt32_t GetId() const {return fId;}
162 0 : void SetId(AliHLTUInt32_t id) {fId=id;}
163 0 : AliHLTTPCRawClusterData* GetDecoder() const {return fDecoder;}
164 0 : void SetDecoder(AliHLTTPCRawClusterData* pDecoder) {fDecoder=pDecoder;}
165 0 : AliHLTSpacePointPropertyGrid* GetGrid() const {return fGrid;}
166 0 : void SetGrid(AliHLTSpacePointPropertyGrid* pGrid) {fGrid=pGrid;}
167 :
168 : protected:
169 : private:
170 : AliHLTTPCRawClusterData* fDecoder; //!
171 : AliHLTSpacePointPropertyGrid* fGrid; //!
172 : AliHLTUInt32_t fId; //!
173 : };
174 :
175 : protected:
176 :
177 : private:
178 : /// map of clusters
179 : std::map<AliHLTUInt32_t, AliHLTTPCRawSpacePointProperties> fClusters; //!
180 :
181 : /// map of cluster id collection for different masks
182 : std::map<AliHLTUInt32_t, vector<AliHLTUInt32_t>*> fSelections; //!
183 :
184 : /// array of decoders
185 : std::map<AliHLTUInt32_t, AliHLTTPCRawSpacePointBlock> fBlocks; //!
186 :
187 : /// the one instance for mode single (=1)
188 : AliHLTTPCRawSpacePointBlock fSingleBlock;
189 :
190 : /// mode
191 : int fMode; //!
192 : int fCreateFlags; //!
193 :
194 : /// vector of cluster ids for writing
195 : vector<AliHLTUInt32_t>* fWrittenClusterIds; //!
196 :
197 6 : ClassDef(AliHLTTPCRawSpacePointContainer, 0)
198 : };
199 :
200 : ostream& operator<<(ostream &out, const AliHLTTPCRawSpacePointContainer::AliHLTTPCRawSpacePointProperties& p);
201 :
202 : #endif
|