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

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

Inheritance diagram for daqdataformats::RawMilliSliceHeader:
daqdataformats::RawDAQData

Public Member Functions

 RawMilliSliceHeader ()
 
 RawMilliSliceHeader (const RawMilliSliceHeader &copy_in)
 The default constructor. More...
 
 RawMilliSliceHeader (const void *millisliceheader_buffer)
 Deep copy constructor. More...
 
 ~RawMilliSliceHeader ()
 Destructor. More...
 
void init ()
 
uint32_t sizeofdata () const
 
uint64_t getTimeStart () const
 
rawmillihdr::Mode_t getMode () const
 
bool setTimeStart (const uint64_t)
 
bool setMode (const rawmillihdr::Mode_t)
 
bool addSliceSize (const uint32_t)
 
bool advanceMicrosliceNumber ()
 
bool advanceFrameSEQ ()
 
bool resetFrameSEQ ()
 
bool advanceMilliSliceSEQ ()
 
 IMPLEMENT_GET_NOVERSION (Version, uint32_t)
 
 IMPLEMENT_SET_NOVERSION_PROTECTED (Version, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (Marker, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (DestBuffID, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (Partition, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (DiblockId, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (DCMId, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (DetId, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (GlobalDCMID, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (TimeStartLow, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (TimeStartHigh, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (TimeLength, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (MilliSliceSEQ, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (FrameSEQ, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (SliceSize, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (MicrosliceNumber, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (MilliSliceIndexNumber, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (MicroSliceTimeLength_usec, uint32_t)
 
 IMPLEMENT_GET_AND_SET_NOVERSION (MonteCarloFlag, bool)
 
 IMPLEMENT_IS_AND_SET_NOVERSION (Complete)
 
 IMPLEMENT_IS_AND_SET_NOVERSION (ConnectionInitialization)
 
 IMPLEMENT_IS_AND_SET_NOVERSION (CloseConnection)
 
 IMPLEMENT_IS_AND_SET_NOVERSION (CorruptData)
 
 IMPLEMENT_IS_AND_SET_NOVERSION (MissingData)
 
 IMPLEMENT_IS_AND_SET_NOVERSION (CRCCalculationUsed)
 
 IMPLEMENT_IS_AND_SET_NOVERSION (MilliSliceIndexUsed)
 
voidreadData (const void *buffer)
 
virtual void copy (const RawDAQData &)
 Deep copy from the DAQDataFormat. More...
 
virtual void copy (const void *buffer)
 Shallow copy from the external buffer. More...
 
voidreadData (const void *buffer, const uint32_t size_of_data)
 Read from the buffer if the size of data is known. More...
 
virtual readDataStatus readData (const int fd)
 From the File descriptor. More...
 
voidwriteData (const void *buffer) const
 Write Data to target memory location. Return is the address of the end of the write. NULL on error. More...
 
ssize_t writeData (const int fd) const
 Write Data to target file descriptor. Return is the number of bytes written. -1 on error. More...
 
uint32_t calculateCheckSum (const uint32_t skip_last_words) const
 
voidgetBuffer () const
 
bool setBufferSource (const void *)
 We are not going to overload these funtions, so no need to declare them virtual. More...
 
bool resetBufferSource ()
 
virtual bool clear ()
 reset _Buffer to point to InternalBuffer More...
 
bool reset ()
 Reset. More...
 
bool isInternalBuffer () const
 
void print (std::ostream &os=std::cout) const
 Method for printing the content of the Buffer. More...
 
void print (std::string &output_string) const
 print into the string More...
 
virtual bool addCheckSum ()
 Add the CRC into the end of fBuffer. CRC of all but the last words of the _Buffer. More...
 

Protected Member Functions

voidreadDataGeneral (const void *buffer)
 General ReadData method when the sizeofdata is known. More...
 
voidreadDataGeneral (const void *buffer, const uint32_t size_of_data_to_read)
 Generic readData methods. More...
 
voidreadDataGeneral (const void *buffer, const uint32_t size_of_data_to_read, const uint32_t buffer_start_position)
 
bool checkBufferInternalness ()
 If the buffer should be internal, check it's pointers and reassign them. More...
 
voidsetBufferSourceGeneral (RawDAQData &, const void *)
 Set BufferSource of the input DataFormat and return pointer to the position right after the end of its buffer. More...
 
bool setBufferSourceUnknownVersion (const void *)
 
bool reserveInternalBuffer (const uint32_t size_of_data)
 Reserve space for the internal buffer to some predetermined size. More...
 
bool addToInternalBuffer (const uint32_t size_of_data_to_add)
 Add Zeros to internal buffer. More...
 
bool resizeInternalBuffer (const uint32_t size_of_data)
 Resize the internal buffer. More...
 
uint32_t boolToUint32_t (const bool number) const
 
bool uint32_tToBool (const uint32_t number) const
 
void printGeneral (std::ostream &os=std::cout) const
 
void printBuffer (std::ostream &os=std::cout, const bool print_offset=true,const bool print_ascii=true,const bool print_buffer_address=false,const bool print_internal_buffer=false,const bool print_size_of_data=false,const std::string separation_between_lines="\n",const uint32_t cols=4) const
 
void printWord (const uint32_t iword, const bool is_bynary_printing, std::ostream &os=std::cout) const
 Print word from Buffer. More...
 
void printWordBinary (const uint32_t word, std::ostream &os=std::cout) const
 ! Print the i-th word of _Buffer, is_bynary_printing: true = bynary, false = HEX More...
 
void printWordHex (const uint32_t word, std::ostream &os=std::cout) const
 
void printBinary (const void *buffer0, const uint32_t size, std::ostream &os=std::cout) const
 
void printHex (const void *buffer0, const uint32_t size, std::ostream &os=std::cout) const
 
void printUnknownVersion (std::ostream &out_stream=std::cout) const
 
bool functionIsNotAllowed (const std::string function="", const std::string message="") const
 One can call this function from another function, which usage is not allowed (for a particular version). More...
 
void defaultConstructorFixedSize ()
 
void defaultConstructorFixedSize (init_t)
 
void defaultConstructorFloatingSize ()
 
void defaultConstructorFloatingSize (init_t)
 
voidreadDataUnknownVersion (const void *buffer)
 Read data from the unknown version. More...
 
bool isVersionUnknown () const
 is current _version unknown? More...
 
bool isVersionUnknown (const version_t version) const
 is input version unknown? More...
 
uint64_t getUint64_t (uint32_t low_word, uint32_t hi_word) const
 Get uint64_t from low and hi word. More...
 
bool getLoAndHi (uint64_t input_data, uint32_t &output_low_word, uint32_t &output_hi_word) const
 
bool setUint64_t (uint64_t value, DELEGATE(RawDAQData, function_set_low_word, bool, uint32_t),)
 
std::string generateExceptionForWrongVersion (version_t maximum_version) const
 Generating exception message as the version of DAQDataFormat is greater than the maximum allowed. More...
 
void lastOperationsInDeepCopy (const RawDAQData &copy_in)
 Need to perform these operations in Deep Copy constructor. More...
 
 Init_t (_function_init)
 Some common function pointers used in each DAQDataFormats class. More...
 
 Sizeofdata_t (_function_sizeofdata)
 
 Print_t (_function_print)
 
 ReadData_t (_function_readData)
 
 SetBufferSource_t (_function_setBufferSource)
 
 EXECUTE_ON_DEBUG (std::string _dataFormatClassName)
 These variables are only for Debugging purposes. More...
 
 EXECUTE_ON_DEBUG (std::string _dataFormatConstructor)
 

Protected Attributes

void_Buffer
 All data formats need to have _Buffer and a Data structure. _Buffer will be common. More...
 
std::vector< uint32_t > _InternalBuffer
 
bool _shouldBufferBeInternal
 Auxillary variable that holds whether the buffer should be external or internal. More...
 
version_t _version
 DataFormat Version. More...
 

Private Member Functions

voidreadDataFromBuffer (const void *buffer)
 
void printStandard (std::ostream &os=std::cout) const
 
version_t figureOutTheVersion (const void *) const
 
bool setFunctionPointers ()
 

Detailed Description

Definition at line 118 of file RawMilliSliceHeader.h.

Constructor & Destructor Documentation

daqdataformats::RawMilliSliceHeader::RawMilliSliceHeader ( )

Perform general routines

Definition at line 9 of file RawMilliSliceHeader.cpp.

References daqdataformats::RawDAQData::defaultConstructorFixedSize().

9  :
10  RawDAQData(0
16 {
17  /// Perform general routines
19 }
#define sizeofdata_t
Definition: FunctionBind.h:30
bool setBufferSource(const void *)
We are not going to overload these funtions, so no need to declare them virtual.
Definition: RawDAQData.cpp:880
void * readDataFromBuffer(const void *buffer)
void printStandard(std::ostream &os=std::cout) const
RawDAQData()
Default Constructor.
Definition: RawDAQData.cpp:14
#define print_t
Definition: FunctionBind.h:31
#define setBufferSource_t
Definition: FunctionBind.h:33
#define readData_t
Definition: FunctionBind.h:32
#define init_t
Definition: FunctionBind.h:29
daqdataformats::RawMilliSliceHeader::RawMilliSliceHeader ( const RawMilliSliceHeader copy_in)

The default constructor.

Definition at line 22 of file RawMilliSliceHeader.cpp.

References daqdataformats::RawDAQData::lastOperationsInDeepCopy().

22  :
23  RawDAQData(copy_in)
24 {
25  lastOperationsInDeepCopy(copy_in);
26 }
void lastOperationsInDeepCopy(const RawDAQData &copy_in)
Need to perform these operations in Deep Copy constructor.
Definition: RawDAQData.cpp:151
RawDAQData()
Default Constructor.
Definition: RawDAQData.cpp:14
daqdataformats::RawMilliSliceHeader::RawMilliSliceHeader ( const void millisliceheader_buffer)

Deep copy constructor.

Use default Shallow copy constructor

Definition at line 29 of file RawMilliSliceHeader.cpp.

References daqdataformats::RawDAQData::copy().

29  :
30  RawDAQData(0
36 {
37  /// Use default Shallow copy constructor
38  copy(millisliceheader_buffer);
39 }
#define sizeofdata_t
Definition: FunctionBind.h:30
bool setBufferSource(const void *)
We are not going to overload these funtions, so no need to declare them virtual.
Definition: RawDAQData.cpp:880
void * readDataFromBuffer(const void *buffer)
void printStandard(std::ostream &os=std::cout) const
virtual void copy(const RawDAQData &)
Deep copy from the DAQDataFormat.
Definition: RawDAQData.cpp:830
RawDAQData()
Default Constructor.
Definition: RawDAQData.cpp:14
#define print_t
Definition: FunctionBind.h:31
#define setBufferSource_t
Definition: FunctionBind.h:33
#define readData_t
Definition: FunctionBind.h:32
#define init_t
Definition: FunctionBind.h:29
daqdataformats::RawMilliSliceHeader::~RawMilliSliceHeader ( )

Destructor.

Shallow copy constructor

Definition at line 43 of file RawMilliSliceHeader.cpp.

43 { }

Member Function Documentation

bool daqdataformats::RawDAQData::addCheckSum ( )
virtualinherited

Add the CRC into the end of fBuffer. CRC of all but the last words of the _Buffer.

Calculate CRC for the buffer, skipping the last word

Do the swab

Write the CRC at the last word of the Buffer

Definition at line 550 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer, daqdataformats::RawDAQData::calculateCheckSum(), EXECUTE_FUNCTION, daqdataformats::RawDAQData::isInternalBuffer(), RAWBUFF32, daqdataformats::RawDAQData::sizeofdata(), and SWAB32.

Referenced by daqdataformats::RawMilliSlice::close().

550  {
551 
552  /// Calculate CRC for the buffer, skipping the last word
553  uint32_t crc = calculateCheckSum(1);
554 
555  /// Do the swab
556  crc = SWAB32(crc);
557 
558  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
559 
560  if(isInternalBuffer() && _InternalBuffer.size() < size_of_data){
561  _InternalBuffer.push_back(crc);
562  }
563  else {
564  /// Write the CRC at the last word of the Buffer
565  RAWBUFF32[size_of_data - 1] = crc;
566  }
567 
568  return true;
569 }// end of RawDAQData::addCheckSum()
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
uint32_t calculateCheckSum(const uint32_t skip_last_words) const
Definition: RawDAQData.cpp:541
#define SWAB32(word)
Definition: BitFields.h:14
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
bool isInternalBuffer() const
Definition: RawDAQData.h:141
#define RAWBUFF32
Definition: RawDAQData.h:16
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
bool daqdataformats::RawMilliSliceHeader::addSliceSize ( const uint32_t  size)

Definition at line 73 of file RawMilliSliceHeader.cpp.

Referenced by daqdataformats::RawMilliSlice::addData(), and daqdataformats::RawMilliSlice::close().

73 { return setSliceSize(getSliceSize() + size);}
bool daqdataformats::RawDAQData::addToInternalBuffer ( const uint32_t  size_of_data_to_add)
protectedinherited

Add Zeros to internal buffer.

Definition at line 284 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer, and MECModelEnuComparisons::i.

Referenced by daqdataformats::RawMilliSliceIndex::addIndex().

284  {
285  for(uint32_t i = 0; i < size_of_data; ++i)
286  _InternalBuffer.push_back(0);
287 
288  return true;
289 }
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
bool daqdataformats::RawMilliSliceHeader::advanceFrameSEQ ( )

Definition at line 70 of file RawMilliSliceHeader.cpp.

70 { return setFrameSEQ(getFrameSEQ() + 1);}
bool daqdataformats::RawMilliSliceHeader::advanceMicrosliceNumber ( )

Definition at line 74 of file RawMilliSliceHeader.cpp.

74 { return setMicrosliceNumber(getMicrosliceNumber() + 1);}
bool daqdataformats::RawMilliSliceHeader::advanceMilliSliceSEQ ( )

Definition at line 72 of file RawMilliSliceHeader.cpp.

Referenced by mcdatadaq::DCMSimulator::nextEvent().

72 { return setMilliSliceSEQ(getMilliSliceSEQ() + 1);}
uint32_t daqdataformats::RawDAQData::boolToUint32_t ( const bool  number) const
inlineprotectedinherited

Conversions from bool to int and backwards We are not going to overload it, so no need to declare virtual

Definition at line 190 of file RawDAQData.h.

190 { return ((number) ? 1 : 0); }
uint32_t daqdataformats::RawDAQData::calculateCheckSum ( const uint32_t  skip_last_words) const
inherited

Calculate CRC of _Buffer (after skipping last skip_last_words words) using CRC32c algorythm with 0x8F6E37A0 polynomial. Usually use skip_last_words=1 as the _Buffer has an CRC in the end If on calculates with skip_last_words=0 (with CRC at the end), it should calculate to Zero (Property of Check Sum)

Definition at line 541 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_Buffer, EXECUTE_FUNCTION, daqdataformats::NOvACheckSum::getInstance(), daqdataformats::NOvACheckSum::processCRC(), and daqdataformats::RawDAQData::sizeofdata().

Referenced by daqdataformats::RawDAQData::addCheckSum(), RawMilliSliceTests::testCalculateCheckSum(), RawMilliSliceTests::testCalculateCheckSumCorrupt(), and daqdataformats::MilliSliceUnitTest::testMilliSliceCRC().

541  {
542 
543  NOvACheckSum* CheckSum = NOvACheckSum::getInstance();
544 
545  return CheckSum->processCRC(_Buffer, EXECUTE_FUNCTION(sizeofdata)() - skip_last_words);
546 }// end of calculateCheckSum
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
void * _Buffer
All data formats need to have _Buffer and a Data structure. _Buffer will be common.
Definition: RawDAQData.h:276
static NOvACheckSum * getInstance()
Method to obtain the class instance.
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
bool daqdataformats::RawDAQData::checkBufferInternalness ( )
protectedinherited
bool daqdataformats::RawDAQData::clear ( )
virtualinherited

reset _Buffer to point to InternalBuffer

Clear Internal Buffer

If buffer is internal, need to use assign, because vector may not have been initialized

Loop over the buffer and zero it The buffer could be either internal or external

Reimplemented in daqdataformats::RawMilliSlice.

Definition at line 573 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer, EXECUTE_FUNCTION, MECModelEnuComparisons::i, daqdataformats::RawDAQData::isInternalBuffer(), PRINT_ON_DEBUG, RAWBUFF32, and daqdataformats::RawDAQData::sizeofdata().

Referenced by daqdataformats::RawMilliSlice::clear(), init(), daqdataformats::RawDAQData::reset(), and daqdataformats::VERSION_NAMESPACE::RawDataBlock::~RawDataBlock().

573  {
574 
575  PRINT_ON_DEBUG(__PRETTY_FUNCTION__);
576 
577  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
578 
579  /// If buffer is internal, need to use assign, because vector may not have been initialized
580  if(isInternalBuffer()){
581  _InternalBuffer.assign(size_of_data, 0);
582  }
583  else{
584  /// Loop over the buffer and zero it
585  /// The buffer could be either internal or external
586  for(uint32_t i = 0; i < size_of_data; ++i)
587  RAWBUFF32[i] = 0;
588  }
589 
590  PRINT_ON_DEBUG("end of"<<__PRETTY_FUNCTION__);
591 
592  return true;
593 } // end of clear
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
bool isInternalBuffer() const
Definition: RawDAQData.h:141
#define RAWBUFF32
Definition: RawDAQData.h:16
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
void daqdataformats::RawDAQData::copy ( const RawDAQData copy_in)
virtualinherited

Deep copy from the DAQDataFormat.

Get version

Copy the entire internal buffer

Set function pointers

Definition at line 830 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer, daqdataformats::RawDAQData::_version, daqdataformats::RawDAQData::lastOperationsInDeepCopy(), and daqdataformats::RawDAQData::setFunctionPointers().

Referenced by daqdataformats::RawDCMChan::RawDCMChan(), daqdataformats::RawMicroSlice::RawMicroSlice(), daqdataformats::RawMilliSlice::RawMilliSlice(), RawMilliSliceHeader(), daqdataformats::RawMilliSliceIndex::RawMilliSliceIndex(), daqdataformats::RawMilliSliceIndexHeader::RawMilliSliceIndexHeader(), and daqdataformats::RawTimingMarker::RawTimingMarker().

830  {
831 
832  /// Get version
833  _version = copy_in._version;
834 
835  /// Copy the entire internal buffer
836  _InternalBuffer = copy_in._InternalBuffer;
837 
838  /// Set function pointers
840 
841  lastOperationsInDeepCopy(copy_in);
842 }// end of copy(const RawDAQData& copy_in)
version_t _version
DataFormat Version.
Definition: RawDAQData.h:289
void lastOperationsInDeepCopy(const RawDAQData &copy_in)
Need to perform these operations in Deep Copy constructor.
Definition: RawDAQData.cpp:151
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
virtual bool setFunctionPointers()=0
void daqdataformats::RawDAQData::copy ( const void buffer)
virtualinherited

Shallow copy from the external buffer.

If input version is -1, then we don't really know what version it is and will try to read it

figure out the version

At this point version should be known

Now, need to define functions

Also, we don't initialize internal buffer, because the pointer is set to the external buffer

Definition at line 846 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_Buffer, daqdataformats::RawDAQData::_version, om::cout, EXECUTE_FUNCTION, daqdataformats::RawDAQData::EXECUTE_ON_DEBUG(), daqdataformats::RawDAQData::figureOutTheVersion(), daqdataformats::RawDAQData::isVersionUnknown(), PRINT_ON_DEBUG, daqdataformats::RawDAQData::setBufferSource(), and daqdataformats::RawDAQData::setFunctionPointers().

846  {
847  /// If input version is -1, then we don't really know what version it is and will try to read it
848  if(isVersionUnknown()){
849  PRINT_ON_DEBUG(__PRETTY_FUNCTION__ <<"version unknown");
850  /// figure out the version
851  _version = figureOutTheVersion(external_buffer);
852  }
853 
854  /// At this point version should be known
855  PRINT_ON_DEBUG(__PRETTY_FUNCTION__ <<"Picked up version "<<_version);
856  /// Now, need to define functions
858 
859  PRINT_ON_DEBUG(__PRETTY_FUNCTION__ << " 32 (about to do setBufferSource)");
860  EXECUTE_ON_DEBUG(if(!_function_setBufferSource)std::cout<<"sbf is not binded\n");
861  // Now set the pointer to the external buffer
862  EXECUTE_FUNCTION(setBufferSource)(external_buffer);
863  //setBufferSource(external_buffer);
864  PRINT_ON_DEBUG(__PRETTY_FUNCTION__ << " 4");
865 
866  EXECUTE_ON_DEBUG(if(_Buffer != external_buffer)
867  std::cout<<"Something is wrong in RawDAQData::copy";
868  else
869  std::cout<<"From RawDAQData::copy Buffer is set to "<<_Buffer<<"\n"
870  );
871 
872  // Don't need to initialize any other fields,
873  // because supposedly they should have been initialized before (by somebody else)
874 
875  /// Also, we don't initialize internal buffer, because the pointer is set to the external buffer
876 
877 }// end of copy(const void* external_buffer)
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
version_t _version
DataFormat Version.
Definition: RawDAQData.h:289
bool setBufferSource(const void *)
We are not going to overload these funtions, so no need to declare them virtual.
Definition: RawDAQData.cpp:880
bool isVersionUnknown() const
is current _version unknown?
Definition: RawDAQData.h:240
void * _Buffer
All data formats need to have _Buffer and a Data structure. _Buffer will be common.
Definition: RawDAQData.h:276
virtual version_t figureOutTheVersion(const void *buffer) const =0
OStream cout
Definition: OStream.cxx:6
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
EXECUTE_ON_DEBUG(std::string _dataFormatClassName)
These variables are only for Debugging purposes.
virtual bool setFunctionPointers()=0
void daqdataformats::RawDAQData::defaultConstructorFixedSize ( )
protectedinherited

General routines for the default constructor of main class for fixed size data formats, like RawNanoSliceHeader, Timing marker etc. (they can be different from version to version though) But the difference is that we want to clear out the internal buffer for them, whereas for floating data formats don't need to have that, since the data may be overwritten anyways

Definition at line 625 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::defaultConstructorGeneral(), daqdataformats::RawDAQData::Init_t(), daqdataformats::RawDAQData::reset(), and resetBufferSource_t.

Referenced by daqdataformats::RawDCMChan::RawDCMChan(), RawMilliSliceHeader(), daqdataformats::RawMilliSliceIndexHeader::RawMilliSliceIndexHeader(), and daqdataformats::RawTimingMarker::RawTimingMarker().

625  {
627 }// end of defaultConstructorFixedSize(version_t)
#define resetBufferSource_t
Definition: FunctionBind.h:34
void defaultConstructorGeneral(resetBufferSource_t)
void daqdataformats::RawDAQData::defaultConstructorFixedSize ( init_t  )
protectedinherited
void daqdataformats::RawDAQData::defaultConstructorFloatingSize ( )
protectedinherited

General routines for the default constructor of main class for floating size data formats, like RawNanoSlice, RawEvent etc. We don't need to initialize internal buffer

Definition at line 642 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_Buffer, daqdataformats::RawDAQData::_InternalBuffer, daqdataformats::RawDAQData::_version, om::cout, daqdataformats::RawDAQData::defaultConstructorGeneral(), EXECUTE_FUNCTION, EXECUTE_GENERAL_FUNCTION, daqdataformats::RawDAQData::EXECUTE_ON_DEBUG(), daqdataformats::RawDAQData::init(), daqdataformats::RawDAQData::Init_t(), daqdataformats::RawDAQData::isVersionUnknown(), PRINT_ON_DEBUG, daqdataformats::RawDAQData::resetBufferSource(), ResetBufferSource_t, resetBufferSource_t, daqdataformats::RawDAQData::resizeInternalBuffer(), daqdataformats::RawDAQData::setFunctionPointers(), gen_flatrecord::size, and daqdataformats::RawDAQData::sizeofdata().

Referenced by daqdataformats::RawMicroSlice::RawMicroSlice(), daqdataformats::RawMilliSlice::RawMilliSlice(), and daqdataformats::RawMilliSliceIndex::RawMilliSliceIndex().

642  {
644 }// end of defaultConstructorFloatingSize(version_t)
#define resetBufferSource_t
Definition: FunctionBind.h:34
void defaultConstructorGeneral(resetBufferSource_t)
void daqdataformats::RawDAQData::defaultConstructorFloatingSize ( init_t  )
protectedinherited
daqdataformats::RawDAQData::EXECUTE_ON_DEBUG ( std::string  _dataFormatClassName)
protectedinherited
daqdataformats::RawDAQData::EXECUTE_ON_DEBUG ( std::string  _dataFormatConstructor)
protectedinherited
version_t daqdataformats::RawMilliSliceHeader::figureOutTheVersion ( const void buffer) const
inlineprivatevirtual

Method which returns the version of the DataFormat given the pointer to the buffer It has to be implemented for all DataFormats.

Implements daqdataformats::RawDAQData.

Definition at line 182 of file RawMilliSliceHeader.h.

182 {return 0;}
bool daqdataformats::RawDAQData::functionIsNotAllowed ( const std::string  function = "",
const std::string  message = "" 
) const
protectedinherited

One can call this function from another function, which usage is not allowed (for a particular version).

The output message string

Generate the exception

Definition at line 962 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_version, gen_flatrecord::size, and string.

962  {
963 
964  /// The output message string
965  std::string output_message;
966 
967  if(function.size() > 0){
968  output_message = "\nFunction " + function + " ";
969  }
970  else{
971  output_message = "Operation ";
972  }
973 
974  output_message.append(" is Not allowed");
975  output_message.append(" for version " + boost::lexical_cast<std::string>(_version));
976  output_message.append(".");
977 
978  if(message.size() > 0)
979  output_message += " " + message;
980 
981  /// Generate the exception
982  throw daqdataformats::DataFormatException((const std::string)output_message);
983 
984  return false;
985 }
version_t _version
DataFormat Version.
Definition: RawDAQData.h:289
enum BeamMode string
std::string daqdataformats::RawDAQData::generateExceptionForWrongVersion ( version_t  maximum_version) const
protectedinherited

Generating exception message as the version of DAQDataFormat is greater than the maximum allowed.

Definition at line 950 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_version, lem_server::msg, and string.

950  {
951 
952  std::string msg = "The version of the DataFormat is too high! ";
953  msg += "The version is " + boost::lexical_cast<std::string>(_version)
954  + ". Whereas the maximum version allowed is " + boost::lexical_cast<std::string>(maximum_version);
955 
956  return msg;
957 }// end of generateExceptionForWrongVersion
version_t _version
DataFormat Version.
Definition: RawDAQData.h:289
enum BeamMode string
void* daqdataformats::RawDAQData::getBuffer ( ) const
inlineinherited
bool daqdataformats::RawDAQData::getLoAndHi ( uint64_t  input_data,
uint32_t &  output_low_word,
uint32_t &  output_hi_word 
) const
protectedinherited

Definition at line 910 of file RawDAQData.cpp.

Referenced by daqdataformats::RawTimingMarker::setTime(), setTimeStart(), and daqdataformats::RawDAQData::setUint64_t().

910  {
911  out_low_word = input_data & 0xffffffff;
912  out_hi_word = input_data >> 32;
913  return true;
914 }// end of getLoAndHi
rawmillihdr::Mode_t daqdataformats::RawMilliSliceHeader::getMode ( ) const
uint64_t daqdataformats::RawMilliSliceHeader::getTimeStart ( ) const

Definition at line 62 of file RawMilliSliceHeader.cpp.

References daqdataformats::RawDAQData::getUint64_t().

Referenced by daqdataformats::RawMilliSlice::getTimeStart().

62  {
63  return getUint64_t(getTimeStartLow(), getTimeStartHigh());
64  }
uint64_t getUint64_t(uint32_t low_word, uint32_t hi_word) const
Get uint64_t from low and hi word.
Definition: RawDAQData.cpp:908
uint64_t daqdataformats::RawDAQData::getUint64_t ( uint32_t  low_word,
uint32_t  hi_word 
) const
protectedinherited

Get uint64_t from low and hi word.

Definition at line 908 of file RawDAQData.cpp.

Referenced by daqdataformats::RawTimingMarker::getTime(), and getTimeStart().

908 { return (uint64_t) high<<32 | low;}
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( Marker  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( DestBuffID  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( Partition  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( DiblockId  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( DCMId  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( DetId  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( GlobalDCMID  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( TimeStartLow  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( TimeStartHigh  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( TimeLength  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( MilliSliceSEQ  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( FrameSEQ  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( SliceSize  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( MicrosliceNumber  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( MilliSliceIndexNumber  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( MicroSliceTimeLength_usec  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_AND_SET_NOVERSION ( MonteCarloFlag  ,
bool   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_GET_NOVERSION ( Version  ,
uint32_t   
)
daqdataformats::RawMilliSliceHeader::IMPLEMENT_IS_AND_SET_NOVERSION ( Complete  )
daqdataformats::RawMilliSliceHeader::IMPLEMENT_IS_AND_SET_NOVERSION ( ConnectionInitialization  )
daqdataformats::RawMilliSliceHeader::IMPLEMENT_IS_AND_SET_NOVERSION ( CloseConnection  )
daqdataformats::RawMilliSliceHeader::IMPLEMENT_IS_AND_SET_NOVERSION ( CorruptData  )
daqdataformats::RawMilliSliceHeader::IMPLEMENT_IS_AND_SET_NOVERSION ( MissingData  )
daqdataformats::RawMilliSliceHeader::IMPLEMENT_IS_AND_SET_NOVERSION ( CRCCalculationUsed  )
daqdataformats::RawMilliSliceHeader::IMPLEMENT_IS_AND_SET_NOVERSION ( MilliSliceIndexUsed  )
daqdataformats::RawMilliSliceHeader::IMPLEMENT_SET_NOVERSION_PROTECTED ( Version  ,
uint32_t   
)
void daqdataformats::RawMilliSliceHeader::init ( )

Need to clear the MilliSlice Header every time on the init

Set version in the buffer

Set Pad3 in the buffer do the defalut value

Definition at line 46 of file RawMilliSliceHeader.cpp.

References daqdataformats::RawDAQData::clear(), daqdataformats::CURRENT_FIELDS_SUB_NAMESPACE::Marker_value, and sizeofdata().

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

46  {
47 
48  /// Need to clear the MilliSlice Header every time on the init
49  clear();
50  /// Set version in the buffer
51  //setVersion(0);
52 
53  /// Set Pad3 in the buffer do the defalut value
54  setMarker(rawmillihdr::Marker_value[0]);
55 
56  setSliceSize(sizeofdata());
57 }
virtual bool clear()
reset _Buffer to point to InternalBuffer
Definition: RawDAQData.cpp:573
daqdataformats::RawDAQData::Init_t ( _function_init  )
protectedinherited
bool daqdataformats::RawDAQData::isInternalBuffer ( ) const
inlineinherited
bool daqdataformats::RawDAQData::isVersionUnknown ( ) const
inlineprotectedinherited
bool daqdataformats::RawDAQData::isVersionUnknown ( const version_t  version) const
inlineprotectedinherited

is input version unknown?

Definition at line 242 of file RawDAQData.h.

References daqdataformats::rawdaqdataformat::DAQDATAFORMAT_UNKNOWN_VERSION, DELEGATE, init_t, resetBufferSource_t, and string.

const XML_Char * version
Definition: expat.h:187
static const version_t DAQDATAFORMAT_UNKNOWN_VERSION
Definition: RawDAQData.h:81
void daqdataformats::RawDAQData::lastOperationsInDeepCopy ( const RawDAQData copy_in)
protectedinherited

Need to perform these operations in Deep Copy constructor.

If buffer is null, nothing to do

Definition at line 151 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_Buffer, EXECUTE_FUNCTION, daqdataformats::RawDAQData::isInternalBuffer(), PRINT_ON_DEBUG, daqdataformats::RawDAQData::resetBufferSource(), and daqdataformats::RawDAQData::setBufferSource().

Referenced by daqdataformats::RawDAQData::copy(), daqdataformats::RawDCMChan::RawDCMChan(), daqdataformats::RawMicroSlice::RawMicroSlice(), daqdataformats::RawMilliSlice::RawMilliSlice(), RawMilliSliceHeader(), daqdataformats::RawMilliSliceIndex::RawMilliSliceIndex(), daqdataformats::RawMilliSliceIndexHeader::RawMilliSliceIndexHeader(), and daqdataformats::RawTimingMarker::RawTimingMarker().

151  {
152 
153  /// If buffer is null, nothing to do
154  if(copy_in._Buffer == NULL) return;
155 
156  // Setup the main buffer pointer
157  // If the copy_in's buffer is external, point to that external memory
158  if(copy_in.isInternalBuffer()) {
160  }
161  else{
162  PRINT_ON_DEBUG("From RawDAQData::copy. Buffer is External. Using setBufferSource.");
163  EXECUTE_FUNCTION(setBufferSource)(copy_in._Buffer);
164  }
165 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
bool setBufferSource(const void *)
We are not going to overload these funtions, so no need to declare them virtual.
Definition: RawDAQData.cpp:880
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
void daqdataformats::RawDAQData::print ( std::ostream &  os = std::cout) const
inherited
void daqdataformats::RawDAQData::print ( std::string output_string) const
inherited

print into the string

Some temporary stream

perform standard print into the stream

Get the string out of the stream

Definition at line 503 of file RawDAQData.cpp.

References EXECUTE_FUNCTION, daqdataformats::RawDAQData::print(), and submit_syst::str.

503  {
504 
505  /// Some temporary stream
506  std::ostringstream str;
507  /// perform standard print into the stream
509  /// Get the string out of the stream
510  output_string = str.str();
511 
512 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
void print(std::ostream &os=std::cout) const
Method for printing the content of the Buffer.
Definition: RawDAQData.cpp:500
daqdataformats::RawDAQData::Print_t ( _function_print  )
protectedinherited
void daqdataformats::RawDAQData::printBinary ( const void buffer0,
const uint32_t  size,
std::ostream &  os = std::cout 
) const
protectedinherited

Definition at line 478 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::printWordBinary(), and gen_flatrecord::size.

478  {
479 
480  const uint32_t* buffer = (uint32_t*)buffer0;
481  for(uint32_t iword = 0; iword < size; ++iword){
482 // out_stream<<"Address "<<&buffer[iword]<<" ";
483  printWordBinary(buffer[iword], out_stream);
484  }// end of loop over buffer
485 }
void printWordBinary(const uint32_t word, std::ostream &os=std::cout) const
! Print the i-th word of _Buffer, is_bynary_printing: true = bynary, false = HEX
Definition: RawDAQData.cpp:456
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
void daqdataformats::RawDAQData::printBuffer ( std::ostream &  os = std::cout,
const bool  print_offset = true,
const bool  print_ascii = true,
const bool  print_buffer_address = false,
const bool  print_internal_buffer = false,
const bool  print_size_of_data = false,
const std::string  separation_between_lines = "\n",
const uint32_t  cols = 4 
) const
protectedinherited

Displays the data _Buffer Customazible for debugging purpose

If we havn't printed buffer address, need to print Internal Buffer address

Print whether the buffer is internal/external

print size

Size of data

Current pointer to a word

This is only for ascii buffer printing

Loop over buffer

Write the data word in hex

At the end of the line write the line in ASCII with suppression of non printing characters

printing the ascii for the word

Loop over 4 characters of the line

print the character

At the end of the line, put separation symbol

Definition at line 330 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_Buffer, daqdataformats::RawDAQData::_InternalBuffer, cols, allTimeWatchdog::endl, EXECUTE_FUNCTION, novadaq::HexUtils::format(), MECModelEnuComparisons::i, daqdataformats::RawDAQData::isInternalBuffer(), calib::j, and daqdataformats::RawDAQData::sizeofdata().

Referenced by daqdataformats::RawMicroSlice::printStandard().

338  {
339 
340  // print Buffer address
341  if(print_buffer_address){
342 
343  uint32_t* buf = (uint32_t*)_Buffer;
344  out_stream<<"Buffer address is "<<buf<<std::endl;
345  }
346 
347  // print internal buffer info
348  if(print_internal_buffer){
349  if(_InternalBuffer.size() > 0){
350  /// If we havn't printed buffer address, need to print Internal Buffer address
351  if(!print_buffer_address || !isInternalBuffer())
352  out_stream<<"Internal Buffer address "<<&_InternalBuffer[0]<<". ";
353 
354  /// Print whether the buffer is internal/external
355  if(isInternalBuffer())
356  out_stream<<"Using Internal Buffer.";
357  else
358  out_stream<<"Using External Buffer.";
359 
360  /// print size
361  out_stream<<" The size of the internal buffer is "<<_InternalBuffer.size()<<std::endl;
362  }
363  else{
364  out_stream<<"Internal Buffer size is ZERO"<<std::endl;
365  }// end of checking if the size of internal buffer is nonzero
366 
367  }// end of printing internal buffer info
368 
369  /// Size of data
370  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
371 
372  if(print_size_of_data)
373  out_stream<<"Size of data = "<<size_of_data<<std::endl;
374 
375  /// Current pointer to a word
376  uint32_t* data_buffer = (uint32_t*)_Buffer;
377 
378  /// This is only for ascii buffer printing
379  char* ascii_buffer = (char*)_Buffer;
380 
381  /// Loop over buffer
382  for(uint32_t i = 0; i < size_of_data; ++i){
383 
384  // At the start of the line write the address offset
385  if((print_offset && !(i % cols))){
386  out_stream<<boost::format("[Offset=%08x bytes] \t")%(uint32_t)((data_buffer-(uint32_t*)_Buffer)*sizeof(uint32_t));
387  }
388 
389  /// Write the data word in hex
390  out_stream<<boost::format("0x%08x\t")%*data_buffer;
391 
392  /// At the end of the line write the line in ASCII with suppression of
393  /// non printing characters
394  if((i + 1) % cols == 0 || i == size_of_data-1){
395 
396  /// printing the ascii for the word
397  if(print_ascii){
398 
399  uint32_t nsymbols = cols;
400 
401  if(i == size_of_data-1){
402  nsymbols = size_of_data % cols;
403  if(nsymbols == 0)
404  nsymbols = cols;
405  }
406 
407  if(size_of_data / cols){
408  for(uint32_t itab = 0; itab < cols - nsymbols; ++itab)
409  out_stream<<" ";
410  }
411 
412  out_stream<<"(ASCII=";
413 
414  /// Loop over 4 characters of the line
415  for(uint32_t j = 0; j < sizeof(uint32_t) * nsymbols; ++j){
416 
417  /// print the character
418  if( (*ascii_buffer < 32) || (*ascii_buffer > 126)){
419  out_stream<<".";
420  }else{
421  out_stream<<boost::format("%c") % (*ascii_buffer);
422  }// end of print the character
423 
424  ++ascii_buffer;
425  }// end of loop over charachters
426 
427  out_stream<<")";
428  }// end of printing ASCII
429 
430  /// At the end of the line, put separation symbol
431  out_stream<<separation_between_lines;
432  }// end of if the end of the line
433 
434  ++data_buffer;
435  }// end of loop over buffer
436 
437 }// end of RawDAQData::printBuffer()
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
void * _Buffer
All data formats need to have _Buffer and a Data structure. _Buffer will be common.
Definition: RawDAQData.h:276
const int cols[3]
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
bool isInternalBuffer() const
Definition: RawDAQData.h:141
const double j
Definition: BetheBloch.cxx:29
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
void daqdataformats::RawDAQData::printGeneral ( std::ostream &  os = std::cout) const
protectedinherited

Print methods Generic print

Definition at line 516 of file RawDAQData.cpp.

References allTimeWatchdog::endl, EXECUTE_FUNCTION, MECModelEnuComparisons::i, daqdataformats::RawDAQData::printWord(), and daqdataformats::RawDAQData::sizeofdata().

516  {
517 
518  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
519 
520  output_stream<<"----------General printing of a DAQDataFormat member-----------size="<<size_of_data<<std::endl;
521  output_stream<<std::endl<<"nRAW:";
522  for(uint32_t i = 0; i < size_of_data; ++i){
523  output_stream<<" ";
524  printWord(i, false, output_stream);
525  }
526 
527  output_stream<<"\nRAW:";
528  for(uint32_t i = 0; i < size_of_data; ++i){
529  if(i > 0)output_stream<<" ";
530  printWord(i, true, output_stream);
531  output_stream<<std::endl;
532  }
533 }// end of RawDAQData::printGeneral()
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
void printWord(const uint32_t iword, const bool is_bynary_printing, std::ostream &os=std::cout) const
Print word from Buffer.
Definition: RawDAQData.cpp:440
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
void daqdataformats::RawDAQData::printHex ( const void buffer0,
const uint32_t  size,
std::ostream &  os = std::cout 
) const
protectedinherited

Definition at line 488 of file RawDAQData.cpp.

References allTimeWatchdog::endl, daqdataformats::RawDAQData::printWordHex(), and gen_flatrecord::size.

488  {
489 
490  const uint32_t* buffer = (uint32_t*)buffer0;
491  for(uint32_t iword = 0; iword < size; ++iword){
492 // out_stream<<"Address "<<&buffer[iword]<<" ";
493  printWordHex(buffer[iword], out_stream);
494  out_stream<<std::endl;
495  }// end of loop over buffer
496 }
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
void printWordHex(const uint32_t word, std::ostream &os=std::cout) const
Definition: RawDAQData.cpp:473
void daqdataformats::RawMilliSliceHeader::printStandard ( std::ostream &  os = std::cout) const
private

Version number for the MilliSlice event builder

MilliSlice header delimiter

Destination buffer node

Partition

Time start 0-31 bits for the MilliSlice

Time start 32-55 bits for the MilliSlice

Time length of the MilliSlice

Status word

Status word

Status word

Status word

Status word

Status word

MilliSlice sequence identifier

Frame sequence identifier for current 5ms time slice

The MilliSlice size in words excluding the header

Number of subframes in the millislice

Definition at line 88 of file RawMilliSliceHeader.cpp.

References allTimeWatchdog::endl, novadaq::HexUtils::format(), getMode(), MECModelEnuComparisons::i, daqdataformats::RawDAQData::printWord(), and sizeofdata().

88  {
89 
90  os<<std::endl<<"MilliSlice Header:";
91  os<<boost::format(" Version=%u" )% getVersion(); //! Version number for the MilliSlice event builder
92  os<<boost::format(" Marker=0x%04x" )% getMarker(); //! MilliSlice header delimiter
93  os<<boost::format(" getDiblockId=%u" )% getDiblockId();
94  os<<boost::format(" DCMId=%u" )% getDCMId();
95  os<<boost::format(" DetId=%u" )% getDetId();
96  os<<boost::format(" DestBuff=%u" )% getDestBuffID(); //! Destination buffer node
97  os<<boost::format(" Partition=%u" )% getPartition(); //! Partition
98  os<<boost::format(" TimeStartLow=%u" )% getTimeStartLow(); //! Time start 0-31 bits for the MilliSlice
99  os<<boost::format(" TimeStartHigh=%u" )% getTimeStartHigh();//! Time start 32-55 bits for the MilliSlice
100  os<<boost::format(" TimeLength=%u" )% getTimeLength(); //! Time length of the MilliSlice
101  os<<boost::format(" isComplete=%u" )% isComplete(); //! Status word
102  os<<boost::format(" isMode=%u" )% getMode(); //! Status word
103  os<<boost::format(" isConnectionInitialization=%u")% isConnectionInitialization(); //! Status word
104  os<<boost::format(" isCloseConnection=%u" )% isCloseConnection(); //! Status word
105  os<<boost::format(" isCorruptData=%u" )% isCorruptData(); //! Status word
106  os<<boost::format(" isMissingData=%u" )% isMissingData(); //! Status word
107  os<<boost::format(" SliceSEQ=%u" )% getMilliSliceSEQ(); //! MilliSlice sequence identifier
108  os<<boost::format(" FrameSEQ=%u" )% getFrameSEQ(); //! Frame sequence identifier for current 5ms time slice
109  os<<boost::format(" SliceSize=%u" )% getSliceSize(); //! The MilliSlice size in words excluding the header
110  os<<boost::format(" MicroSliceNumber=%u" )% getMicrosliceNumber(); //! Number of subframes in the millislice
111  os<<boost::format(" MilliSliceIndexNumber=%u" )% getMilliSliceIndexNumber();
112  os<<boost::format(" MicroSliceTimeLength_usec=%u" )% getMicroSliceTimeLength_usec();
113  os<<boost::format(" MonteCarloFlag=%u" )% getMonteCarloFlag();
114  os<<boost::format(" isCRCCalculationUsed=%u" )% isCRCCalculationUsed();
115  os<<boost::format(" isMilliSliceIndexUsed=%u" )% isMilliSliceIndexUsed();
116 
117  const uint32_t size_of_data = sizeofdata();
118 
119  os<<"\nMilliSliceHeader RAW 32bit words (converted, if required, to native endian format):";
120  for(uint32_t i = 0; i < size_of_data; ++i){
121  os<<" ";
122  printWord(i, false, os);
123  }
124 
125  os<<"\nMilliSliceHeader RAW bits (converted, if required, to native endian format):";
126  for(uint32_t i = 0; i < size_of_data; ++i){
127  os<<std::endl;
128  printWord(i, true, os);
129  }
130 
131 }
rawmillihdr::Mode_t getMode() const
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
void printWord(const uint32_t iword, const bool is_bynary_printing, std::ostream &os=std::cout) const
Print word from Buffer.
Definition: RawDAQData.cpp:440
void daqdataformats::RawDAQData::printUnknownVersion ( std::ostream &  out_stream = std::cout) const
inlineprotectedinherited

Definition at line 213 of file RawDAQData.h.

References allTimeWatchdog::endl, init_t, datagram_client::message, and string.

Referenced by daqdataformats::RawDAQData::RawDAQData().

213 { out_stream<<"DAQDataFormat is of unknown version"<<std::endl;}
void daqdataformats::RawDAQData::printWord ( const uint32_t  iword,
const bool  is_bynary_printing,
std::ostream &  os = std::cout 
) const
protectedinherited

Print word from Buffer.

Check if we want to print in a bynary mode

Definition at line 440 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::printWordBinary(), daqdataformats::RawDAQData::printWordHex(), RAWBUFF32, and SWAB32.

Referenced by daqdataformats::RawMilliSliceIndex::print(), daqdataformats::RawDCMChan::print(), daqdataformats::RawDAQData::printGeneral(), daqdataformats::RawTimingMarker::printStandard(), daqdataformats::RawMilliSlice::printStandard(), and printStandard().

440  {
441 
442  const uint32_t rawbuf = RAWBUFF32[iword];
443  const uint32_t value = SWAB32(rawbuf);
444 
445  /// Check if we want to print in a bynary mode
446  if(is_bynary_printing){
447  printWordBinary(value, out_stream);
448  } else {
449  //Else print in hex mode
450  printWordHex(value, out_stream);
451  }// end of if(is_bynary_printing)
452 
453 }//end of void printWord
void printWordBinary(const uint32_t word, std::ostream &os=std::cout) const
! Print the i-th word of _Buffer, is_bynary_printing: true = bynary, false = HEX
Definition: RawDAQData.cpp:456
#define SWAB32(word)
Definition: BitFields.h:14
void printWordHex(const uint32_t word, std::ostream &os=std::cout) const
Definition: RawDAQData.cpp:473
const XML_Char int const XML_Char * value
Definition: expat.h:331
#define RAWBUFF32
Definition: RawDAQData.h:16
void daqdataformats::RawDAQData::printWordBinary ( const uint32_t  word,
std::ostream &  os = std::cout 
) const
protectedinherited

! Print the i-th word of _Buffer, is_bynary_printing: true = bynary, false = HEX

Definition at line 456 of file RawDAQData.cpp.

References allTimeWatchdog::endl, and MECModelEnuComparisons::i.

Referenced by daqdataformats::RawDAQData::printBinary(), and daqdataformats::RawDAQData::printWord().

456  {
457 
458  uint32_t value_copy = value;
459 
460  const int SHIFT = 8 * sizeof( unsigned ) - 1;
461  const unsigned MASK = 1 << SHIFT;
462 
463  for ( int i = 1; i <= SHIFT + 1; i++ ){
464  out_stream << ( value_copy & MASK ? '1' : '0' );
465  value_copy <<= 1;
466 
467  if ( i % 8 == 0 ) out_stream << ' ';
468  }
469  out_stream<<std::endl;
470 }
const XML_Char int const XML_Char * value
Definition: expat.h:331
void daqdataformats::RawDAQData::printWordHex ( const uint32_t  word,
std::ostream &  os = std::cout 
) const
protectedinherited

Definition at line 473 of file RawDAQData.cpp.

References novadaq::HexUtils::format().

Referenced by daqdataformats::RawDAQData::printHex(), and daqdataformats::RawDAQData::printWord().

473  {
474  out_stream<<boost::format("0x%08x")% value;
475 }
const XML_Char int const XML_Char * value
Definition: expat.h:331
std::string format(const int32_t &value, const int &ndigits=8)
Definition: HexUtils.cpp:14
void* daqdataformats::RawDAQData::readData ( const void buffer,
const uint32_t  size_of_data 
)
inlineinherited

Read from the buffer if the size of data is known.

Definition at line 114 of file RawDAQData.h.

References fd.

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

114 {return readDataGeneral(buffer, size_of_data);}
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
readDataStatus daqdataformats::RawDAQData::readData ( const int  fd)
virtualinherited

From the File descriptor.

Reimplemented in daqdataformats::RawMicroSlice, and daqdataformats::RawMilliSlice.

Definition at line 255 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_Buffer, EXECUTE_FUNCTION, daqdataformats::rds_complete, daqdataformats::rds_error, daqdataformats::rds_incomplete, daqdataformats::RawDAQData::sizeofdata(), and ss.

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

255  {
256 
257  if(fd < 0) return rds_error;
258 
259  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
260 
261  const ssize_t ss = read(fd, _Buffer, (size_t)size_of_data*sizeof(uint32_t));
262 
263  if (ss == -1 || ss == 0) return rds_error;
264 
265  if ((uint32_t)ss == size_of_data*sizeof(uint32_t)) return rds_complete;
266  else return rds_incomplete;
267 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
void * _Buffer
All data formats need to have _Buffer and a Data structure. _Buffer will be common.
Definition: RawDAQData.h:276
Float_t ss
Definition: plot.C:24
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
void* daqdataformats::RawMilliSliceHeader::readData ( const void buffer)
inline

Definition at line 173 of file RawMilliSliceHeader.h.

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

173 {return readDataGeneral(buffer);}
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
daqdataformats::RawDAQData::ReadData_t ( _function_readData  )
protectedinherited
void* daqdataformats::RawMilliSliceHeader::readDataFromBuffer ( const void buffer)
inlineprivate

Definition at line 179 of file RawMilliSliceHeader.h.

References om::cout.

179 {return readDataGeneral(buffer);}
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
void * daqdataformats::RawDAQData::readDataGeneral ( const void buffer)
protectedinherited

General ReadData method when the sizeofdata is known.

Definition at line 186 of file RawDAQData.cpp.

References EXECUTE_FUNCTION, and daqdataformats::RawDAQData::sizeofdata().

Referenced by daqdataformats::RawMilliSlice::addData(), daqdataformats::RawMicroSlice::addData(), daqdataformats::RawMilliSliceIndex::close(), daqdataformats::RawMilliSlice::close(), daqdataformats::RawDAQData::RawDAQData(), daqdataformats::RawMilliSliceIndex::readData(), daqdataformats::VERSION_NAMESPACE::RawSummaryDCMDataHeader::readData(), daqdataformats::VERSION_NAMESPACE::RawTriggerRange::readData(), daqdataformats::VERSION_NAMESPACE::RawMicroBlockHeader::readData(), daqdataformats::VERSION_NAMESPACE::RawMicroSliceHeader::readData(), daqdataformats::VERSION_NAMESPACE::RawSummaryDroppedMicroblock::readData(), daqdataformats::VERSION_NAMESPACE::RawConfigurationTail::readData(), daqdataformats::VERSION_NAMESPACE::RawEventTail::readData(), daqdataformats::VERSION_NAMESPACE::RawSummaryDCMDataPoint::readData(), daqdataformats::VERSION_NAMESPACE::RawTriggerTimingMarker::readData(), daqdataformats::VERSION_NAMESPACE::RawTriggerMask::readData(), daqdataformats::VERSION_NAMESPACE::RawTriggerTime::readData(), daqdataformats::VERSION_NAMESPACE::RawDataBlockHeader::readData(), daqdataformats::VERSION_NAMESPACE::RawConfigurationHeader::readData(), daqdataformats::VERSION_NAMESPACE::RawTriggerHeader::readData(), daqdataformats::VERSION_NAMESPACE::RawNanoSlice::readData(), daqdataformats::VERSION_NAMESPACE::RawEventHeader::readData(), daqdataformats::VERSION_NAMESPACE::RawNanoSliceHeader::readData(), daqdataformats::VERSION_NAMESPACE::RawRunHeader::readData(), daqdataformats::RawMilliSlice::readDataFromBuffer(), daqdataformats::RawMicroSlice::readDataFromBuffer(), and daqdataformats::RawDAQData::readDataGeneral().

186  {
188 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
void * daqdataformats::RawDAQData::readDataGeneral ( const void buffer,
const uint32_t  size_of_data_to_read 
)
protectedinherited

Generic readData methods.

Adding stuff to buffer.

Definition at line 191 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer, EXECUTE_FUNCTION, PRINT_ON_DEBUG, daqdataformats::RawDAQData::readDataGeneral(), and daqdataformats::RawDAQData::sizeofdata().

191  {
192 
193  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<"size of data "<<sizeofdata());
194  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<_InternalBuffer.size());
195 
196  return readDataGeneral(buffer_void, size_of_data_to_read, EXECUTE_FUNCTION(sizeofdata)());
197 }
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
void * readDataGeneral(const void *buffer)
General ReadData method when the sizeofdata is known.
Definition: RawDAQData.cpp:186
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
void * daqdataformats::RawDAQData::readDataGeneral ( const void buffer,
const uint32_t  size_of_data_to_read,
const uint32_t  buffer_start_position 
)
protectedinherited

If it's negative, then nothing to assign

At first, we are going to be assigning things

Push back the rest

Since, it's the external buffer, then we are going to assign

Definition at line 200 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer, om::cout, daqdataformats::RawDAQData::EXECUTE_ON_DEBUG(), exit(), MECModelEnuComparisons::i, daqdataformats::RawDAQData::isInternalBuffer(), std::min(), PRINT_ON_DEBUG, and RAWBUFF32.

200  {
201 
202  PRINT_ON_DEBUG(__PRETTY_FUNCTION__);
203 
204  const uint32_t* buffer = (const uint32_t*)buffer_void;
205 
206  if(buffer == 0){return 0;}
207 
208 
209  if(isInternalBuffer()){
210  {
211  PRINT_ON_DEBUG ("Internal buffer");
212  }
213 
214  int32_t words_to_assign = int32_t(_InternalBuffer.size()) - int32_t(buffer_start_position);
215  {
216  PRINT_ON_DEBUG ("Size="<<_InternalBuffer.size()<<" buffer_start_pos="<<buffer_start_position<<" size_of_data_to_read="<<size_of_data_to_read);
217  PRINT_ON_DEBUG ("Words to assign1="<<words_to_assign);
218  EXECUTE_ON_DEBUG(if(words_to_assign < 0) {std::cout<<"FROM "<<__PRETTY_FUNCTION__<<"words_to_assign is negative("<<words_to_assign<<"). SOMETHING MUST BE WRONG\n";exit(1);});
219  }
220  /// If it's negative, then nothing to assign
221  if(words_to_assign > 0)
222  words_to_assign = std::min(int32_t(size_of_data_to_read), words_to_assign);
223  else
224  words_to_assign = 0;
225 
226  {
227  PRINT_ON_DEBUG ("Words to assign2="<<words_to_assign);
228  }
229  uint32_t i = 0;
230  ///At first, we are going to be assigning things
231  for(; i < uint32_t(words_to_assign); ++i ){
232  RAWBUFF32[buffer_start_position + i] = buffer[i];
233  }
234 
235  /// Push back the rest
236  for(; i < size_of_data_to_read; ++i ){
237  _InternalBuffer.push_back(buffer[i]);;
238  }
239  }
240  else {
241  /// Since, it's the external buffer, then we are going to assign
242  for(uint32_t i = 0; i < size_of_data_to_read; ++i ){
243  RAWBUFF32[buffer_start_position + i] = buffer[i];
244  }
245 
246  }// end if buffer is internal or external
247 
248  // Return the address of the buffer advanced by 1 word;
249  return (void*)(buffer + size_of_data_to_read);
250 }
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
bool isInternalBuffer() const
Definition: RawDAQData.h:141
OStream cout
Definition: OStream.cxx:6
#define RAWBUFF32
Definition: RawDAQData.h:16
exit(0)
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
T min(const caf::Proxy< T > &a, T b)
EXECUTE_ON_DEBUG(std::string _dataFormatClassName)
These variables are only for Debugging purposes.
void * daqdataformats::RawDAQData::readDataUnknownVersion ( const void buffer)
protectedinherited

Read data from the unknown version.

Read data from the unknown version Reading data to the format with unknown version can only happen when the buffer is set to internal source, because if it was set to external source, then we already figured out the version from it and wouldn't call this method After reading the data, the DataFormat is fully initialized

get the version

Now that we know the version, initialize function pointers, including readData

Resize internal buffer

Reset buffer source, so that we can construct other things (like headers and such)

Don't need to initialize the fields (use init()) because we are going to read new values from the buffer anyways... Like now

Definition at line 805 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_version, EXECUTE_FUNCTION, daqdataformats::RawDAQData::figureOutTheVersion(), daqdataformats::RawDAQData::isInternalBuffer(), PRINT_ON_DEBUG, daqdataformats::RawDAQData::readData(), daqdataformats::RawDAQData::resetBufferSource(), daqdataformats::RawDAQData::resizeInternalBuffer(), RETURN_FUNCTION, daqdataformats::RawDAQData::setFunctionPointers(), and daqdataformats::RawDAQData::sizeofdata().

Referenced by daqdataformats::RawDAQData::RawDAQData().

805  {
806 
807  PRINT_ON_DEBUG(__PRETTY_FUNCTION__);
808  /// get the version
810 
811  /// Now that we know the version, initialize function pointers,
812  /// including readData
814 
815  /// Resize internal buffer
816  if(isInternalBuffer()){
818 
819  /// Reset buffer source, so that we can construct other things (like headers and such)
821  }// end of if isInternalBuffer
822 
823  /// Don't need to initialize the fields (use init()) because we are going to read new values from the buffer anyways...
824  /// Like now
826 }// end of readDataUnknownVersion
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
version_t _version
DataFormat Version.
Definition: RawDAQData.h:289
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
#define RETURN_FUNCTION(FULLFUNCTIONNAME)
Definition: Macros.h:57
virtual version_t figureOutTheVersion(const void *buffer) const =0
bool isInternalBuffer() const
Definition: RawDAQData.h:141
void * readData(const void *buffer)
Shallow copy constructor.
Definition: RawDAQData.cpp:181
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
virtual bool setFunctionPointers()=0
bool resizeInternalBuffer(const uint32_t size_of_data)
Resize the internal buffer.
Definition: RawDAQData.cpp:292
bool daqdataformats::RawDAQData::reserveInternalBuffer ( const uint32_t  size_of_data)
protectedinherited

Reserve space for the internal buffer to some predetermined size.

We use vector::reserve instead of vector::resize, because resize not only reserves things, it initializes them to zero value. We don't have to do that, because we may overwrite things.

Definition at line 271 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer.

Referenced by daqdataformats::RawMicroSlice::RawMicroSlice(), daqdataformats::RawMilliSlice::RawMilliSlice(), and daqdataformats::RawMilliSliceIndex::RawMilliSliceIndex().

271  {
272 
273  /// We use vector::reserve instead of vector::resize,
274  /// because resize not only reserves things,
275  /// it initializes them to zero value.
276  /// We don't have to do that, because we may overwrite things.
277  if(_InternalBuffer.capacity() < size_of_data)
278  _InternalBuffer.reserve(size_of_data);
279 
280  return true;
281 }
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
bool daqdataformats::RawDAQData::reset ( )
inherited

Reset.

Definition at line 596 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::clear(), om::cout, daqdataformats::RawDAQData::EXECUTE_ON_DEBUG(), PRINT_ON_DEBUG, and daqdataformats::RawDAQData::resetBufferSource().

Referenced by daqdataformats::RawDAQData::defaultConstructorFixedSize().

596  {
597  PRINT_ON_DEBUG(__PRETTY_FUNCTION__);
599  EXECUTE_ON_DEBUG(clear(); std::cout<<"End of "<<__PRETTY_FUNCTION__<<"\n"; return true);
600  return clear();
601 }// end of reset
virtual bool clear()
reset _Buffer to point to InternalBuffer
Definition: RawDAQData.cpp:573
OStream cout
Definition: OStream.cxx:6
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
EXECUTE_ON_DEBUG(std::string _dataFormatClassName)
These variables are only for Debugging purposes.
bool daqdataformats::RawDAQData::resetBufferSource ( )
inherited

Definition at line 605 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer, PRINT_ON_DEBUG, RETURN_FUNCTION, and daqdataformats::RawDAQData::setBufferSource().

Referenced by daqdataformats::RawDAQData::checkBufferInternalness(), daqdataformats::RawDAQData::defaultConstructorFloatingSize(), daqdataformats::RawDAQData::lastOperationsInDeepCopy(), daqdataformats::RawMilliSlice::readData(), daqdataformats::RawDAQData::readDataUnknownVersion(), and daqdataformats::RawDAQData::reset().

605  {
606  PRINT_ON_DEBUG(__PRETTY_FUNCTION__);
607 
609 } // end of reset _Buffer to point to InternalBuffer
bool setBufferSource(const void *)
We are not going to overload these funtions, so no need to declare them virtual.
Definition: RawDAQData.cpp:880
#define RETURN_FUNCTION(FULLFUNCTIONNAME)
Definition: Macros.h:57
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
bool daqdataformats::RawMilliSliceHeader::resetFrameSEQ ( )

Definition at line 71 of file RawMilliSliceHeader.cpp.

71 { return setFrameSEQ(0); }
bool daqdataformats::RawDAQData::resizeInternalBuffer ( const uint32_t  size_of_data)
protectedinherited

Resize the internal buffer.

Definition at line 292 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_InternalBuffer.

Referenced by daqdataformats::RawDAQData::defaultConstructorFloatingSize(), daqdataformats::RawMicroSlice::init(), daqdataformats::RawMicroSlice::RawMicroSlice(), daqdataformats::RawMicroSlice::readData(), and daqdataformats::RawDAQData::readDataUnknownVersion().

292  {
293 
294  if(_InternalBuffer.size() < size_of_data)
295  _InternalBuffer.resize(size_of_data);
296 
297  return true;
298 }
std::vector< uint32_t > _InternalBuffer
Definition: RawDAQData.h:283
bool daqdataformats::RawDAQData::setBufferSource ( const void pointer)
inherited

We are not going to overload these funtions, so no need to declare them virtual.

Set The Buffer pointer to a given location.

Definition at line 880 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_Buffer, and PRINT_ON_DEBUG.

Referenced by daqdataformats::RawDAQData::copy(), daqdataformats::RawDAQData::lastOperationsInDeepCopy(), daqdataformats::RawDAQData::RawDAQData(), daqdataformats::RawDAQData::resetBufferSource(), daqdataformats::RawMilliSlice::setBufferSource(), daqdataformats::RawMilliSliceIndex::setBufferSource(), daqdataformats::VERSION_NAMESPACE::RawMicroBlockHeader::setBufferSource(), daqdataformats::RawMicroSlice::setBufferSource(), daqdataformats::RawDAQData::setBufferSourceGeneral(), and daqdataformats::RawDAQData::setBufferSourceUnknownVersion().

880  {
881  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<" Setting to "<<pointer);
882  _Buffer = (void*)pointer;
883  return true;
884 }// end of setBufferSource
void * _Buffer
All data formats need to have _Buffer and a Data structure. _Buffer will be common.
Definition: RawDAQData.h:276
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
daqdataformats::RawDAQData::SetBufferSource_t ( _function_setBufferSource  )
protectedinherited
void * daqdataformats::RawDAQData::setBufferSourceGeneral ( RawDAQData dataformat,
const void pointer 
)
protectedinherited

Set BufferSource of the input DataFormat and return pointer to the position right after the end of its buffer.

Definition at line 888 of file RawDAQData.cpp.

References PRINT_ON_DEBUG, daqdataformats::RawDAQData::setBufferSource(), and daqdataformats::RawDAQData::sizeofdata().

888  {
889  dataformat.setBufferSource(pointer);
890  const uint32_t* next_block_pointer = ((uint32_t*)(pointer)) + dataformat.sizeofdata();
891  PRINT_ON_DEBUG(__PRETTY_FUNCTION__<<" Size of data="<<dataformat.sizeofdata()<<". Next pointer will be"<<next_block_pointer);
892  return (void*)next_block_pointer;
893 }// end of setBufferSourceGeneral(RawDAQData& dataformat, const void* pointer)
#define PRINT_ON_DEBUG(x)
Definition: RawDAQData.h:35
bool daqdataformats::RawDAQData::setBufferSourceUnknownVersion ( const void pointer)
protectedinherited

First, figure out version

Now, set Function pointers accordingly

Now, execute setBuffer Source

Definition at line 896 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_version, daqdataformats::RawDAQData::figureOutTheVersion(), RETURN_FUNCTION, daqdataformats::RawDAQData::setBufferSource(), and daqdataformats::RawDAQData::setFunctionPointers().

Referenced by daqdataformats::RawDAQData::RawDAQData().

896  {
897  /// First, figure out version
898  _version = figureOutTheVersion(pointer);
899 
900  /// Now, set Function pointers accordingly
902 
903  /// Now, execute setBuffer Source
905 }// end of setBufferSourceUnknownVersion(const void* pointer)
version_t _version
DataFormat Version.
Definition: RawDAQData.h:289
bool setBufferSource(const void *)
We are not going to overload these funtions, so no need to declare them virtual.
Definition: RawDAQData.cpp:880
#define RETURN_FUNCTION(FULLFUNCTIONNAME)
Definition: Macros.h:57
virtual version_t figureOutTheVersion(const void *buffer) const =0
virtual bool setFunctionPointers()=0
bool daqdataformats::RawMilliSliceHeader::setFunctionPointers ( )
inlineprivatevirtual

Function where we set all function pointers. At this point we don't know it It is to be derived in the final user readable class

Implements daqdataformats::RawDAQData.

Definition at line 183 of file RawMilliSliceHeader.h.

183 {return true;}
bool daqdataformats::RawMilliSliceHeader::setMode ( const rawmillihdr::Mode_t  mode)
bool daqdataformats::RawMilliSliceHeader::setTimeStart ( const uint64_t  timestamp)

Definition at line 77 of file RawMilliSliceHeader.cpp.

References daqdataformats::RawDAQData::getLoAndHi(), hi(), and lo().

Referenced by daqdataformats::RawMilliSlice::setTimeStart().

77  {
78  uint32_t lo, hi;
79  getLoAndHi(timestamp, lo, hi);
80 
81  setTimeStartLow(lo);
82  return setTimeStartHigh(hi);
83  }
TSpline3 lo("lo", xlo, ylo, 12,"0")
bool getLoAndHi(uint64_t input_data, uint32_t &output_low_word, uint32_t &output_hi_word) const
Definition: RawDAQData.cpp:910
TSpline3 hi("hi", xhi, yhi, 18,"0")
bool daqdataformats::RawDAQData::setUint64_t ( uint64_t  value,
DELEGATE(RawDAQData, function_set_low_word, bool, uint32_t)   
)
protectedinherited

Definition at line 937 of file RawDAQData.cpp.

References DELEGATE, EXECUTE_GENERAL_FUNCTION, and daqdataformats::RawDAQData::getLoAndHi().

940  {
941  uint32_t low, high;
942  getLoAndHi(value, low, high);
943 
944  EXECUTE_GENERAL_FUNCTION(function_set_low_word)(low);
945  return EXECUTE_GENERAL_FUNCTION(function_set_hi_word)(high);
946 }// end of setUint64_t
bool getLoAndHi(uint64_t input_data, uint32_t &output_low_word, uint32_t &output_hi_word) const
Definition: RawDAQData.cpp:910
const XML_Char int const XML_Char * value
Definition: expat.h:331
#define EXECUTE_GENERAL_FUNCTION(FULLFUNCTIONNAME)
Macro to execute the function given a function pointer.
Definition: FunctionBind.h:37
uint32_t daqdataformats::RawMilliSliceHeader::sizeofdata ( ) const
inline
daqdataformats::RawDAQData::Sizeofdata_t ( _function_sizeofdata  )
protectedinherited
bool daqdataformats::RawDAQData::uint32_tToBool ( const uint32_t  number) const
inlineprotectedinherited

Definition at line 191 of file RawDAQData.h.

References cols, om::cout, gen_flatrecord::size, and string.

191 { return ((number) ? true : false); }
void * daqdataformats::RawDAQData::writeData ( const void buffer) const
inherited

Write Data to target memory location. Return is the address of the end of the write. NULL on error.

General write method that writes the raw formated data block to the target memory We are not going to overload it, so no need to declare virtual

Loop over words of the buffer

Definition at line 302 of file RawDAQData.cpp.

References EXECUTE_FUNCTION, MECModelEnuComparisons::i, RAWBUFF32, and daqdataformats::RawDAQData::sizeofdata().

302  {
303 
304  if(buffer == 0){return 0;}
305 
306  uint32_t* write_buffer = (uint32_t*)buffer;
307 
308  const uint32_t size_of_data = EXECUTE_FUNCTION(sizeofdata)();
309  /// Loop over words of the buffer
310  for(uint32_t i = 0; i < size_of_data; ++i){
311  *write_buffer = RAWBUFF32[i];
312  ++write_buffer;
313  } // endfor
314 
315  return write_buffer;
316 }// end of RawDAQData::writeData(void* buffer)
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
#define RAWBUFF32
Definition: RawDAQData.h:16
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990
ssize_t daqdataformats::RawDAQData::writeData ( const int  fd) const
inherited

Write Data to target file descriptor. Return is the number of bytes written. -1 on error.

Definition at line 320 of file RawDAQData.cpp.

References daqdataformats::RawDAQData::_Buffer, EXECUTE_FUNCTION, daqdataformats::RawDAQData::sizeofdata(), and pclistAnalyser::write.

320  {
321  if(fd>0){
322  return write(fd, _Buffer, (size_t)EXECUTE_FUNCTION(sizeofdata)()*sizeof(uint32_t));
323  }else{
324  return -1;
325  }
326 }// end of RawDAQData::writeData(int fd)
#define EXECUTE_FUNCTION(FULLFUNCTIONNAME)
Execute and return the delegate.
Definition: Macros.h:54
void * _Buffer
All data formats need to have _Buffer and a Data structure. _Buffer will be common.
Definition: RawDAQData.h:276
write
Run ND cosmics.
uint32_t sizeofdata() const
Sizeof method for the current data block. Returns the size of the data block in 32bit words...
Definition: RawDAQData.cpp:990

Member Data Documentation

void* daqdataformats::RawDAQData::_Buffer
protectedinherited
std::vector<uint32_t> daqdataformats::RawDAQData::_InternalBuffer
protectedinherited
bool daqdataformats::RawDAQData::_shouldBufferBeInternal
protectedinherited
version_t daqdataformats::RawDAQData::_version
protectedinherited

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