20 #include "art_root_io/TFileService.h" 39 class TimingRawDecoder;
114 for(
int i=0;i<20;i++) std::cout <<
"=";
116 std::cout <<
"Parameter Set" <<
std::endl;
117 for(
int i=0;i<20;i++) std::cout <<
"=";
122 std::cout <<
"fDebug: ";
126 for(
int i=0;i<20;i++) std::cout <<
"=";
133 fHTimestamp = tFileService->make<TH1I>(
"Timestamp",
"Timing Timestamp", 1e3, 0, 1e9);
134 fHTimestamp->GetXaxis()->SetTitle(
"Timestamp (ms)");
136 fHTimestampDelta = tFileService->make<TH1I>(
"TimestampDelta",
"Timing Timestamp Delta", 100, 0, 1e3);
139 fHTrigType = tFileService->make<TH1I>(
"TrigType",
"Timing trigger type", 20, -0.5, 19.5);
140 fHTrigType->GetXaxis()->SetTitle(
"Trigger type");
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";
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);
232 int subrun = evt.
subRun();
234 cout <<
"TimingRawDecoder::produce: WARNING: Unexpected subrun number: " << subrun <<
endl;
238 ofstream
fout(foutName);
239 fout << evtTimestamp <<
endl;
243 if ( rawFrag.timestamp() != evtTimestamp ) {
244 cout <<
"TimingRawDecoder::produce: WARNING: Fragments have inconsistent timestamps." <<
endl;
uint64_t get_last_spillend_timestamp() const
EventNumber_t event() const
void setLastSpillEnd(ULong64_t arg)
void produce(art::Event &e) override
void setLastSpillStart(ULong64_t arg)
Handle< PROD > getHandle(SelectorBase const &) const
void setTimeStamp(ULong64_t arg)
uint64_t get_last_runstart_timestamp() const
EDProducer(fhicl::ParameterSet const &pset)
uint32_t get_tcmd() const
void setEventCounter(UInt_t arg)
static constexpr double fs
void reconfigure(const fhicl::ParameterSet &pset)
std::string fRawDataLabel
void setTriggerType(dune::ProtoDUNETimingCommand arg)
void setLastRunStart(ULong64_t arg)
void setReservedBits(UInt_t arg)
#define DEFINE_ART_MODULE(klass)
uint32_t get_cookie() const
T get(std::string const &key) const
uint64_t get_last_spillstart_timestamp() const
TimingRawDecoder & operator=(TimingRawDecoder const &)=delete
SubRunNumber_t subRun() const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void setChecksumGood(bool arg)
void setVersion(UInt_t arg)
uint64_t get_tstamp() const
std::optional< T > get_if_present(std::string const &key) const
uint32_t get_scmd() const
IDNumber_t< Level::Event > EventNumber_t
std::string fOutputDataLabel
TimingRawDecoder(fhicl::ParameterSet const &p)
uint32_t get_evtctr() const
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