RawTriggerTimingMarkerV0.cpp
Go to the documentation of this file.
1 #include "DAQDataFormats/RawTriggerTimingMarkerV0.h"
2 #include "DAQDataFormats/BitFields.h"
3 #include <boost/format.hpp>
4 
5 /// It is requred to
6 /// 1. include DAQDataFormats/DataFormatFirst.inc
7 /// 2. define CURRENT_CLASS
8 /// 3. define CURRENT_CLASS_VERSION for version of the class
9 /// OR define LAST_CLASS_VERSION for the main structure of the class
10 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
11 /// 5. include DAQDataFormats/DataFormatLast.inc
12 /// before the declaration of the DataFormat version class in the header.
13 #include "DAQDataFormats/DataFormatFirst.inc"
14 #define CURRENT_CLASS RawTriggerTimingMarker
15 #define CURRENT_CLASS_VERSION 0
16 #define CURRENT_FIELDS_SUB_NAMESPACE triggertimingmarker
17 #include "DAQDataFormats/DataFormatLast.inc"
18 
19 
20 namespace daqdataformats{
21 namespace VERSION_NAMESPACE{
22 //------------------------Constructors------------------------------------------
24  PREVIOUS_VERSION_CLASS_NAME(version)
25  ,ZEROOUT_GET_AND_SET(Version )
26  ,ZEROOUT_GET_AND_SET(TriggerStartLow_baseClock)
27  ,ZEROOUT_GET_AND_SET(TriggerStartHigh_baseClock)
28  ,ZEROOUT_GET_AND_SET(TriggerStartLow_833kHz )
29  ,ZEROOUT_GET_AND_SET(TriggerStartHigh_833kHz )
30  ,ZEROOUT_GET_AND_SET(TriggerStart_baseClock)
31  ,ZEROOUT_GET_AND_SET(TriggerStart_833kHz )
32 {}
33 
34 //------------------------------------------------------------------------------
36  PREVIOUS_VERSION_CLASS_NAME(copyin)
37  ,DEEPCOPY_GET_AND_SET(Version )
38  ,DEEPCOPY_GET_AND_SET(TriggerStartLow_baseClock)
39  ,DEEPCOPY_GET_AND_SET(TriggerStartHigh_baseClock)
40  ,DEEPCOPY_GET_AND_SET(TriggerStartLow_833kHz )
41  ,DEEPCOPY_GET_AND_SET(TriggerStartHigh_833kHz )
42  ,DEEPCOPY_GET_AND_SET(TriggerStart_baseClock)
43  ,DEEPCOPY_GET_AND_SET(TriggerStart_833kHz )
44 {}
45 
46 //------------------------------------------------------------------------------
48 
49 //------------------------------------------------------------------------------
50 // General Initialization
52  EXECUTE_FUNCTION(setVersion)(_version);
53 }
54 
55 //------------------------------------------------------------------------------
56 // get Method for 64 bit start time on the base clock
57 uint64_t RawTriggerTimingMarker::getTriggerStart_baseClock() const {
58  return getUint64_t(EXECUTE_FUNCTION(getTriggerStartLow_baseClock)(), EXECUTE_FUNCTION(getTriggerStartHigh_baseClock)());
59 }
60 
61 //------------------------------------------------------------------------------
62 // get Method for 64 bit start time on the base clock
63 uint64_t RawTriggerTimingMarker::getTriggerStart_833kHz() const {
64  return getUint64_t(EXECUTE_FUNCTION(getTriggerStartLow_833kHz)(), EXECUTE_FUNCTION(getTriggerStartHigh_833kHz)());
65 }
66 
67 //------------------------------------------------------------------------------
68 // set Method for 64bit time stamp
69 bool RawTriggerTimingMarker::setTriggerStart_baseClock(const uint64_t timestamp) {
70  uint32_t low, high;
71  getLoAndHi(timestamp, low, high);
72 
73  EXECUTE_FUNCTION(setTriggerStartHigh_baseClock)(high);
74  RETURN_FUNCTION(setTriggerStartLow_baseClock)(low);
75 }
76 
77 //------------------------------------------------------------------------------
78 // set Method for 64bit time stamp
79 bool RawTriggerTimingMarker::setTriggerStart_833kHz (const uint64_t timestamp) {
80 
81  uint32_t low, high;
82  getLoAndHi(timestamp, low, high);
83 
84  EXECUTE_FUNCTION(setTriggerStartHigh_833kHz)(high);
85  RETURN_FUNCTION(setTriggerStartLow_833kHz)(low);
86 }
87 
88 
89 //------------------------------------------------------------------------------
90 void RawTriggerTimingMarker::print(std::ostream& os) const{
91 
92  os<<"++++ Trigger Timing Marker ++++\n";
93 
94  printBuffer(os);
95 
96  os<<boost::format("Trigger Timing Marker Version:\t%u\n")%EXECUTE_FUNCTION(getVersion)();
97  os<<boost::format("Start Low Nova Clock:\t\t%u\n")%EXECUTE_FUNCTION(getTriggerStartLow_baseClock)();
98  os<<boost::format("Start High Nova Clock:\t\t%u\n")%EXECUTE_FUNCTION(getTriggerStartHigh_baseClock)();
99  os<<boost::format("Full Nova Clock:\t\t%Lu\n")%(long long unsigned int)EXECUTE_FUNCTION(getTriggerStart_baseClock)();
100  //os<<boost::format("Start Time:\t\t%s\n")%novadaq::timeutils::convertNovaTimeToString(getTriggerStart_baseClock()).c_str();
101  os<<boost::format("Extraction Start Low:\t\t%u\n")%EXECUTE_FUNCTION(getTriggerStartLow_833kHz)();
102  os<<boost::format("Extraction Start High:\t\t%u\n")%EXECUTE_FUNCTION(getTriggerStartHigh_833kHz)();
103 
104 }
105 
106 }}// end of namespaces
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
#define DEEPCOPY_GET_AND_SET(FUNC)
Definition: FunctionBind.h:44
#define VERSION_NAMESPACE
#define ZEROOUT_GET_AND_SET(FUNC)
Definition: FunctionBind.h:56
#define RETURN_FUNCTION(FULLFUNCTIONNAME)
Definition: Macros.h:57
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
RawTriggerTimingMarker(const version_t)
The default constructor.
Class that contains the timing information relating to a given trigger.
const XML_Char * version
Definition: expat.h:187
int32_t version_t
Definition: RawDAQData.h:72
Class to hold the data from the FEBs in correct formats.