]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTSpacePointContainer.h
adding USE_DLOPEN option for HLT
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTSpacePointContainer.h
CommitLineData
488caaa0 1//-*- Mode: C++ -*-
2// $Id$
3#ifndef ALIHLTSPACEPOINTCONTAINER_H
4#define ALIHLTSPACEPOINTCONTAINER_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 AliHLTSpacePointContainer.h
10/// @author Matthias Richter
11/// @date 2011-04-29
12/// @brief Base helper class for handling of HLT space point data blocks
13///
14
15#include <vector>
86e69fe5 16#include <cmath>
488caaa0 17#include <TObject.h>
18#include "AliHLTLogging.h"
19#include "AliHLTDataTypes.h"
20#include "AliHLTStdIncludes.h"
4e1f33ca 21#include "AliHLTIndexGrid.h"
488caaa0 22
06b152d9 23class AliHLTDataDeflater;
488caaa0 24class TArrayC;
27d45f0c 25class TH1;
6fa220b4 26class TTree;
488caaa0 27
28/**
29 * @class AliHLTSpacePointContainer
30 * Base class of helper classes for space point data blocks.
31 * The class implements a couple of interface methods to be commonly used
32 * for space point data blocks.
33 *
34 * @ingroup alihlt_base
35 */
36class AliHLTSpacePointContainer : public TObject, public AliHLTLogging
37{
38 public:
39 /// standard constructor
40 AliHLTSpacePointContainer();
41 /// copy constructor
42 AliHLTSpacePointContainer(const AliHLTSpacePointContainer&);
43 /// assignment operator
44 AliHLTSpacePointContainer& operator=(const AliHLTSpacePointContainer&);
45
46 /// destructor
47 ~AliHLTSpacePointContainer();
48
32c9b74b 49 struct AliHLTSpacePointProperties {
50 AliHLTSpacePointProperties(AliHLTUInt32_t id=~(AliHLTUInt32_t)0, int trackid=-1) : fId(id), fTrackId(trackid) {}
51 AliHLTUInt32_t fId; //! the id of the spacepoint
52 int fTrackId; //! track the spacepoint is assigned to
53 };
54 typedef AliHLTIndexGrid<float, AliHLTSpacePointProperties> AliHLTSpacePointPropertyGrid;
4e1f33ca 55 typedef AliHLTIndexGrid<float, AliHLTUInt32_t> AliHLTSpacePointGrid;
86e69fe5 56
57 //////////////////////////////////////////////////////////////////////////
58 //
59 // interface functions
60 //
61
488caaa0 62 /// add input block to the collection
63 virtual int AddInputBlock(const AliHLTComponentBlockData* pDesc)=0;
32c9b74b 64 virtual int PopulateAccessGrid(AliHLTSpacePointPropertyGrid* /*pGrid*/, AliHLTUInt32_t /*mask*/) const {return -ENOSYS;}
65 virtual const AliHLTSpacePointPropertyGrid* GetSpacePointPropertyGrid(AliHLTUInt32_t /*mask*/) const {return NULL;}
66 virtual int SetSpacePointPropertyGrid(AliHLTUInt32_t /*mask*/, AliHLTSpacePointPropertyGrid* /*pGrid*/) {return -ENOSYS;}
67
68 // for backward compatibility
86e69fe5 69 virtual int PopulateAccessGrid(AliHLTSpacePointGrid* /*pGrid*/, AliHLTUInt32_t /*mask*/) const {return -ENOSYS;}
70 virtual const AliHLTSpacePointGrid* GetAccessGrid(AliHLTUInt32_t /*mask*/) const {return NULL;}
32c9b74b 71 virtual int SetAccessGrid(AliHLTUInt32_t /*mask*/, AliHLTSpacePointGrid* /*pGrid*/) {return -ENOSYS;}
488caaa0 72
e1e03704 73 virtual int GetNumberOfSpacePoints() const;
74 virtual bool Check(AliHLTUInt32_t clusterID) const;
488caaa0 75 virtual int GetClusterIDs(vector<AliHLTUInt32_t>& tgt) const = 0;
54ff4c01 76 virtual const vector<AliHLTUInt32_t>* GetClusterIDs(AliHLTUInt32_t /*mask*/) {return NULL;}
488caaa0 77 virtual float GetX(AliHLTUInt32_t clusterID) const = 0;
78 virtual float GetXWidth(AliHLTUInt32_t clusterID) const = 0;
79 virtual float GetY(AliHLTUInt32_t clusterID) const = 0;
80 virtual float GetYWidth(AliHLTUInt32_t clusterID) const = 0;
81 virtual float GetZ(AliHLTUInt32_t clusterID) const = 0;
82 virtual float GetZWidth(AliHLTUInt32_t clusterID) const = 0;
83 virtual float GetCharge(AliHLTUInt32_t clusterID) const = 0;
37c3ba28 84 virtual float GetMaxSignal(AliHLTUInt32_t /*clusterID*/) const {return 0.0;}
27d45f0c 85 virtual float GetPhi(AliHLTUInt32_t /*clusterID*/) const {return 0.0;}
488caaa0 86
54ff4c01 87 /// create a collection of clusters for a space point mask
88 virtual AliHLTSpacePointContainer* SelectByMask(AliHLTUInt32_t mask, bool bAlloc=false) const;
89
488caaa0 90 /// create a collection of clusters for a specific track
91 virtual AliHLTSpacePointContainer* SelectByTrack(int trackId, bool bAlloc=false) const;
92
93 /// create a collection of clusters for a specific MC track
94 virtual AliHLTSpacePointContainer* SelectByMC(int mcId, bool bAlloc=false) const;
95
96 /// create a collection of all used clusters
97 virtual AliHLTSpacePointContainer* UsedClusters(bool bAlloc=false) const;
98
99 /// create a collection of all unused clusters
100 virtual AliHLTSpacePointContainer* UnusedClusters(bool bAlloc=false) const;
101
102 int MarkUsed(AliHLTUInt32_t clusterID) {return MarkUsed(&clusterID, sizeof(clusterID));}
103 virtual int MarkUsed(const AliHLTUInt32_t* clusterIDs, int arraySize);
104
105 int SetTrackID(int trackID, AliHLTUInt32_t clusterID) {
106 return SetTrackID(trackID, &clusterID, sizeof(clusterID));
107 }
108 virtual int SetTrackID(int trackID, const AliHLTUInt32_t* clusterIDs, int arraySize);
109
e1e03704 110 virtual int GetTrackID(AliHLTUInt32_t /*clusterID*/) const {return -1;}
111
488caaa0 112 int SetMCID(int mcID, AliHLTUInt32_t clusterID) {
113 return SetMCID(mcID, &clusterID, sizeof(clusterID));
114 }
115 virtual int SetMCID(int clusterID, const AliHLTUInt32_t* clusterIDs, int arraySize);
116
da9919a1 117 /// write blocks to HLT component output
06b152d9 118 virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size,
119 vector<AliHLTComponentBlockData>& outputBlocks,
120 AliHLTDataDeflater* /*pDeflater*/,
121 const char* option="") const {
122 return Write(outputPtr, size, outputBlocks, option);
123 }
124
125 /// write blocks to HLT component output: old function definition for backward compatibility
da9919a1 126 virtual int Write(AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t /*size*/,
127 vector<AliHLTComponentBlockData>& /*outputBlocks*/,
128 const char* /*option*/="") const {return 0;}
129
488caaa0 130 /// add input block from file to collection
131 int AddInputBlock(const char* filename, AliHLTComponentDataType dt, unsigned specification);
132
133 /// add input block from list of blank separated files to collection
134 int AddInputBlocks(const char* filenames, AliHLTComponentDataType dt);
135
3488f70b 136 /// alloc memory for a space point data block
137 AliHLTUInt8_t* Alloc(int size);
138
488caaa0 139 /// inherited from TObject: clear the object and reset pointer references
140 virtual void Clear(Option_t * /*option*/ ="");
141
142 /// inherited from TObject
143 virtual void Print(Option_t *option="") const;
144
145 virtual void Print(ostream& out, Option_t *option="") const;
146
5f195a83 147 void Draw(Option_t *option);
148
27d45f0c 149 TH1* DrawProjection(const char* plane) const {
150 vector<AliHLTUInt32_t> selection; // empty list -> no selection
151 return DrawProjection(plane, selection);
152 }
153
154 TH1* DrawProjection(const char* plane, AliHLTUInt32_t specification) const {
155 vector<AliHLTUInt32_t> selection; selection.push_back(specification);
156 return DrawProjection(plane, selection);
157 }
158
159 TH1* DrawProjection(const char* plane, const vector<AliHLTUInt32_t>& selection) const;
160
6fa220b4 161 TTree* FillTree(const char* name, const char* title="");
162
488caaa0 163 protected:
164
165 private:
166 vector<TArrayC*> fBuffers; //! buffers of loaded files
167
168 ClassDef(AliHLTSpacePointContainer, 0)
169};
170
171ostream& operator<<(ostream &out, const AliHLTSpacePointContainer& c);
172
32c9b74b 173ostream& operator<<(ostream &out, const AliHLTSpacePointContainer::AliHLTSpacePointProperties& p);
174
7131282c 175bool operator==(const AliHLTSpacePointContainer::AliHLTSpacePointProperties& a,
176 const AliHLTSpacePointContainer::AliHLTSpacePointProperties& b);
488caaa0 177#endif