From 5a8f8730f578dc1798e2cee1fc0d3824882a5455 Mon Sep 17 00:00:00 2001 From: gwm17 Date: Wed, 31 Aug 2022 11:51:47 -0400 Subject: [PATCH] Fix another bug in the SABRE geometry. Tilt needs to be flipped again in calc (minus implicitly handled in equation). --- src/Detectors/SabreArray.cpp | 1 + src/Detectors/SabreDetector.cpp | 20 +++++++++----------- src/Detectors/main.cpp | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Detectors/SabreArray.cpp b/src/Detectors/SabreArray.cpp index 9390b86..01a41ae 100644 --- a/src/Detectors/SabreArray.cpp +++ b/src/Detectors/SabreArray.cpp @@ -248,6 +248,7 @@ double SabreArray::RunConsistencyCheck() if(channels.first != -1) { count++; + break; } } } diff --git a/src/Detectors/SabreDetector.cpp b/src/Detectors/SabreDetector.cpp index cf143ee..226a11b 100644 --- a/src/Detectors/SabreDetector.cpp +++ b/src/Detectors/SabreDetector.cpp @@ -194,8 +194,9 @@ ROOT::Math::XYZPoint SabreDetector::GetTrajectoryCoordinates(double theta, doubl if(m_translation.Vect().X() != 0.0 || m_translation.Vect().Y() != 0.0) return ROOT::Math::XYZPoint(); + double tilt = -1.0*m_tilt; //Calculate the *potential* phi in the flat detector - double phi_numerator = std::cos(m_tilt)*(std::sin(phi)*std::cos(m_centerPhi) - std::sin(m_centerPhi)*std::cos(phi)); + double phi_numerator = std::cos(tilt)*(std::sin(phi)*std::cos(m_centerPhi) - std::sin(m_centerPhi)*std::cos(phi)); double phi_denominator = std::cos(m_centerPhi)*std::cos(phi) + std::sin(m_centerPhi)*std::sin(phi); double phi_flat = std::atan2(phi_numerator, phi_denominator); if(phi_flat < 0) @@ -203,13 +204,13 @@ ROOT::Math::XYZPoint SabreDetector::GetTrajectoryCoordinates(double theta, doubl //Calculate the *potential* R in the flat detector double r_numerator = m_translation.Vect().Z()*std::cos(phi)*std::sin(theta); - double r_denominator = std::cos(phi_flat)*std::cos(m_centerPhi)*std::cos(m_tilt)*std::cos(theta) - + double r_denominator = std::cos(phi_flat)*std::cos(m_centerPhi)*std::cos(tilt)*std::cos(theta) - std::sin(phi_flat)*std::sin(m_centerPhi)*std::cos(theta) - - std::cos(phi_flat)*std::sin(m_tilt)*std::cos(phi)*std::sin(theta); + std::cos(phi_flat)*std::sin(tilt)*std::cos(phi)*std::sin(theta); double r_flat = r_numerator/r_denominator; //Calculate the distance from the origin to the hit on the detector - double R_to_detector = (r_flat*std::cos(phi_flat)*std::sin(m_tilt) + m_translation.Vect().Z())/std::cos(theta); + double R_to_detector = (r_flat*std::cos(phi_flat)*std::sin(tilt) + m_translation.Vect().Z())/std::cos(theta); double xhit = R_to_detector*std::sin(theta)*std::cos(phi); double yhit = R_to_detector*std::sin(theta)*std::sin(phi); double zhit = R_to_detector*std::cos(theta); @@ -244,8 +245,9 @@ std::pair SabreDetector::GetTrajectoryRingWedge(double theta, double p if(m_translation.Vect().X() != 0.0 || m_translation.Vect().Y() != 0.0) return std::make_pair(-1, -1); + double tilt = -1.0*m_tilt; //Calculate the *potential* phi in the flat detector - double phi_numerator = std::cos(m_tilt)*(std::sin(phi)*std::cos(m_centerPhi) - std::sin(m_centerPhi)*std::cos(phi)); + double phi_numerator = std::cos(tilt)*(std::sin(phi)*std::cos(m_centerPhi) - std::sin(m_centerPhi)*std::cos(phi)); double phi_denominator = std::cos(m_centerPhi)*std::cos(phi) + std::sin(m_centerPhi)*std::sin(phi); double phi_flat = std::atan2(phi_numerator, phi_denominator); if(phi_flat < 0) @@ -253,15 +255,11 @@ std::pair SabreDetector::GetTrajectoryRingWedge(double theta, double p //Calculate the *potential* R in the flat detector double r_numerator = m_translation.Vect().Z()*std::cos(phi)*std::sin(theta); - double r_denominator = std::cos(phi_flat)*std::cos(m_centerPhi)*std::cos(m_tilt)*std::cos(theta) - + double r_denominator = std::cos(phi_flat)*std::cos(m_centerPhi)*std::cos(tilt)*std::cos(theta) - std::sin(phi_flat)*std::sin(m_centerPhi)*std::cos(theta) - - std::cos(phi_flat)*std::sin(m_tilt)*std::cos(phi)*std::sin(theta); + std::cos(phi_flat)*std::sin(tilt)*std::cos(phi)*std::sin(theta); double r_flat = r_numerator/r_denominator; - //Calculate the distance from the origin to the hit on the detector - //double R_to_detector = (r_flat*std::cos(phi_flat)*std::sin(m_tilt) + m_translation.GetZ())/std::cos(theta); - - //Check to see if our flat coords fall inside the flat detector if(IsInside(r_flat, phi_flat)) { diff --git a/src/Detectors/main.cpp b/src/Detectors/main.cpp index 9ae677a..8cfb3b0 100644 --- a/src/Detectors/main.cpp +++ b/src/Detectors/main.cpp @@ -28,7 +28,7 @@ int main(int argc, char** argv) std::string mapfile = "./etc/sabreDeadChannels_May2022.txt"; sabre.SetDeadChannelMap(mapfile); sabre.CalculateEfficiency(inputname, outputname, statsname); - //std::cout<<"Running consistency check(1=success): "<