]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTSpacePointContainer.h
restoring ostream properties after printout
[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
4e1f33ca 49 typedef AliHLTIndexGrid<float, AliHLTUInt32_t> AliHLTSpacePointGrid;
86e69fe5 50
51 //////////////////////////////////////////////////////////////////////////
52 //
53 // interface functions
54 //
55
488caaa0 56 /// add input block to the collection
57 virtual int AddInputBlock(const AliHLTComponentBlockData* pDesc)=0;
86e69fe5 58 virtual int PopulateAccessGrid(AliHLTSpacePointGrid* /*pGrid*/, AliHLTUInt32_t /*mask*/) const {return -ENOSYS;}
59 virtual const AliHLTSpacePointGrid* GetAccessGrid(AliHLTUInt32_t /*mask*/) const {return NULL;}
488caaa0 60
e1e03704 61 virtual int GetNumberOfSpacePoints() const;
62 virtual bool Check(AliHLTUInt32_t clusterID) const;
488caaa0 63 virtual int GetClusterIDs(vector<AliHLTUInt32_t>& tgt) const = 0;
54ff4c01 64 virtual const vector<AliHLTUInt32_t>* GetClusterIDs(AliHLTUInt32_t /*mask*/) {return NULL;}
488caaa0 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;
37c3ba28 72 virtual float GetMaxSignal(AliHLTUInt32_t /*clusterID*/) const {return 0.0;}
27d45f0c 73 virtual float GetPhi(AliHLTUInt32_t /*clusterID*/) const {return 0.0;}
488caaa0 74
54ff4c01 75 /// create a collection of clusters for a space point mask
76 virtual AliHLTSpacePointContainer* SelectByMask(AliHLTUInt32_t mask, bool bAlloc=false) const;
77
488caaa0 78 /// create a collection of clusters for a specific track
79 virtual AliHLTSpacePointContainer* SelectByTrack(int trackId, bool bAlloc=false) const;
80
81 /// create a collection of clusters for a specific MC track
82 virtual AliHLTSpacePointContainer* SelectByMC(int mcId, bool bAlloc=false) const;
83
84 /// create a collection of all used clusters
85 virtual AliHLTSpacePointContainer* UsedClusters(bool bAlloc=false) const;
86
87 /// create a collection of all unused clusters
88 virtual AliHLTSpacePointContainer* UnusedClusters(bool bAlloc=false) const;
89
90 int MarkUsed(AliHLTUInt32_t clusterID) {return MarkUsed(&clusterID, sizeof(clusterID));}
91 virtual int MarkUsed(const AliHLTUInt32_t* clusterIDs, int arraySize);
92
93 int SetTrackID(int trackID, AliHLTUInt32_t clusterID) {
94 return SetTrackID(trackID, &clusterID, sizeof(clusterID));
95 }
96 virtual int SetTrackID(int trackID, const AliHLTUInt32_t* clusterIDs, int arraySize);
97
e1e03704 98 virtual int GetTrackID(AliHLTUInt32_t /*clusterID*/) const {return -1;}
99
488caaa0 100 int SetMCID(int mcID, AliHLTUInt32_t clusterID) {
101 return SetMCID(mcID, &clusterID, sizeof(clusterID));
102 }
103 virtual int SetMCID(int clusterID, const AliHLTUInt32_t* clusterIDs, int arraySize);
104
da9919a1 105 /// write blocks to HLT component output
06b152d9 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);
111 }
112
113 /// write blocks to HLT component output: old function definition for backward compatibility
da9919a1 114 virtual int Write(AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t /*size*/,
115 vector<AliHLTComponentBlockData>& /*outputBlocks*/,
116 const char* /*option*/="") const {return 0;}
117
488caaa0 118 /// add input block from file to collection
119 int AddInputBlock(const char* filename, AliHLTComponentDataType dt, unsigned specification);
120
121 /// add input block from list of blank separated files to collection
122 int AddInputBlocks(const char* filenames, AliHLTComponentDataType dt);
123
3488f70b 124 /// alloc memory for a space point data block
125 AliHLTUInt8_t* Alloc(int size);
126
488caaa0 127 /// inherited from TObject: clear the object and reset pointer references
128 virtual void Clear(Option_t * /*option*/ ="");
129
130 /// inherited from TObject
131 virtual void Print(Option_t *option="") const;
132
133 virtual void Print(ostream& out, Option_t *option="") const;
134
5f195a83 135 void Draw(Option_t *option);
136
27d45f0c 137 TH1* DrawProjection(const char* plane) const {
138 vector<AliHLTUInt32_t> selection; // empty list -> no selection
139 return DrawProjection(plane, selection);
140 }
141
142 TH1* DrawProjection(const char* plane, AliHLTUInt32_t specification) const {
143 vector<AliHLTUInt32_t> selection; selection.push_back(specification);
144 return DrawProjection(plane, selection);
145 }
146
147 TH1* DrawProjection(const char* plane, const vector<AliHLTUInt32_t>& selection) const;
148
6fa220b4 149 TTree* FillTree(const char* name, const char* title="");
150
488caaa0 151 protected:
152
153 private:
154 vector<TArrayC*> fBuffers; //! buffers of loaded files
155
156 ClassDef(AliHLTSpacePointContainer, 0)
157};
158
159ostream& operator<<(ostream &out, const AliHLTSpacePointContainer& c);
160
161#endif