Public Member Functions | Private Member Functions | Private Attributes | List of all members
mcdatadaq::BufferNodeSimulator Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-05-06/MockDataDAQ/include/BufferNodeSimulator.h"

Public Member Functions

 BufferNodeSimulator (uint32_t buffer_node_id)
 Constructor. More...
 
 ~BufferNodeSimulator ()
 Destructor. More...
 
daqdataformats::RawDataBlockgetDataBlock (const std::vector< daqdataformats::RawMilliSlice * > &, daqdataformats::RawTrigger *)
 Given all MilliSlices for all DCMs and a Trigger from GlobalTrigger, produce DataBlock. More...
 
uint32_t getBufferNodeID () const
 This Buffer Node ID. More...
 
bool nextEvent ()
 Advance to the next event - clearing the DataBlock. More...
 

Private Member Functions

bool addMilliSlice (daqdataformats::RawMilliSlice *)
 Add a millislice to the dataBlock. More...
 

Private Attributes

uint32_t _bufferNodeID
 Buffer Node ID. More...
 
daqdataformats::RawDataBlock _dataBlock
 Data Block. More...
 

Detailed Description

Definition at line 24 of file BufferNodeSimulator.h.

Constructor & Destructor Documentation

mcdatadaq::BufferNodeSimulator::BufferNodeSimulator ( uint32_t  buffer_node_id)

Constructor.

Definition at line 24 of file BufferNodeSimulator.cpp.

References _bufferNodeID, and _dataBlock.

24  :_bufferNodeID(buffer_node_id) {
25  _dataBlock.setBuffId(_bufferNodeID);
26  _dataBlock.setMonteCarloFlag(true);
27 }
daqdataformats::RawDataBlock _dataBlock
Data Block.
uint32_t _bufferNodeID
Buffer Node ID.
mcdatadaq::BufferNodeSimulator::~BufferNodeSimulator ( )

Destructor.

Definition at line 30 of file BufferNodeSimulator.cpp.

30 { }

Member Function Documentation

bool mcdatadaq::BufferNodeSimulator::addMilliSlice ( daqdataformats::RawMilliSlice millislice)
private

Add a millislice to the dataBlock.

Loop over microslices. Fill DataBlock with MicroBlocks.

Definition at line 51 of file BufferNodeSimulator.cpp.

References _dataBlock, daqdataformats::RawDataBlock::addMicroBlock(), daqdataformats::RawDAQData::getBuffer(), daqdataformats::RawMilliSlice::getFloatingMicroSlice(), mcdatadaq::Configuration::getInstance(), mcdatadaq::Configuration::getMicroBlockVersion(), daqdataformats::RawMilliSlice::getMicrosliceNumber(), and daqdataformats::RawMilliSlice::setFloatingMicroSlice().

Referenced by getDataBlock().

51  {
52 
54 
55  const daqdataformats::version_t microblock_version = config->getMicroBlockVersion();
56 
57  //millislice->print();
58 
59  /// Loop over microslices. Fill DataBlock with MicroBlocks.
60  const uint32_t number_of_microslices = millislice->getMicrosliceNumber();
61  for(uint32_t imicroslice = 0; imicroslice < number_of_microslices; imicroslice++ ){
62 
63  millislice->setFloatingMicroSlice(imicroslice);
64  daqdataformats::RawMicroSlice* microslice = millislice->getFloatingMicroSlice();
65 
66  _dataBlock.addMicroBlock(millislice->getBuffer(), microslice->getBuffer(), microblock_version);
67  }// end of loop over microslices
68 
69  return true;
70 }
bool setFloatingMicroSlice(const uint32_t) const
daqdataformats::RawDataBlock _dataBlock
Data Block.
daqdataformats::RawMicroSlice * getFloatingMicroSlice() const
Definition: RawMilliSlice.h:48
Definition: config.py:1
void * getBuffer() const
Definition: RawDAQData.h:131
static Configuration * getInstance()
Method to obtain the class instance.
uint32_t getMicrosliceNumber() const
Definition: RawMilliSlice.h:63
Class to hold the MicroSlice data.
Definition: RawMicroSlice.h:48
int32_t version_t
Definition: RawDAQData.h:72
bool addMicroBlock(const void *microblock_buffer, const bool check_mc_flag=true)
Definition: RawDataBlock.h:42
uint32_t mcdatadaq::BufferNodeSimulator::getBufferNodeID ( ) const

This Buffer Node ID.

Definition at line 73 of file BufferNodeSimulator.cpp.

References _bufferNodeID.

73 { return _bufferNodeID;}
uint32_t _bufferNodeID
Buffer Node ID.
daqdataformats::RawDataBlock * mcdatadaq::BufferNodeSimulator::getDataBlock ( const std::vector< daqdataformats::RawMilliSlice * > &  millislices,
daqdataformats::RawTrigger trigger 
)

Given all MilliSlices for all DCMs and a Trigger from GlobalTrigger, produce DataBlock.

Set Trigger Number taken from Trigger Object

Loop over MilliSlices and fill DataBlock

< Need to close datablock - produces CRC

Definition at line 33 of file BufferNodeSimulator.cpp.

References _dataBlock, addMilliSlice(), and daqdataformats::RawDataBlock::close().

34  {
35 
36  /// Set Trigger Number taken from Trigger Object
37  _dataBlock.setTrigNum(trigger->getTriggerHeader()->getTriggerNumber());
38 
39  /// Loop over MilliSlices and fill DataBlock
40  for(uint32_t imillislice = 0; imillislice < millislices.size(); imillislice++ ){
41  addMilliSlice(millislices[imillislice]);
42  }// end of loop over MilliSlices
43 
44  _dataBlock.close(); ///< Need to close datablock - produces CRC
45 
46 
47  return &_dataBlock;
48 }
daqdataformats::RawDataBlock _dataBlock
Data Block.
bool close(bool produce_crc=false)
Definition: RawDataBlock.h:80
bool addMilliSlice(daqdataformats::RawMilliSlice *)
Add a millislice to the dataBlock.
bool mcdatadaq::BufferNodeSimulator::nextEvent ( )

Advance to the next event - clearing the DataBlock.

This is a fast but very dangerous to clear out the datablock

Definition at line 76 of file BufferNodeSimulator.cpp.

References _dataBlock.

76  {
77 
78  /// This is a fast but very dangerous to clear out the datablock
79  _dataBlock.getHeader()->setCRCCalculationUsed(false);
80  _dataBlock.getHeader()->setNumMicroBlocks(0);
81  _dataBlock.getHeader()->setDataSize(_dataBlock.getHeader()->sizeofdata());
82 
83  return true;
84 }
daqdataformats::RawDataBlock _dataBlock
Data Block.

Member Data Documentation

uint32_t mcdatadaq::BufferNodeSimulator::_bufferNodeID
private

Buffer Node ID.

Definition at line 45 of file BufferNodeSimulator.h.

Referenced by BufferNodeSimulator(), and getBufferNodeID().

daqdataformats::RawDataBlock mcdatadaq::BufferNodeSimulator::_dataBlock
private

Data Block.

Definition at line 47 of file BufferNodeSimulator.h.

Referenced by addMilliSlice(), BufferNodeSimulator(), getDataBlock(), and nextEvent().


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