Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Df250PulseData.h
Go to the documentation of this file.
1 // $Id$
2 // $HeadURL$
3 //
4 // File: Df250PulseData.h
5 // Created: Thu Sep 1 09:30:13 EDT 2016
6 // Creator: davidl (on Darwin harriet.jlab.org 15.6.0 x86_64)
7 //
8 // This data type corresponds to a new firware version deployed
9 // in Fall 2016. It replaces the f250PulseIntegral, Df250PulsePedestal,
10 // and Df250PulseTime objects. Those are left in place to support the
11 // data taken with the earlier firmware.
12 //
13 // This corresponds to data type 9 in the new firmware (previously,
14 // data type 9 was reserved for "streaming raw data", but that was
15 // never implemented in the firware).
16 //
17 // Note that the new data format ties the integral, pedestal, and
18 // time together (unlike the original). This allows us to put all
19 // of these in a single object without requiring additional objects
20 // and object associations.
21 //
22 
23 
24 #ifndef _Df250PulseData_
25 #define _Df250PulseData_
26 
27 #include <DAQ/DDAQAddress.h>
28 
30 
31  /// Holds pulse integral,pedestal,time data for one identified
32  /// pulse in one event in one channel of a single
33  /// f250 Flash ADC module.
34 
35  public:
37 
38  Df250PulseData(uint32_t rocid=0, uint32_t slot=0, uint32_t channel=0, uint32_t itrigger=0
39  , uint32_t event_within_block=0
40  , bool QF_pedestal=false
41  , uint32_t pedestal=0
42  , uint32_t integral=0
43  , bool QF_NSA_beyond_PTW=false
44  , bool QF_overflow=false
45  , bool QF_underflow=false
46  , uint32_t nsamples_over_threshold=0
47  , uint32_t course_time=0
48  , uint32_t fine_time=0
49  , uint32_t pulse_peak=0
50  , bool QF_vpeak_beyond_NSA=false
51  , bool QF_vpeak_not_found=false
52  , bool QF_bad_pedestal=false
53  , uint32_t pulse_number=0
54  , uint32_t nsamples_integral=0
55  , uint32_t nsamples_pedestal=0
56  , bool emulated=false
57  , uint32_t integral_emulated=0
58  , uint32_t pedestal_emulated=0
59  , uint32_t time_emulated=0
60  , uint32_t pulse_peak_emulated=0)
84 
85 
86  // from word 1
89  uint32_t pedestal;
90 
91  // from word 2
92  uint32_t integral;
97 
98  // from word 3
99  uint32_t course_time; //< 4 ns/count
100  uint32_t fine_time; //< 0.0625 ns/count
101  uint32_t pulse_peak;
105 
106  // supplemental (not from data stream)
107  uint32_t pulse_number; ///< pulse number for this channel, this event starting from 0
108  uint32_t nsamples_integral; ///< number of samples used in integral
109  uint32_t nsamples_pedestal; ///< number of samples used in pedestal
110  bool emulated; ///< true if made from Window Raw Data
111  uint32_t integral_emulated; ///< Value calculated from raw data (if available)
112  uint32_t pedestal_emulated; ///< Value calculated from raw data (if available)
113  uint32_t time_emulated; ///< Value calculated from raw data (if available)
114  uint32_t course_time_emulated; ///< Value calculated from raw data (if available) - debug
115  uint32_t fine_time_emulated; ///< Value calculated from raw data (if available) - debug
116  uint32_t pulse_peak_emulated; ///< Value calculated from raw data (if available)
117  uint32_t QF_emulated;
118 
119  // This method is used primarily for pretty printing
120  // the second argument to AddString is printf style format
121  void toStrings(vector<pair<string,string> > &items)const{
122 
123  uint32_t QF = 0; // make single quality factor number for compactness
124  if( QF_pedestal ) QF |= (1<<0);
125  if( QF_NSA_beyond_PTW ) QF |= (1<<1);
126  if( QF_overflow ) QF |= (1<<2);
127  if( QF_underflow ) QF |= (1<<3);
128  if( QF_vpeak_beyond_NSA ) QF |= (1<<4);
129  if( QF_vpeak_not_found ) QF |= (1<<5);
130  if( QF_bad_pedestal ) QF |= (1<<6);
131 
132  uint32_t emulated_all = 0; // make single emulated flags code
133  if( emulated ) emulated_all |= (1<<0);
134  if( integral_emulated ) emulated_all |= (1<<1);
135  if( pedestal_emulated ) emulated_all |= (1<<2);
136 
137  DDAQAddress::toStrings(items);
138  //AddString(items, "event_within_block" , "%d", event_within_block );
139  AddString(items, "integral" , "%d", integral );
140  AddString(items, "pedestal" , "%d", pedestal );
141  AddString(items, "course_time" , "%d", course_time );
142  AddString(items, "fine_time" , "%d", fine_time );
143  AddString(items, "pulse_peak" , "%d", pulse_peak );
144  AddString(items, "pulse_number" , "%d", pulse_number );
145  AddString(items, "nsamples_integral" , "%d", nsamples_integral );
146  AddString(items, "nsamples_pedestal" , "%d", nsamples_pedestal );
147  AddString(items, "nsamples_over_threshold" , "%d", nsamples_over_threshold );
148  AddString(items, "QF" , "%x", QF );
149  AddString(items, "emulated" , "%x", emulated_all );
150 
151  AddString(items, "integral_emulated" , "%d", integral_emulated );
152  AddString(items, "pedestal_emulated" , "%d", pedestal_emulated );
153  AddString(items, "course_time_emulated" , "%d", course_time_emulated );
154  AddString(items, "fine_time_emulated" , "%d", fine_time_emulated );
155  AddString(items, "pulse_peak_emulated" , "%d", pulse_peak_emulated );
156  AddString(items, "QF_emulated" , "%x", QF_emulated );
157  }
158 };
159 
160 #endif // _Df250PulseData_
161 
void toStrings(vector< pair< string, string > > &items) const
void toStrings(vector< pair< string, string > > &items) const
Definition: DDAQAddress.h:47
uint32_t fine_time
uint32_t pedestal_emulated
Value calculated from raw data (if available)
uint32_t time_emulated
Value calculated from raw data (if available)
uint32_t course_time_emulated
Value calculated from raw data (if available) - debug.
bool emulated
true if made from Window Raw Data
uint32_t integral
uint32_t nsamples_integral
number of samples used in integral
uint32_t pedestal
uint32_t fine_time_emulated
Value calculated from raw data (if available) - debug.
uint32_t pulse_peak_emulated
Value calculated from raw data (if available)
uint32_t integral_emulated
Value calculated from raw data (if available)
uint32_t nsamples_over_threshold
This class holds the Crate, Slot, Channel address for a digitized value from the DAQ system...
Definition: DDAQAddress.h:26
uint32_t channel
Definition: DDAQAddress.h:34
uint32_t pulse_peak
uint32_t nsamples_pedestal
number of samples used in pedestal
JOBJECT_PUBLIC(Df250PulseData)
Holds pulse integral,pedestal,time data for one identified pulse in one event in one channel of a sin...
uint32_t rocid
Definition: DDAQAddress.h:32
uint32_t course_time
Df250PulseData(uint32_t rocid=0, uint32_t slot=0, uint32_t channel=0, uint32_t itrigger=0, uint32_t event_within_block=0, bool QF_pedestal=false, uint32_t pedestal=0, uint32_t integral=0, bool QF_NSA_beyond_PTW=false, bool QF_overflow=false, bool QF_underflow=false, uint32_t nsamples_over_threshold=0, uint32_t course_time=0, uint32_t fine_time=0, uint32_t pulse_peak=0, bool QF_vpeak_beyond_NSA=false, bool QF_vpeak_not_found=false, bool QF_bad_pedestal=false, uint32_t pulse_number=0, uint32_t nsamples_integral=0, uint32_t nsamples_pedestal=0, bool emulated=false, uint32_t integral_emulated=0, uint32_t pedestal_emulated=0, uint32_t time_emulated=0, uint32_t pulse_peak_emulated=0)
uint32_t QF_emulated
uint32_t itrigger
Definition: DDAQAddress.h:35
uint32_t event_within_block
uint32_t pulse_number
pulse number for this channel, this event starting from 0
uint32_t slot
Definition: DDAQAddress.h:33