68 mf::LogInfo(
"IndirectHitParticleAssns") <<
"Configured\n";
104 auto mcParticleHandle =
107 if (!partHitAssnsHandle.isValid() || !mcParticleHandle.isValid()) {
109 <<
"===>> NO MCParticle <--> Hit associations found for run/subrun/event: " << evt.
run()
119 if (!hitListHandle.
isValid()) {
121 <<
"===>> NO Hit collection found to process for run/subrun/event: " << evt.
run() <<
"/" 127 using ParticleDataPair = std::pair<size_t, const anab::BackTrackerHitMatchingData*>;
128 using MCParticleDataSet = std::set<ParticleDataPair>;
129 using TickToPartDataMap = std::unordered_map<raw::TDCtick_t, MCParticleDataSet>;
130 using ChannelToTickPartDataMap = std::unordered_map<raw::ChannelID_t, TickToPartDataMap>;
132 ChannelToTickPartDataMap chanToTickPartDataMap;
136 partHitItr != partHitAssnsHandle->end();
142 TickToPartDataMap& tickToPartDataMap = chanToTickPartDataMap[recoHit->
Channel()];
146 tickToPartDataMap[
tick].insert(ParticleDataPair(mcParticle.
key(), data));
151 for (
size_t hitIdx = 0; hitIdx < hitListHandle->size(); hitIdx++) {
154 TickToPartDataMap& tickToPartDataMap = chanToTickPartDataMap[hit->
Channel()];
156 if (tickToPartDataMap.empty()) {
158 <<
"No channel information found for hit " << hit <<
"\n";
163 MCParticleDataSet particleDataSet;
170 if (hitInfoItr != tickToPartDataMap.end()) {
171 for (
const auto& partData : hitInfoItr->second)
172 particleDataSet.insert(partData);
177 for (
const auto& partData : particleDataSet)
code to link reconstructed objects back to the MC truth information
SubRunNumber_t subRun() const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void CreateHitParticleAssociations(art::Event &, HitParticleAssociations *) override
This rebuilds the internal maps.
Declaration of signal hit object.
art::InputTag fMCParticleModuleLabel
art::InputTag fHitPartAssnsModuleLabel
int TDCtick_t
Type representing a TDC tick.
bool isValid() const noexcept
void reconfigure(fhicl::ParameterSet const &pset) override
std::vector< art::InputTag > fHitModuleLabelVec
key_type key() const noexcept
T get(std::string const &key) const
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
float PeakTimeMinusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
Detector simulation of raw signals on wires.
IndirectHitParticleAssns(fhicl::ParameterSet const &pset)
Constructor.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
void addSingle(Ptr< left_t > const &left, Ptr< right_t > const &right, data_t const &data)
EventNumber_t event() const
float PeakTimePlusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
typename art::const_AssnsIter< L, R, D, Direction::Forward > const_iterator
cet::coded_exception< error, detail::translate > exception