RawNanoSliceV0.h
Go to the documentation of this file.
1 #ifndef RAWNANOSLICEV0_H
2 #define RAWNANOSLICEV0_H
3 #include "DAQDataFormats/RawNanoSliceHeader.h"
4 #include "DAQDataFormats/NanoSliceVersionConvention.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 RawNanoSlice
16 #define CURRENT_CLASS_VERSION 0
17 #define CURRENT_FIELDS_SUB_NAMESPACE rawnano
18 #include "DAQDataFormats/DataFormatLast.inc"
19 
20 
21 
22 namespace daqdataformats {
23 
24  //! Data structure for holding all the nanoslice data of interest
25  typedef struct {
27  uint32_t TimeStamp;
28  uint32_t PulseHeight;
29  uint32_t Reserved;
30  // new data members : not used in V0, will be used in V1
31  uint32_t Value1;
32  uint32_t Value2;
33 
34  } NanoSlice;
35 
36 
37  namespace VERSION_NAMESPACE {
39 
40  static const uint32_t RAWNANOSLICE_SIZE = 3;
41  static const uint32_t cafe_word = 0xCAFE;
42 
47  };
49  MASK_TimeStamp = 0xFFFFFFFF,
50  MASK_PulseHeight = 0x0FFF0000,
51  MASK_Reserved = 0x0000FFFF
52  };
53 
54  DEFINE_SHIFT_FROM_MASK(TimeStamp );
55  DEFINE_SHIFT_FROM_MASK(PulseHeight);
56  DEFINE_SHIFT_FROM_MASK(Reserved );
57 
58  } // end of namespace rawnano
59 
60  //! Class to hold the data from the FEBs in correct formats
61  /*!
62  The RawNanoSlice class is designed to mimic the format of the actual data
63  block that the NOvA Front End6
64  Boards (FEBS) produce when they detect a signal
65  above the zero suppression threshold.
66 
67  The class supports general initialization with or with out data blocks as
68  well as copyin style initialization for use with STL containers.
69 
70  Pack and unpack methods for the data rely on two types of structured data
71  blocks that are provided in association with the class.
72 
73  The NanoSliceBlock structure breaks the raw data block out into its related
74  high and low half words to give the headers, time stamps and pulseheight information
75 
76  The NanoSliceHeader structure further breaks out the header blocks into the
77  individual data information parts.
78  */
79 
80  class RawNanoSlice: public PREVIOUS_VERSION_CLASS_NAME {
81 
82  public:
83  // Constructors
84  RawNanoSlice (const version_t);
85  RawNanoSlice (const NanoSlice&);
86  RawNanoSlice (const RawNanoSlice&);
87  /// Destructor
88  ~RawNanoSlice();
89 
90  void init ();
92  void print (std::ostream& os=std::cout) const;
94  bool setBufferSource (const void* pointer);
95 
96  /// Nanoslice of version 0 is a fixed size format
98  void* readData(const void* pointer){return RawDAQData::readDataGeneral(pointer);};
99 
100  // Get/Set Value fields are not allowed for version 0,
101  // because there are no such fields
102  /// The meaning of the value could be different.
103  /// It could be DCS
104  uint32_t getValue(const uint32_t) const {RETURN_FUNCTION(getPulseHeight)();}
105  bool setValue(const uint32_t sample_number [[gnu::unused]], const uint32_t value) {RETURN_FUNCTION(setPulseHeight)(value);}
106 
107  uint32_t getValue1() const {RETURN_FUNCTION(getPulseHeight)();}
108  bool setValue1(const uint32_t value) {RETURN_FUNCTION(setPulseHeight)(value);}
109 
110 
111  /// Get total number of samples in the nanoslice
112  uint32_t getNSamples() const;
113  /// Get number of pretriggered samples
114  uint32_t getNPretriggeredSamples() const;
115  /// get the type of encoding for the samples in the nanoslice
116  Encode_Type getEncodeType() const;
117 
118  protected:
119  IMPLEMENT_FIRST_GET_AND_SET(PulseHeight, uint32_t);
120  IMPLEMENT_FIRST_GET_AND_SET(TimeStamp , uint32_t);
121  IMPLEMENT_FIRST_GET_AND_SET(Reserved , uint32_t);
122 
123  INIT_FIRST(initWithData , , void, const NanoSlice&);
124  INIT_FIRST(setParameters , , bool, const NanoSlice&);
125  INIT_FIRST(checkReservedForCafe, const, bool, );
126  INIT_FIRST(initWithDataInternal, , void, );
127 
128  protected:
129  /// The Nanoslice header pointer
131 
132 
133  };// end of RawNanoSlice
134 
135 
136 }} // END NAMESPCE daqdataformats
137 #endif /* RAWNANOSLICEV0_H */
Encode_Type
All encoding types.
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
#define VERSION_NAMESPACE
uint32_t getValue(const uint32_t) const
daqdataformats::RawNanoSliceHeader * _Header
The Nanoslice header pointer.
#define INIT_FIRST(FUNC, CONSTNESS, OUTPUT_UNITS,...)
Definition: Macros.h:239
#define IMPLEMENT_FIRST_GET_AND_SET(FUNC, UNITS)
Definition: Macros.h:171
Data structure for holding all the nanoslice data of interest.
#define RETURN_FUNCTION(FULLFUNCTIONNAME)
Definition: Macros.h:57
Data structure for holding all the nanoslice data of interest.
const XML_Char int const XML_Char * value
Definition: expat.h:331
bool print
OStream cout
Definition: OStream.cxx:6
void * readData(const void *buffer)
Shallow copy constructor.
Definition: RawDAQData.cpp:181
Class to hold the data from the FEBs in correct formats.
int32_t version_t
Definition: RawDAQData.h:72
#define CURRENT_FIELDS_SUB_NAMESPACE
Class to hold the data from the FEBs in correct formats.
bool setValue(const uint32_t sample_number[[gnu::unused]], const uint32_t value)