BaseProducts.h
Go to the documentation of this file.
1 #ifndef BASEPRODUCTS_H
2 #define BASEPRODUCTS_H
3 
4 #include "DAQChannelMap/DAQChannelMap.h"
5 #include "DAQDataFormats/TriggerDefines.h"
6 
7 #include <stdint.h>
8 
9 namespace novaddt{
10 
11  // These are the definitions of the base
12  // data types that are contained in all
13  // DAQHit objects and used else where
14  // as parameters for other data products
15 
16  // The Time Stamp for the data
17  // This is a 64bit time stamp
18  // which is constructed from two 32bit
19  // data words
20 
21  // The fractional member was added to provide
22  // sub-tick precision derived from
23  // multipoint fitting.
24  struct TDC {
25 #ifndef __GCCXML__
26  TDC() = default;
27 #endif
28  TDC(uint64_t const a):val(a),frac(0){}
29  TDC(uint64_t const a, uint8_t f):val(a),frac(f){}
30 
31  // use unsigned long long to ensure the same type on OSX and linux systems
32  typedef unsigned long long value_type;
33  typedef uint8_t fraction_type;
34  value_type val;
35  fraction_type frac;
36 
37  double fraction() const { return double(frac) / 100; }
38  };
39 
40 
41  // Note:
42  // fractional TDC values are not used in the operators
43  //
44  inline bool operator== (TDC lhs, TDC rhs) { return lhs.val == rhs.val; }
45  inline bool operator< (TDC lhs, TDC rhs) { return lhs.val < rhs.val; }
46  inline bool operator> (TDC lhs, TDC rhs) { return lhs.val > rhs.val; }
47  inline TDC::value_type operator- (TDC lhs, TDC rhs)
48  { return lhs.val - rhs.val; }
49  inline TDC::value_type operator+ (TDC lhs, TDC rhs)
50  { return lhs.val + rhs.val; }
51  inline TDC::value_type operator* (TDC lhs, TDC rhs)
52  { return lhs.val * rhs.val; }
53  inline TDC::value_type operator+= (TDC lhs, TDC rhs)
54  { return lhs.val += rhs.val; }
55 
56 
57  // This is the ADC value which is 12bits
58  // wide in the raw data
59  struct ADC {
60 #ifndef __GCCXML__
61  ADC() = default;
62 #endif
63  ADC(uint16_t const a):val(a){}
64  typedef uint16_t value_type;
65  value_type val;
66  };
67 
68  inline bool operator== (ADC lhs, ADC rhs) { return lhs.val == rhs.val; }
69  inline bool operator< (ADC lhs, ADC rhs) { return lhs.val < rhs.val; }
70  inline bool operator> (ADC lhs, ADC rhs) { return lhs.val > rhs.val; }
71  inline ADC::value_type operator- (ADC lhs, ADC rhs)
72  { return lhs.val - rhs.val; }
73  inline ADC::value_type operator+ (ADC lhs, ADC rhs)
74  { return lhs.val + rhs.val; }
75 
76  // This is the Plane on which the hit registered
77  // This ranges from 1 to 32*Nblocks (960ish)
78  struct Plane {
79 #ifndef __GCCXML__
80  Plane() = default;
81 #endif
82  Plane(uint16_t const a):val(a){}
83  typedef uint16_t value_type;
84  value_type val;
85  };
86 
87  inline bool operator== (Plane lhs, Plane rhs) { return lhs.val == rhs.val; }
88  inline bool operator< (Plane lhs, Plane rhs) { return lhs.val < rhs.val; }
89  inline bool operator> (Plane lhs, Plane rhs) { return lhs.val > rhs.val; }
91  { return lhs.val - rhs.val; }
93  { return lhs.val + rhs.val; }
95  { return lhs.val * rhs.val; }
97  { return lhs.val += rhs.val; }
98 
99 
100  // This is the cell number within the plane to
101  // which the hit belonged. This ranges from 1
102  // to 384 (32*12)
103  struct Cell {
104 #ifndef __GCCXML__
105  Cell() = default;
106 #endif
107  Cell(uint16_t const a):val(a){}
108  typedef uint16_t value_type;
109  value_type val;
110  };
111 
112  inline bool operator== (Cell lhs, Cell rhs) { return lhs.val == rhs.val; }
113  inline bool operator< (Cell lhs, Cell rhs) { return lhs.val < rhs.val; }
114  inline bool operator> (Cell lhs, Cell rhs) { return lhs.val > rhs.val; }
116  { return lhs.val - rhs.val; }
118  { return lhs.val + rhs.val; }
120  { return lhs.val * rhs.val; }
122  { return lhs.val += rhs.val; }
123 
124  // This is the view to which the hit belonged
125  // This is either an X or Y view
126 
127  /*
128  MF (8/15/2013)
129  Chris G. recommended this form of the View struct so as to not confuse Root
130  about the constructor. For some reason, Root would add the View as a branch
131  rather than as a member. Let's see whether this will fix the problem.
132  */
133  struct View {
134  typedef uint8_t value_type;
135  View() : val(0) {}
136  explicit View(value_type const a) : val(a) {}
137  value_type val;
138  };
139 // struct View {
140 // #ifndef __GCCXML__
141 // View() = default;
142 // #endif
143 // View(uint8_t const a):val(a){}
144 // typedef uint8_t value_type;
145 // value_type val;
146 // };
147 
148  // It is not clear whether we want a comparison operator for the view
149  // and how to implement it, but here is an example based on the comparison
150  // operators above:
151 
152  inline bool operator== (View lhs, View rhs) { return lhs.val == rhs.val; }
153  inline bool operator< (View lhs, View rhs) { return lhs.val < rhs.val; }
154  inline bool operator> (View lhs, View rhs) { return lhs.val > rhs.val; }
155  inline bool operator!= (View lhs, View rhs) { return lhs.val != rhs.val; }
156 
157 
158  // This is the DCM to which the hit belonged
159  // This is going to be used in partitioning by DCM boundaries
160  struct DCM {
161 #ifndef __GCCXML__
162  DCM() = default;
163 #endif
166  value_type val;
167  };
168 
169  inline bool operator== (DCM lhs, DCM rhs) { return lhs.val == rhs.val; }
170  inline bool operator< (DCM lhs, DCM rhs) { return lhs.val < rhs.val; }
171  inline bool operator> (DCM lhs, DCM rhs) { return lhs.val > rhs.val; }
172 
173 
174  //This is the triggger decision that has been issued
175  struct TriggerMask {
176 #ifndef __GCCXML__
177  TriggerMask() = default;
178 #endif
181  value_type val;
182  };
183 
184 
185 } /* End Namespace */
186 #endif /* BASEPRODUCTS_H */
TDC::value_type operator-(TDC lhs, TDC rhs)
Definition: BaseProducts.h:47
TDC::value_type operator+=(TDC lhs, TDC rhs)
Definition: BaseProducts.h:53
daqchannelmap::dcm_id_t value_type
Definition: BaseProducts.h:165
fraction_type frac
Definition: BaseProducts.h:35
bool operator>(TDC lhs, TDC rhs)
Definition: BaseProducts.h:46
value_type val
Definition: BaseProducts.h:34
TDC(uint64_t const a)
Definition: BaseProducts.h:28
TriggerMask(daqdataformats::trigID const a)
Definition: BaseProducts.h:179
TDC::value_type operator+(TDC lhs, TDC rhs)
Definition: BaseProducts.h:49
value_type val
Definition: BaseProducts.h:109
value_type val
Definition: BaseProducts.h:166
ADC(uint16_t const a)
Definition: BaseProducts.h:63
unsigned long long value_type
Definition: BaseProducts.h:32
TDC()=default
uint8_t fraction_type
Definition: BaseProducts.h:33
View(value_type const a)
Definition: BaseProducts.h:136
const double a
bool operator==(TDC lhs, TDC rhs)
Definition: BaseProducts.h:44
TDC::value_type operator*(TDC lhs, TDC rhs)
Definition: BaseProducts.h:51
value_type val
Definition: BaseProducts.h:84
Plane(uint16_t const a)
Definition: BaseProducts.h:82
Definition: View.py:1
Cell(uint16_t const a)
Definition: BaseProducts.h:107
double fraction() const
Definition: BaseProducts.h:37
uint16_t value_type
Definition: BaseProducts.h:64
uint32_t dcm_id_t
Type for DCM number, counts from 1.
uint8_t value_type
Definition: BaseProducts.h:134
bool operator!=(View lhs, View rhs)
Definition: BaseProducts.h:155
TDC(uint64_t const a, uint8_t f)
Definition: BaseProducts.h:29
bool operator<(TDC lhs, TDC rhs)
Definition: BaseProducts.h:45
uint16_t value_type
Definition: BaseProducts.h:83
value_type val
Definition: BaseProducts.h:137
value_type val
Definition: BaseProducts.h:65
DCM(daqchannelmap::dcm_id_t const a)
Definition: BaseProducts.h:164
daqdataformats::trigID value_type
Definition: BaseProducts.h:180
uint16_t value_type
Definition: BaseProducts.h:108