]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCRawSpacePointContainer.h
minor coverity defect: added protection for self-assignment
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCRawSpacePointContainer.h
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
11 /// @date   2011-08-01
12 /// @brief  Helper class for handling of HLT TPC raw cluster data blocks
13 /// @note   Class is a duplicate of AliHLTTPCRawSpacePointContainer and should
14 ///         be merged with it in a generic way
15
16 #include "AliHLTSpacePointContainer.h"
17 #include "AliHLTTPCRawCluster.h"
18 #include <map>
19 using namespace std;
20
21 /**
22  * @class AliHLTTPCRawSpacePointContainer
23  * Handler class for HLT TPCS raw space point data blocks.
24  *
25  * @ingroup alihlt_tpc
26  */
27 class AliHLTTPCRawSpacePointContainer : public AliHLTSpacePointContainer
28 {
29  public:
30   /// standard constructor
31   AliHLTTPCRawSpacePointContainer();
32   /// copy constructor
33   AliHLTTPCRawSpacePointContainer(const AliHLTTPCRawSpacePointContainer& c);
34   /// assignment operator
35   AliHLTTPCRawSpacePointContainer& operator=(const AliHLTTPCRawSpacePointContainer& c);
36   /// destructor
37   ~AliHLTTPCRawSpacePointContainer();
38
39   virtual bool Check(AliHLTUInt32_t clusterID) const;
40   virtual int GetClusterIDs(vector<AliHLTUInt32_t>& tgt) const;
41   virtual const vector<AliHLTUInt32_t>* GetClusterIDs(AliHLTUInt32_t mask);
42   virtual float GetX(AliHLTUInt32_t clusterID) const;
43   virtual float GetXWidth(AliHLTUInt32_t clusterID) const;
44   virtual float GetY(AliHLTUInt32_t clusterID) const;
45   virtual float GetYWidth(AliHLTUInt32_t clusterID) const;
46   virtual float GetZ(AliHLTUInt32_t clusterID) const;
47   virtual float GetZWidth(AliHLTUInt32_t clusterID) const;
48   virtual float GetCharge(AliHLTUInt32_t clusterID) const;
49   virtual float GetMaxSignal(AliHLTUInt32_t clusterID) const;
50   virtual float GetPhi(AliHLTUInt32_t clusterID) const;
51
52   /// add input block to the collection
53   virtual int AddInputBlock(const AliHLTComponentBlockData* pDesc);
54
55   /// clear the object and reset pointer references
56   virtual void Clear(Option_t * option ="");
57
58   /// print information
59   virtual void Print(ostream& out, Option_t *option="") const;
60
61   /// create a collection of clusters for a space point mask
62   virtual AliHLTSpacePointContainer* SelectByMask(AliHLTUInt32_t mask, bool bAlloc=false) const;
63
64   /// create a collection of clusters for a specific track
65   virtual AliHLTSpacePointContainer* SelectByTrack(int trackId, bool bAlloc=false) const;
66
67   /// create a collection of clusters for a specific MC track
68   virtual AliHLTSpacePointContainer* SelectByMC(int mcId, bool bAlloc=false) const;
69
70   /// create a collection of all used clusters
71   virtual AliHLTSpacePointContainer* UsedClusters(bool bAlloc=false) const;
72
73   /// create a collection of all unused clusters
74   virtual AliHLTSpacePointContainer* UnusedClusters(bool bAlloc=false) const;
75
76   virtual int MarkUsed(const AliHLTUInt32_t* clusterIDs, int arraySize);
77   virtual int SetTrackID(int trackID, const AliHLTUInt32_t* clusterIDs, int arraySize);
78   virtual int GetTrackID(AliHLTUInt32_t clusterID) const;
79   virtual int SetMCID(int clusterID, const AliHLTUInt32_t* clusterIDs, int arraySize);
80
81   virtual int Write(AliHLTUInt8_t* outputPtr, AliHLTUInt32_t size,
82                     vector<AliHLTComponentBlockData>& outputBlocks,
83                     const char* option="") const;
84
85   class AliHLTTPCRawSpacePointProperties {
86   public:
87     AliHLTTPCRawSpacePointProperties();
88     AliHLTTPCRawSpacePointProperties(const AliHLTTPCRawCluster* pCluster);
89     AliHLTTPCRawSpacePointProperties(const AliHLTTPCRawSpacePointProperties& src);
90     AliHLTTPCRawSpacePointProperties& operator=(const AliHLTTPCRawSpacePointProperties& src);
91
92     ~AliHLTTPCRawSpacePointProperties() {}
93
94     const AliHLTTPCRawCluster* Data() const {return fCluster;}
95     bool IsUsed() const {return fUsed;}
96     void MarkUsed(bool used=true) {fUsed=used;}
97     int GetTrackId() const {return fTrackId;}
98     void SetTrackId(int trackId) {fTrackId=trackId;}
99     int GetMCId() const {return fMCId;}
100     void SetMCId(int mcId) {fMCId=mcId;}
101
102     void Print(ostream& out, Option_t *option="") const;
103
104   private:
105     const AliHLTTPCRawCluster* fCluster; //! transient
106     bool fUsed; //! transient
107     int fTrackId; //! track id from reconstruction
108     int fMCId; //! MC id
109   };
110
111  protected:
112
113  private:
114   /// map of clusters
115   std::map<AliHLTUInt32_t, AliHLTTPCRawSpacePointProperties> fClusters; //!
116
117   /// map of cluster id collection for different masks
118   std::map<AliHLTUInt32_t, vector<AliHLTUInt32_t>*> fSelections; //!
119
120   ClassDef(AliHLTTPCRawSpacePointContainer, 0)
121 };
122
123 ostream& operator<<(ostream &out, const AliHLTTPCRawSpacePointContainer::AliHLTTPCRawSpacePointProperties& p);
124
125 #endif