diff --git a/src/algorithms/digi/PhotoMultiplierHitDigi.cc b/src/algorithms/digi/PhotoMultiplierHitDigi.cc index 6704a14e18..e74b80202d 100644 --- a/src/algorithms/digi/PhotoMultiplierHitDigi.cc +++ b/src/algorithms/digi/PhotoMultiplierHitDigi.cc @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -168,11 +169,16 @@ void PhotoMultiplierHitDigi::process( // build `MCRecoTrackerHitAssociation` (for non-noise hits only) if(!data.sim_hit_indices.empty()) { - auto hit_assoc = hit_assocs->create(); - hit_assoc.setWeight(1.0); // not used - hit_assoc.setRawHit(raw_hit); - for(auto i : data.sim_hit_indices) + for(auto i : data.sim_hit_indices) { + auto hit_assoc = hit_assocs->create(); + hit_assoc.setWeight(1.0 / data.sim_hit_indices.size()); // not used + hit_assoc.setRawHit(raw_hit); +#if EDM4EIC_VERSION_MAJOR >= 6 + hit_assoc.setSimHit(sim_hits->at(i)); +#else hit_assoc.addToSimHits(sim_hits->at(i)); +#endif + } } } } diff --git a/src/algorithms/digi/SiliconTrackerDigi.cc b/src/algorithms/digi/SiliconTrackerDigi.cc index 79197b5816..5833f5ae17 100644 --- a/src/algorithms/digi/SiliconTrackerDigi.cc +++ b/src/algorithms/digi/SiliconTrackerDigi.cc @@ -4,6 +4,7 @@ #include "SiliconTrackerDigi.h" #include +#include #include #include #include @@ -97,7 +98,11 @@ void SiliconTrackerDigi::process( auto hitassoc = associations->create(); hitassoc.setWeight(1.0); hitassoc.setRawHit(item.second); +#if EDM4EIC_VERSION_MAJOR >= 6 + hitassoc.setSimHit(sim_hit); +#else hitassoc.addToSimHits(sim_hit); +#endif } } diff --git a/src/algorithms/pid/IrtCherenkovParticleID.cc b/src/algorithms/pid/IrtCherenkovParticleID.cc index 4b2cd508d6..13de55e18d 100644 --- a/src/algorithms/pid/IrtCherenkovParticleID.cc +++ b/src/algorithms/pid/IrtCherenkovParticleID.cc @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -218,17 +219,22 @@ std::map> e for(const auto& hit_assoc : *in_hit_assocs) { if(hit_assoc.getRawHit().isAvailable()) { if(hit_assoc.getRawHit().id() == raw_hit.id()) { +#if EDM4EIC_VERSION_MAJOR >= 6 + mc_photon = hit_assoc.getSimHit().getMCParticle(); +#else // hit association found, get the MC photon and break the loop - // FIXME: occasionally there will be more than one photon associated with a hit; - // for now let's just take the first one... if(hit_assoc.simHits_size() > 0) { mc_photon = hit_assoc.getSimHits(0).getMCParticle(); +#endif mc_photon_found = true; if(mc_photon.getPDG() != -22) m_log->warn("non-opticalphoton hit: PDG = {}",mc_photon.getPDG()); +#if EDM4EIC_VERSION_MAJOR >= 6 +#else } else if(m_cfg.CheatModeEnabled()) m_log->error("cheat mode enabled, but no MC photons provided"); +#endif break; } }