LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Shower.h
Go to the documentation of this file.
1 //
3 // \brief Definition of shower object for LArSoft
4 //
5 // \author brebel@fnal.gov, modifications by andrzej.szelc@yale.edu and yuntse@slac.stanford.edu
6 //
8 #ifndef SHOWER_H
9 #define SHOWER_H
10 
12 #include <iosfwd>
13 #include <limits> // std::numeric_limits<>
14 
15 #include "TVector3.h"
16 
17 namespace recob {
18 
19  class Shower {
20 
21  public:
22  Shower();
23 
24  private:
25  int fID;
26  TVector3 fDCosStart;
27  TVector3 fSigmaDCosStart;
28  TVector3 fXYZstart;
29  TVector3 fSigmaXYZstart;
30  std::vector<double> fTotalEnergy;
31  std::vector<double> fSigmaTotalEnergy;
32  std::vector<double> fdEdx;
33  std::vector<double> fSigmadEdx;
34 
35  std::vector<double> fTotalMIPEnergy;
36  std::vector<double> fSigmaTotalMIPEnergy;
48  double fLength;
49 
62  double fOpenAngle;
63 
73  static constexpr double InvalidLength = std::numeric_limits<double>::lowest();
74 
84  static constexpr double InvalidOpeningAngle = std::numeric_limits<double>::lowest();
85 
86  public:
87  Shower(TVector3 const& dcosVtx,
88  TVector3 const& dcosVtxErr,
89  TVector3 const& xyz,
90  TVector3 const& xyzErr,
91  std::vector<double> TotalEnergy,
92  std::vector<double> TotalEnergyErr,
93  std::vector<double> dEdx,
94  std::vector<double> dEdxErr,
95  int bestplane,
96  int id,
97  double length,
98  double openAngle);
99 
102  Shower(TVector3 const& dcosVtx,
103  TVector3 const& dcosVtxErr,
104  TVector3 const& xyz,
105  TVector3 const& xyzErr,
106  std::vector<double> TotalEnergy,
107  std::vector<double> TotalEnergyErr,
108  std::vector<double> dEdx,
109  std::vector<double> dEdxErr,
110  int bestplane,
111  int id = util::kBogusI)
112  : Shower(dcosVtx,
113  dcosVtxErr,
114  xyz,
115  xyzErr,
116  TotalEnergy,
117  TotalEnergyErr,
118  dEdx,
119  dEdxErr,
120  bestplane,
121  id,
122  InvalidLength,
123  InvalidOpeningAngle)
124  {}
125 
126  //set methods
127  void set_id(const int id) { fID = id; }
128  void set_total_energy(const std::vector<double>& q) { fTotalEnergy = q; }
129  void set_total_energy_err(const std::vector<double>& q) { fSigmaTotalEnergy = q; }
130  void set_total_MIPenergy(const std::vector<double>& q) { fTotalMIPEnergy = q; }
131  void set_total_MIPenergy_err(const std::vector<double>& q) { fSigmaTotalMIPEnergy = q; }
132  void set_total_best_plane(const int q) { fBestPlane = q; }
133 
134  void set_direction(const TVector3& dir) { fDCosStart = dir; }
135  void set_direction_err(const TVector3& dir_e) { fSigmaDCosStart = dir_e; }
136  void set_start_point(const TVector3& xyz) { fXYZstart = xyz; }
137  void set_start_point_err(const TVector3& xyz_e) { fSigmaXYZstart = xyz_e; }
138  void set_dedx(const std::vector<double>& q) { fdEdx = q; }
139  void set_dedx_err(const std::vector<double>& q) { fSigmadEdx = q; }
140  void set_length(const double& l) { fLength = l; }
141  void set_open_angle(const double& a) { fOpenAngle = a; }
142 
143  int ID() const;
144 
145  const TVector3& Direction() const;
146  const TVector3& DirectionErr() const;
147 
148  const TVector3& ShowerStart() const;
149  const TVector3& ShowerStartErr() const;
150 
151  const std::vector<double>& Energy() const;
152  const std::vector<double>& EnergyErr() const;
153 
154  const std::vector<double>& MIPEnergy() const;
155  const std::vector<double>& MIPEnergyErr() const;
156  int best_plane() const;
157  double Length() const;
158  double OpenAngle() const;
159  const std::vector<double>& dEdx() const;
160  const std::vector<double>& dEdxErr() const;
161 
162  //
163  // being floating point numbers, equality is a risky comparison;
164  // we use anything negative to denote that the following items are not valid
165  //
166 
168  bool has_open_angle() const;
169 
171  bool has_length() const;
172 
173  friend std::ostream& operator<<(std::ostream& stream, Shower const& a);
174 
175  friend bool operator<(const Shower& a, const Shower& b);
176 
177  static_assert(InvalidLength < 0.0f, "Invalid length must be negative!");
178  static_assert(InvalidOpeningAngle < 0.0f, "Invalid opening angle must be negative!");
179 
180  }; // recob::Shower
181 }
182 
183 inline int recob::Shower::ID() const
184 {
185  return fID;
186 }
187 
188 inline const TVector3& recob::Shower::Direction() const
189 {
190  return fDCosStart;
191 }
192 inline const TVector3& recob::Shower::DirectionErr() const
193 {
194  return fSigmaDCosStart;
195 }
196 
197 inline const TVector3& recob::Shower::ShowerStart() const
198 {
199  return fXYZstart;
200 }
201 inline const TVector3& recob::Shower::ShowerStartErr() const
202 {
203  return fSigmaXYZstart;
204 }
205 
206 inline const std::vector<double>& recob::Shower::Energy() const
207 {
208  return fTotalEnergy;
209 }
210 inline const std::vector<double>& recob::Shower::EnergyErr() const
211 {
212  return fSigmaTotalEnergy;
213 }
214 
215 inline const std::vector<double>& recob::Shower::MIPEnergy() const
216 {
217  return fTotalMIPEnergy;
218 }
219 inline const std::vector<double>& recob::Shower::MIPEnergyErr() const
220 {
221  return fSigmaTotalMIPEnergy;
222 }
223 inline int recob::Shower::best_plane() const
224 {
225  return fBestPlane;
226 }
227 inline double recob::Shower::Length() const
228 {
229  return fLength;
230 }
231 inline double recob::Shower::OpenAngle() const
232 {
233  return fOpenAngle;
234 }
235 inline const std::vector<double>& recob::Shower::dEdx() const
236 {
237  return fdEdx;
238 }
239 inline const std::vector<double>& recob::Shower::dEdxErr() const
240 {
241  return fSigmadEdx;
242 }
243 
244 //
245 // being floating point numbers, equality is a risky comparison;
246 // we use anything negative to denote that the following items are not valid
247 //
248 inline bool recob::Shower::has_open_angle() const
249 {
250  return fOpenAngle >= 0.0;
251 }
252 inline bool recob::Shower::has_length() const
253 {
254  return fLength >= 0.0;
255 }
256 
257 #endif // SHOWER_H
int best_plane() const
Definition: Shower.h:223
const std::vector< double > & dEdxErr() const
Definition: Shower.h:239
void set_start_point_err(const TVector3 &xyz_e)
Definition: Shower.h:137
const TVector3 & ShowerStart() const
Definition: Shower.h:197
void set_dedx_err(const std::vector< double > &q)
Definition: Shower.h:139
void set_direction_err(const TVector3 &dir_e)
Definition: Shower.h:135
std::vector< double > fTotalMIPEnergy
Calculated Energy per each plane.
Definition: Shower.h:35
Reconstruction base classes.
bool has_length() const
Returns whether the shower has a valid length.
Definition: Shower.h:252
double Length() const
Definition: Shower.h:227
const std::vector< double > & EnergyErr() const
Definition: Shower.h:210
std::vector< double > fdEdx
Calculated dE/dx per each plane.
Definition: Shower.h:32
std::vector< double > fSigmadEdx
Calculated dE/dx per each plane.
Definition: Shower.h:33
std::vector< double > fSigmaTotalMIPEnergy
Calculated Energy per each plane.
Definition: Shower.h:36
TVector3 fSigmaXYZstart
uncertainty on initial direction cosines
Definition: Shower.h:29
const std::vector< double > & Energy() const
Definition: Shower.h:206
void set_total_energy(const std::vector< double > &q)
Definition: Shower.h:128
friend bool operator<(const Shower &a, const Shower &b)
Definition: Shower.cxx:62
const TVector3 & ShowerStartErr() const
Definition: Shower.h:201
constexpr int kBogusI
obviously bogus integer value
void set_total_MIPenergy_err(const std::vector< double > &q)
Definition: Shower.h:131
std::vector< double > fTotalEnergy
Calculated Energy per each plane.
Definition: Shower.h:30
void set_total_energy_err(const std::vector< double > &q)
Definition: Shower.h:129
bool has_open_angle() const
Returns whether the shower has a valid opening angle.
Definition: Shower.h:248
static constexpr double InvalidLength
The magic constant indicating the invalidity of the shower length variable.
Definition: Shower.h:73
TFile f
Definition: plotHisto.C:6
void set_id(const int id)
Definition: Shower.h:127
const std::vector< double > & MIPEnergyErr() const
Definition: Shower.h:219
void set_direction(const TVector3 &dir)
Definition: Shower.h:134
const std::vector< double > & dEdx() const
Definition: Shower.h:235
const std::vector< double > & MIPEnergy() const
Definition: Shower.h:215
static constexpr double InvalidOpeningAngle
The magic constant indicating the invalidity of the opening angle variable.
Definition: Shower.h:84
void set_length(const double &l)
Definition: Shower.h:140
double OpenAngle() const
Definition: Shower.h:231
void set_open_angle(const double &a)
Definition: Shower.h:141
TVector3 fDCosStart
direction cosines at start of shower
Definition: Shower.h:26
const TVector3 & DirectionErr() const
Definition: Shower.h:192
int fID
Default constructor.
Definition: Shower.h:25
TVector3 fSigmaDCosStart
uncertainty on initial direction cosines
Definition: Shower.h:27
const TVector3 & Direction() const
Definition: Shower.h:188
void set_total_best_plane(const int q)
Definition: Shower.h:132
void set_total_MIPenergy(const std::vector< double > &q)
Definition: Shower.h:130
double fOpenAngle
Opening angle [rad].
Definition: Shower.h:62
TDirectory * dir
Definition: macro.C:5
double fLength
Shower length [cm].
Definition: Shower.h:48
int fBestPlane
Definition: Shower.h:37
std::vector< double > fSigmaTotalEnergy
Calculated Energy per each plane.
Definition: Shower.h:31
friend std::ostream & operator<<(std::ostream &stream, Shower const &a)
Definition: Shower.cxx:50
TVector3 fXYZstart
direction cosines at start of shower
Definition: Shower.h:28
void set_start_point(const TVector3 &xyz)
Definition: Shower.h:136
Collection of Physical constants used in LArSoft.
Shower(TVector3 const &dcosVtx, TVector3 const &dcosVtxErr, TVector3 const &xyz, TVector3 const &xyzErr, std::vector< double > TotalEnergy, std::vector< double > TotalEnergyErr, std::vector< double > dEdx, std::vector< double > dEdxErr, int bestplane, int id=util::kBogusI)
Definition: Shower.h:102
int ID() const
Definition: Shower.h:183
void set_dedx(const std::vector< double > &q)
Definition: Shower.h:138