27 #include "art_root_io/TFileService.h" 47 template <
class COMPARABLE>
50 limits(): fMin(
std::numeric_limits<COMPARABLE>::
max()), fMax(
std::numeric_limits<COMPARABLE>::
min()) {}
53 void operator()(
const COMPARABLE& comp)
55 if(comp < fMin) fMin = comp;
56 if(comp > fMax) fMax = comp;
61 inline COMPARABLE
min()
const {
return fMin; }
62 inline COMPARABLE
max()
const {
return fMax; }
63 inline COMPARABLE range()
const {
return fMax - fMin; }
133 consumes<std::vector<CRT::Trigger>>(
fCRTLabel);
146 std::stringstream ss;
150 fTimestampMinusCRT = tfs->make<TH1D>(
"TimestampMinusCRT", (
std::string(
"Time Difference Between CRT and ")+ss.str()+
";Time [ticks];").c_str(),
152 fEarliestDeltaT = tfs->make<TH1D>(
"EarliestDeltaT",
"Time Difference Between Earliest CRT::Trigger and Earliest RDTimestamp;Time [ticks];",
155 fMinDeltaT = tfs->make<TH1D>(
"MinDeltaT",
"Minimum Time Difference Between a CRT::Trigger and any RDTimestamp;Time [ticks];", 601, -100, 500);
170 ::limits<timestamp_t> crtLimits, rawLimits;
172 for(
const auto&
trigger: *crtHandle)
175 const timestamp_t& crtTime =
trigger.Timestamp();
176 for(
const auto&
time: *timeHandle)
178 const timestamp_t& rawTime =
time.GetTimeStamp();
179 const auto deltaT = rawTime - crtTime;
182 if(labs(deltaT) < labs(minAbsDeltaT)) minAbsDeltaT = deltaT;
195 mf::LogWarning(
"Product not found") <<
"Failed to find one of the data products that " 196 <<
"CRT::TimeOffset needs to make timing plots. " 197 <<
"This module needs CRT::Triggers and raw::RDTimeStamps.\n"
TimeOffset(fhicl::ParameterSet const &p)
EDAnalyzer(fhicl::ParameterSet const &pset)
const double fIntervalMin
TH1D * fTimestampMinusCRT
#define DEFINE_ART_MODULE(klass)
const double fIntervalMax
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
struct ptb::content::word::timestamp_t timestamp_t
static int max(int a, int b)
const art::InputTag fTimestampLabel
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
const art::InputTag fCRTLabel
TimeOffset & operator=(TimeOffset const &)=delete
void analyze(art::Event const &e) override
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
auto const & get(AssnsNode< L, R, D > const &r)
cet::coded_exception< error, detail::translate > exception