From 2b386d0964dc07e22578bc1740f469ec5bc21eb6 Mon Sep 17 00:00:00 2001
From: Thomas Strebler <thomas.strebler@cern.ch>
Date: Thu, 3 Sep 2020 13:45:55 +0000
Subject: [PATCH] Updated BeamPipeBuilder to pick physical radius

---
 .../src/BeamPipeBuilder.cxx                   | 27 ++++++++++++++++---
 .../PROCTools/data/master_q431_AOD_digest.ref |  4 +--
 .../share/ref_RDOtoRDOTrig_mt1_build.ref      |  6 ++---
 3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/BeamPipeBuilder.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/BeamPipeBuilder.cxx
index b0f843b2a3d5..f15cd22196b7 100755
--- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/BeamPipeBuilder.cxx
+++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/BeamPipeBuilder.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -118,8 +118,29 @@ const std::vector< const Trk::CylinderLayer* >* InDet::BeamPipeBuilder::cylindri
             // get the geoShape and translate
             Trk::GeoShapeConverter geoShaper;
             beamPipeTube = dynamic_cast<const GeoTube*>(beamPipeLogVolume->getShape());
-            if (beamPipeTube)
-                beamPipeRadius = beamPipeTube->getRMax()-m_beamPipeEnvelope;
+            if (beamPipeTube){
+
+	      for(unsigned int i=0;i<beamPipeTopVolume->getNChildVols();i++){
+
+		if(beamPipeTopVolume->getNameOfChildVol(i)=="SectionC03"){
+		  PVConstLink childTopVolume =  beamPipeTopVolume->getChildVol(i);
+		  const GeoLogVol* childLogVolume = childTopVolume->getLogVol();
+		  const GeoTube* childTube = 0;
+
+		  if (childLogVolume){
+		    childTube = dynamic_cast<const GeoTube*>(childLogVolume->getShape());
+		    if (childTube){
+		      beamPipeRadius = 0.5 * (childTube->getRMax()+childTube->getRMin());
+		    }
+		  }
+
+		  break; //Exit loop after SectionC03 is found
+		}
+
+	      } // Loop over child volumes
+
+	    }
+
         }
         ATH_MSG_VERBOSE("BeamPipe constructed from Database: translation (yes) - radius "<< ( beamPipeTube ? "(yes)" : "(no)") << " - r = " << beamPipeRadius );        
   } else 
diff --git a/Tools/PROCTools/data/master_q431_AOD_digest.ref b/Tools/PROCTools/data/master_q431_AOD_digest.ref
index 10ae6a45e789..b639cb841c44 100644
--- a/Tools/PROCTools/data/master_q431_AOD_digest.ref
+++ b/Tools/PROCTools/data/master_q431_AOD_digest.ref
@@ -5,13 +5,13 @@
       330470  1183732647         467         450          12           1
       330470  1183733040         381         284           6           1
       330470  1183734651         361         360          14           3
-      330470  1183735332         406         372          10           1
+      330470  1183735332         406         372           9           1
       330470  1183736475         741         651          15           3
       330470  1183738728           1           0           0           0
       330470  1183738949         368         424           9           1
       330470  1183742489         152         124           2           1
       330470  1183743040         285         306           5           0
-      330470  1183746343         492         464          12           0
+      330470  1183746343         492         464          14           0
       330470  1183746710           6           0           0           0
       330470  1183751782         239         234           5           0
       330470  1183752624         347         343           8           3
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
index 18b41e35da0d..c104628cd874 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref
@@ -282,7 +282,7 @@ TrigSignatureMoniMT                                 INFO -- #3341539267 Events
 TrigSignatureMoniMT                                 INFO -- #3341539267 Features                             0          0          0          0          0          0          0          0          0          0          50         -
 TrigSignatureMoniMT                                 INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 #991419339
 TrigSignatureMoniMT                                 INFO -- #991419339 Events          19         19         0          0          0          0          0          0          0          0          0          0          19         10         10
-TrigSignatureMoniMT                                 INFO -- #991419339 Features                              0          0          0          0          0          0          0          0          0          0          49         20
+TrigSignatureMoniMT                                 INFO -- #991419339 Features                              0          0          0          0          0          0          0          0          0          0          49         21
 TrigSignatureMoniMT                                 INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 #1961149049
 TrigSignatureMoniMT                                 INFO -- #1961149049 Events         19         19         0          0          0          0          0          0          0          0          0          0          19         19         19
 TrigSignatureMoniMT                                 INFO -- #1961149049 Features                             0          0          0          0          0          0          0          0          0          0          49         49
@@ -443,8 +443,8 @@ TrigSignatureMoniMT                                 INFO HLT_mu6_mu4_L12MU4 #171
 TrigSignatureMoniMT                                 INFO -- #1713982776 Events         4          4          0          0          0          0          4          4          4          4          -          -          -          -          4
 TrigSignatureMoniMT                                 INFO -- #1713982776 Features                             0          0          0          0          8          8          12         10         -          -          -          -
 TrigSignatureMoniMT                                 INFO HLT_mu6_mu6noL1_L1MU6 #451489897
-TrigSignatureMoniMT                                 INFO -- #451489897 Events          10         10         0          0          0          0          10         10         10         10         6          4          -          -          6
-TrigSignatureMoniMT                                 INFO -- #451489897 Features                              0          0          0          0          14         13         16         15         9          7          -          -
+TrigSignatureMoniMT                                 INFO -- #451489897 Events          10         10         0          0          0          0          10         10         10         10         5          4          -          -          5
+TrigSignatureMoniMT                                 INFO -- #451489897 Features                              0          0          0          0          14         13         16         15         8          7          -          -
 TrigSignatureMoniMT                                 INFO HLT_mu6fast_L1MU6 #3518031697
 TrigSignatureMoniMT                                 INFO -- #3518031697 Events         10         10         0          0          0          0          10         -          -          -          -          -          -          -          10
 TrigSignatureMoniMT                                 INFO -- #3518031697 Features                             0          0          0          0          14         -          -          -          -          -          -          -
-- 
GitLab