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 *
9 /// @file AliHLTSpacePointContainer.h
10 /// @author Matthias Richter
12 /// @brief Base helper class for handling of HLT space point data blocks
18 #include "AliHLTLogging.h"
19 #include "AliHLTDataTypes.h"
20 #include "AliHLTStdIncludes.h"
21 #include "AliHLTIndexGrid.h"
23 class AliHLTDataDeflater;
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.
34 * @ingroup alihlt_base
36 class AliHLTSpacePointContainer : public TObject, public AliHLTLogging
39 /// standard constructor
40 AliHLTSpacePointContainer();
42 AliHLTSpacePointContainer(const AliHLTSpacePointContainer&);
43 /// assignment operator
44 AliHLTSpacePointContainer& operator=(const AliHLTSpacePointContainer&);
47 ~AliHLTSpacePointContainer();
49 typedef AliHLTIndexGrid<float, AliHLTUInt32_t> AliHLTSpacePointGrid;
51 //////////////////////////////////////////////////////////////////////////
53 // interface functions
56 /// add input block to the collection
57 virtual int AddInputBlock(const AliHLTComponentBlockData* pDesc)=0;
58 virtual int PopulateAccessGrid(AliHLTSpacePointGrid* /*pGrid*/, AliHLTUInt32_t /*mask*/) const {return -ENOSYS;}
59 virtual const AliHLTSpacePointGrid* GetAccessGrid(AliHLTUInt32_t /*mask*/) const {return NULL;}
61 virtual int GetNumberOfSpacePoints() const;
62 virtual bool Check(AliHLTUInt32_t clusterID) const;
63 virtual int GetClusterIDs(vector<AliHLTUInt32_t>& tgt) const = 0;
64 virtual const vector<AliHLTUInt32_t>* GetClusterIDs(AliHLTUInt32_t /*mask*/) {return NULL;}
65 virtual float GetX(AliHLTUInt32_t clusterID) const = 0;
66 virtual float GetXWidth(AliHLTUInt32_t clusterID) const = 0;
67 virtual float GetY(AliHLTUInt32_t clusterID) const = 0;
68 virtual float GetYWidth(AliHLTUInt32_t clusterID) const = 0;
69 virtual float GetZ(AliHLTUInt32_t clusterID) const = 0;
70 virtual float GetZWidth(AliHLTUInt32_t clusterID) const = 0;
71 virtual float GetCharge(AliHLTUInt32_t clusterID) const = 0;
72 virtual float GetMaxSignal(AliHLTUInt32_t /*clusterID*/) const {return 0.0;}
73 virtual float GetPhi(AliHLTUInt32_t /*clusterID*/) const {return 0.0;}
75 /// create a collection of clusters for a space point mask
76 virtual AliHLTSpacePointContainer* SelectByMask(AliHLTUInt32_t mask, bool bAlloc=false) const;
78 /// create a collection of clusters for a specific track
79 virtual AliHLTSpacePointContainer* SelectByTrack(int trackId, bool bAlloc=false) const;
81 /// create a collection of clusters for a specific MC track
82 virtual AliHLTSpacePointContainer* SelectByMC(int mcId, bool bAlloc=false) const;
84 /// create a collection of all used clusters
85 virtual AliHLTSpacePointContainer* UsedClusters(bool bAlloc=false) const;
87 /// create a collection of all unused clusters
88 virtual AliHLTSpacePointContainer* UnusedClusters(bool bAlloc=false) const;
90 int MarkUsed(AliHLTUInt32_t clusterID) {return MarkUsed(&clusterID, sizeof(clusterID));}
91 virtual int MarkUsed(const AliHLTUInt32_t* clusterIDs, int arraySize);
93 int SetTrackID(int trackID, AliHLTUInt32_t clusterID) {
94 return SetTrackID(trackID, &clusterID, sizeof(clusterID));
96 virtual int SetTrackID(int trackID, const AliHLTUInt32_t* clusterIDs, int arraySize);
98 virtual int GetTrackID(AliHLTUInt32_t /*clusterID*/) const {return -1;}
100 int SetMCID(int mcID, AliHLTUInt32_t clusterID) {
101 return SetMCID(mcID, &clusterID, sizeof(clusterID));
103 virtual int SetMCID(int clusterID, const AliHLTUInt32_t* clusterIDs, int arraySize);
105 /// write blocks to HLT component output
106 virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size,
107 vector<AliHLTComponentBlockData>& outputBlocks,
108 AliHLTDataDeflater* /*pDeflater*/,
109 const char* option="") const {
110 return Write(outputPtr, size, outputBlocks, option);
113 /// write blocks to HLT component output: old function definition for backward compatibility
114 virtual int Write(AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t /*size*/,
115 vector<AliHLTComponentBlockData>& /*outputBlocks*/,
116 const char* /*option*/="") const {return 0;}
118 /// add input block from file to collection
119 int AddInputBlock(const char* filename, AliHLTComponentDataType dt, unsigned specification);
121 /// add input block from list of blank separated files to collection
122 int AddInputBlocks(const char* filenames, AliHLTComponentDataType dt);
124 /// alloc memory for a space point data block
125 AliHLTUInt8_t* Alloc(int size);
127 /// inherited from TObject: clear the object and reset pointer references
128 virtual void Clear(Option_t * /*option*/ ="");
130 /// inherited from TObject
131 virtual void Print(Option_t *option="") const;
133 virtual void Print(ostream& out, Option_t *option="") const;
135 void Draw(Option_t *option);
137 TH1* DrawProjection(const char* plane) const {
138 vector<AliHLTUInt32_t> selection; // empty list -> no selection
139 return DrawProjection(plane, selection);
142 TH1* DrawProjection(const char* plane, AliHLTUInt32_t specification) const {
143 vector<AliHLTUInt32_t> selection; selection.push_back(specification);
144 return DrawProjection(plane, selection);
147 TH1* DrawProjection(const char* plane, const vector<AliHLTUInt32_t>& selection) const;
149 TTree* FillTree(const char* name, const char* title="");
154 vector<TArrayC*> fBuffers; //! buffers of loaded files
156 ClassDef(AliHLTSpacePointContainer, 0)
159 ostream& operator<<(ostream &out, const AliHLTSpacePointContainer& c);