]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCRawSpacePointContainer.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCRawSpacePointContainer.h
CommitLineData
71510a33 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
e18c0370 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
71510a33 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>
e18c0370 20#include <vector>
71510a33 21using namespace std;
22
23/**
24 * @class AliHLTTPCRawSpacePointContainer
e18c0370 25 * Handler class for HLT TPC hardware ClusterFinder space point data blocks.
71510a33 26 *
27 * @ingroup alihlt_tpc
28 */
29class AliHLTTPCRawSpacePointContainer : public AliHLTSpacePointContainer
30{
31 public:
32 /// standard constructor
e18c0370 33 AliHLTTPCRawSpacePointContainer(int mode=0);
71510a33 34 /// copy constructor
35 AliHLTTPCRawSpacePointContainer(const AliHLTTPCRawSpacePointContainer& c);
36 /// assignment operator
37 AliHLTTPCRawSpacePointContainer& operator=(const AliHLTTPCRawSpacePointContainer& c);
38 /// destructor
39 ~AliHLTTPCRawSpacePointContainer();
40
e18c0370 41 enum {
42 kModeSingle = 0x1,
43 kModeCreateMap = 0x2,
44 kModeDifferentialPadTime = 0x4
45 };
46
71510a33 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;
e18c0370 57 virtual float GetQMax(AliHLTUInt32_t clusterID) const;
71510a33 58 virtual float GetPhi(AliHLTUInt32_t clusterID) const;
59
60 /// add input block to the collection
61 virtual int AddInputBlock(const AliHLTComponentBlockData* pDesc);
62
e18c0370 63 virtual int PopulateAccessGrid(AliHLTSpacePointPropertyGrid* pGrid, AliHLTUInt32_t mask) const;
64 int PopulateAccessGrid(AliHLTSpacePointPropertyGrid* pGrid, AliHLTTPCRawClusterData * pDecoder, int slice, int partition) const;
65 virtual const AliHLTSpacePointPropertyGrid* GetSpacePointPropertyGrid(AliHLTUInt32_t mask) const;
66 virtual int SetSpacePointPropertyGrid(AliHLTUInt32_t mask, AliHLTSpacePointPropertyGrid*);
67
71510a33 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
c2b3c776 94 virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size,
95 vector<AliHLTComponentBlockData>& outputBlocks,
e18c0370 96 AliHLTDataDeflater* pDeflater,
97 const char* option="") const;
98 virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size, AliHLTUInt32_t offset,
99 vector<AliHLTComponentBlockData>& outputBlocks,
100 AliHLTDataDeflater* pDeflater,
c2b3c776 101 const char* option="") const;
102
e18c0370 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,
109 AliHLTTPCRawClusterData* pDecoder, AliHLTSpacePointPropertyGrid* pGrid,
110 AliHLTUInt32_t mask,
111 vector<AliHLTComponentBlockData>& outputBlocks,
112 AliHLTDataDeflater* pDeflater,
113 const char* option) const;
114
115 /// allocate index grid, one single point to define the dimensions
116 static AliHLTSpacePointPropertyGrid* AllocateIndexGrid();
117
71510a33 118 class AliHLTTPCRawSpacePointProperties {
119 public:
120 AliHLTTPCRawSpacePointProperties();
121 AliHLTTPCRawSpacePointProperties(const AliHLTTPCRawCluster* pCluster);
122 AliHLTTPCRawSpacePointProperties(const AliHLTTPCRawSpacePointProperties& src);
123 AliHLTTPCRawSpacePointProperties& operator=(const AliHLTTPCRawSpacePointProperties& src);
124
125 ~AliHLTTPCRawSpacePointProperties() {}
126
e18c0370 127 const AliHLTTPCRawCluster* GetCluster() const {return fpCluster;}
71510a33 128 bool IsUsed() const {return fUsed;}
129 void MarkUsed(bool used=true) {fUsed=used;}
130 int GetTrackId() const {return fTrackId;}
131 void SetTrackId(int trackId) {fTrackId=trackId;}
132 int GetMCId() const {return fMCId;}
133 void SetMCId(int mcId) {fMCId=mcId;}
134
135 void Print(ostream& out, Option_t *option="") const;
136
137 private:
e18c0370 138 const AliHLTTPCRawCluster* fpCluster; //! decoder for data block
71510a33 139 bool fUsed; //! transient
140 int fTrackId; //! track id from reconstruction
141 int fMCId; //! MC id
142 };
143
e18c0370 144 class AliHLTTPCRawSpacePointBlock {
145 public:
146 AliHLTTPCRawSpacePointBlock(AliHLTUInt32_t id=0, AliHLTTPCRawClusterData *pDecoder=NULL, AliHLTSpacePointPropertyGrid* pGrid=NULL)
147 : fDecoder(pDecoder), fGrid(pGrid), fId(id) {}
148 AliHLTTPCRawSpacePointBlock(const AliHLTTPCRawSpacePointBlock& s)
149 : fDecoder(s.fDecoder), fGrid(s.fGrid), fId(s.fId) {}
150 AliHLTTPCRawSpacePointBlock& operator=(const AliHLTTPCRawSpacePointBlock& s) {
151 if (this==&s) return *this;
152 fDecoder=s.fDecoder; fGrid=s.fGrid; fId=s.fId; return *this;
153 }
154 ~AliHLTTPCRawSpacePointBlock() {}
155
156 int GetNofSpacepoints() const {return fDecoder?fDecoder->fCount:0;}
157 AliHLTUInt32_t GetId() const {return fId;}
158 void SetId(AliHLTUInt32_t id) {fId=id;}
159 AliHLTTPCRawClusterData* GetDecoder() const {return fDecoder;}
160 void SetDecoder(AliHLTTPCRawClusterData* pDecoder) {fDecoder=pDecoder;}
161 AliHLTSpacePointPropertyGrid* GetGrid() const {return fGrid;}
162 void SetGrid(AliHLTSpacePointPropertyGrid* pGrid) {fGrid=pGrid;}
163
164 protected:
165 private:
166 AliHLTTPCRawClusterData* fDecoder; //!
167 AliHLTSpacePointPropertyGrid* fGrid; //!
168 AliHLTUInt32_t fId; //!
169 };
170
71510a33 171 protected:
172
173 private:
174 /// map of clusters
175 std::map<AliHLTUInt32_t, AliHLTTPCRawSpacePointProperties> fClusters; //!
176
177 /// map of cluster id collection for different masks
178 std::map<AliHLTUInt32_t, vector<AliHLTUInt32_t>*> fSelections; //!
179
e18c0370 180 /// array of decoders
181 std::map<AliHLTUInt32_t, AliHLTTPCRawSpacePointBlock> fBlocks; //!
182
183 /// the one instance for mode single (=1)
184 AliHLTTPCRawSpacePointBlock fSingleBlock;
185
186 /// mode
187 int fMode; //!
188
189 /// vector of cluster ids for writing
190 vector<AliHLTUInt32_t>* fWrittenClusterIds; //!
191
71510a33 192 ClassDef(AliHLTTPCRawSpacePointContainer, 0)
193};
194
195ostream& operator<<(ostream &out, const AliHLTTPCRawSpacePointContainer::AliHLTTPCRawSpacePointProperties& p);
196
197#endif