Skip to content

Commit

Permalink
feat: set position error for CartesianGridXY as dim / sqrt(12)
Browse files Browse the repository at this point in the history
  • Loading branch information
wdconinc committed Aug 17, 2024
1 parent 59823cf commit 78c72bd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
36 changes: 29 additions & 7 deletions src/algorithms/calorimetry/CalorimeterHitToTrackerHit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,37 @@ void CalorimeterHitToTrackerHit::process(
const auto [calorimeter_hits] = input;
auto [tracker_hits] = output;

for (const auto &calorimeter_hit: *calorimeter_hits) {

edm4eic::CovDiag3f position_error;

[[maybe_unused]]
auto tracker_hit = tracker_hits->create(
for (const auto& calorimeter_hit: *calorimeter_hits) {

// Get CellID
auto cell_id{calorimeter_hit.getCellID()};

// Determine detector element
auto det_element = m_volume_manager.lookupDetElement(cell_id);

// Cache position errors for detector elements
static std::map<dd4hep::DetElement, edm4eic::CovDiag3f> position_error;
if (position_error.count(det_element) == 0) {

// Determine readout and segmentation
auto readout = m_converter->findReadout(det_element);
auto segmentation = readout.segmentation();

// Determine position uncertainty
if (segmentation.type() == "CartesianGridXY") {
auto cell_dimensions = m_converter->cellDimensions(cell_id);
position_error[det_element].xx = cell_dimensions[0] / std::sqrt(12);
position_error[det_element].yy = cell_dimensions[1] / std::sqrt(12);
} else {
continue;
}
}

// Create tracker hit
tracker_hits->create(
calorimeter_hit.getCellID(),
calorimeter_hit.getPosition(),
position_error,
position_error[det_element],
calorimeter_hit.getTime(),
calorimeter_hit.getTimeError(),
calorimeter_hit.getEnergy(),
Expand Down
1 change: 1 addition & 0 deletions src/algorithms/calorimetry/CalorimeterHitToTrackerHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace eicrecon {

private:
const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
const dd4hep::rec::CellIDPositionConverter* m_converter{algorithms::GeoSvc::instance().cellIDPositionConverter()};
const dd4hep::VolumeManager m_volume_manager{m_detector->volumeManager()};

};
Expand Down

0 comments on commit 78c72bd

Please sign in to comment.