Skip to content

Commit

Permalink
Add one-to-one relation with raw tracker/calorimeter hit for reconstr…
Browse files Browse the repository at this point in the history
…ucted 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
eic/EDM4eic#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 <[email protected]>
Co-authored-by: Wouter Deconinck <[email protected]>
  • Loading branch information
4 people authored Aug 7, 2024
1 parent a8abfdb commit 134f1bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/algorithms/calorimetry/CalorimeterHitReco.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <Math/GenVector/Cartesian3D.h>
#include <Math/GenVector/DisplacementVector3D.h>
#include <algorithms/service.h>
#include <edm4eic/EDM4eicVersion.h>
#include <fmt/core.h>
#include <fmt/format.h>
#include <algorithm>
Expand Down Expand Up @@ -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,
Expand All @@ -276,6 +280,9 @@ void CalorimeterHitReco::process(
sid,
lid,
local_position);
#if EDM4EIC_VERSION_MAJOR >= 7
recohit.setRawHit(rh);
#endif
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/algorithms/tracking/TrackerHitReconstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <Math/GenVector/Cartesian3D.h>
#include <Math/GenVector/DisplacementVector3D.h>
#include <edm4eic/CovDiag3f.h>
#include <edm4eic/EDM4eicVersion.h>
#include <edm4hep/Vector3f.h>
#include <fmt/core.h>
#include <spdlog/common.h>
Expand Down Expand Up @@ -66,7 +67,10 @@ std::unique_ptr<edm4eic::TrackerHitCollection> 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<float>(pos.x() / mm), static_cast<float>(pos.y() / mm), static_cast<float>(pos.z() / mm)}, // mm
edm4eic::CovDiag3f{get_variance(dim[0] / mm), get_variance(dim[1] / mm), // variance (see note above)
Expand All @@ -75,6 +79,9 @@ std::unique_ptr<edm4eic::TrackerHitCollection> TrackerHitReconstruction::process
m_cfg.timeResolution, // in ns
static_cast<float>(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

}

Expand Down

0 comments on commit 134f1bf

Please sign in to comment.