79 mf::LogInfo(
"IndirectHitParticleAssns") <<
"Configured\n";
120 if (!partHitAssnsHandle.isValid() || !mcParticleHandle.isValid())
122 throw cet::exception(
"IndirectHitParticleAssns") <<
"===>> NO MCParticle <--> Hit associations found for run/subrun/event: " << evt.
run() <<
"/" << evt.
subRun() <<
"/" << evt.
id().
event();
130 throw cet::exception(
"IndirectHitParticleAssns") <<
"===>> NO Hit collection found to process for run/subrun/event: " << evt.
run() <<
"/" << evt.
subRun() <<
"/" << evt.
id().
event();
134 using ParticleDataPair = std::pair<size_t, const anab::BackTrackerHitMatchingData*>;
135 using MCParticleDataSet = std::set<ParticleDataPair>;
136 using TickToPartDataMap = std::unordered_map<raw::TDCtick_t, MCParticleDataSet>;
137 using ChannelToTickPartDataMap = std::unordered_map<raw::ChannelID_t, TickToPartDataMap>;
139 ChannelToTickPartDataMap chanToTickPartDataMap;
148 TickToPartDataMap& tickToPartDataMap = chanToTickPartDataMap[recoHit->
Channel()];
152 tickToPartDataMap[tick].insert(ParticleDataPair(mcParticle.
key(),data));
157 for(
size_t hitIdx = 0; hitIdx < hitListHandle->size(); hitIdx++)
161 TickToPartDataMap& tickToPartDataMap = chanToTickPartDataMap[hit->
Channel()];
163 if (tickToPartDataMap.empty())
165 mf::LogInfo(
"IndirectHitParticleAssns") <<
"No channel information found for hit " << hit <<
"\n";
170 MCParticleDataSet particleDataSet;
177 if (hitInfoItr != tickToPartDataMap.end())
179 for(
const auto& partData : hitInfoItr->second) particleDataSet.insert(partData);
184 for(
const auto& partData : particleDataSet)
code to link reconstructed objects back to the MC truth information
SubRunNumber_t subRun() const
art::InputTag fHitModuleLabel
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.
void reconfigure(fhicl::ParameterSet const &pset) override
T get(std::string const &key) const
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.
Utility object to perform functions of association.
bool getByLabel(std::string const &label, std::string const &productInstanceName, 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.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
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
~IndirectHitParticleAssns()
Destructor.