RecoHit.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file RecoHit.cxx
3 // \brief RecoHit class
4 // \version $Id: RecoHit.cxx,v 1.7 2012-03-07 22:13:19 bckhouse Exp $
5 // \author $Author: bckhouse $
6 ////////////////////////////////////////////////////////////////////////
7 #include "RecoBase/RecoHit.h"
8 
9 #include <cassert>
10 #include <iomanip>
11 #include <iostream>
12 #include <iosfwd>
13 #include <string>
14 
15 namespace rb
16 {
17  //----------------------------------------------------------------------
19  fPECorr(-1),
20  fMIP(-1),
21  fGeV(-1),
22  fX(0),
23  fY(0),
24  fZ(0),
25  fT(0)
26  {
27  }
28 
29  //----------------------------------------------------------------------
31  {
32  }
33 
34  //----------------------------------------------------------------------
35  bool RecoHit::IsCalibrated() const
36  {
37  return fPECorr >= 0 && fMIP >= 0 && fGeV >= 0;
38  }
39 
40  //----------------------------------------------------------------------
41  void RecoHit::Print() const
42  {
43  std::cout << *this << std::endl;
44  }
45 
46  //----------------------------------------------------------------------
47  float RecoHit::PECorr() const
48  {
49  if(!IsCalibrated()){
50  std::cerr << "This RecoHit is not calibrated. You should check RecoHit::IsCalibrated() before RecoHit::PECorr() and take appropriate action (probably skipping the hit). Aborting." << std::endl;
51  abort();
52  }
53 
54  return fPECorr;
55  }
56 
57  //----------------------------------------------------------------------
58  float RecoHit::MIP() const
59  {
60  if(!IsCalibrated()){
61  std::cerr << "This RecoHit is not calibrated. You should check RecoHit::IscCalibrated() before RecoHit::MIP() and take appropriate action (probably skipping the hit). Aborting." << std::endl;
62  abort();
63  }
64 
65  return fMIP;
66  }
67 
68  //----------------------------------------------------------------------
69  float RecoHit::GeV() const
70  {
71  if(!IsCalibrated()){
72  std::cerr << "This RecoHit is not calibrated. You should check RecoHit::IsCalibrated() before RecoHit::GeV() and take appropriate action (probably skipping the hit). Aborting." << std::endl;
73  abort();
74  }
75 
76  return fGeV;
77  }
78 
79  //------------------------------------------------------------
80  std::ostream& operator<< (std::ostream& o, const RecoHit& r)
81  {
82  o << std::setiosflags(std::ios::fixed) << std::setprecision(2);
83  o << "PECor = " << std::setw(5) << std::right << r.PECorr()
84  << " MIP = " << std::setw(5) << std::right << r.MIP()
85  << " GeV = " << std::setw(5) << std::right << r.GeV()
86  << " X = " << std::setw(5) << std::right << r.X()
87  << " Y = " << std::setw(5) << std::right << r.Y()
88  << " Z = " << std::setw(5) << std::right << r.Z();
89  return o;
90  }
91 } // end namespace rb
92 ///////////////////////////////////////////////////////////////////////////////////
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
float Z() const
Definition: RecoHit.h:38
OStream cerr
Definition: OStream.cxx:7
friend std::ostream & operator<<(std::ostream &o, const RecoHit &r)
Definition: RecoHit.cxx:80
float fPECorr
PE with attenuation corrections added.
Definition: RecoHit.h:54
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
Definition: RecoHit.h:19
bool IsCalibrated() const
You MUST check here before accessing PECorr, MIP or GeV.
Definition: RecoHit.cxx:35
void Print() const
Definition: RecoHit.cxx:41
Perform a "2 point" Hough transform on a collection of hits.
float fGeV
energy deposition represented by this hit
Definition: RecoHit.h:56
OStream cout
Definition: OStream.cxx:6
float MIP() const
Definition: RecoHit.cxx:58
float GeV() const
Definition: RecoHit.cxx:69
float X() const
Definition: RecoHit.h:36
TRandom3 r(0)
float Y() const
Definition: RecoHit.h:37
float PECorr() const
Definition: RecoHit.cxx:47
float fMIP
pulseheight normalized to a MIP
Definition: RecoHit.h:55