MilliSliceConstructor.cpp
Go to the documentation of this file.
1 /*
2  * File: MilliSliceConstructor.cpp
3  * Author: denis
4  *
5  * Created on September 20, 2012, 2:18 PM
6  */
7 
8 #include <DAQDataFormats/RawMilliSlice.h>
10 
11 #include "DAQDataFormats/DataFormatFirst.inc"
12 #define CURRENT_CLASS RawMilliSlice
13 
14 namespace daqdataformats {
15 
17 {
18 }
20 
21 //------------------------------------------------------------------------------
24  fillDataFormat(out);
25  return out;
26 }
27 
28 //------------------------------------------------------------------------------
31  out->close(true);
32  return out;
33 }
34 
35 //------------------------------------------------------------------------------
38 
39  millislice->setDiblockId(5);
40  millislice->setPartition(6);
41  millislice->setTimeStartLow(7);
42  millislice->setTimeStartHigh(8);
43  millislice->setTimeLength(9);
44  millislice->setMilliSliceSEQ(10);
45  millislice->setMicroSliceTimeLength_usec(11);
46  millislice->setMonteCarloFlag(true);
47  millislice->setFrameSEQ(12);
48 
51 
52  micro2->setTime(micro2->getTime() + 500);
53 
54  millislice->addMicroSlice(micro1->getBuffer());
55  millislice->addMicroSlice(micro2->getBuffer());
56 
57  millislice->close(true);
58 
59 
60  delete micro1;
61  delete micro2;
62 
63  return true;
64 }
65 
66 //------------------------------------------------------------------------------
67 // Gets the NanoSlices version in the MilliSlice
69 
71 
72  /// right now it's unknown
74 
75  /// loop over nanoslices
76  for(uint32_t imicro = 0; imicro < milli->getMicrosliceNumber(); ++imicro){
77  milli->setFloatingMicroSlice(imicro);
78 
79  /// If number of Nanoslices in Microslice is zero, then skip it
80  if(milli->getFloatingMicroSlice()->getNumNanoSlices() == 0) continue;
81 
83 
85  LOG_ERROR("UNITTEST")<<"Failure in "<<__PRETTY_FUNCTION__<<" at "<<__LINE__<<"\n"
86  <<" Output nanoslice version is rawdaqdataformat::DAQDATAFORMAT_UNKNOWN_VERSION\n";
88  }
89 
91  nano_ver = nano_ver_current;
92  }
93  else{
94  if(nano_ver != nano_ver_current){
95  LOG_ERROR("UNITTEST")<<"Failure in "<<__PRETTY_FUNCTION__<<" at "<<__LINE__<<"\n"
96  <<" versions are inconsistent: at microslice "<<imicro<<"\n"
97  <<"ver0="<<nano_ver<<" ver1="<<nano_ver_current<<"\n";
99  }
100  }
101  }// end of loop over nanoslices
102 
103  return nano_ver;
104 }
105 
106 }// end of namespaces
version_t getNanoSlicesVersion(const RawMicroSlice *) const
Gets the NanoSlices version in the MicroSlice.
daqdataformats::RawDAQData * getFilledDataFormat(const version_t) const
bool setPartition(const uint32_t a)
Definition: RawMilliSlice.h:85
bool setFrameSEQ(const uint32_t a)
daqdataformats::RawDAQData * getFilledDataFormat(const daqdataformats::version_t) const
bool setFloatingMicroSlice(const uint32_t) const
uint32_t getNumNanoSlices() const
Get current Hit Probability (for a microslice generation)
bool setMilliSliceSEQ(const uint32_t a)
Definition: RawMilliSlice.h:96
daqdataformats::RawMicroSlice * getFloatingMicroSlice() const
Definition: RawMilliSlice.h:48
daqdataformats::RawDAQData * getEmptyDataFormat(const daqdataformats::version_t) const
method to create an empty dataformat with a given version
void * getBuffer() const
Definition: RawDAQData.h:131
bool setMicroSliceTimeLength_usec(const uint32_t a)
Definition: RawMilliSlice.h:97
bool close(const bool produce_crc=false)
uint64_t getTime() const
Get method for upper half of timing word.
bool setDiblockId(const uint32_t a)
Definition: RawMilliSlice.h:80
bool setTimeStartLow(const uint32_t a)
Definition: RawMilliSlice.h:87
uint32_t getMicrosliceNumber() const
Definition: RawMilliSlice.h:63
bool setMonteCarloFlag(const bool a)
Definition: RawMilliSlice.h:98
bool setTime(const uint64_t)
Set method for upper half of timing word.
Class to hold the MicroSlice data.
Definition: RawMicroSlice.h:48
bool setTimeLength(const uint32_t a)
Definition: RawMilliSlice.h:89
int32_t version_t
Definition: RawDAQData.h:72
bool addMicroSlice(const void *microslice_buffer, const bool indexate=false, const bool check_mc_flag=false)
static const version_t DAQDATAFORMAT_UNKNOWN_VERSION
Definition: RawDAQData.h:81
bool setTimeStartHigh(const uint32_t a)
Definition: RawMilliSlice.h:88
Class to hold the data from the FEBs in correct formats.
version_t getNanoSlicesVersion(const RawMilliSlice *) const
Gets the NanoSlices version in the MilliSlice.
#define LOG_ERROR(stream)
Definition: Messenger.h:129
bool fillDataFormat(daqdataformats::RawDAQData *) const
method to Fill the input dataformat