10 #include "DAQDataFormats/RawTrigger.h" 11 #include "DAQDataFormats/RawTriggerHeader.h" 12 #include "DAQDataFormats/RawTriggerTime.h" 13 #include "DAQDataFormats/RawTriggerMask.h" 14 #include "DAQDataFormats/RawTriggerTimingMarker.h" 15 #include "DAQDataFormats/RawDataBlock.h" 16 #include "DAQDataFormats/RawMicroBlock.h" 17 #include "RawFileParser/RawFileParser.h" 18 #include "NovaDAQConventions/DAQConventions.h" 19 #include "DAQChannelMap/DAQChannelMap.h" 26 #include <boost/algorithm/string.hpp> 33 fFilterCorruptedNanoslices (false)
35 ,fNumberOfNonemptyMicroblocks(0)
37 ,fCurrentFileName (file_name)
49 std::vector<novaddt::DAQHit>*
hits,
60 std::vector<novaddt::DAQHit>*
hits,
66 <<
"Read error attempting to obtain next raw event:" 67 << strerror(
errno) <<
".\n";
86 std::cout<<
"Event Header markers are wrong\n";
96 #ifdef DAQDATAFORMATS_VERSIONING_IS_IMPLEMENTED 102 std::cout<<
"Trigger Header markers are wrong\n";
128 const uint32_t n_datablocks =
fRawEvent.getDataBlockNumber();
131 uint32_t total_microslices=0;
133 uint64_t eventStart = UINT64_MAX;
135 for(uint32_t idatablock = 0; idatablock < n_datablocks; ++idatablock){
138 fRawEvent.setFloatingDataBlock(idatablock);
142 #ifdef DAQDATAFORMATS_VERSIONING_IS_IMPLEMENTED 147 std::cout<<
"DataBlock Header markers are wrong\n";
152 const uint32_t n_microblocks = datablock->getNumMicroBlocks();
154 for(uint32_t imicro = 0; imicro < n_microblocks; ++imicro){
157 datablock->setFloatingMicroBlock(imicro);
164 if(microslice->
getHeader()->getByteCount() < 8)
return false;
166 #ifndef DAQDATAFORMATS_VERSIONING_IS_IMPLEMENTED 168 if(microslice->
getHeader()->getByteCount() % 4)
return false;
171 if(!microslice->
getHeader()->getDataPresent() && microslice->
getHeader()->getByteCount()!= 8)
return false;
177 fDetId = (
int)microblock->getHeader()->getDetId();
185 const uint32_t
diblock = microblock->getHeader()->getDiblockId();
187 const uint32_t dcmid = microblock->getHeader()->getDCMId();
190 uint64_t tmpTime = microslice->
getTime();
191 if(tmpTime < eventStart){
192 eventStart = tmpTime;
200 for(uint32_t inano = 0; inano < n_nanoslices; ++inano){
212 if(!nanoslice_header->getDataPresent())
continue;
217 const uint32_t dcm_link = nanoslice_header->getFEBId();
219 const uint32_t pixel = nanoslice_header->getPixelAddr();
227 dMap->getDetector(daq_channel);
228 dMap->getDiBlock(daq_channel);
229 dMap->getDCM(daq_channel);
230 dMap->getFEB(daq_channel);
231 dMap->getPixel(daq_channel);
232 dMap->getView(daq_channel);
235 mf::LogError(
"BadDAQChannel") <<
"we have a bad DAQChannel " << daq_channel
236 <<
" don't make a digit from it";
241 wpr->
setup(microslice, nanoslice);
247 hits->push_back(
fHit);
261 std::cout<<
"From "<<__PRETTY_FUNCTION__<<
":"<<__LINE__;
262 std::cout<<
" Warning!!! Could not get the detector ID.";
285 if(!file_name)
return false;
287 if (boost::find_first(*file_name,
"ndos") || boost::find_first(*file_name,
"NDOS")){
290 else if(boost::find_first(*file_name,
"fardet") || boost::find_first(*file_name,
"FarDet")){
293 else if(boost::find_first(*file_name,
"neardet") || boost::find_first(*file_name,
"NearDet")){
static std::string GetName(int id)
uint64_t fTriggerTime_GenTime
uint32_t fTriggerHeader_Source
diblock
print "ROW IS " print row
uint32_t fTriggerMask_TriggerTypesHigh
novaddt::DAQHit fHit
Instance of DAQHit class.
const std::string * fCurrentFileName
Current file name.
int fNumberOfHits
! Detector type
UnpackedEvent fUnpackedEventParameters
uint32_t fTriggerRange_TriggerLength
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
uint32_t fTriggerMask_TriggerTypesHigh2
uint32_t fTriggerMask_Prescale
::xsd::cxx::tree::buffer< char > buffer
uint32_t fTriggerMask_TriggerTypesLow
uint32_t fTriggerMask_MCBit
uint32_t fTriggerMask_TMod
Far Detector at Ash River, MN.
int fDetId
Detector ID reading from Microblocks.
static DAQChannelMap * getInstance(int detID)
bool ProcessRawEvent_(std::vector< novaddt::DAQHit > *, novaddt::EventHeader *)
Prototype Near Detector on the surface at FNAL.
uint64_t fTriggerTimingMarker_ExtractionStart
Near Detector in the NuMI cavern.
uint64_t fTriggerHeader_MasterTriggerNumber
! Universal trigger number
~OnlineUnpack()
Destructor.
uint32_t fTriggerTime_ClockSource
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
bool ProcessRawEvent(void *rawevent_buffer, std::vector< novaddt::DAQHit > *, novaddt::EventHeader *)
Unpack the RawEvent.
uint64_t fTriggerHeader_TriggerNumber
! Identifier of the subsystem or channel on source device
bool fFilterCorruptedNanoslices
Do we need to filter out Corrupted NanoSlices?
uint32_t fTriggerHeader_SourceID
! Trigger source (see DAQDataFormats/TriggerDefines.h)
uint64_t fTriggerTimingMarker_TimeStart
int getEvent(daqdataformats::RawEvent &theEvent)
Retrieve the next event from the file.
uint32_t fTriggerHeader_SourceSubID
! Identifier of the source system
uint32_t dchan
< DAQ Channel Map Package
bool getDetIDFromFileName(const std::string *)
Try to get Detector ID from the file name.
daqdataformats::RawEvent fRawEvent
Flat DAQ RawEvent.
OnlineUnpack(const std::string *file_name=nullptr)
Constructor.
uint32_t fNumberOfNonemptyMicroblocks