156 std::vector<raw::RDTimeStamp> rdtimestamps;
157 std::vector<dune::ProtoDUNETimeStamp> pdtimestamps;
159 if(rawFragments.isValid()){
161 ULong64_t evtTimestamp = 0;
162 for(
auto const& rawFrag : *rawFragments){
169 int fragmentVersion=0;
170 if(rawFrag.hasMetadata()){
175 size_t dataSizeBytes=rawFrag.dataSizeBytes();
177 if(dataSizeBytes==6*
sizeof(uint32_t)){
183 else if(dataSizeBytes==12*
sizeof(uint32_t)){
187 throw cet::exception(
"TimingRawDecoder::produce") <<
"Fragment had no metadata and unexpected size " << dataSizeBytes <<
" bytes. Can't determined timing fragment version";
192 ULong64_t currentTimestamp=frag.get_tstamp();
193 uint16_t scmd = (frag.get_scmd() & 0xFFFF);
194 rdtimestamps.emplace_back(currentTimestamp,scmd);
206 if(fragmentVersion>=2){
218 pdtimestamps.push_back(pdts);
229 if ( evtTimestamp == 0 ) {
230 evtTimestamp = rawFrag.timestamp();
231 string foutName =
"artdaqTimestamp-Run" +
std::to_string(runNumber);
234 cout <<
"TimingRawDecoder::produce: WARNING: Unexpected subrun number: " << subrun <<
endl;
238 ofstream
fout(foutName);
243 if ( rawFrag.timestamp() != evtTimestamp ) {
244 cout <<
"TimingRawDecoder::produce: WARNING: Fragments have inconsistent timestamps." <<
endl;
void setLastSpillEnd(ULong64_t arg)
void setLastSpillStart(ULong64_t arg)
void setTimeStamp(ULong64_t arg)
void setEventCounter(UInt_t arg)
std::string fRawDataLabel
void setTriggerType(dune::ProtoDUNETimingCommand arg)
void setLastRunStart(ULong64_t arg)
void setReservedBits(UInt_t arg)
void setChecksumGood(bool arg)
void setVersion(UInt_t arg)
IDNumber_t< Level::Event > EventNumber_t
std::string fOutputDataLabel
std::string to_string(ModuleType const mt)
std::vector< Fragment > Fragments
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
void setCookie(UInt_t arg)
IDNumber_t< Level::Run > RunNumber_t