LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
MCRecoEdep.h
Go to the documentation of this file.
1 #ifndef MCRECOEDEP_H
2 #define MCRECOEDEP_H
3 
4 // ART includes
13 
14 // LArSoft
19 // STL
20 #include <map>
21 #include <set>
22 #include <vector>
23 #include <sstream>
24 
25 // ROOT
26 #include <TString.h>
27 #include <TTree.h>
28 
29 namespace sim
30 {
31 
32  namespace details {
33  // Returns a map with all available plane IDs,
34  // each mapped into an index from a compact range.
35  std::map<geo::PlaneID, size_t> createPlaneIndexMap();
36  } // namespace details
37 
38 
39  class MCEdepHit {
40 
41  public:
42 
43  //static const unsigned short kINVALID_USHORT;
44 
45  public:
46 
47  MCEdepHit(){ Clear(); }
48 
49  unsigned short timeStart;
50  unsigned short timeEnd;
51  unsigned short timeMax;
52  float qSum;
53  float qMax;
54  void Clear()
55  {
56  //timeStart = timeEnd = timeMax = kINVALID_USHORT;
57  timeStart = timeEnd = timeMax = 0;
58  qSum = qMax = 0;
59  }
60  };
61 
63  public:
64  double _x, _y, _z;
65 
66  public:
67  UniquePosition(double x=0, double y=0, double z=0)
68  { _x = x; _y = y; _z = z; }
69 
70 
71  inline bool operator<( const UniquePosition& rhs) const
72  {
73  if(_x < rhs._x) return true;
74  if(rhs._x < _x) return false;
75  if(_y < rhs._y) return true;
76  if(rhs._y < _y) return false;
77  if(_z < rhs._z) return true;
78  if(rhs._z < _z) return false;
79  return false;
80  }
81 
82  };
83 
84 
85  struct MCEdep {
86  struct deposit{
87  float energy {};
88  float charge {};
89  deposit() = default;
90  deposit(float e, float c) : energy(e), charge(c) { }
91  };
92 
95  std::vector<deposit> deps {};
96 
97  MCEdep() = default;
98 
100  geo::PlaneID pi,
101  size_t num_planes,
102  float e, float c,
103  size_t id) :
104  pos(p), pid(pi), deps(num_planes) { deps[id].energy=e; deps[id].charge=c;}
105  };
106 
107  class MCRecoEdep {
108 
109  public:
110 
112  MCRecoEdep(fhicl::ParameterSet const& pset);
113  //ClusterMergeAlg(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
114 
115  void MakeMCEdep(const std::vector<sim::SimChannel>& schArray);
116 
117  bool ExistTrack(const unsigned int track_id) const
118  { return (_track_index.find(track_id) != _track_index.end()); }
119 
121  int TrackToEdepIndex(unsigned int track_id) const
122  {
123  auto iter = _track_index.find(track_id);
124  return (iter == _track_index.end() ? -1 : (int)((*iter).second));
125  }
126 
128  const std::vector<sim::MCEdep>& GetEdepArrayAt(size_t edep_index) const;
129 
131  const std::map<unsigned int,size_t> TrackIndexMap() const
132  { return _track_index; }
133 
134  void Clear() {
135  _mc_edeps.clear();
136  _track_index.clear();
137  std::vector<std::vector<sim::MCEdep>>().swap(_mc_edeps);
138  std::map<unsigned int,size_t>().swap(_track_index);
139  }
140  protected:
141 
142  std::vector<sim::MCEdep>& __GetEdepArray__(unsigned int track_id);
143 
146  std::map<unsigned int,size_t> _track_index;
147  std::vector<std::vector<sim::MCEdep> > _mc_edeps;
148 
149  }; // class MCRecoEdep
150 
151 } //namespace cluster
152 #endif
Float_t x
Definition: compare.C:6
MCEdep(sim::UniquePosition p, geo::PlaneID pi, size_t num_planes, float e, float c, size_t id)
Definition: MCRecoEdep.h:99
bool operator<(const UniquePosition &rhs) const
Definition: MCRecoEdep.h:71
void Clear()
Definition: MCRecoEdep.h:54
Float_t y
Definition: compare.C:6
unsigned short timeEnd
Definition: MCRecoEdep.h:50
Double_t z
Definition: plot.C:279
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
std::map< geo::PlaneID, size_t > createPlaneIndexMap()
Definition: MCRecoEdep.cxx:17
unsigned short timeMax
Definition: MCRecoEdep.h:51
Particle class.
int TrackToEdepIndex(unsigned int track_id) const
Converts a track ID to MCEdep array index. Returns -1 if no corresponding array found ...
Definition: MCRecoEdep.h:121
bool ExistTrack(const unsigned int track_id) const
Definition: MCRecoEdep.h:117
double energy
Definition: plottest35.C:25
unsigned short timeStart
Definition: MCRecoEdep.h:49
Monte Carlo Simulation.
std::vector< std::vector< sim::MCEdep > > _mc_edeps
Definition: MCRecoEdep.h:147
deposit(float e, float c)
Definition: MCRecoEdep.h:90
UniquePosition(double x=0, double y=0, double z=0)
Definition: MCRecoEdep.h:67
object containing MC truth information necessary for making RawDigits and doing back tracking ...
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
std::map< unsigned int, size_t > _track_index
Definition: MCRecoEdep.h:146
Float_t e
Definition: plot.C:34
const std::map< unsigned int, size_t > TrackIndexMap() const
Returns a map of track id <-> MCEdep vector index.
Definition: MCRecoEdep.h:131
art framework interface to geometry description