LiteHit.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file LiteHit.h
3 /// \brief Compressed hit info, basic component of LEM events
4 /// \author Christopher Backhouse - bckhouse@caltech.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef LEM_LITEHIT_H
8 #define LEM_LITEHIT_H
9 
10 #ifndef __GCCXML__
11 #include <cassert>
12 #include <ostream>
13 #endif // __GCCXML__
14 
15 namespace lem
16 {
17  /// Compressed hit info, basic component of %LEM events
18  class LiteHit
19  {
20  public:
21  LiteHit() {}
22 
23  // Saving space
24  float pecorr;
25  unsigned short cellIdx;
26  unsigned char partIdx;
27 
28 #ifndef __GCCXML__
29  LiteHit(unsigned int p, unsigned int c, double pe, unsigned char i) : pecorr(pe), partIdx(i)
30  {
31  assert(pecorr > 0);
32 
33  assert(sizeof(short) == 2);
34 
35  SetPlaneCell(p, c);
36  }
37 
38  int Plane() const {return cellIdx/256;}
39  int Cell() const {return cellIdx%256;}
40  void SetPlaneCell(int p, int c) {cellIdx = int(p)*256+int(c);}
41  void SetPlane(int p){SetPlaneCell(p, Cell());}
42  void SetCell(int c){SetPlaneCell(Plane(), c);}
43 
44  bool operator<(const LiteHit& rhs) const {return cellIdx < rhs.cellIdx;}
45 #endif // __GCCXML__
46  };
47 
48 #ifndef __GCCXML__
49  bool compareByCell(const LiteHit& a, const LiteHit& b);
50  bool compareByPlane(const LiteHit& a, const LiteHit& b);
51 
52  std::ostream& operator<<(std::ostream& os, const lem::LiteHit& h);
53 #endif // __GCCXML__
54 } // namespace
55 
56 #endif
bool compareByPlane(const LiteHit &a, const LiteHit &b)
Definition: LiteHit.cxx:16
const char * p
Definition: xmltok.h:285
unsigned char partIdx
Definition: LiteHit.h:26
bool compareByCell(const LiteHit &a, const LiteHit &b)
Definition: LiteHit.cxx:11
float pecorr
Definition: LiteHit.h:24
int Cell() const
Definition: LiteHit.h:39
std::ostream & operator<<(std::ostream &os, const lem::Heads &hs)
Definition: Heads.cxx:140
bool operator<(const LiteHit &rhs) const
Definition: LiteHit.h:44
void SetPlane(int p)
Definition: LiteHit.h:41
PID
Definition: FillPIDs.h:13
LiteHit(unsigned int p, unsigned int c, double pe, unsigned char i)
Definition: LiteHit.h:29
int Plane() const
Definition: LiteHit.h:38
unsigned short cellIdx
Definition: LiteHit.h:25
const double a
void SetPlaneCell(int p, int c)
Definition: LiteHit.h:40
const hit & b
Definition: hits.cxx:21
assert(nhit_max >=nhit_nbins)
void SetCell(int c)
Definition: LiteHit.h:42
Compressed hit info, basic component of LEM events.
Definition: LiteHit.h:18