LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 
11 #include <iosfwd>
12 #include <limits> // std::numeric_limits<>
14 
15 #include "TVector3.h"
16 
17 namespace recob {
18 
19  class Shower {
20 
21  public:
22 
23  Shower();
24 
25  private:
26 
27  int fID;
28  TVector3 fDCosStart;
29  TVector3 fSigmaDCosStart;
30  TVector3 fXYZstart;
31  TVector3 fSigmaXYZstart;
32  std::vector< double > fTotalEnergy;
33  std::vector< double > fSigmaTotalEnergy;
34  std::vector< double > fdEdx;
35  std::vector< double > fSigmadEdx;
36 
37  std::vector< double > fTotalMIPEnergy;
38  std::vector< double > fSigmaTotalMIPEnergy;
50  double fLength;
51 
64  double fOpenAngle;
65 
75  static constexpr double InvalidLength
76  = std::numeric_limits<double>::lowest();
77 
87  static constexpr double InvalidOpeningAngle
88  = std::numeric_limits<double>::lowest();
89 
90  public:
91 
92  Shower(TVector3 const& dcosVtx,
93  TVector3 const& dcosVtxErr,
94  TVector3 const& xyz,
95  TVector3 const& xyzErr,
96  std::vector< double > TotalEnergy,
97  std::vector< double > TotalEnergyErr,
98  std::vector< double > dEdx,
99  std::vector< double > dEdxErr,
100  int bestplane,
101  int id,
102  double length,
103  double openAngle);
104 
107  Shower(TVector3 const& dcosVtx,
108  TVector3 const& dcosVtxErr,
109  TVector3 const& xyz,
110  TVector3 const& xyzErr,
111  std::vector< double > TotalEnergy,
112  std::vector< double > TotalEnergyErr,
113  std::vector< double > dEdx,
114  std::vector< double > dEdxErr,
115  int bestplane,
116  int id=util::kBogusI)
117  :
118  Shower(
119  dcosVtx, dcosVtxErr, xyz, xyzErr, TotalEnergy, TotalEnergyErr, dEdx, dEdxErr,
120  bestplane, id,
122  )
123  {}
124 
125 
126 
127  //set methods
128  void set_id (const int id) { fID = id; }
129  void set_total_energy (const std::vector< double >& q) { fTotalEnergy = q; }
130  void set_total_energy_err (const std::vector< double >& q) { fSigmaTotalEnergy = q; }
131  void set_total_MIPenergy (const std::vector< double >& q) { fTotalMIPEnergy = q; }
132  void set_total_MIPenergy_err (const std::vector< double >& q) { fSigmaTotalMIPEnergy = q; }
133  void set_total_best_plane (const int q) { fBestPlane = q; }
134 
135  void set_direction (const TVector3& dir) { fDCosStart = dir; }
136  void set_direction_err (const TVector3& dir_e) { fSigmaDCosStart = dir_e; }
137  void set_start_point (const TVector3& xyz) { fXYZstart = xyz; }
138  void set_start_point_err (const TVector3& xyz_e) { fSigmaXYZstart = xyz_e; }
139  void set_dedx (const std::vector< double >& q) { fdEdx = q; }
140  void set_dedx_err (const std::vector< double >& q) { fSigmadEdx = q; }
141  void set_length(const double& l) { fLength = l; }
142  void set_open_angle( const double& a ) { fOpenAngle = a; }
143 
144 
145  int ID() const;
146 
147  const TVector3& Direction() const;
148  const TVector3& DirectionErr() const;
149 
150  const TVector3& ShowerStart() const;
151  const TVector3& ShowerStartErr() const;
152 
153  const std::vector< double >& Energy() const;
154  const std::vector< double >& EnergyErr() const;
155 
156  const std::vector< double >& MIPEnergy() const;
157  const std::vector< double >& MIPEnergyErr() const;
158  int best_plane() const;
159  double Length() const;
160  double OpenAngle() const;
161  const std::vector< double >& dEdx() const;
162  const std::vector< double >& dEdxErr() const;
163 
164  //
165  // being floating point numbers, equality is a risky comparison;
166  // we use anything negative to denote that the following items are not valid
167  //
168 
170  bool has_open_angle() const;
171 
173  bool has_length() const;
174 
175 
176  friend std::ostream& operator << (std::ostream& stream, Shower const& a);
177 
178  friend bool operator < (const Shower & a, const Shower & b);
179 
180  static_assert(InvalidLength < 0.0f, "Invalid length must be negative!");
181  static_assert
182  (InvalidOpeningAngle < 0.0f, "Invalid opening angle must be negative!");
183 
184  }; // recob::Shower
185 }
186 
187  inline int recob::Shower::ID() const { return fID; }
188 
189  inline const TVector3& recob::Shower::Direction() const { return fDCosStart; }
190  inline const TVector3& recob::Shower::DirectionErr() const { return fSigmaDCosStart; }
191 
192  inline const TVector3& recob::Shower::ShowerStart() const { return fXYZstart; }
193  inline const TVector3& recob::Shower::ShowerStartErr() const { return fSigmaXYZstart; }
194 
195  inline const std::vector< double >& recob::Shower::Energy() const { return fTotalEnergy; }
196  inline const std::vector< double >& recob::Shower::EnergyErr() const { return fSigmaTotalEnergy; }
197 
198  inline const std::vector< double >& recob::Shower::MIPEnergy() const { return fTotalMIPEnergy; }
199  inline const std::vector< double >& recob::Shower::MIPEnergyErr() const { return fSigmaTotalMIPEnergy; }
200  inline int recob::Shower::best_plane() const { return fBestPlane; }
201  inline double recob::Shower::Length() const { return fLength; }
202  inline double recob::Shower::OpenAngle() const { return fOpenAngle; }
203  inline const std::vector< double >& recob::Shower::dEdx() const { return fdEdx; }
204  inline const std::vector< double >& recob::Shower::dEdxErr() const { return fSigmadEdx; }
205 
206  //
207  // being floating point numbers, equality is a risky comparison;
208  // we use anything negative to denote that the following items are not valid
209  //
210  inline bool recob::Shower::has_open_angle() const { return fOpenAngle >= 0.0; }
211  inline bool recob::Shower::has_length() const { return fLength >= 0.0; }
212 
213 
214 
215 
216 
217 #endif // SHOWER_H
int best_plane() const
Definition: Shower.h:200
const std::vector< double > & dEdxErr() const
Definition: Shower.h:204
void set_start_point_err(const TVector3 &xyz_e)
Definition: Shower.h:138
const TVector3 & ShowerStart() const
Definition: Shower.h:192
void set_dedx_err(const std::vector< double > &q)
Definition: Shower.h:140
void set_direction_err(const TVector3 &dir_e)
Definition: Shower.h:136
std::vector< double > fTotalEnergy
Calculated Energy per each plane.
Definition: Shower.h:32
Reconstruction base classes.
bool has_length() const
Returns whether the shower has a valid length.
Definition: Shower.h:211
double Length() const
Definition: Shower.h:201
const std::vector< double > & EnergyErr() const
Definition: Shower.h:196
std::vector< double > fSigmaTotalMIPEnergy
Calculated Energy per each plane.
Definition: Shower.h:38
std::vector< double > fSigmadEdx
Calculated dE/dx per each plane.
Definition: Shower.h:35
TVector3 fSigmaXYZstart
uncertainty on initial direction cosines
Definition: Shower.h:31
const std::vector< double > & Energy() const
Definition: Shower.h:195
void set_total_energy(const std::vector< double > &q)
Definition: Shower.h:129
friend bool operator<(const Shower &a, const Shower &b)
Definition: Shower.cxx:67
const TVector3 & ShowerStartErr() const
Definition: Shower.h:193
constexpr int kBogusI
obviously bogus integer value
std::vector< double > fTotalMIPEnergy
Calculated Energy per each plane.
Definition: Shower.h:37
void set_total_MIPenergy_err(const std::vector< double > &q)
Definition: Shower.h:132
void set_total_energy_err(const std::vector< double > &q)
Definition: Shower.h:130
bool has_open_angle() const
Returns whether the shower has a valid opening angle.
Definition: Shower.h:210
static constexpr double InvalidLength
The magic constant indicating the invalidity of the shower length variable.
Definition: Shower.h:76
TFile f
Definition: plotHisto.C:6
void set_id(const int id)
Definition: Shower.h:128
const std::vector< double > & MIPEnergyErr() const
Definition: Shower.h:199
void set_direction(const TVector3 &dir)
Definition: Shower.h:135
const std::vector< double > & dEdx() const
Definition: Shower.h:203
const std::vector< double > & MIPEnergy() const
Definition: Shower.h:198
static constexpr double InvalidOpeningAngle
The magic constant indicating the invalidity of the opening angle variable.
Definition: Shower.h:88
void set_length(const double &l)
Definition: Shower.h:141
double OpenAngle() const
Definition: Shower.h:202
void set_open_angle(const double &a)
Definition: Shower.h:142
TVector3 fDCosStart
direction cosines at start of shower
Definition: Shower.h:28
const TVector3 & DirectionErr() const
Definition: Shower.h:190
int fID
Default constructor.
Definition: Shower.h:27
TVector3 fSigmaDCosStart
uncertainty on initial direction cosines
Definition: Shower.h:29
const TVector3 & Direction() const
Definition: Shower.h:189
std::vector< double > fdEdx
Calculated dE/dx per each plane.
Definition: Shower.h:34
void set_total_best_plane(const int q)
Definition: Shower.h:133
void set_total_MIPenergy(const std::vector< double > &q)
Definition: Shower.h:131
double fOpenAngle
Opening angle [rad].
Definition: Shower.h:64
TDirectory * dir
Definition: macro.C:5
double fLength
Shower length [cm].
Definition: Shower.h:50
int fBestPlane
Definition: Shower.h:39
friend std::ostream & operator<<(std::ostream &stream, Shower const &a)
Definition: Shower.cxx:55
TVector3 fXYZstart
direction cosines at start of shower
Definition: Shower.h:30
void set_start_point(const TVector3 &xyz)
Definition: Shower.h:137
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:107
int ID() const
Definition: Shower.h:187
std::vector< double > fSigmaTotalEnergy
Calculated Energy per each plane.
Definition: Shower.h:33
void set_dedx(const std::vector< double > &q)
Definition: Shower.h:139