From 3efb386766da15de7bbd1fbb4861c8e503578650 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck <wouter.deconinck@umanitoba.ca> Date: Thu, 26 Aug 2021 23:40:46 +0000 Subject: [PATCH] Resolve "MRICH overlap in master branch" --- compact/mrich.xml | 15 ++++++++------- src/MRich_geo.cpp | 24 +++++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/compact/mrich.xml b/compact/mrich.xml index 0826d32c..469952a1 100644 --- a/compact/mrich.xml +++ b/compact/mrich.xml @@ -91,19 +91,20 @@ </photodet> </module> <comment> - Modules are only listed here for one quadrant + Modules are only listed here for one quadrant. The modules point back to the + z0 position (should be their actual position, but breaks parametrization). </comment> - <positions scale="1.03"> + <positions scale="1.03" z0="157.5*cm"> <position x="-41.3250000000" y="178.6750000000"/> <position x=" 96.0250000001" y="178.6750000000"/> </positions> - <positions scale="1.036"> + <positions scale="1.036" z0="157.5*cm"> <position x="-41.3250000000" y="316.0250000001"/> <position x=" 96.0250000001" y="316.0250000001"/> <position x="233.3750000002" y="178.6750000000"/> <position x="233.3750000002" y="316.0250000001"/> </positions> - <positions scale="1.052"> + <positions scale="1.052" z0="157.5*cm"> <position x="-41.3250000000" y="453.3750000002"/> <position x=" 96.0250000001" y="453.3750000002"/> <position x="233.3750000002" y="453.3750000002"/> @@ -111,7 +112,7 @@ <position x="370.7250000003" y="316.0250000001"/> <position x="370.7250000003" y="178.6750000000"/> </positions> - <positions scale="1.078"> + <positions scale="1.078" z0="157.5*cm"> <position x="-41.3250000000" y="590.7250000003"/> <position x=" 96.0250000001" y="590.7250000003"/> <position x="233.3750000002" y="590.7250000003"/> @@ -121,7 +122,7 @@ <position x="508.0750000004" y="316.0250000001"/> <position x="508.0750000004" y="453.3750000002"/> </positions> - <positions scale="1.09"> + <positions scale="1.09" z0="157.5*cm"> <position x="-41.3250000000" y="728.0750000004"/> <position x=" 96.0250000001" y="728.0750000004"/> <!--position x="233.3750000002" y="728.0750000004"/--> @@ -132,7 +133,7 @@ <position x="645.4250000005" y="316.0250000001"/> <position x="645.4250000005" y="178.6750000000"/> </positions> - <positions scale="1.095"> + <positions scale="1.095" z0="157.5*cm"> <!--position x="-41.3250000000" y="865.4250000005"/--> <!--position x=" 96.0250000001" y="865.4250000005"/--> <!--position x="233.3750000002" y="865.4250000005"/--> diff --git a/src/MRich_geo.cpp b/src/MRich_geo.cpp index 21054dfb..65954a1e 100644 --- a/src/MRich_geo.cpp +++ b/src/MRich_geo.cpp @@ -33,14 +33,15 @@ static Ref_t createDetector(Detector& description, xml::Handle_t e, SensitiveDet OpticalSurfaceManager surfMgr = description.surfaceManager(); // read module positions - std::vector<std::pair<double,double>> positions; + std::vector<std::tuple<double,double,double>> positions; for (xml_coll_t x_positions_i(x_det, _Unicode(positions)); x_positions_i; ++x_positions_i) { xml_comp_t x_positions = x_positions_i; for (xml_coll_t x_position_i(x_positions, _U(position)); x_position_i; ++x_position_i) { xml_comp_t x_position = x_position_i; positions.push_back( - std::make_pair(x_positions.scale() * x_position.x() * mm, - x_positions.scale() * x_position.y() * mm)); + std::make_tuple(x_positions.scale() * x_position.x() * mm, + x_positions.scale() * x_position.y() * mm, + -x_positions.z0())); } } @@ -303,20 +304,21 @@ static Ref_t createDetector(Detector& description, xml::Handle_t e, SensitiveDet for (auto& p: positions) { // get positions in one quadrant - double x = p.first; - double y = p.second; - double z = -zpos; + double x = std::get<0>(p); + double y = std::get<1>(p); + double z0 = std::get<2>(p); // and place in all quadrants (intentional shadowing) - for (auto& p: decltype(positions){{x,y}, {y,-x}, {-x,-y}, {-y,x}}) { + for (auto& p: decltype(positions){{x,y,z0}, {y,-x,z0}, {-x,-y,z0}, {-y,x,z0}}) { // get positions (intentional shadowing) - double x = p.first; - double y = p.second; + double x = std::get<0>(p); + double y = std::get<1>(p); + double z0 = std::get<2>(p); // get angles - double rotAngX = atan(y/z); - double rotAngY = -1.*atan(x/z); + double rotAngX = atan(y/z0); + double rotAngY = -1.*atan(x/z0); /* ROOT::Math::XYZVector x_location(p.x(), p.y(), zmin+std::signbit(zmin)*mod_length/2.0); -- GitLab