From be7dcb4f553fc033d1cb146f0e9e51a3d71274b3 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Wed, 24 Apr 2024 14:12:16 -0400 Subject: [PATCH 1/6] RICH: for OneToOne relation to SimHit in MCRecoTrackerHitAssociation --- src/algorithms/digi/PhotoMultiplierHitDigi.cc | 14 ++++++++++---- src/algorithms/pid/IrtCherenkovParticleID.cc | 10 ++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/algorithms/digi/PhotoMultiplierHitDigi.cc b/src/algorithms/digi/PhotoMultiplierHitDigi.cc index 6704a14e18..fd658e1752 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); // 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/pid/IrtCherenkovParticleID.cc b/src/algorithms/pid/IrtCherenkovParticleID.cc index 4b2cd508d6..9be17bb8bd 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; } } From 051567670fed3321e297c2aa464ac06bcec687dd Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 29 Apr 2024 16:46:34 -0400 Subject: [PATCH 2/6] SiliconTrackerDigi: for OneToOne relation to SimHit in MCRecoTrackerHitAssociation --- src/algorithms/digi/SiliconTrackerDigi.cc | 5 +++++ 1 file changed, 5 insertions(+) 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 } } From 0f8ea70bd71adc5c52a4c80a47a338e77764b616 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 20:46:52 +0000 Subject: [PATCH 3/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/algorithms/digi/PhotoMultiplierHitDigi.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/digi/PhotoMultiplierHitDigi.cc b/src/algorithms/digi/PhotoMultiplierHitDigi.cc index fd658e1752..fcc3f6fea7 100644 --- a/src/algorithms/digi/PhotoMultiplierHitDigi.cc +++ b/src/algorithms/digi/PhotoMultiplierHitDigi.cc @@ -178,7 +178,7 @@ void PhotoMultiplierHitDigi::process( #else hit_assoc.addToSimHits(sim_hits->at(i)); #endif - } + } } } } From 32608aca2897b18f39500c0729554915684d224b Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 29 Apr 2024 17:40:18 -0400 Subject: [PATCH 4/6] Update src/algorithms/pid/IrtCherenkovParticleID.cc Co-authored-by: Wouter Deconinck --- src/algorithms/pid/IrtCherenkovParticleID.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/pid/IrtCherenkovParticleID.cc b/src/algorithms/pid/IrtCherenkovParticleID.cc index 9be17bb8bd..13de55e18d 100644 --- a/src/algorithms/pid/IrtCherenkovParticleID.cc +++ b/src/algorithms/pid/IrtCherenkovParticleID.cc @@ -220,7 +220,7 @@ std::map> e if(hit_assoc.getRawHit().isAvailable()) { if(hit_assoc.getRawHit().id() == raw_hit.id()) { #if EDM4EIC_VERSION_MAJOR >= 6 - mc_photon = hit_assoc.getSimHit().getMCParticle(); + mc_photon = hit_assoc.getSimHit().getMCParticle(); #else // hit association found, get the MC photon and break the loop if(hit_assoc.simHits_size() > 0) { From 9fd50ea502ee18de6c4ffb47c7b0e39de7a912e6 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 29 Apr 2024 17:40:35 -0400 Subject: [PATCH 5/6] Update src/algorithms/digi/PhotoMultiplierHitDigi.cc Co-authored-by: Wouter Deconinck --- src/algorithms/digi/PhotoMultiplierHitDigi.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/digi/PhotoMultiplierHitDigi.cc b/src/algorithms/digi/PhotoMultiplierHitDigi.cc index fcc3f6fea7..823c586385 100644 --- a/src/algorithms/digi/PhotoMultiplierHitDigi.cc +++ b/src/algorithms/digi/PhotoMultiplierHitDigi.cc @@ -171,7 +171,7 @@ void PhotoMultiplierHitDigi::process( if(!data.sim_hit_indices.empty()) { for(auto i : data.sim_hit_indices) { auto hit_assoc = hit_assocs->create(); - hit_assoc.setWeight(1.0); // not used + hit_assoc.setWeight(1.0 / data.size()); // not used hit_assoc.setRawHit(raw_hit); #if EDM4EIC_VERSION_MAJOR >= 6 hit_assoc.setSimHit(sim_hits->at(i)); From 1f1790eb0fc18c3977fe80d564999f87fd63ae3c Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Mon, 29 Apr 2024 18:11:22 -0400 Subject: [PATCH 6/6] Update src/algorithms/digi/PhotoMultiplierHitDigi.cc --- src/algorithms/digi/PhotoMultiplierHitDigi.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/digi/PhotoMultiplierHitDigi.cc b/src/algorithms/digi/PhotoMultiplierHitDigi.cc index 823c586385..e74b80202d 100644 --- a/src/algorithms/digi/PhotoMultiplierHitDigi.cc +++ b/src/algorithms/digi/PhotoMultiplierHitDigi.cc @@ -171,7 +171,7 @@ void PhotoMultiplierHitDigi::process( if(!data.sim_hit_indices.empty()) { for(auto i : data.sim_hit_indices) { auto hit_assoc = hit_assocs->create(); - hit_assoc.setWeight(1.0 / data.size()); // not used + 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));