LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SimPhotons.h
Go to the documentation of this file.
1 
29 #ifndef LARDATAOBJ_SIMULATION_SIMPHOTONS_H
30 #define LARDATAOBJ_SIMULATION_SIMPHOTONS_H
31 
32 // LArSoft libraries
35 
36 // C/C++ standard libraries
37 #include <limits> // std::numeric_limits<>
38 #include <map>
39 #include <string>
40 #include <vector>
41 
42 // -----------------------------------------------------------------------------
43 // forward declarations
44 namespace sim {
45  struct OnePhoton;
46  class SimPhotons;
47  class SimPhotonsLite;
48  class SimPhotonsCollection;
49 
51  bool operator<(OnePhoton const&, OnePhoton const&);
52 
53 } // namespace sim
54 
55 // -----------------------------------------------------------------------------
61 
64 
72 
75  float Time{std::numeric_limits<float>::min()};
76 
78  float Energy{0.0};
79 
81  int MotherTrackID{std::numeric_limits<int>::min()};
82 
84  bool SetInSD{true};
85 
86 }; // sim::OnePhoton
87 
88 // -----------------------------------------------------------------------------
99 public:
101  SimPhotonsLite() = default;
102 
104  SimPhotonsLite(int chan) : OpChannel(chan) {}
105 
106  int OpChannel;
107 
109  std::map<int, int> DetectedPhotons;
110 
113 
116  SimPhotonsLite operator+(const SimPhotonsLite& rhs) const;
117 
119  bool operator==(const SimPhotonsLite& other) const;
120 
121 }; // sim::SimPhotonsLite
122 
123 // -----------------------------------------------------------------------------
127 class sim::SimPhotons : public std::vector<sim::OnePhoton> {
128 
129 public:
131 
132  // --- BEGIN -- Vector types -------------------------------------------------
135 
136  typedef std::vector<OnePhoton> list_type;
137  typedef list_type::value_type value_type;
140  typedef list_type::reverse_iterator reverse_iterator;
141  typedef list_type::const_reverse_iterator const_reverse_iterator;
142  typedef list_type::size_type size_type;
143  typedef list_type::difference_type difference_type;
144 
146  // --- END -- Vector types ---------------------------------------------------
147 
149  SimPhotons() = default;
150 
152  SimPhotons(int chan) : fOpChannel(chan) {}
153 
155  int OpChannel() const;
156 
158  void SetChannel(int ch);
159 
161  SimPhotons& operator+=(const SimPhotons& rhs);
162 
165  SimPhotons operator+(const SimPhotons& rhs) const;
166 
168  bool operator==(const SimPhotons& other) const;
169 
170 }; // sim::SimPhotons
171 
172 // -----------------------------------------------------------------------------
178 class sim::SimPhotonsCollection : public std::map<int, sim::SimPhotons> {
179 
180  std::string fTheSDName;
181 
182 public:
183  // --- BEGIN -- Vector types -------------------------------------------------
186  typedef std::map<int, SimPhotons> list_type;
187  typedef list_type::key_type key_type;
188  typedef list_type::mapped_type mapped_type;
189  typedef list_type::value_type value_type;
192  typedef list_type::reverse_iterator reverse_iterator;
193  typedef list_type::const_reverse_iterator const_reverse_iterator;
194  typedef list_type::size_type size_type;
195  typedef list_type::difference_type difference_type;
196  typedef list_type::key_compare key_compare;
197  typedef list_type::allocator_type allocator_type;
198 
200  // --- END -- Vector types ---------------------------------------------------
201 
203  SimPhotonsCollection() = default;
204 
206  std::string const& GetSDName() const;
207 
209  void SetSDName(std::string const& TheSDName);
210 
211 }; // sim::SimPhotonsCollection
212 
213 // =============================================================================
214 // === Inline implementations
215 // =============================================================================
216 // -----------------------------------------------------------------------------
217 // --- sim::OnePhoton
218 // -----------------------------------------------------------------------------
219 inline bool sim::operator<(OnePhoton const& a, OnePhoton const& b)
220 {
221  if (a.Time < b.Time) return true;
222  if (a.Time > b.Time) return false;
223 
224  return (a.MotherTrackID < b.MotherTrackID);
225 } // sim::operator< (OnePhoton const&, OnePhoton const&)
226 
227 // -----------------------------------------------------------------------------
228 // --- sim::SimPhotonsLite
229 // -----------------------------------------------------------------------------
231 {
232  return OpChannel == other.OpChannel;
233 }
234 
235 // -----------------------------------------------------------------------------
236 // --- sim::SimPhotons
237 // -----------------------------------------------------------------------------
238 
239 inline int sim::SimPhotons::OpChannel() const
240 {
241  return fOpChannel;
242 }
243 
244 inline void sim::SimPhotons::SetChannel(int ch)
245 {
246  fOpChannel = ch;
247 }
248 
250 {
251  return OpChannel() == other.OpChannel();
252 }
253 
254 // -----------------------------------------------------------------------------
255 // --- sim::SimPhotonsCollection
256 // -----------------------------------------------------------------------------
257 
258 inline std::string const& sim::SimPhotonsCollection::GetSDName() const
259 {
260  return fTheSDName;
261 }
262 
263 inline void sim::SimPhotonsCollection::SetSDName(std::string const& TheSDName)
264 {
265  fTheSDName = TheSDName;
266 }
267 
268 // -----------------------------------------------------------------------------
269 
270 #endif // LARDATAOBJ_SIMULATION_SIMPHOTONS_H
list_type::allocator_type allocator_type
Definition: SimPhotons.h:197
void SetSDName(std::string const &TheSDName)
Sets the name of the sensitive detector for this collection.
Definition: SimPhotons.h:263
intermediate_table::iterator iterator
bool operator==(const SimPhotons &other) const
Returns whether other is on the same channel (OpChannel) as this.
Definition: SimPhotons.h:249
int OpChannel() const
Returns the optical channel number this object is associated to.
Definition: SimPhotons.h:239
list_type::difference_type difference_type
Definition: SimPhotons.h:195
std::vector< OnePhoton > list_type
Definition: SimPhotons.h:136
list_type::size_type size_type
Definition: SimPhotons.h:194
list_type::size_type size_type
Definition: SimPhotons.h:142
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:60
list_type::difference_type difference_type
Definition: SimPhotons.h:143
intermediate_table::const_iterator const_iterator
int fOpChannel
Optical detector channel associated to this data.
Definition: SimPhotons.h:130
list_type::key_compare key_compare
Definition: SimPhotons.h:196
SimPhotons(int chan)
Constructor: associated to optical detector channel chan, and empty.
Definition: SimPhotons.h:152
list_type::key_type key_type
Definition: SimPhotons.h:187
geo::Point_t InitialPosition
Scintillation position in world coordinates [cm].
Definition: SimPhotons.h:63
list_type::reverse_iterator reverse_iterator
Definition: SimPhotons.h:140
std::map< int, int > DetectedPhotons
Number of photons detected at each given time: time tick -> photons.
Definition: SimPhotons.h:109
void SetChannel(int ch)
Sets the optical detector channel number this object is associated to.
Definition: SimPhotons.h:244
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
Definitions of vector data types for optical detectors.
Definitions of geometry vector data types.
list_type::const_reverse_iterator const_reverse_iterator
Definition: SimPhotons.h:193
std::string const & GetSDName() const
Returns the name of the sensitive detector for this collection.
Definition: SimPhotons.h:258
list_type::const_reverse_iterator const_reverse_iterator
Definition: SimPhotons.h:141
int OpChannel
Optical detector channel associated to this data.
Definition: SimPhotons.h:106
String & operator+=(String &s, VectorDumper< Vector > const &manip)
Appends a string rendering of a vector to the specified string.
Definition: DumpUtils.h:463
list_type::iterator iterator
Definition: SimPhotons.h:138
SimPhotonsLite(int chan)
Constructor: associated to optical detector channel chan, and empty.
Definition: SimPhotons.h:104
list_type::iterator iterator
Definition: SimPhotons.h:190
bool operator==(const SimPhotonsLite &other) const
Returns whether other is on the same channel (OpChannel) as this.
Definition: SimPhotons.h:230
Monte Carlo Simulation.
list_type::mapped_type mapped_type
Definition: SimPhotons.h:188
list_type::value_type value_type
Definition: SimPhotons.h:137
list_type::reverse_iterator reverse_iterator
Definition: SimPhotons.h:192
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:127
Compact representation of photons on a channel.
Definition: SimPhotons.h:98
bool SetInSD
Whether the photon reaches the sensitive detector.
Definition: SimPhotons.h:84
QuadExpr operator+(double v, const QuadExpr &e)
Definition: QuadExpr.h:36
list_type::const_iterator const_iterator
Definition: SimPhotons.h:191
list_type::value_type value_type
Definition: SimPhotons.h:189
geo::OpticalPoint_t FinalLocalPosition
Where photon enters the optical detector in local coordinates [cm].
Definition: SimPhotons.h:71
list_type::const_iterator const_iterator
Definition: SimPhotons.h:139
OpticalPoint3DBase_t< double > OpticalPoint_t
Type of optical 3D point with representation in double precision.
std::map< int, SimPhotons > list_type
Definition: SimPhotons.h:186
std::string fTheSDName
Sensitive detector name.
Definition: SimPhotons.h:180
float Energy
Scintillation photon energy [GeV].
Definition: SimPhotons.h:78
Collection of sim::SimPhotons, indexed by channel number.
Definition: SimPhotons.h:178
bool operator==(infinite_endcount_iterator< T > const &, count_iterator< T > const &)
Definition: counter.h:278
bool operator<(const BeamGateInfo &lhs, const BeamGateInfo &rhs)
Definition: BeamGateInfo.h:40
int MotherTrackID
ID of the GEANT4 track causing the scintillation.
Definition: SimPhotons.h:81