21 #include "canvas/Persistency/Common/FindManyP.h" 22 #include "art_root_io/TFileService.h" 38 class CRTSimValidation;
89 consumes<std::vector<CRT::Trigger>>(
fCRTLabel);
90 consumes<std::vector<art::Assns<sim::AuxDetSimChannel, CRT::Trigger>>>(
fCRTLabel);
98 art::FindManyP<sim::AuxDetSimChannel> trigToSim(triggers, e,
fCRTLabel);
104 std::unordered_map<size_t, double> prevTimes;
105 for(
const auto&
trigger: *triggers)
108 const auto& hits =
trigger.Hits();
112 if(
found != prevTimes.end())
120 for(
size_t trigIt = 0; trigIt < trigToSim.size(); ++trigIt)
122 const auto& trig = (*triggers)[trigIt];
123 const auto& simChans = trigToSim.at(trigIt);
126 const auto sumSq = std::accumulate(simChans.begin(), simChans.end(), 0.,
127 [
this, &trig, &nIDEs](
double sum,
const auto&
channel)
129 const auto& ides =
channel->AuxDetIDEs();
130 nIDEs += ides.size();
131 return sum + std::accumulate(ides.begin(), ides.end(), 0.,
132 [
this, &trig](
double subSum,
const auto& ide)
134 const auto diff = trig.Timestamp() -
135 (ide.exitT + ide.entryT)/2.;
140 mf::LogInfo(
"LargeDeltaT") <<
"Found large deltaT: " << diff <<
"\n" 141 <<
"Timestamp is " << trig.Timestamp() <<
"\n" 142 <<
"True time is " << (ide.exitT +
143 ide.entryT)/2. <<
".\n";
146 return subSum + diff*diff;
157 fDetsWithHits = tfs->make<TH1D>(
"DetsWithHits",
"AuxDetGeo Names that Had CRT::Triggers;AuxDetGeo Name;Events", 1, 0, -1);
159 fAllADCs = tfs->make<TH1D>(
"AllADCs",
"ADC Values from CRT::Hits on All Channels;ADC Value;Hits", 500, 0, 2000);
160 fDevWithinTrigger = tfs->make<TH1D>(
"DevWithinTrigger",
"Deviation of True Times from Associated Trigger Timestamp;" 161 "True Time #sigma;Energy Deposits", 100, 0, 300);
162 fDeltaTAssoc = tfs->make<TH1D>(
"DeltaTAssoc",
"Time Difference Between Associated IDEs and Trigger Timestamp;#DeltaT_{IDE};Energy Deposits",
164 fTriggerDeltaT = tfs->make<TH1D>(
"TriggerDeltaT",
"#DeltaT Between Consecutive Triggers in a Module;#DeltaT;Trigger Pairs", 20, 0, 30);
void analyze(art::Event const &e) override
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
ChannelGroupService::Name Name
EDAnalyzer(fhicl::ParameterSet const &pset)
art framework interface to geometry description
CRTSimValidation(fhicl::ParameterSet const &p)
#define DEFINE_ART_MODULE(klass)
CRTSimValidation & operator=(CRTSimValidation const &)=delete
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
AuxDetGeo const & AuxDet(unsigned int const ad=0) const
Returns the specified auxiliary detector.
Detector simulation of raw signals on wires.
auto const & get(AssnsNode< L, R, D > const &r)