RawMilliSlice.h
Go to the documentation of this file.
1 #ifndef RAWMILLISLICE_H
2 #define RAWMILLISLICE_H
3 
4 #include "DAQDataFormats/RawMilliSliceHeader.h"
5 #include "DAQDataFormats/RawMilliSliceIndex.h"
6 #include "DAQDataFormats/RawMicroSlice.h"
7 
8 
9 namespace daqdataformats {
10 
11  static const uint32_t DEFAULT_MILLISLICE_SIZE = 262144; /* Default allocated MilliSlice Buffer Size */
12 
13 
14  class RawMilliSlice : public RawDAQData {
15 
16  public:
17  // Constructors
18  RawMilliSlice (const uint32_t bufsize=DEFAULT_MILLISLICE_SIZE, const uint32_t tlvl=0); //! The default constructor
19  RawMilliSlice (const RawMilliSlice& copy_in); //! Deep copy constructor
20  RawMilliSlice (const void* millislice_buffer, const uint32_t buffersize = DEFAULT_MILLISLICE_SIZE); //! Shallow copy constructor
21  /// Destructor
23 
24  void init ();
25  uint32_t sizeofdata () const {return _Header->getSliceSize();}
26  bool setBufferSource(const void*);
27 
28  using RawDAQData::readData; // unhide the reset of the readData methods
29  readDataStatus readData(const int fd);
30 
31  /// Add some data containing NumberofMicroslices MicroSlices into the MilliSlice changing the MilliSlice Header appropriately
32  /// if indexate is true, produce an index for the MicroSlice
33  /// If check_mc_flag = true, the method checks whether the microslice is MC generated
34  /// and adds an appropriate flag to the MilliSlice Header.
35  /// bool check_mc_flag = true
36  bool addMicroSlice(const void* microslice_buffer, const bool indexate=false, const bool check_mc_flag=false);
37  /// Add some data containing NumberofMicroslices MicroSlices into the MilliSlice changing the MilliSlice Header appropriately
38  /// If check_mc_flag = true, the method checks whether the microslice is MC generated
39  /// and adds an appropriate flag to the MilliSlice Header.
40  /// bool check_mc_flag = true
41  bool addData(const void* buffer, const uint32_t size, const uint32_t number_of_microslices, const bool check_mc_flag=false);
42 
43 
44  bool clear(); //!< Clear Internal Buffer and zero out _fd_read_bytes
45  bool softclear(); //!< zero out _fd_read_bytes, but leaving buffer alone
46 
50 
51  uint32_t getVersion() const {return _Header->getVersion();}
52  uint32_t getMarker() const {return _Header->getMarker();}
53  uint32_t getDestBuffID() const {return _Header->getDestBuffID();}
54  uint32_t getPartition() const {return _Header->getPartition();}
55  uint64_t getTimeStart() const {return _Header->getTimeStart();}
56  uint32_t getTimeStartLow() const {return _Header->getTimeStartLow();}
57  uint32_t getTimeStartHigh() const {return _Header->getTimeStartHigh();}
58  uint32_t getTimeLength() const {return _Header->getTimeLength();}
60  uint32_t getMilliSliceSEQ() const {return _Header->getMilliSliceSEQ();}
61  uint32_t getFrameSEQ() const {return _Header->getFrameSEQ();}
62  uint32_t getSliceSize() const {return _Header->getSliceSize();}
63  uint32_t getMicrosliceNumber() const {return _Header->getMicrosliceNumber();}
64  uint32_t getDiblockId() const {return _Header->getDiblockId();}
65  uint32_t getDCMId() const {return _Header->getDCMId();}
66  uint32_t getDetId() const {return _Header->getDetId();}
67  uint32_t getGlobalDCMID() const {return _Header->getGlobalDCMID();}
68  uint32_t getMilliSliceIndexNumber() const {return _Header->getMilliSliceIndexNumber();}
69  uint32_t getMicroSliceTimeLength_usec() const {return _Header->getMicroSliceTimeLength_usec();}
70  bool getMonteCarloFlag() const {return _Header->getMonteCarloFlag();}
71  uint32_t isComplete() const {return _Header->isComplete();}
72  uint32_t isCRCCalculationUsed() const {return _Header->isCRCCalculationUsed();}
73  uint32_t isMilliSliceIndexUsed() const {return _Header->isMilliSliceIndexUsed();}
74  uint32_t isConnectionInitialization() const {return _Header->isConnectionInitialization();}
75  uint32_t isCloseConnection() const {return _Header->isCloseConnection();}
76  uint32_t isCorruptData() const {return _Header->isCorruptData();}
77  uint32_t isMissingData() const {return _Header->isMissingData();}
78  uint32_t getCRC() const;
79 
80  bool setDiblockId(const uint32_t a) {return _Header->setDiblockId(a);}
81  bool setDCMId(const uint32_t a) {return _Header->setDCMId(a);}
82  bool setDetId(const uint32_t a) {return _Header->setDetId(a);}
83  bool setGlobalDCMID(const uint32_t a) {return _Header->setGlobalDCMID(a);}
84  bool setDestBuffID(const uint32_t a) {return _Header->setDestBuffID(a);}
85  bool setPartition(const uint32_t a) {return _Header->setPartition(a);}
86  bool setTimeStart(const uint64_t a) {return _Header->setTimeStart(a);}
87  bool setTimeStartLow(const uint32_t a) {return _Header->setTimeStartLow(a);}
88  bool setTimeStartHigh(const uint32_t a) {return _Header->setTimeStartHigh(a);}
89  bool setTimeLength(const uint32_t a) {return _Header->setTimeLength(a);}
90  bool setComplete(const bool a) {return _Header->setComplete(a);}
91  bool setMode(const rawmillihdr::Mode_t a) {return _Header->setMode(a);}
92  bool setConnectionInitialization(const bool a) {return _Header->setConnectionInitialization(a);}
93  bool setCloseConnection(const bool a) {return _Header->setCloseConnection(a);}
94  bool setCorruptData(const bool a) {return _Header->setCorruptData(a);}
95  bool setMissingData(const bool a) {return _Header->setMissingData(a);}
96  bool setMilliSliceSEQ(const uint32_t a) {return _Header->setMilliSliceSEQ(a);}
97  bool setMicroSliceTimeLength_usec(const uint32_t a) {return _Header->setMicroSliceTimeLength_usec(a);}
98  bool setMonteCarloFlag(const bool a) {return _Header->setMonteCarloFlag(a);}
99  bool setMilliSliceIndexUsed(const bool a) {return _Header->setMilliSliceIndexUsed(a);}
100  bool setFrameSEQ(const uint32_t a) {return _Header->setFrameSEQ(a);}
101 
102  bool setFloatingMicroSlice(const uint32_t) const;
103  bool close(const bool produce_crc=false);
104 
105  protected:
106 
107  version_t figureOutTheVersion(const void*) const {return 0;}
108  bool setFunctionPointers() {return true;}
110  bool setFloatingMicroSliceToBufferSource(const void* ) const;
111 
112  protected:
113 
114  // These have to have a different name from readData and print.
115  // Otherwise, we can't bind them to their respactive DELEGATEs.
116  void* readDataFromBuffer(const void*);
117  void printStandard (std::ostream& os=std::cout) const;
118 
119  // The actual internal buffer (not a pointer).
120  // Used only if the constructors with the default size are used
121 
123  mutable daqdataformats::RawMilliSliceIndex* _Index; //! MilliSlice Index
124 
125  mutable daqdataformats::RawMicroSlice* _FloatingMicroSlice; //! Floating MicroSlice
126  mutable int _FloatingMicroSliceNumber;//! Floating MicroSlice Number
127 
128 
130 
131  uint32_t _tlvl; // debug "trace level mask"
132  void tprintf( unsigned lvl, const char *fmt, ... )
133  __attribute__((format(printf, 3, 4))); // g++ note: attributes are not
134 
135 
136  };
137 
138 
139 } // END NAMESPCE daqdataformats
140 #endif /* RAWMILLISLICE_H */
bool setConnectionInitialization(const bool a)
Definition: RawMilliSlice.h:92
uint32_t isConnectionInitialization() const
Definition: RawMilliSlice.h:74
bool clear()
Clear Internal Buffer and zero out _fd_read_bytes.
rawmillihdr::Mode_t getMode() const
uint32_t getMilliSliceSEQ() const
Definition: RawMilliSlice.h:60
bool setPartition(const uint32_t a)
Definition: RawMilliSlice.h:85
uint32_t getMilliSliceIndexNumber() const
Definition: RawMilliSlice.h:68
bool setFrameSEQ(const uint32_t a)
bool setBufferSource(const void *)
uint32_t getVersion() const
Definition: RawMilliSlice.h:51
uint32_t getDetId() const
Definition: RawMilliSlice.h:66
uint32_t getGlobalDCMID() const
Definition: RawMilliSlice.h:67
uint32_t getFrameSEQ() const
Definition: RawMilliSlice.h:61
bool setCloseConnection(const bool a)
Definition: RawMilliSlice.h:93
bool setFloatingMicroSlice(const uint32_t) const
uint32_t getDCMId() const
Definition: RawMilliSlice.h:65
bool setFloatingMicroSliceToBufferSource(const void *) const
bool setDCMId(const uint32_t a)
Definition: RawMilliSlice.h:81
readDataStatus readData(const int fd)
From the File descriptor.
bool setMilliSliceSEQ(const uint32_t a)
Definition: RawMilliSlice.h:96
uint32_t getMicroSliceTimeLength_usec() const
Definition: RawMilliSlice.h:69
bool setDestBuffID(const uint32_t a)
Definition: RawMilliSlice.h:84
void tprintf(unsigned lvl, const char *fmt,...) __attribute__((format(printf
daqdataformats::RawMicroSlice * getFloatingMicroSlice() const
Definition: RawMilliSlice.h:48
static const uint32_t DEFAULT_MILLISLICE_SIZE
Definition: RawMilliSlice.h:11
bool setMicroSliceTimeLength_usec(const uint32_t a)
Definition: RawMilliSlice.h:97
bool close(const bool produce_crc=false)
uint32_t isCorruptData() const
Definition: RawMilliSlice.h:76
bool setMilliSliceIndexUsed(const bool a)
Definition: RawMilliSlice.h:99
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
bool setDiblockId(const uint32_t a)
Definition: RawMilliSlice.h:80
bool setTimeStartLow(const uint32_t a)
Definition: RawMilliSlice.h:87
uint32_t getTimeLength() const
Definition: RawMilliSlice.h:58
int _FloatingMicroSliceNumber
Floating MicroSlice.
bool setMode(const rawmillihdr::Mode_t a)
Definition: RawMilliSlice.h:91
void printStandard(std::ostream &os=std::cout) const
daqdataformats::RawMilliSliceHeader * _Header
bool setMissingData(const bool a)
Definition: RawMilliSlice.h:95
uint32_t getMicrosliceNumber() const
Definition: RawMilliSlice.h:63
daqdataformats::RawMilliSliceHeader * getHeader() const
Definition: RawMilliSlice.h:47
__attribute__((unused)) static std
bool setComplete(const bool a)
Definition: RawMilliSlice.h:90
bool setMonteCarloFlag(const bool a)
Definition: RawMilliSlice.h:98
const double a
uint32_t isComplete() const
Definition: RawMilliSlice.h:71
daqdataformats::RawMicroSlice * _FloatingMicroSlice
MilliSlice Index.
printf("%d Experimental points found\n", nlines)
uint32_t getTimeStartLow() const
Definition: RawMilliSlice.h:56
uint32_t predefinedSize() const
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
uint32_t getPartition() const
Definition: RawMilliSlice.h:54
OStream cout
Definition: OStream.cxx:6
uint32_t getMarker() const
Definition: RawMilliSlice.h:52
uint32_t isMilliSliceIndexUsed() const
Definition: RawMilliSlice.h:73
Class to hold the MicroSlice data.
Definition: RawMicroSlice.h:48
bool setTimeStart(const uint64_t a)
Definition: RawMilliSlice.h:86
void * readDataFromBuffer(const void *)
bool setMode(const rawmillihdr::Mode_t)
bool setTimeLength(const uint32_t a)
Definition: RawMilliSlice.h:89
void * readData(const void *buffer)
Shallow copy constructor.
Definition: RawDAQData.cpp:181
bool setGlobalDCMID(const uint32_t a)
Definition: RawMilliSlice.h:83
daqdataformats::RawMilliSliceIndex * getMilliSliceIndex() const
bool softclear()
zero out _fd_read_bytes, but leaving buffer alone
int32_t version_t
Definition: RawDAQData.h:72
uint32_t isMissingData() const
Definition: RawMilliSlice.h:77
uint32_t getSliceSize() const
Definition: RawMilliSlice.h:62
bool setCorruptData(const bool a)
Definition: RawMilliSlice.h:94
uint32_t isCloseConnection() const
Definition: RawMilliSlice.h:75
bool addData(const void *buffer, const uint32_t size, const uint32_t number_of_microslices, const bool check_mc_flag=false)
rawmillihdr::Mode_t getMode() const
Definition: RawMilliSlice.h:59
uint32_t getTimeStartHigh() const
Definition: RawMilliSlice.h:57
bool addMicroSlice(const void *microslice_buffer, const bool indexate=false, const bool check_mc_flag=false)
version_t figureOutTheVersion(const void *) const
uint32_t sizeofdata() const
Definition: RawMilliSlice.h:25
bool setTimeStartHigh(const uint32_t a)
Definition: RawMilliSlice.h:88
size_t _fd_read_bytes
Floating MicroSlice Number.
Class to hold the data from the FEBs in correct formats.
uint32_t getDiblockId() const
Definition: RawMilliSlice.h:64
uint32_t getDestBuffID() const
Definition: RawMilliSlice.h:53
uint32_t isCRCCalculationUsed() const
Definition: RawMilliSlice.h:72
daqdataformats::RawMilliSliceIndex * _Index
MilliSlice Header.
uint64_t getTimeStart() const
Definition: RawMilliSlice.h:55
RawMilliSlice(const uint32_t bufsize=DEFAULT_MILLISLICE_SIZE, const uint32_t tlvl=0)
bool setDetId(const uint32_t a)
Definition: RawMilliSlice.h:82