Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
daqdataformats::VERSION_NAMESPACE::RawEvent Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-10-28/DAQDataFormats/cxx/include/RawEventV0.h"

Inheritance diagram for daqdataformats::VERSION_NAMESPACE::RawEvent:

Public Member Functions

 RawEvent (const version_t)
 
 RawEvent (const RawEvent &)
 The default constructor. More...
 
 ~RawEvent ()
 Destructor. More...
 
void init ()
 
void print (std::ostream &os=std::cout) const
 
uint32_t sizeofdata () const
 
bool setBufferSource (const void *pointer)
 
voidreadData (const void *)
 
 RawEvent (const version_t)
 
 RawEvent (const RawEvent &)
 The default constructor. More...
 
 ~RawEvent ()
 Destructor. More...
 
void init ()
 
bool setBufferSource (const void *pointer)
 
bool close (const bool)
 
bool setTrigger2 (const void *pointer)
 
bool nextEvent ()
 

Protected Member Functions

 INIT_FIRST (addDataBlock,, bool, const void *)
 
 INIT_FIRST (addDataBlockWithSize,, bool, const void *, const uint32_t)
 
 INIT_FIRST (close,, bool, const bool)
 
 INIT_FIRST (setTrigger1,, bool, const daqdataformats::RawTrigger &)
 
 INIT_FIRST (setTrigger2,, bool, const void *)
 
 INIT_FIRST (setFloatingDataBlockToBufferSource, const, bool, const void *)
 
 INIT_FIRST (nextEvent,, bool,)
 Next event. Advance the event number and clear the DataBlocks and CRC. More...
 
 INIT_FIRST (setAppropriateMCFlag,, bool, const void *)
 
 INIT_FIRST (getHeader, const, daqdataformats::RawEventHeader *,)
 
 INIT_FIRST (getTail,, daqdataformats::RawEventTail *,)
 
 INIT_FIRST (getTrigger,, daqdataformats::RawTrigger *,)
 
 INIT_FIRST (getFloatingDataBlock,, daqdataformats::RawDataBlock *,)
 
 INIT_FIRST (getHeaderConst, const, daqdataformats::RawEventHeader *,)
 
 INIT_FIRST (getTailConst, const, daqdataformats::RawEventTail *,)
 
 INIT_FIRST (getTriggerConst, const, daqdataformats::RawTrigger *,)
 
 INIT_FIRST (getFloatingDataBlockConst, const, daqdataformats::RawDataBlock *,)
 
 INIT_FIRST (getHeaderMarkerLeft, const, uint32_t,)
 
 INIT_FIRST (getHeaderMarkerRight, const, uint32_t,)
 
 INIT_FIRST (getVersion, const, uint32_t,)
 
 INIT_FIRST (getDataLoggerID, const, uint32_t,)
 
 INIT_FIRST (getRunNumber, const, uint32_t,)
 
 INIT_FIRST (getRunType, const, uint32_t,)
 
 INIT_FIRST (getConfigIDX, const, uint32_t,)
 
 INIT_FIRST (getPartition, const, uint32_t,)
 
 INIT_FIRST (getSubrun, const, uint32_t,)
 
 INIT_FIRST (getEventNumberLo, const, uint32_t,)
 
 INIT_FIRST (getEventNumberHi, const, uint32_t,)
 
 INIT_FIRST (getEventNumber, const, uint64_t,)
 
 INIT_FIRST (getEventType, const, uint32_t,)
 
 INIT_FIRST (getEventSize, const, uint32_t,)
 
 INIT_FIRST (getDataBlockNumber, const, uint32_t,)
 
 INIT_FIRST (isEventIncomplete, const, bool,)
 
 INIT_FIRST (getMonteCarloFlag, const, bool,)
 
 INIT_FIRST (isCRCCalculationUsed, const, bool,)
 
 INIT_FIRST (setTriggerPointer,, bool, const void *)
 
 INIT_FIRST (setDataLoggerID,, bool, const uint32_t)
 
 INIT_FIRST (setRunNumber,, bool, const uint32_t)
 
 INIT_FIRST (setRunType,, bool, const uint32_t)
 
 INIT_FIRST (setConfigIDX,, bool, const uint32_t)
 
 INIT_FIRST (setPartition,, bool, const uint32_t)
 
 INIT_FIRST (setSubrun,, bool, const uint32_t)
 
 INIT_FIRST (setEventNumberLo,, bool, const uint32_t)
 
 INIT_FIRST (setEventNumberHi,, bool, const uint32_t)
 
 INIT_FIRST (setEventNumber,, bool, const uint64_t)
 
 INIT_FIRST (setEventType,, bool, const uint32_t)
 
 INIT_FIRST (setEventIncomplete,, bool, const bool)
 
 INIT_FIRST (setMonteCarloFlag,, bool, const bool)
 
 INIT_FIRST (setFloatingDataBlock, const ,bool, const uint32_t)
 
uint32_t getPredefinedSize () const
 

Protected Attributes

daqdataformats::RawEventHeader_Header
 
daqdataformats::RawEventTail_Tail
 RawEventV0 Header. More...
 
daqdataformats::RawTrigger_Trigger
 RawEventV0 Tail. More...
 
daqdataformats::RawDataBlock_FloatingDataBlock
 Trigger. More...
 
int32_t _FloatingDataBlockNumber
 Floating DataBlock. The count starts from 0. More...
 
version_t _triggerVersion
 Floating DataBlock number. More...
 
version_t _datablockVersion
 
int32_t _mcFlag
 
bool _mcFlagBool
 
uint32_t _tailSize
 

Private Member Functions

bool tryToSetTrigger ()
 Attempt to set the trigger to the pointer. More...
 
bool tryToSetTail ()
 Attempt to set the Event Tail to the pointer. More...
 

Detailed Description

Definition at line 40 of file RawEventV0.h.

Constructor & Destructor Documentation

daqdataformats::VERSION_NAMESPACE::RawEvent::RawEvent ( const version_t  version)

Definition at line 28 of file RawEventV0.cpp.

28  :
30  ,ZEROOUT_FUNCTION(addDataBlock )
31  ,ZEROOUT_FUNCTION(addDataBlockWithSize )
33  ,ZEROOUT_FUNCTION(setTrigger1 )
35  ,ZEROOUT_FUNCTION(setFloatingDataBlockToBufferSource)
37  ,ZEROOUT_FUNCTION(setAppropriateMCFlag)
38  ,ZEROOUT_FUNCTION(getHeader )
39  ,ZEROOUT_FUNCTION(getTail )
40  ,ZEROOUT_FUNCTION(getTrigger )
41  ,ZEROOUT_FUNCTION(getFloatingDataBlock )
42  ,ZEROOUT_FUNCTION(getHeaderConst )
43  ,ZEROOUT_FUNCTION(getTailConst )
44  ,ZEROOUT_FUNCTION(getTriggerConst )
45  ,ZEROOUT_FUNCTION(getFloatingDataBlockConst )
46  ,ZEROOUT_FUNCTION(getHeaderMarkerLeft )
47  ,ZEROOUT_FUNCTION(getHeaderMarkerRight )
48  ,ZEROOUT_FUNCTION(getVersion )
49  ,ZEROOUT_FUNCTION(getDataLoggerID )
50  ,ZEROOUT_FUNCTION(getRunNumber )
51  ,ZEROOUT_FUNCTION(getRunType )
52  ,ZEROOUT_FUNCTION(getConfigIDX )
53  ,ZEROOUT_FUNCTION(getPartition )
54  ,ZEROOUT_FUNCTION(getSubrun )
55  ,ZEROOUT_FUNCTION(getEventNumberLo )
56  ,ZEROOUT_FUNCTION(getEventNumberHi )
57  ,ZEROOUT_FUNCTION(getEventNumber )
58  ,ZEROOUT_FUNCTION(getEventType )
59  ,ZEROOUT_FUNCTION(getEventSize )
60  ,ZEROOUT_FUNCTION(getDataBlockNumber )
61  ,ZEROOUT_FUNCTION(isEventIncomplete )
62  ,ZEROOUT_FUNCTION(getMonteCarloFlag )
63  ,ZEROOUT_FUNCTION(isCRCCalculationUsed )
64  ,ZEROOUT_FUNCTION(setTriggerPointer )
65  ,ZEROOUT_FUNCTION(setDataLoggerID )
66  ,ZEROOUT_FUNCTION(setRunNumber )
67  ,ZEROOUT_FUNCTION(setRunType )
68  ,ZEROOUT_FUNCTION(setConfigIDX )
69  ,ZEROOUT_FUNCTION(setPartition )
70  ,ZEROOUT_FUNCTION(setSubrun )
71  ,ZEROOUT_FUNCTION(setEventNumberLo )
72  ,ZEROOUT_FUNCTION(setEventNumberHi )
73  ,ZEROOUT_FUNCTION(setEventNumber )
74  ,ZEROOUT_FUNCTION(setEventType )
75  ,ZEROOUT_FUNCTION(setEventIncomplete )
76  ,ZEROOUT_FUNCTION(setMonteCarloFlag )
77  ,ZEROOUT_FUNCTION(setFloatingDataBlock )
78  ,_Header (NULL)
79  ,_Tail (NULL)
80  ,_Trigger (NULL)
81  ,_FloatingDataBlock (NULL)
86  ,_mcFlagBool (false)
88 { }
#define ZEROOUT_FUNCTION(FUNC)
Definition: FunctionBind.h:52
#define sizeofdata_t
Definition: FunctionBind.h:30
version_t _triggerVersion
Floating DataBlock number.
Definition: RawEventV0.h:139
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
int32_t _FloatingDataBlockNumber
Floating DataBlock. The count starts from 0.
Definition: RawEventV0.h:137
uint32_t getTailSize(const version_t event_version)
Function to get the tail size from Event version.
Definition: RawEvent.h:36
daqdataformats::RawDataBlock * _FloatingDataBlock
Trigger.
Definition: RawEventV0.h:136
const XML_Char * version
Definition: expat.h:187
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
daqdataformats::RawEventTail * _Tail
RawEventV0 Header.
Definition: RawEventV0.h:134
static const version_t DAQDATAFORMAT_UNKNOWN_VERSION
Definition: RawDAQData.h:81
daqdataformats::VERSION_NAMESPACE::RawEvent::RawEvent ( const RawEvent copyin)

The default constructor.

Definition at line 91 of file RawEventV0.cpp.

91  :
92  RawDAQData(copyin)
93  ,DEEPCOPY_FUNCTION(addDataBlock )
94  ,DEEPCOPY_FUNCTION(addDataBlockWithSize )
96  ,DEEPCOPY_FUNCTION(setTrigger1 )
98  ,DEEPCOPY_FUNCTION(setFloatingDataBlockToBufferSource)
100  ,DEEPCOPY_FUNCTION(setAppropriateMCFlag)
101  ,DEEPCOPY_FUNCTION(getHeader )
102  ,DEEPCOPY_FUNCTION(getTail )
103  ,DEEPCOPY_FUNCTION(getTrigger )
104  ,DEEPCOPY_FUNCTION(getFloatingDataBlock )
105  ,DEEPCOPY_FUNCTION(getHeaderConst )
106  ,DEEPCOPY_FUNCTION(getTailConst )
107  ,DEEPCOPY_FUNCTION(getTriggerConst )
108  ,DEEPCOPY_FUNCTION(getFloatingDataBlockConst )
109  ,DEEPCOPY_FUNCTION(getHeaderMarkerLeft )
110  ,DEEPCOPY_FUNCTION(getHeaderMarkerRight )
111  ,DEEPCOPY_FUNCTION(getVersion )
112  ,DEEPCOPY_FUNCTION(getDataLoggerID )
113  ,DEEPCOPY_FUNCTION(getRunNumber )
114  ,DEEPCOPY_FUNCTION(getRunType )
115  ,DEEPCOPY_FUNCTION(getConfigIDX )
116  ,DEEPCOPY_FUNCTION(getPartition )
117  ,DEEPCOPY_FUNCTION(getSubrun )
118  ,DEEPCOPY_FUNCTION(getEventNumberLo )
119  ,DEEPCOPY_FUNCTION(getEventNumberHi )
120  ,DEEPCOPY_FUNCTION(getEventNumber )
121  ,DEEPCOPY_FUNCTION(getEventType )
122  ,DEEPCOPY_FUNCTION(getEventSize )
123  ,DEEPCOPY_FUNCTION(getDataBlockNumber )
124  ,DEEPCOPY_FUNCTION(isEventIncomplete )
125  ,DEEPCOPY_FUNCTION(getMonteCarloFlag )
126  ,DEEPCOPY_FUNCTION(isCRCCalculationUsed )
127  ,DEEPCOPY_FUNCTION(setTriggerPointer )
128  ,DEEPCOPY_FUNCTION(setDataLoggerID )
129  ,DEEPCOPY_FUNCTION(setRunNumber )
130  ,DEEPCOPY_FUNCTION(setRunType )
131  ,DEEPCOPY_FUNCTION(setConfigIDX )
132  ,DEEPCOPY_FUNCTION(setPartition )
133  ,DEEPCOPY_FUNCTION(setSubrun )
134  ,DEEPCOPY_FUNCTION(setEventNumberLo )
135  ,DEEPCOPY_FUNCTION(setEventNumberHi )
136  ,DEEPCOPY_FUNCTION(setEventNumber )
137  ,DEEPCOPY_FUNCTION(setEventType )
138  ,DEEPCOPY_FUNCTION(setEventIncomplete )
139  ,DEEPCOPY_FUNCTION(setMonteCarloFlag )
140  ,DEEPCOPY_FUNCTION(setFloatingDataBlock )
141  ,_Header (NULL)
142  ,_Tail (NULL)
143  ,_Trigger (NULL)
144  ,_FloatingDataBlock (NULL)
146  ,_triggerVersion (copyin._triggerVersion)
147  ,_datablockVersion (copyin._datablockVersion)
148  ,_mcFlag (copyin._mcFlag)
149  ,_mcFlagBool (copyin._mcFlagBool)
150  ,_tailSize (copyin._tailSize)
151 { }
#define DEEPCOPY_FUNCTION(FUNC)
Definition: FunctionBind.h:40
version_t _triggerVersion
Floating DataBlock number.
Definition: RawEventV0.h:139
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
int32_t _FloatingDataBlockNumber
Floating DataBlock. The count starts from 0.
Definition: RawEventV0.h:137
daqdataformats::RawDataBlock * _FloatingDataBlock
Trigger.
Definition: RawEventV0.h:136
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
daqdataformats::RawEventTail * _Tail
RawEventV0 Header.
Definition: RawEventV0.h:134
daqdataformats::VERSION_NAMESPACE::RawEvent::~RawEvent ( )

Destructor.

Definition at line 155 of file RawEventV0.cpp.

References _FloatingDataBlock, _Header, _Tail, and _Trigger.

155  {
156  if(_Header) delete _Header;
158  if(_Tail) delete _Tail;
159  if(_Trigger) delete _Trigger;
160 }
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
daqdataformats::RawDataBlock * _FloatingDataBlock
Trigger.
Definition: RawEventV0.h:136
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
daqdataformats::RawEventTail * _Tail
RawEventV0 Header.
Definition: RawEventV0.h:134
daqdataformats::VERSION_NAMESPACE::RawEvent::RawEvent ( const version_t  )
daqdataformats::VERSION_NAMESPACE::RawEvent::RawEvent ( const RawEvent )

The default constructor.

daqdataformats::VERSION_NAMESPACE::RawEvent::~RawEvent ( )

Destructor.

Member Function Documentation

bool daqdataformats::VERSION_NAMESPACE::RawEvent::close ( const bool  produce_crc)

Add the size of the tail

Resize the internal event buffer by adding Tail + CRC

Check pointers after each read or resize buffer

Finally, add CRC in the very end of _Buffer

Definition at line 265 of file RawEventV0.cpp.

References _FloatingDataBlock, _Header, _Tail, _Trigger, EXECUTE_FUNCTION, RAWBUFF32, RETURN_FUNCTION, setTrigger2(), and sizeofdata().

265  {
266 
267  const uint32_t old_event_size = EXECUTE_FUNCTION(sizeofdata)();
268 
269  /// Add the size of the tail
270  const uint32_t new_event_size = old_event_size + _Tail->sizeofdata();
271 
272  _Header->setEventSize(new_event_size);
273 
274  /// Resize the internal event buffer by adding Tail + CRC
275  if(_shouldBufferBeInternal){
276  resizeInternalBuffer(new_event_size);
277  /// Check pointers after each read or resize buffer
278  checkBufferInternalness();
279  }
280 
281  _Tail->setBufferSource(&RAWBUFF32[old_event_size - 1]);
282 
283  _Tail->init();
284  _Tail->setEventNumberLo(_Header->getEventNumberLo());
285  _Tail->setEventNumberHi(_Header->getEventNumberHi());
286  _Tail->setEventSize (_Header->getEventSize());
287 
288  /// Finally, add CRC in the very end of _Buffer
289  if(produce_crc){
290  _Header->setCRCCalculationUsed(true);
291  addCheckSum();
292  }
293 
294  return true;
295 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
daqdataformats::RawEventTail * _Tail
RawEventV0 Header.
Definition: RawEventV0.h:134
#define RAWBUFF32
Definition: RawDAQData.h:16
uint32_t daqdataformats::VERSION_NAMESPACE::RawEvent::getPredefinedSize ( ) const
inlineprotected

Definition at line 124 of file RawEventV0.h.

124 {return 1;}
void daqdataformats::VERSION_NAMESPACE::RawEvent::init ( )
void daqdataformats::VERSION_NAMESPACE::RawEvent::init ( )

Header + CRC

Check pointers after each read or resize buffer

Check pointers after each read or resize buffer

Tail should always be non-filled at initialization

Definition at line 165 of file RawEventV0.cpp.

References _datablockVersion, _FloatingDataBlockNumber, _Header, _mcFlag, _mcFlagBool, _Tail, _Trigger, daqdataformats::RawEvent::addDataBlock(), EXECUTE_FUNCTION, daqdataformats::CURRENT_FIELDS_SUB_NAMESPACE::MC_FLAG_UNKNOWN, PRINT_ON_DEBUG, RETURN_FUNCTION, and sizeofdata().

Referenced by demo.App::__init__(), testem0.App::__init__(), Lesson1.App::__init__(), and ExN03.App::__init__().

165  {
166 
167  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<" Header size:"<<_Header->sizeofdata());
168 
169  /// Header + CRC
170  uint32_t size_of_data = _Header->sizeofdata() + 1;
171 
172  if(_Trigger){
173 
174  size_of_data += _Trigger->sizeofdata();
175 
176  if(_shouldBufferBeInternal){
177  resizeInternalBuffer(size_of_data);
178  /// Check pointers after each read or resize buffer
179  checkBufferInternalness();
180  }
181 
182  _Trigger->init();
183  }
184  else {
185 
186  if(_shouldBufferBeInternal){
187  resizeInternalBuffer(size_of_data);
188  /// Check pointers after each read or resize buffer
189  checkBufferInternalness();
190  }
191  }
192 
193  if(!_Tail) _Tail = new daqdataformats::RawEventTail(_Header->getTailVersion());
194 
195  _Header->init();
196  _Header->setEventSize(size_of_data);
197 
198  // Initialize the _FloatingDataBlockNumber
200 }
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
int32_t _FloatingDataBlockNumber
Floating DataBlock. The count starts from 0.
Definition: RawEventV0.h:137
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
daqdataformats::RawEventTail * _Tail
RawEventV0 Header.
Definition: RawEventV0.h:134
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( addDataBlock  ,
bool  ,
const void  
)
protected

Add a MicroSlice into the MilliSlice changing the MilliSlice Header appropriately If check_mc_flag = true, the method checks whether the DataBlock is MC generated and adds an appropriate flag to the Event Header.

daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( addDataBlockWithSize  ,
bool  ,
const void ,
const uint32_t   
)
protected

Add a MicroSlice of into the MilliSlice changing the MilliSlice Header appropriately If check_mc_flag = true, the method checks whether the DataBlock is MC generated and adds an appropriate flag to the Event Header.

daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( close  ,
bool  ,
const bool   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setTrigger1  ,
bool  ,
const daqdataformats::RawTrigger  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setTrigger2  ,
bool  ,
const void  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setFloatingDataBlockToBufferSource  ,
const  ,
bool  ,
const void  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( nextEvent  ,
bool   
)
protected

Next event. Advance the event number and clear the DataBlocks and CRC.

daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setAppropriateMCFlag  ,
bool  ,
const void  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getHeader  ,
const  ,
daqdataformats::RawEventHeader  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getTail  ,
daqdataformats::RawEventTail  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getTrigger  ,
daqdataformats::RawTrigger  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getFloatingDataBlock  ,
daqdataformats::RawDataBlock  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getHeaderConst  ,
const  ,
daqdataformats::RawEventHeader  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getTailConst  ,
const  ,
daqdataformats::RawEventTail  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getTriggerConst  ,
const  ,
daqdataformats::RawTrigger  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getFloatingDataBlockConst  ,
const  ,
daqdataformats::RawDataBlock  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getHeaderMarkerLeft  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getHeaderMarkerRight  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getVersion  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getDataLoggerID  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getRunNumber  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getRunType  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getConfigIDX  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getPartition  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getSubrun  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getEventNumberLo  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getEventNumberHi  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getEventNumber  ,
const  ,
uint64_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getEventType  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getEventSize  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getDataBlockNumber  ,
const  ,
uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( isEventIncomplete  ,
const  ,
bool   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( getMonteCarloFlag  ,
const  ,
bool   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( isCRCCalculationUsed  ,
const  ,
bool   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setTriggerPointer  ,
bool  ,
const void  
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setDataLoggerID  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setRunNumber  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setRunType  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setConfigIDX  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setPartition  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setSubrun  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setEventNumberLo  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setEventNumberHi  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setEventNumber  ,
bool  ,
const uint64_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setEventType  ,
bool  ,
const uint32_t   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setEventIncomplete  ,
bool  ,
const bool   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setMonteCarloFlag  ,
bool  ,
const bool   
)
protected
daqdataformats::VERSION_NAMESPACE::RawEvent::INIT_FIRST ( setFloatingDataBlock  ,
const   ,
bool  ,
const uint32_t   
)
protected
bool daqdataformats::VERSION_NAMESPACE::RawEvent::nextEvent ( )

Definition at line 455 of file RawEventV0.cpp.

References _FloatingDataBlockNumber, _Header, and _Trigger.

455  {
456 
457  // Advance event number
458  _Header->advanceEventNumber();
459  //reset DataBlock number
460  _Header->setDataBlockNumber(0);
461  //reset the size
462  _Header->setEventSize(_Trigger->sizeofdata() + _Header->sizeofdata() + 1);
463 
464  // reset the _FloatingDataBlockNumber
466 
467  return true;
468 
469 }
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
int32_t _FloatingDataBlockNumber
Floating DataBlock. The count starts from 0.
Definition: RawEventV0.h:137
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
void daqdataformats::VERSION_NAMESPACE::RawEvent::print ( std::ostream &  os = std::cout) const

Copy of the event

Print the Trigger Block

Print all DataBlocks. Can only print them when there is a Trigger

Definition at line 473 of file RawEventV0.cpp.

References _Trigger, samweb_client.client::_version, allTimeWatchdog::endl, EXECUTE_FUNCTION, novadaq::HexUtils::format(), MECModelEnuComparisons::i, daqdataformats::VERSION_NAMESPACE::RawTrigger::print(), sizeofdata(), and make_root_from_grid_output::tr.

473  {
474 
475  os<<boost::format("---RawEvent---------------------------------------------size = %u\n")
476  % sizeofdata();
477 
478  printBuffer(os);
479 
480  /// Copy of the event
481  daqdataformats::RawEvent event_copy(_Buffer, _version);
482 
483  event_copy.getHeader()->print(os);
484 
485  /// Print the Trigger Block
486  if(_Trigger){
487 
488  RawTrigger* tr = event_copy.getTrigger();
489  tr->print(os);
490 
491  const uint32_t n_datablocks = event_copy.getDataBlockNumber();
492  os<<"Number of datablocks="<<n_datablocks<<std::endl;
493 
494  /// Print all DataBlocks. Can only print them when there is a Trigger
495  for(uint32_t idatablock = 0; idatablock < n_datablocks; ++idatablock){
496  event_copy.setFloatingDataBlock(idatablock);
497  event_copy.getFloatingDataBlock()->print(os);
498  }
499 
500  }
501  else{
502  os<<"There is no trigger right now\n";
503  }
504  return;
505 
506  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
507 
508  os<<"\nRAW:";
509  for(uint32_t i = 0; i < size_of_data; ++i){
510  printWord(i, false, os);
511  os<<" ";
512  }
513 
514  os<<"\nRAW:";
515  for(uint32_t i = 0; i < size_of_data; ++i){
516  os<<" ";
517  printWord(i, true, os);
518  os<<std::endl;
519  }
520 
521  os<<boost::format("---end of RawEvent---------------------------------------size = %u\n")
522  % size_of_data;
523 
524 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
void * daqdataformats::VERSION_NAMESPACE::RawEvent::readData ( const void datablock_buffer)

Check pointers after each read or resize buffer

Read the header

Check pointers after each read or resize buffer

Read the rest of the event

Check pointers after each read or resize buffer

Need to assign trigger if it's not constructed yet

Definition at line 532 of file RawEventV0.cpp.

References _Header, _Trigger, EXECUTE_FUNCTION, PRINT_ON_DEBUG, RAWBUFF32, and sizeofdata().

Referenced by PandAna.core.core.loader::Go().

532  {
533 
534  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<" Reading "<<_Header->sizeofdata());
535 
536  const uint32_t header_size = _Header->sizeofdata();
537 
538  if(_shouldBufferBeInternal){
539  resizeInternalBuffer(header_size + 1);
540  /// Check pointers after each read or resize buffer
541  checkBufferInternalness();
542  }
543 
544  /// Read the header
545  void* datablock_buffer_new = readDataGeneral(datablock_buffer, header_size, 0);
546 
547  if(_shouldBufferBeInternal){
548  resizeInternalBuffer(EXECUTE_FUNCTION(sizeofdata)());
549  /// Check pointers after each read or resize buffer
550  checkBufferInternalness();
551  }
552 
553  /// Read the rest of the event
554  datablock_buffer_new = readDataGeneral(datablock_buffer_new, EXECUTE_FUNCTION(sizeofdata)() - header_size, header_size);
555 
556  /// Check pointers after each read or resize buffer
557  checkBufferInternalness();
558 
559  /// Need to assign trigger if it's not constructed yet
560  if(!_Trigger){
561  EXECUTE_FUNCTION(setTriggerPointer)(&RAWBUFF32[header_size]);
562  }
563 
564  return datablock_buffer_new;
565 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
#define RAWBUFF32
Definition: RawDAQData.h:16
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
bool daqdataformats::VERSION_NAMESPACE::RawEvent::setBufferSource ( const void pointer)
bool daqdataformats::VERSION_NAMESPACE::RawEvent::setBufferSource ( const void pointer)

If Header is already defined, then set its buffer source Otherwise, need to construct it

Once we set the header, then try to set Trigger and then if we succed, set Tail

end of if there is Header

So, the header is not constructed. Construct it now

< version of the EventHeader equals the version of the Event

Once header is constructed, we can read size of data

Once we set the header, then try to set Trigger and then if we succed, set Tail

If Header is already defined, then set its buffer source Otherwise, need to construct it

end of if there is Header

So, the header is not constructed. Construct it now

< version of the EventHeader equals the version of the Event

If the buffer is internal, need to resize it just in case, because TriggerFilled and TailFilled must be 0 by default

Check pointers after each read or resize buffer

Once header is constructed, we can read size of data

If there is Trigger, set it

If also, there is tail, get it

If tail exists, just assign the buffer source

Definition at line 570 of file RawEventV0.cpp.

References _Header, samweb_client.client::_version, PRINT_ON_DEBUG, sizeofdata_t, tryToSetTail(), and tryToSetTrigger().

570  {
571 
572  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<"version = "<<_version);
573 
574  _Buffer = (void*)pointer;
575 
576  _shouldBufferBeInternal = isInternalBuffer();
577 
578  /// If Header is already defined, then set its buffer source
579  /// Otherwise, need to construct it
580  if(_Header){
581  _Header->setBufferSource(pointer);
582 
583  /// Once we set the header, then try to set Trigger and then if we succed, set Tail
584  if(tryToSetTrigger())
585  tryToSetTail();
586 
587  return true;
588  }/// end of if there is Header
589 
590  /// So, the header is not constructed. Construct it now
591 
592  PRINT_ON_DEBUG("Setting Header "<<"version = "<<_version);
593  _Header = new daqdataformats::RawEventHeader(_Buffer, _version); ///< version of the EventHeader equals the version of the Event
594 
595  /// Once header is constructed, we can read size of data
596  _function_sizeofdata = (sizeofdata_t) &VERSION_NAMESPACE::CURRENT_CLASS::sizeofdata;
597 
598  /// Once we set the header, then try to set Trigger and then if we succed, set Tail
599  if(tryToSetTrigger())
600  tryToSetTail();
601 
602  return true;
603 }
#define sizeofdata_t
Definition: FunctionBind.h:30
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
bool tryToSetTrigger()
Attempt to set the trigger to the pointer.
Definition: RawEventV0.cpp:607
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
bool tryToSetTail()
Attempt to set the Event Tail to the pointer.
Definition: RawEventV0.cpp:658
bool daqdataformats::VERSION_NAMESPACE::RawEvent::setTrigger2 ( const void pointer)

New Trigger, so resize the Event Size

Check pointers after each read or resize buffer

read Trigger

Definition at line 343 of file RawEventV0.cpp.

References _datablockVersion, _FloatingDataBlock, _FloatingDataBlockNumber, _Header, _Trigger, _triggerVersion, EXECUTE_FUNCTION, PRINT_ON_DEBUG, RAWBUFF32, and sizeofdata().

Referenced by close().

343  {
344 
345  EXECUTE_FUNCTION(setTriggerPointer)(pointer);
346 
347  /// New Trigger, so resize the Event Size
348  _Header->setEventSize(_Header->sizeofdata() + _Trigger->sizeofdata() + 1);
349 
350  if(_shouldBufferBeInternal){
351  resizeInternalBuffer(EXECUTE_FUNCTION(sizeofdata)());
352  /// Check pointers after each read or resize buffer
353  checkBufferInternalness();
354  }
355 
356  /// read Trigger
357  readDataGeneral(pointer, _Trigger->sizeofdata(), _Header->sizeofdata());
358 
359  EXECUTE_FUNCTION(setTriggerPointer)(&(RAWBUFF32[_Header->sizeofdata()]));
360 
361  return true;
362 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
#define RAWBUFF32
Definition: RawDAQData.h:16
uint32_t daqdataformats::VERSION_NAMESPACE::RawEvent::sizeofdata ( ) const

Definition at line 528 of file RawEventV0.cpp.

References _Header.

Referenced by close(), init(), print(), readData(), setTrigger2(), tryToSetTail(), and tryToSetTrigger().

528 { return _Header->getEventSize(); }
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
bool daqdataformats::VERSION_NAMESPACE::RawEvent::tryToSetTail ( )
private

Attempt to set the Event Tail to the pointer.

If header or triggeris not instanciated, no way to set the Tail

If header is not set appropriately, no way we can se the trigger.

Can't do anything if version is unknown

Get version of the tail from the header

Once header is of a known version, then everything should be fine as _tailVersion is fixed

if the size is too small, can't set Tail

Pointer should point to the end of event minus tail size and crc

trying to read markers

At this point should be able to read tail

If tail exists, just assign the buffer source

Definition at line 658 of file RawEventV0.cpp.

References _Header, _Tail, _Trigger, EXECUTE_FUNCTION, daqdataformats::CURRENT_FIELDS_SUB_NAMESPACE::Marker_value, RAWBUFF32, sizeofdata(), and daqdataformats::CURRENT_FIELDS_SUB_NAMESPACE::TriggerHeaderDelimiter.

Referenced by setBufferSource().

658  {
659 
660  /// If header or triggeris not instanciated, no way to set the Tail
661  if(!_Header) return false;
662  if(!_Trigger) return false;
663 
664  /// If header is not set appropriately, no way we can se the trigger.
665  if(_Header->getMarkerLeft() != daqdataformats::raweventhdr::Marker_value[0]) return false;
666  if(_Header->getMarkerRight() != daqdataformats::raweventhdr::Marker_value[1]) return false;
667 
668  if(_Trigger->getTriggerHeader()->getDelimiter() != daqdataformats::triggerheader::TriggerHeaderDelimiter) return false;
669 
670  /// Can't do anything if version is unknown
671  if(isVersionUnknown()) return false;
672 
673  /// Get version of the tail from the header
674  const version_t tail_version = _Header->getTailVersion();
675 
676  /// Once header is of a known version, then everything should be fine as _tailVersion is fixed
677  try{
678  daqdataformats::RawEventTail tail_0(tail_version);
679 
680 
681  const uint32_t event_tail_size = tail_0.sizeofdata();
682 
683  /// if the size is too small, can't set Tail
684  if(EXECUTE_FUNCTION(sizeofdata)() - _Header->sizeofdata() - _Trigger->sizeofdata() < tail_0.sizeofdata())
685  return false;
686 
687  /// Pointer should point to the end of event minus tail size and crc
688  const void* pointer = &RAWBUFF32[sizeofdata() - event_tail_size - 1];
689 
690  /// trying to read markers
691  tail_0.setBufferSource(pointer);
692 
693  if(tail_0.getMarker() != daqdataformats::raweventtail::Marker_value[0]) return false;
694  if(tail_0.getMarkerLeft() != daqdataformats::raweventtail::Marker_value[1]) return false;
695  if(tail_0.getMarkerRight() != daqdataformats::raweventtail::Marker_value[2]) return false;
696 
697  /// At this point should be able to read tail
698 
699  /// If tail exists, just assign the buffer source
700  if(_Tail)
701  _Tail->setBufferSource(pointer);
702  else
703  _Tail = new daqdataformats::RawEventTail(pointer, tail_version);
704  }
705  catch(...){
706  return false;
707  }
708 
709 
710 
711 
712  return true;
713 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
daqdataformats::RawTrigger * _Trigger
RawEventV0 Tail.
Definition: RawEventV0.h:135
daqdataformats::RawEventTail * _Tail
RawEventV0 Header.
Definition: RawEventV0.h:134
#define RAWBUFF32
Definition: RawDAQData.h:16
int32_t version_t
Definition: RawDAQData.h:72
bool daqdataformats::VERSION_NAMESPACE::RawEvent::tryToSetTrigger ( )
private

Attempt to set the trigger to the pointer.

If header is not instanciated, no way to set the Trigger

If header is not set appropriately, no way we can se the trigger.

Can't do anything if version is unknown

See if we can even read TriggerHeader in case the buffer is internal som trigger header of version 0

if the size is too small, can't even set the TriggerHeader, much less trigger

pointer to the trigger

Set Trigger header to that pointer

Check Delimiter If it's not valid, ca't set it

Finally, check if we can se the trigger

if the size is too small, can't even set the TriggerHeader, much less trigger

At this point, should be able to set Trigger

Definition at line 607 of file RawEventV0.cpp.

References _Header, EXECUTE_FUNCTION, daqdataformats::CURRENT_FIELDS_SUB_NAMESPACE::Marker_value, RAWBUFF32, RETURN_FUNCTION, sizeofdata(), and daqdataformats::CURRENT_FIELDS_SUB_NAMESPACE::TriggerHeaderDelimiter.

Referenced by setBufferSource().

607  {
608  /// If header is not instanciated, no way to set the Trigger
609  if(!_Header) return false;
610 
611  /// If header is not set appropriately, no way we can se the trigger.
612  if(_Header->getMarkerLeft() != daqdataformats::raweventhdr::Marker_value[0]) return false;
613  if(_Header->getMarkerRight() != daqdataformats::raweventhdr::Marker_value[1]) return false;
614 
615  /// Can't do anything if version is unknown
616  if(isVersionUnknown()) return false;
617 
618  /// See if we can even read TriggerHeader in case the buffer is internal
619  /// som trigger header of version 0
621 
622  /// if the size is too small, can't even set the TriggerHeader,
623  /// much less trigger
624  if(EXECUTE_FUNCTION(sizeofdata)() - _Header->sizeofdata() < header_v0.sizeofdata())
625  return false;
626 
627  /// pointer to the trigger
628  const void* pointer = &RAWBUFF32[_Header->sizeofdata()];
629 
630  /// Set Trigger header to that pointer
631  header_v0.setBufferSource(pointer);
632 
633  /// Check Delimiter
634  /// If it's not valid, ca't set it
635  if(header_v0.getDelimiter() != daqdataformats::triggerheader::TriggerHeaderDelimiter)
636  return false;
637 
638  /// Finally, check if we can se the trigger
639  try{
640  const daqdataformats::RawTrigger trigger_try((version_t)header_v0.getVersion());
641 
642  /// if the size is too small, can't even set the TriggerHeader,
643  /// much less trigger
644  if(EXECUTE_FUNCTION(sizeofdata)() - _Header->sizeofdata() < trigger_try.sizeofdata())
645  return false;
646  }
647  catch(...){
648  return false;
649  }
650 
651  /// At this point, should be able to set Trigger
652 
653  RETURN_FUNCTION(setTriggerPointer)(pointer);
654 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
daqdataformats::RawEventHeader * _Header
Definition: RawEventV0.h:133
Class to hold the data from the global trigger in the correct format.
Definition: RawTrigger.h:40
#define RETURN_FUNCTION(FULLFUNCTIONNAME)
Definition: Macros.h:57
#define RAWBUFF32
Definition: RawDAQData.h:16
int32_t version_t
Definition: RawDAQData.h:72

Member Data Documentation

version_t daqdataformats::VERSION_NAMESPACE::RawEvent::_datablockVersion
protected

Definition at line 140 of file RawEventV0.h.

Referenced by init(), and setTrigger2().

daqdataformats::RawDataBlock* daqdataformats::VERSION_NAMESPACE::RawEvent::_FloatingDataBlock
mutableprotected

Trigger.

Definition at line 136 of file RawEventV0.h.

Referenced by close(), setTrigger2(), and ~RawEvent().

int32_t daqdataformats::VERSION_NAMESPACE::RawEvent::_FloatingDataBlockNumber
mutableprotected

Floating DataBlock. The count starts from 0.

Definition at line 137 of file RawEventV0.h.

Referenced by init(), nextEvent(), and setTrigger2().

daqdataformats::RawEventHeader* daqdataformats::VERSION_NAMESPACE::RawEvent::_Header
protected
int32_t daqdataformats::VERSION_NAMESPACE::RawEvent::_mcFlag
protected

Definition at line 142 of file RawEventV0.h.

Referenced by init().

bool daqdataformats::VERSION_NAMESPACE::RawEvent::_mcFlagBool
protected

Definition at line 143 of file RawEventV0.h.

Referenced by init().

daqdataformats::RawEventTail* daqdataformats::VERSION_NAMESPACE::RawEvent::_Tail
protected

RawEventV0 Header.

Definition at line 134 of file RawEventV0.h.

Referenced by close(), init(), tryToSetTail(), and ~RawEvent().

uint32_t daqdataformats::VERSION_NAMESPACE::RawEvent::_tailSize
protected

Definition at line 145 of file RawEventV0.h.

daqdataformats::RawTrigger* daqdataformats::VERSION_NAMESPACE::RawEvent::_Trigger
protected

RawEventV0 Tail.

Definition at line 135 of file RawEventV0.h.

Referenced by close(), init(), nextEvent(), print(), readData(), setTrigger2(), tryToSetTail(), and ~RawEvent().

version_t daqdataformats::VERSION_NAMESPACE::RawEvent::_triggerVersion
protected

Floating DataBlock number.

Definition at line 139 of file RawEventV0.h.

Referenced by setTrigger2().


The documentation for this class was generated from the following files: