From 134f1bf21e5e60cfcc446c488a91a7625b110213 Mon Sep 17 00:00:00 2001 From: Sakib Rahman Date: Wed, 7 Aug 2024 11:54:49 -0400 Subject: [PATCH] Add one-to-one relation with raw tracker/calorimeter hit for reconstructed tracker/calorimeter hit (#1535) ### Briefly, what does this PR introduce? Add one-to-one relation with raw tracker/calorimeter hit for reconstructed tracker/calorimeter hit. Contingent on https://github.com/eic/EDM4eic/pull/86. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [ ] Tests for the changes have been added - [ ] Documentation has been added / updated - [ ] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? ### Does this PR change default behavior? --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dmitry Kalinkin Co-authored-by: Wouter Deconinck --- src/algorithms/calorimetry/CalorimeterHitReco.cc | 7 +++++++ src/algorithms/tracking/TrackerHitReconstruction.cc | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/algorithms/calorimetry/CalorimeterHitReco.cc b/src/algorithms/calorimetry/CalorimeterHitReco.cc index 0457592ae0..8d8df473cd 100644 --- a/src/algorithms/calorimetry/CalorimeterHitReco.cc +++ b/src/algorithms/calorimetry/CalorimeterHitReco.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -265,6 +266,9 @@ void CalorimeterHitReco::process( const decltype(edm4eic::CalorimeterHitData::local) local_position(pos.x() / dd4hep::mm, pos.y() / dd4hep::mm, pos.z() / dd4hep::mm); +#if EDM4EIC_VERSION_MAJOR >= 7 + auto recohit = +#endif recohits->create( rh.getCellID(), energy, @@ -276,6 +280,9 @@ void CalorimeterHitReco::process( sid, lid, local_position); +#if EDM4EIC_VERSION_MAJOR >= 7 + recohit.setRawHit(rh); +#endif } } diff --git a/src/algorithms/tracking/TrackerHitReconstruction.cc b/src/algorithms/tracking/TrackerHitReconstruction.cc index 155ba7d35f..5fe85534e4 100644 --- a/src/algorithms/tracking/TrackerHitReconstruction.cc +++ b/src/algorithms/tracking/TrackerHitReconstruction.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -66,7 +67,10 @@ std::unique_ptr TrackerHitReconstruction::process // - XYZ segmentation: xx -> sigma_x, yy-> sigma_y, zz -> sigma_z, tt -> 0 // This is properly in line with how we get the local coordinates for the hit // in the TrackerSourceLinker. - rec_hits->create( + #if EDM4EIC_VERSION_MAJOR >= 7 + auto rec_hit = + #endif + rec_hits->create( raw_hit.getCellID(), // Raw DD4hep cell ID edm4hep::Vector3f{static_cast(pos.x() / mm), static_cast(pos.y() / mm), static_cast(pos.z() / mm)}, // mm edm4eic::CovDiag3f{get_variance(dim[0] / mm), get_variance(dim[1] / mm), // variance (see note above) @@ -75,6 +79,9 @@ std::unique_ptr TrackerHitReconstruction::process m_cfg.timeResolution, // in ns static_cast(raw_hit.getCharge() / 1.0e6), // Collected energy (GeV) 0.0F); // Error on the energy +#if EDM4EIC_VERSION_MAJOR >= 7 + rec_hit.setRawHit(raw_hit); +#endif }