RawTriggerV0.h
Go to the documentation of this file.
1 #ifndef DAQRAWTRIGGERV0_H
2 #define DAQRAWTRIGGERV0_H
3 #include "DAQDataFormats/RawDAQData.h"
4 #include "DAQDataFormats/Macros.h"
5 
6 /// It is requred to
7 /// 1. include DAQDataFormats/DataFormatFirst.inc
8 /// 2. define CURRENT_CLASS
9 /// 3. define CURRENT_CLASS_VERSION for version of the class
10 /// OR define LAST_CLASS_VERSION for the main structure of the class
11 /// 4. (optional) define CURRENT_FIELDS_SUB_NAMESPACE
12 /// 5. include DAQDataFormats/DataFormatLast.inc
13 /// before the declaration of the DataFormat version class in the header.
14 #include "DAQDataFormats/DataFormatFirst.inc"
15 #define CURRENT_CLASS RawTrigger
16 #define CURRENT_CLASS_VERSION 0
17 #define CURRENT_FIELDS_SUB_NAMESPACE rawtrigger
18 #include "DAQDataFormats/DataFormatLast.inc"
19 
20 // forward declarations
21 namespace daqdataformats{
22  class RawTriggerHeader;
23  class RawTriggerTimingMarker;
24  class RawTriggerRange;
25  class RawTriggerTime;
26  class RawTriggerMask;
27 }
28 
29 namespace daqdataformats {
30 
32 
33  /// order in the version vector
40  };
41  }
42 
43 namespace VERSION_NAMESPACE {
45 
46  /// Versions of Trigger formats for the current trigger
47  /// Header is the same version as RawTrigger
49  static const version_t VERSION_TriggerRange = 0;
50  static const version_t VERSION_TriggerTime = 0;
51  static const version_t VERSION_TriggerMask = 0;
52  }
53 
54 
55  //! Class to hold the data from the global trigger in the correct format
56  /*!
57  The RawTriggerV0 class is designed to mimic the format of the actual
58  data that emitted from the global trigger process. This information
59  include the source of the trigger, the trigger number etc...
60 
61  The class supports general initialization with an internal or external
62  data buffer as well as copyin style initialization for use with
63  STL containers.
64  */
65  class RawTrigger : public PREVIOUS_VERSION_CLASS_NAME {
66 
67  public:
68  // Constructors
69  RawTrigger (const version_t); //! The default constructor
70  RawTrigger (const RawTrigger&);
71  /// Destructor
72  ~RawTrigger();
73 
74  void init ();
76  void print (std::ostream& os=std::cout) const;
77  uint32_t sizeofdata () const {return _size;}
78  bool setBufferSource(const void* pointer);
79 
80  // Get Methods for parts of the trigger block
86 
87  INIT_FIRST(setTriggerHeader , , bool , const daqdataformats::RawTriggerHeader&);
88  INIT_FIRST(setTriggerTimingMarker, , bool , const daqdataformats::RawTriggerTimingMarker&);
89  INIT_FIRST(setTriggerRange , , bool , const daqdataformats::RawTriggerRange&);
90  INIT_FIRST(setTriggerTime , , bool , const daqdataformats::RawTriggerTime&);
91  INIT_FIRST(setTriggerMask , , bool , const daqdataformats::RawTriggerMask&);
92 
93  INIT_FIRST(getTriggerStart , const, uint64_t, );
94  INIT_FIRST(setTriggerStart , , bool , const uint64_t);
95 
97  void* readData(const void*);
98 
99  protected:
100  /// Method to read data from a PIPE (not socket).
101  /// Only one read can be made. After that the pipe is closed.
102  /// According to Ron Rechenmacher, the maximum size of a PIPE is 512 bytes.
103  INIT_FIRST(readDataFromFileDescriptor , , readDataStatus, const int);
104  readDataStatus readDataUnknownVersion(const int);
105 
106  bool setVersions();
107 
108  protected:
109  //! Trigger Consists of the Following Items
115 
116  uint32_t _size; //< trigger size
117 
122  };
123 
124 
125 }} // END NAMESPCE daqdataformats
126 #endif /* DAQRAWTRIGGERV0_H */
Class to hold the data from the global trigger in the correct format.
Definition: RawTriggerV0.h:65
#define VERSION_NAMESPACE
daqdataformats::RawTriggerTimingMarker * getTriggerTimingMarker() const
Definition: RawTriggerV0.h:82
#define INIT_FIRST(FUNC, CONSTNESS, OUTPUT_UNITS,...)
Definition: Macros.h:239
daqdataformats::RawTriggerTime * _Time
Definition: RawTriggerV0.h:113
daqdataformats::RawTriggerRange * getTriggerRange() const
Definition: RawTriggerV0.h:83
Class to hold the data corresponding to the trigger mask.
daqdataformats::RawTriggerTime * getTriggerTime() const
Definition: RawTriggerV0.h:84
daqdataformats::RawTriggerHeader * getTriggerHeader() const
Definition: RawTriggerV0.h:81
Class to hold the data from the global trigger range in the correct format.
bool print
daqdataformats::RawTriggerMask * getTriggerMask() const
Definition: RawTriggerV0.h:85
Class that contains the timing information relating to a given trigger.
#define CURRENT_FIELDS_SUB_NAMESPACE
Definition: RawTriggerV0.h:17
OStream cout
Definition: OStream.cxx:6
daqdataformats::RawTriggerTimingMarker * _Marker
Definition: RawTriggerV0.h:111
daqdataformats::RawTriggerRange * _Range
Definition: RawTriggerV0.h:112
void * readData(const void *buffer)
Shallow copy constructor.
Definition: RawDAQData.cpp:181
int32_t version_t
Definition: RawDAQData.h:72
daqdataformats::RawTriggerMask * _Mask
Definition: RawTriggerV0.h:114
TriggerVersions
order in the version vector
Definition: RawTriggerV0.h:34
Class to hold the data from the FEBs in correct formats.
Class to hold the data corresponding to the trigger mask.
daqdataformats::RawTriggerHeader * _Header
Trigger Consists of the Following Items.
Definition: RawTriggerV0.h:110