CellHit.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file CellHit.h
3 // \brief A CellHit has all the calibrated information about a hit that
4 // doesn't require any event context (e.g., reconstruction location).
5 // \version $Id: CellHit.h,v 1.10 2012-10-26 21:31:55 bckhouse Exp $
6 // \author $Author: bckhouse $
7 ////////////////////////////////////////////////////////////////////////
8 #ifndef RBCELLHIT_H
9 #define RBCELLHIT_H
10 
11 #include <iosfwd>
12 #include <vector>
13 #include <utility>
14 
17 #include "RawData/RawDigit.h"
18 
19 #ifndef __GCCXML__
22 #endif
23 
24 namespace rb
25 {
26  /// \brief A \ref rawdata::RawDigit with channel information decoded
27  class CellHit : public rawdata::RawDigit
28  {
29  public:
30  CellHit(); // Default constructor
31  ~CellHit();
32 
33 #ifndef __GCCXML__
34  CellHit(const rawdata::RawDigit& rd, int id=0);
35 
36  void Print() const; //print out the important bits of this cellhit
37 
38  // Getters
39  unsigned short Plane () const { return fPlane; }
40  unsigned short Cell () const { return fCell; }
41  geo::View_t View () const { return fView; }
42  float PE () const { return fPE; }
43  /// Returns the time of the hit in nanoseconds. This is the
44  /// multipoint fit (a.k.a. fine timing) if available, and the time
45  /// of the last baseline sample (a.k.a. coarse timing) if not.
46  float TNS () const { return fTNS; }
47  const int ID () const { return fID; }
48  bool GoodTiming() const { return !fCoarseTiming; }
50 
51  // Setters
52  void SetCell (unsigned short cell ) { fCell = cell; }
53  void SetPlane (unsigned short plane ) { fPlane = plane; }
55  void SetPE (float pe ) { fPE = pe; }
56  void SetTNS (float tns,
57  bool good ) { fTNS = tns; fCoarseTiming = !good;}
58  void SetID (int id ) { fID = id; }
59 
60  ///< Compares hits by plane, then cell, then time
61  bool operator< (const CellHit& other) const;
62  bool operator== (const CellHit& other) const; ///< Returns true if the two cellhits have the same plane, cell, PE and TDC values.
63 
64  friend std::ostream& operator << (std::ostream& o, const CellHit& c);
65 #endif // __GCCXML__
66  protected:
67  unsigned short fPlane; ///< plane number
68  unsigned short fCell; ///< cell number
69  geo::View_t fView; ///< view (geo::kX or geo::kY)
70 
71  float fPE; ///< after ADC-->PE gain applied
72  float fTNS; ///< time of hit in ns with channel differences removed
73  int fID; ///< ID for CellHit
74 
75  bool fCoarseTiming; ///< Was the timing fit bad?
76  };
77 
78 #ifndef __GCCXML__
79  /// Helper for \ref SortByPlane. Is \a a on a lower number plane than \a b?
81  const art::Ptr<rb::CellHit>& b);
82 
83  /// Helper for \ref SortByTime. Is \a a earlier than \a b?
85  const art::Ptr<rb::CellHit>& b);
86 
87  /// Helper for \ref SortByCell. Is \a a on a lower cell number than \a b?
89  const art::Ptr<rb::CellHit>& b);
90 
91  /// Helper for \ref SortByPlaneAndCell. Is \a a on a lower (plane,cell)
92  /// number than \a b?
94  const art::Ptr<rb::CellHit>& b);
95 
96  /// Sort \a c in plane order (low to high).
97  void SortByPlane(std::vector<art::Ptr<rb::CellHit> >& c);
98  /// Sort \a c in plane order (low to high).
100  /// Sort \a c in plane order (low to high).
101  /// Within a plane, order them by cell
103  /// Sort \a c in plane order (low to high).
104  /// Within a plane, order them by cell
105  void SortByPlaneAndCell(std::vector<rb::CellHit>& c);
106 
107  /// Sort \a c in time order (earliest to latest).
108  void SortByTime(std::vector<art::Ptr<rb::CellHit> >& c);
109  /// Sort \a c in time order (earliest to latest).
111 
112  /// Sort \a c in cell order (low to high)
113  void SortByCell(std::vector<art::Ptr<rb::CellHit> >& c);
114  /// Sort \a c in cell order (low to high)
116 #endif // __GCCXML__
117 } // end namespace
118 
119 #endif // RBCELLHIT_H
120 ////////////////////////////////////////////////////////////////////////
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
float TNS() const
Definition: CellHit.h:46
void SetTNS(float tns, bool good)
Definition: CellHit.h:56
bool operator==(const CellHit &other) const
Returns true if the two cellhits have the same plane, cell, PE and TDC values.
Definition: CellHit.cxx:81
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
friend std::ostream & operator<<(std::ostream &o, const CellHit &c)
Definition: CellHit.cxx:66
unsigned short Plane() const
Definition: CellHit.h:39
bool operator<(const CellHit &other) const
Definition: CellHit.cxx:54
geo::View_t fView
view (geo::kX or geo::kY)
Definition: CellHit.h:69
geo::View_t View() const
Definition: CellHit.h:41
bool CompareByCell(const art::Ptr< rb::CellHit > &a, const art::Ptr< rb::CellHit > &b)
Helper for SortByCell. Is a on a lower cell number than b?
Definition: CellHit.cxx:106
void SortByTime(std::vector< art::Ptr< rb::CellHit > > &c)
Sort c in time order (earliest to latest).
Definition: CellHit.cxx:134
geo::OfflineChan OfflineChan() const
Definition: CellHit.h:49
bool CompareByPlane(const art::Ptr< rb::CellHit > &a, const art::Ptr< rb::CellHit > &b)
Helper for SortByPlane. Is a on a lower number plane than b?
Definition: CellHit.cxx:92
bool CompareByTime(const art::Ptr< rb::CellHit > &a, const art::Ptr< rb::CellHit > &b)
Helper for SortByTime. Is a earlier than b?
Definition: CellHit.cxx:99
void SetView(geo::View_t view)
Definition: CellHit.h:54
void SetPlane(unsigned short plane)
Definition: CellHit.h:53
float fPE
after ADC–>PE gain applied
Definition: CellHit.h:71
unsigned short fCell
cell number
Definition: CellHit.h:68
unsigned short Cell() const
Definition: CellHit.h:40
void SetCell(unsigned short cell)
Definition: CellHit.h:52
void SetID(int id)
Compares hits by plane, then cell, then time.
Definition: CellHit.h:58
void SetPE(float pe)
Definition: CellHit.h:55
const double a
float PE() const
Definition: CellHit.h:42
Perform a "2 point" Hough transform on a collection of hits.
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
bool CompareByPlaneAndCell(const art::Ptr< rb::CellHit > &a, const art::Ptr< rb::CellHit > &b)
Definition: CellHit.cxx:113
const int ID() const
Definition: CellHit.h:47
bool fCoarseTiming
Was the timing fit bad?
Definition: CellHit.h:75
A (plane, cell) pair.
Definition: OfflineChan.h:17
void SortByCell(std::vector< art::Ptr< rb::CellHit > > &c)
Sort c in cell order (low to high)
Definition: CellHit.cxx:145
const hit & b
Definition: hits.cxx:21
float fTNS
time of hit in ns with channel differences removed
Definition: CellHit.h:72
unsigned short fPlane
plane number
Definition: CellHit.h:67
bool GoodTiming() const
Definition: CellHit.h:48
void Print() const
Definition: CellHit.cxx:48
int fID
ID for CellHit.
Definition: CellHit.h:73
Simple object representing a (plane, cell) pair.
void SortByPlane(std::vector< art::Ptr< rb::CellHit > > &c)
Sort c in plane order (low to high).
Definition: CellHit.cxx:124
void SortByPlaneAndCell(std::vector< art::Ptr< rb::CellHit > > &c)
Definition: CellHit.cxx:155