64 mf::LogInfo(
"IndirectHitParticleAssns") <<
"Configured\n";
100 if (!partHitAssnsHandle.isValid() || !mcParticleHandle.isValid())
102 throw cet::exception(
"IndirectHitParticleAssns") <<
"===>> NO MCParticle <--> Hit associations found for run/subrun/event: " << evt.
run() <<
"/" << evt.
subRun() <<
"/" << evt.
id().
event();
113 mf::LogInfo(
"IndirectHitParticleAssns") <<
"===>> NO Hit collection found to process for run/subrun/event: " << evt.
run() <<
"/" << evt.
subRun() <<
"/" << evt.
id().
event() <<
"\n";
118 using ParticleDataPair = std::pair<size_t, const anab::BackTrackerHitMatchingData*>;
119 using MCParticleDataSet = std::set<ParticleDataPair>;
120 using TickToPartDataMap = std::unordered_map<raw::TDCtick_t, MCParticleDataSet>;
121 using ChannelToTickPartDataMap = std::unordered_map<raw::ChannelID_t, TickToPartDataMap>;
123 ChannelToTickPartDataMap chanToTickPartDataMap;
132 TickToPartDataMap& tickToPartDataMap = chanToTickPartDataMap[recoHit->
Channel()];
136 tickToPartDataMap[
tick].insert(ParticleDataPair(mcParticle.
key(),
data));
141 for(
size_t hitIdx = 0; hitIdx < hitListHandle->size(); hitIdx++)
145 TickToPartDataMap& tickToPartDataMap = chanToTickPartDataMap[hit->
Channel()];
147 if (tickToPartDataMap.empty())
149 mf::LogInfo(
"IndirectHitParticleAssns") <<
"No channel information found for hit " << hit <<
"\n";
154 MCParticleDataSet particleDataSet;
161 if (hitInfoItr != tickToPartDataMap.end())
163 for(
const auto& partData : hitInfoItr->second) particleDataSet.insert(partData);
168 for(
const auto& partData : particleDataSet)
code to link reconstructed objects back to the MC truth information
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void CreateHitParticleAssociations(art::Event &, HitParticleAssociations *) override
This rebuilds the internal maps.
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
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
key_type key() const noexcept
T get(std::string const &key) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
SubRunNumber_t subRun() const
float PeakTimeMinusRMS(float sigmas=+1.) const
IndirectHitParticleAssns(fhicl::ParameterSet const &pset)
Constructor.
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