Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #63 from LDMX-Software/iss62
Browse files Browse the repository at this point in the history
Switch to using orientation from the geometry condition
  • Loading branch information
EinarElen authored May 10, 2023
2 parents c1076e7 + 7b6a87b commit 08f6507
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/Hcal/HcalDigiProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,13 @@ void HcalDigiProducer::produce(framework::Event& event) {
float distance_along_bar, distance_ecal;
float distance_close, distance_far;
int end_close;
const auto orientation{hcalGeometry.getScintillatorOrientation(detID)};
if (section == ldmx::HcalID::HcalSection::BACK) {
distance_along_bar =
hcalGeometry.layerIsHorizontal(layer) ? position[0] : position[1];
(orientation ==
ldmx::HcalGeometry::ScintillatorOrientation::horizontal)
? position[0]
: position[1];
end_close = (distance_along_bar > 0) ? 0 : 1;
distance_close = half_total_width;
distance_far = half_total_width;
Expand Down
7 changes: 4 additions & 3 deletions src/Hcal/HcalDoubleEndRecProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void HcalDoubleEndRecProducer::produce(framework::Event& event) {

// get bar position from geometry
auto position = hcalGeometry.getStripCenterPosition(id);
const auto orientation{hcalGeometry.getScintillatorOrientation(id)};

// skip non-double-ended layers
if (id.section() != ldmx::HcalID::HcalSection::BACK)
Expand All @@ -116,9 +117,9 @@ void HcalDoubleEndRecProducer::produce(framework::Event& event) {
299.792 / 1.6; // velocity of light in polystyrene, n = 1.6 = c/v
double hitTimeDiff = hitPosEnd.getTime() - hitNegEnd.getTime();
int position_bar_sign = hitTimeDiff > 0 ? 1 : -1;
double position_bar =
position_bar_sign * fabs(hitTimeDiff) * v / 2;
if (hcalGeometry.layerIsHorizontal(hitPosEnd.getLayer())) {
double position_bar = position_bar_sign * fabs(hitTimeDiff) * v / 2;
if (orientation ==
ldmx::HcalGeometry::ScintillatorOrientation::horizontal) {
position.SetX(position_bar);
} else {
position.SetY(position_bar);
Expand Down
4 changes: 3 additions & 1 deletion src/Hcal/HcalRecProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,10 @@ void HcalRecProducer::produce(framework::Event& event) {
// set amplitude as the average of both bars (reverse attenuated)
amplT = (amplT_posend / att_posend + amplT_negend / att_negend) / 2;

const auto orientation{hcalGeometry.getScintillatorOrientation(id)};
// set position along the bar
if (hcalGeometry.layerIsHorizontal(id_posend.layer())) {
if (orientation ==
ldmx::HcalGeometry::ScintillatorOrientation::horizontal) {
position.SetX(position_bar);
} else {
position.SetY(position_bar);
Expand Down

0 comments on commit 08f6507

Please sign in to comment.