DAQEventUnpack.cxx
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 /// \file DAQEventUnpack.cxx
3 /// \brief Producer module to extract DAQ header variables relevant to
4 /// data quality
5 /// \author Justin Vasel <jvasel@indiana.edu>
6 /// Mark Messier <messier@indiana.edu>
7 ///////////////////////////////////////////////////////////////////////////////
8 
9 #include <list>
10 
11 // NOvA Online
12 #include "DAQDataFormats/RawEvent.h"
13 #include "DAQDataFormats/RawTrigger.h"
14 #include "DAQDataFormats/RawTriggerMask.h"
15 #include "DAQDataFormats/RawDataBlock.h"
16 #include "DAQDataFormats/RawMicroBlock.h"
17 #include "DAQDataFormats/RawMicroSlice.h"
18 #include "DAQDataFormats/RawNanoSlice.h"
19 #include "DAQChannelMap/DAQChannelMap.h"
20 #include "RawData/RawSumDropMB.h"
21 
22 // NOvA Offline
25 
26 
27 namespace dq {
28  //...........................................................................
30 
31 
32  //...........................................................................
34 
35 
36  //...........................................................................
37  /// Extract raw information at event level and unpack conatined datablocks
38  /// \param raw : Raw event
39  /// \param daqsum : DAQEventSummary object
41  dq::DAQEventSummary* daqsum)
42  {
43  if (raw.getHeader()->isEventIncomplete()) daqsum->fEventIncomplete = true;
44  unsigned int nDataBlock = raw.getDataBlockNumber();
45  unsigned int eventNumber = raw.getEventNumber();
46 
47  daqsum->fEventNumber = eventNumber;
48 
49  // Now unpack the associated data blocks
50  unsigned int idata;
51  for (idata = 0; idata < nDataBlock; ++idata) {
52  this->UnpackDataBlock(raw, idata, daqsum);
53  }
54  }
55 
56 
57  //...........................................................................
58  /// Extract raw information at datablock level and unpack contained microblocks
59  /// \param raw : Raw event
60  /// \param idata : Data block number
61  /// \param daqsum : DAQEventSummary object
63  unsigned int idata,
64  dq::DAQEventSummary* daqsum)
65  {
66  raw.setFloatingDataBlock(idata);
67  daqdataformats::RawDataBlock& datablock = (*raw.getFloatingDataBlock());
68 
69  // Bail if this is the DAQ status block
70  if (datablock.getHeader()->getMarker() == daqdataformats::datablockheader::SummaryBlock_Marker){
71  if (datablock.getHeader()->checkMarker()) {
72  return;
73  }
74  }
75 
76  if (datablock.isMissingData()) ++daqsum->fNdataBlockMissingData;
77 
78  unsigned int nMicroBlock = datablock.getNumMicroBlocks();
79  daqsum->fNmicroBlocks = nMicroBlock;
80 
81  if (nMicroBlock == 0) ++daqsum->fNemptyDataBlock;
82 
83  // Now unpack the associated micro slices
84  unsigned int imicro;
85  for (imicro = 0; imicro < nMicroBlock; ++imicro) {
86  this->UnpackMicroSlice(datablock, imicro, daqsum);
87  }
88  }
89 
90 
91  //...........................................................................
92  /// Extract raw information at microblock level and unpack contained nanoslices
93  /// \param datablock : Datablock
94  /// \param imicro : Microblock number
95  /// \param daqsum : DAQEventSummary object
97  unsigned int imicro,
98  dq::DAQEventSummary* daqsum)
99  {
100  datablock.setFloatingMicroBlock(imicro);
101 
103  microblock = (*datablock.getFloatingMicroBlock());
104 
106  microblock_header = (*microblock.getHeader());
107 
108  // Get diblock number from microblock header
109  daqsum->fDiblocks.push_back(microblock_header.getDiblockId());
110 
111  daqdataformats::RawMicroSlice& microslice = (*microblock.getMicroSlice());
112  if (!microslice.getDataPresent()) ++daqsum->fNmicroSliceDataNotPresent;
113 
114  unsigned int nNanoSlice = microslice.getNumNanoSlices();
115  if (nNanoSlice == 0) ++daqsum->fNemptyMicroSlice;
116  daqsum->fNtotalNanoSlices += nNanoSlice;
117 
118  // Now unpack all the associated nano slices
119  unsigned int inano;
120  for (inano = 0; inano < nNanoSlice; ++inano) {
121  this->UnpackNanoSlice(microslice, inano, daqsum);
122  }
123  }
124 
125 
126  //...........................................................................
127  /// Extract raw information at nanoslice level
128  /// \param microslice : Microslice
129  /// \param inano : Nanoslice number
130  /// \param daqsum : DAQEventSummary object
132  unsigned int inano,
133  dq::DAQEventSummary* daqsum)
134  {
135  microslice.setFloatingNanoSlice(inano);
136 
137  daqdataformats::RawNanoSlice& nanoslice = (*microslice.getFloatingNanoSlice());
138  daqdataformats::RawNanoSliceHeader& nanoslicehdr = (*nanoslice.getHeader());
139 
140  if (!nanoslicehdr.getDataPresent()) ++daqsum->fNanoSliceDataNotPresent;
141  if (!nanoslicehdr.getLinkStatus()) ++daqsum->fNanoSliceNoLinkStatus;
142  if ( nanoslicehdr.getBufferEmpty()) ++daqsum->fNanoSliceBufferEmpty;
143  if ( nanoslicehdr.getBufferFull()) ++daqsum->fNanoSliceBufferFull;
144  if ( nanoslicehdr.getCommError()) ++daqsum->fNanoSliceCommError;
145  if ( nanoslicehdr.getPacketError()) ++daqsum->fNanoSlicePacketError;
146  if ( nanoslicehdr.getOverflowError()) ++daqsum->fNanoSliceOverflowError;
147  if ( nanoslicehdr.getADCError()) ++daqsum->fNanoSliceADCError;
148  }
149 }
150 
151 ////////////////////////////////////////////////////////////////////////////////
IMPLEMENT_MAIN_STANDARD IMPLEMENT_MAIN_setBufferSource daqdataformats::RawNanoSliceHeader * getHeader() const
Get the NanoSlice header pointer.
Definition: RawNanoSlice.h:57
void UnpackDataBlock(daqdataformats::RawEvent &rawevt, unsigned int idata, dq::DAQEventSummary *daqsum)
int fNdataBlockMissingData
of occurances of isMissingData
uint32_t getNumNanoSlices() const
Get current Hit Probability (for a microslice generation)
int fNmicroBlocks
How many microblocks?
int fNanoSliceADCError
of nanoslices reporting ADCError
int fNanoSliceCommError
of nanoslices reporting CommError
int fNemptyMicroSlice
How many empty micro slices?
bool setFloatingNanoSlice(const uint32_t inano) const
Set the SIM flag.
int fNanoSliceNoLinkStatus
of nanoslices reporting !LinkPresent
if(dump)
int fEventNumber
Event number (diagnostic)
int fNanoSliceDataNotPresent
of nanoslices reporting !DataPresent
bool fEventIncomplete
Is the event incomplete?
std::list< int > fDiblocks
List of diblocks.
int fNanoSliceOverflowError
of nanoslices reporting OverflowError
int fNanoSliceBufferFull
of nanoslices reporting BufferFull
void UnpackMicroSlice(daqdataformats::RawDataBlock &datablock, unsigned int imicro, dq::DAQEventSummary *daqsum)
int fNemptyDataBlock
How many empty data blocks?
int fNmicroSliceDataNotPresent
of microslices with !DataPresent
Class to hold the MicroSlice data.
Definition: RawMicroSlice.h:48
int fNanoSlicePacketError
of nanoslices reporting PacketError
void UnpackNanoSlice(daqdataformats::RawMicroSlice &microslice, unsigned int inano, dq::DAQEventSummary *daqsum)
int fNtotalNanoSlices
of nano slices in the event
int fNanoSliceBufferEmpty
of nanoslices reporting BufferEmpty
void UnpackRawEvent(daqdataformats::RawEvent &rawevt, dq::DAQEventSummary *daqsum)
bool getDataPresent() const
Get Floating NanoSlice.
daqdataformats::RawNanoSlice * getFloatingNanoSlice() const
Get the MicroSlice Timing Marker.