MCDataHolder.h
Go to the documentation of this file.
1 #ifndef MCDATAHOLDER_H
2 #define MCDATAHOLDER_H
3 
4 #include <algorithm>
5 #include <array>
7 
8 namespace sim {
9 
10  class MCEnDep {
11 
12  public:
13 
14  MCEnDep() { Reset(); }
15  ~MCEnDep() {}
16 
17  protected:
18 
19  std::array<float,3> fVertex;
20  float fEnergy;
21  unsigned int fTrackId;
22 
23  public:
24 
25  void Reset()
26  {
27  fVertex.fill(::sim::kINVALID_FLOAT);
28  fEnergy = ::sim::kINVALID_FLOAT;
29  fTrackId = ::sim::kINVALID_UINT;
30  }
31 
32  void SetVertex(float x, float y, float z)
33  {
34  fVertex.at(0) = x;
35  fVertex.at(1) = y;
36  fVertex.at(2) = z;
37  }
38 
39  void SetEnergy(float e) { fEnergy = e; }
40 
41  void SetTrackId(unsigned int id) { fTrackId = id; }
42 
43  const std::array<float,3>& Vertex() const { return fVertex; }
44 
45  float Energy() const { return fEnergy; }
46 
47  unsigned int TrackId() const { return fTrackId; }
48 
49  inline bool operator< (const MCEnDep& e) const
50  {
51  if( fTrackId < e.fTrackId ) return true;
52  if( fTrackId > e.fTrackId ) return false;
53 
54  if( fVertex.at(0) < e.fVertex.at(0) ) return true;
55  if( fVertex.at(0) > e.fVertex.at(0) ) return false;
56 
57  if( fVertex.at(1) < e.fVertex.at(1) ) return true;
58  if( fVertex.at(1) > e.fVertex.at(1) ) return false;
59 
60  if( fVertex.at(2) < e.fVertex.at(2) ) return true;
61  if( fVertex.at(2) > e.fVertex.at(2) ) return false;
62 
63  if( fEnergy < e.fEnergy ) return true;
64  if( fEnergy > e.fEnergy ) return false;
65 
66  return false;
67  }
68  };
69 }
70 
71 namespace std {
72  template <>
73  class less<sim::MCEnDep*>
74  {
75  public:
76  bool operator()( const sim::MCEnDep* lhs, const sim::MCEnDep* rhs )
77  { return (*lhs) < (*rhs); }
78  };
79 }
80 
81 #endif
unsigned int fTrackId
Definition: MCDataHolder.h:21
void SetEnergy(float e)
Definition: MCDataHolder.h:39
bool operator()(const sim::MCEnDep *lhs, const sim::MCEnDep *rhs)
Definition: MCDataHolder.h:76
STL namespace.
void SetTrackId(unsigned int id)
Definition: MCDataHolder.h:41
static const float kINVALID_FLOAT
Definition: TruncMean.h:31
const double e
unsigned int TrackId() const
Definition: MCDataHolder.h:47
void SetVertex(float x, float y, float z)
Definition: MCDataHolder.h:32
void Reset()
Definition: MCDataHolder.h:25
Code to link reconstructed objects back to the MC truth information.
std::array< float, 3 > fVertex
Definition: MCDataHolder.h:19
float Energy() const
Definition: MCDataHolder.h:45
const unsigned int kINVALID_UINT
Definition: MCLimits.h:14
list x
Definition: train.py:276
bool operator<(const MCEnDep &e) const
Definition: MCDataHolder.h:49
const std::array< float, 3 > & Vertex() const
Definition: MCDataHolder.h:43
const float kINVALID_FLOAT
Definition: MCLimits.h:12