LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
SimPhotons.h
Go to the documentation of this file.
1 // This file contains the definitions of the classes which
8 // are stored in the event representing OpDet hits.
9 //
10 // A OpDet Hit stores data for each photon which steps inside the OpDet
11 // volume. Currently the quantities stored are 4 potition, 4 momentum
12 // and TrackID. A SimPhotonsCollection is a set of SimPhotonss, one per OpDet
13 // in the collection.
14 //
15 // The SimPhotons is filled in by the OpDetSensitiveDetector class in LArG4
16 // and will be used to generate the OpDet response later in the simulation
17 // chain.
18 //
19 // OnePhoton, SimPhotons and SimPhotonsCollection are all persistent under
20 // ROOT I/O. For compilation to succeed, the relevant pragma lines
21 // must be present in LinkDef.h.
22 //
23 // The current implementation resembles that of an STL container in
24 // some respects but needs more work before it is polished product.
25 //
26 // Ben Jones, MIT, 06/04/2010
27 //
28 
29 #ifndef SimPhotons_h
30 #define SimPhotons_h
31 
32 #include "TLorentzVector.h"
33 
34 #include <map>
35 
36 
37 namespace sim
38 {
39 
40  // This structure contains all the information per photon
41  // which entered the sensitive OpDet volume.
42 
43  class OnePhoton
44  {
45  public:
46  OnePhoton();
47 
48  bool SetInSD;
49  TVector3 InitialPosition;
50  TVector3 FinalLocalPosition; // in cm
51  float Time;
52  float Energy;
54  };
55 
57  {
58  public:
60  SimPhotonsLite(int chan)
61  : OpChannel(chan)
62  {}
63 
64  int OpChannel;
65  std::map<int, int> DetectedPhotons;
66 
68  const SimPhotonsLite operator+(const SimPhotonsLite &rhs) const;
69 
70  bool operator==(const SimPhotonsLite &other) const;
71  };
72 
73 
74  // Define a OpDet Hit as a list of OpDet photons which were
75  // recorded in the OpDet volume.
76 
77  class SimPhotons : public std::vector<OnePhoton>
78  {
79  public:
80  SimPhotons();
81  SimPhotons(int chan)
82  : fOpChannel(chan)
83  {}
84 
85  int fOpChannel;
86 
87 #ifndef __GCCXML__
88  public:
89 
90  typedef std::vector<OnePhoton> list_type;
91  typedef list_type::value_type value_type;
94  typedef list_type::reverse_iterator reverse_iterator;
95  typedef list_type::const_reverse_iterator const_reverse_iterator;
96  typedef list_type::size_type size_type;
97  typedef list_type::difference_type difference_type;
98 
99  // define addition operators for combining hits
100  // (add all photons to one vector)
101  SimPhotons& operator+=(const SimPhotons &rhs);
102  const SimPhotons operator+(const SimPhotons &rhs) const;
103 
104  bool operator== (const SimPhotons &other) const;
105 
106  int OpChannel() const;
107  void SetChannel(int ch);
108 
109 #endif
110 
111  };
112 
113 
114 
115  // The OpDet Hit collection is the set of all OpDet Hits indexed
116  // by OpDet ID
117 
118  class SimPhotonsCollection : public std::map<int, SimPhotons>{
119  public:
120 
122 
123  private:
124  std::string fTheSDName;
125 
126 #ifndef __GCCXML__
127 
128  public:
129  typedef std::map<int,SimPhotons> list_type;
130  typedef list_type::key_type key_type;
131  typedef list_type::mapped_type mapped_type;
132  typedef list_type::value_type value_type;
135  typedef list_type::reverse_iterator reverse_iterator;
136  typedef list_type::const_reverse_iterator const_reverse_iterator;
137  typedef list_type::size_type size_type;
138  typedef list_type::difference_type difference_type;
139  typedef list_type::key_compare key_compare;
140  typedef list_type::allocator_type allocator_type;
141 
142  //SimPhotons& GetHit(int);
143  //SimPhotons GetHit(int);
144 
145  // define addition operators for combining hit collections
146  // (add each hit in the collection)
147  //SimPhotonsCollection& operator+=(const SimPhotonsCollection &rhs);
148  //const SimPhotonsCollection operator+(const SimPhotonsCollection &rhs) const;
149 
150  public:
151  void SetSDName(std::string TheSDName);
152  std::string GetSDName();
153 
154 #endif
155  };
156 
157 }
158 
159 #ifndef __GCCXML__
160 
161 inline int sim::SimPhotons::OpChannel() const { return fOpChannel; }
162 inline void sim::SimPhotons::SetChannel(int ch) { fOpChannel = ch; }
163 inline std::string sim::SimPhotonsCollection::GetSDName() { return fTheSDName; }
164 inline void sim::SimPhotonsCollection::SetSDName(std::string TheSDName) { fTheSDName = TheSDName; }
165 
166 inline bool sim::SimPhotons::operator==(const sim::SimPhotons& other) const { return fOpChannel == other.OpChannel(); }
167 inline bool sim::SimPhotonsLite::operator==(const sim::SimPhotonsLite& other) const { return OpChannel == other.OpChannel; }
168 
169 #endif
170 
171 #endif
list_type::allocator_type allocator_type
Definition: SimPhotons.h:140
std::map< int, SimPhotons > list_type
Definition: SimPhotons.h:129
bool operator==(const SimPhotons &other) const
Definition: SimPhotons.h:166
void SetSDName(std::string TheSDName)
Definition: SimPhotons.h:164
int OpChannel() const
Definition: SimPhotons.h:161
list_type::difference_type difference_type
Definition: SimPhotons.h:138
intermediate_table::iterator iterator
std::vector< OnePhoton > list_type
volume number for the OpDet
Definition: SimPhotons.h:90
list_type::size_type size_type
Definition: SimPhotons.h:137
list_type::size_type size_type
Definition: SimPhotons.h:96
list_type::difference_type difference_type
Definition: SimPhotons.h:97
list_type::key_compare key_compare
Definition: SimPhotons.h:139
SimPhotons(int chan)
Definition: SimPhotons.h:81
list_type::key_type key_type
Definition: SimPhotons.h:130
list_type::reverse_iterator reverse_iterator
Definition: SimPhotons.h:94
std::map< int, int > DetectedPhotons
Definition: SimPhotons.h:65
void SetChannel(int ch)
Definition: SimPhotons.h:162
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
intermediate_table::const_iterator const_iterator
list_type::const_reverse_iterator const_reverse_iterator
Definition: SimPhotons.h:136
list_type::const_reverse_iterator const_reverse_iterator
Definition: SimPhotons.h:95
String & operator+=(String &s, VectorDumper< Vector > const &manip)
Appends a string rendering of a vector to the specified string.
Definition: DumpUtils.h:424
list_type::iterator iterator
Definition: SimPhotons.h:92
SimPhotonsLite(int chan)
Definition: SimPhotons.h:60
list_type::iterator iterator
Definition: SimPhotons.h:133
bool operator==(const SimPhotonsLite &other) const
Definition: SimPhotons.h:167
Monte Carlo Simulation.
list_type::mapped_type mapped_type
Definition: SimPhotons.h:131
list_type::value_type value_type
Definition: SimPhotons.h:91
list_type::reverse_iterator reverse_iterator
Definition: SimPhotons.h:135
TVector3 InitialPosition
Definition: SimPhotons.h:49
QuadExpr operator+(double v, const QuadExpr &e)
Definition: QuadExpr.h:37
list_type::const_iterator const_iterator
Definition: SimPhotons.h:134
list_type::value_type value_type
Definition: SimPhotons.h:132
TVector3 FinalLocalPosition
Definition: SimPhotons.h:50
list_type::const_iterator const_iterator
Definition: SimPhotons.h:93
bool operator==(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to the same ID.
std::string GetSDName()
Definition: SimPhotons.h:163