All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCRecoEdep.h
Go to the documentation of this file.
1 #ifndef MCRECOEDEP_H
2 #define MCRECOEDEP_H
3 
4 // LArSoft
9 
10 // Framework includes
11 namespace fhicl { class ParameterSet; }
12 
13 // STL
14 #include <map>
15 #include <vector>
16 
17 namespace sim
18 {
19 
20  namespace details {
21  // Returns a map with all available plane IDs,
22  // each mapped into an index from a compact range.
23  std::map<geo::PlaneID, size_t> createPlaneIndexMap();
24  } // namespace details
25 
26 
27  class MCEdepHit {
28 
29  public:
30 
31  //static const unsigned short kINVALID_USHORT;
32 
33  public:
34 
35  MCEdepHit(){ Clear(); }
36 
37  unsigned short timeStart;
38  unsigned short timeEnd;
39  unsigned short timeMax;
40  float qSum;
41  float qMax;
42  void Clear()
43  {
44  //timeStart = timeEnd = timeMax = kINVALID_USHORT;
45  timeStart = timeEnd = timeMax = 0;
46  qSum = qMax = 0;
47  }
48  };
49 
51  public:
52  double _x, _y, _z;
53 
54  public:
55  UniquePosition(double x=0, double y=0, double z=0)
56  { _x = x; _y = y; _z = z; }
57 
58 
59  inline bool operator<( const UniquePosition& rhs) const
60  {
61  if(_x < rhs._x) return true;
62  if(rhs._x < _x) return false;
63  if(_y < rhs._y) return true;
64  if(rhs._y < _y) return false;
65  if(_z < rhs._z) return true;
66  if(rhs._z < _z) return false;
67  return false;
68  }
69 
70  };
71 
72 
73  struct MCEdep {
74  struct deposit{
75  float energy {};
76  float charge {};
77  deposit() = default;
78  deposit(float e, float c) : energy(e), charge(c) { }
79  };
80 
83  std::vector<deposit> deps {};
84 
85  MCEdep() = default;
86 
89  size_t num_planes,
90  float e, float c,
91  size_t id) :
92  pos(p), pid(pi), deps(num_planes) { deps[id].energy=e; deps[id].charge=c;}
93  };
94 
95  class MCRecoEdep {
96 
97  public:
98 
99  /// Default constructor with fhicl parameters
100  MCRecoEdep(fhicl::ParameterSet const& pset);
101  //ClusterMergeAlg(fhicl::ParameterSet const& pset, art::ActivityRegistry& reg);
102 
103  void MakeMCEdep(const std::vector<sim::SimChannel>& schArray);
104 
105  void MakeMCEdep(const std::vector<sim::SimEnergyDeposit>& sedArray);
106 
107  void MakeMCEdep(const std::vector<sim::SimEnergyDepositLite>& sedArray);
108 
109  bool ExistTrack(const unsigned int track_id) const
110  { return (_track_index.find(track_id) != _track_index.end()); }
111 
112  /// Converts a track ID to MCEdep array index. Returns -1 if no corresponding array found .
113  int TrackToEdepIndex(unsigned int track_id) const
114  {
115  auto iter = _track_index.find(track_id);
116  return (iter == _track_index.end() ? -1 : (int)((*iter).second));
117  }
118 
119  /// Returns a vector of MCEdep object at the given index
120  const std::vector<sim::MCEdep>& GetEdepArrayAt(size_t edep_index) const;
121 
122  /// Returns a map of track id <-> MCEdep vector index
123  const std::map<unsigned int,size_t> TrackIndexMap() const
124  { return _track_index; }
125 
126  void Clear() {
127  _mc_edeps.clear();
128  _track_index.clear();
129  std::vector<std::vector<sim::MCEdep>>().swap(_mc_edeps);
130  std::map<unsigned int,size_t>().swap(_track_index);
131  }
132  protected:
133 
134  std::vector<sim::MCEdep>& __GetEdepArray__(unsigned int track_id);
135 
138  std::map<unsigned int,size_t> _track_index;
139  std::vector<std::vector<sim::MCEdep> > _mc_edeps;
140 
141  }; // class MCRecoEdep
142 
143 } //namespace cluster
144 #endif
MCEdep(sim::UniquePosition p, geo::PlaneID pi, size_t num_planes, float e, float c, size_t id)
Definition: MCRecoEdep.h:87
bool operator<(const UniquePosition &rhs) const
Definition: MCRecoEdep.h:59
process_name opflash particleana ie ie ie z
void Clear()
Definition: MCRecoEdep.h:42
MCEdep()=default
void MakeMCEdep(const std::vector< sim::SimChannel > &schArray)
Definition: MCRecoEdep.cxx:64
process_name opflash particleana ie x
unsigned short timeEnd
Definition: MCRecoEdep.h:38
pdgs p
Definition: selectors.fcl:22
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
std::map< geo::PlaneID, size_t > createPlaneIndexMap()
Definition: MCRecoEdep.cxx:26
unsigned short timeMax
Definition: MCRecoEdep.h:39
const std::vector< sim::MCEdep > & GetEdepArrayAt(size_t edep_index) const
Returns a vector of MCEdep object at the given index.
Definition: MCRecoEdep.cxx:49
MCRecoEdep(fhicl::ParameterSet const &pset)
Default constructor with fhicl parameters.
Definition: MCRecoEdep.cxx:42
geo::PlaneID pid
Definition: MCRecoEdep.h:82
process_name opflash particleana ie ie y
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:113
bool ExistTrack(const unsigned int track_id) const
Definition: MCRecoEdep.h:109
sim::UniquePosition pos
Definition: MCRecoEdep.h:81
pdgs pi
Definition: selectors.fcl:22
contains information for a single step in the detector simulation (pared down in size to the essentia...
unsigned short timeStart
Definition: MCRecoEdep.h:37
Definition of data types for geometry description.
std::vector< std::vector< sim::MCEdep > > _mc_edeps
Definition: MCRecoEdep.h:139
deposit(float e, float c)
Definition: MCRecoEdep.h:78
UniquePosition(double x=0, double y=0, double z=0)
Definition: MCRecoEdep.h:55
std::vector< sim::MCEdep > & __GetEdepArray__(unsigned int track_id)
Definition: MCRecoEdep.cxx:56
contains information for a single step in the detector simulation
object containing MC truth information necessary for making RawDigits and doing back tracking ...
do i e
std::vector< deposit > deps
Definition: MCRecoEdep.h:83
std::map< unsigned int, size_t > _track_index
Definition: MCRecoEdep.h:138
const std::map< unsigned int, size_t > TrackIndexMap() const
Returns a map of track id &lt;-&gt; MCEdep vector index.
Definition: MCRecoEdep.h:123