70 mf::LogInfo(
"DirectHitParticleAssns") <<
"Configured\n";
106 auto const clockData =
114 if (!hitListHandle.
isValid()) {
116 <<
"InputTag not associating to valid hit collection, tag: " << inputTag <<
"\n";
121 std::unordered_map<int, int>
124 auto const& hitList(*hitListHandle);
125 auto const& mcpartList(*mcpartHandle);
127 for (
size_t i_h = 0; i_h < hitList.size(); ++i_h) {
130 auto trkide_list = btService->HitToTrackIDEs(clockData, hitPtr);
142 for (
size_t i_t = 0; i_t < trkide_list.size(); ++i_t) {
143 auto const&
t(trkide_list[i_t]);
148 maxtrkid =
t.trackID;
151 totn +=
t.numElectrons;
154 maxntrkid =
t.trackID;
158 if (trkid_lookup.find(
t.trackID) == trkid_lookup.end()) {
160 while (i_p < mcpartList.size()) {
161 if (mcpartList[i_p].TrackId() ==
abs(
t.trackID)) {
162 trkid_lookup[
t.trackID] = (
int)i_p;
167 if (i_p == mcpartList.size()) trkid_lookup[
t.trackID] = -1;
174 int mcpart_i = trkid_lookup[
t.first];
175 if (mcpart_i == -1)
continue;
183 hitPartAssns->
addSingle(mcpartPtr, hitPtr, bthmd);
code to link reconstructed objects back to the MC truth information
std::unordered_map< int, TrackIDEinfo > fTrkIDECollector
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void CreateHitParticleAssociations(art::Event &, HitParticleAssociations *) override
This rebuilds the internal maps.
DirectHitParticleAssns(fhicl::ParameterSet const &pset)
Constructor.
bool isValid() const noexcept
art::InputTag fMCParticleModuleLabel
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
T get(std::string const &key) const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
std::vector< art::InputTag > fHitModuleLabelVec
void addSingle(Ptr< left_t > const &left, Ptr< right_t > const &right, data_t const &data)
void reconfigure(fhicl::ParameterSet const &pset) override