From dc60ee1a3cca759b9b8a62e7a6bb05a8c352f023 Mon Sep 17 00:00:00 2001
From: Jakob Novak <janovak@cern.ch>
Date: Tue, 1 Oct 2019 13:53:16 +0200
Subject: [PATCH 01/11] BCM prime initial commit

---
 .../PixelLayouts/BCM/BCM/BCMPrimeXMLHelper.h  |  44 ++++++
 .../PixelLayouts/BCM/BCM/BCMPrime_Module.h    |  57 +++++++
 .../PixelLayouts/BCM/BCM/GeoBCMPrimeTool.h    |  55 +++++++
 .../PixelLayouts/BCM/CMakeLists.txt           |  49 ++++++
 .../BCM/src/BCMPrimeXMLHelper.cxx             | 114 ++++++++++++++
 .../PixelLayouts/BCM/src/BCMPrime_Module.cxx  | 145 ++++++++++++++++++
 .../PixelLayouts/BCM/src/GeoBCMPrimeTool.cxx  | 125 +++++++++++++++
 .../BCM/src/components/BCM_entries.cxx        |  11 ++
 .../BCM/src/components/BCM_load.cxx           |   3 +
 .../GeoPixelEnvelopeInclRefTool.h             |   2 +
 .../src/GeoPixelEnvelopeExtInclTool.cxx       |  38 +++++
 .../PixelInterfaces/IGeoBCMPrimeTool.h        |  38 +++++
 .../python/SLHC_Setup_InclBrl_4.py            |  13 ++
 .../G4AtlasTools/python/G4AtlasToolsConfig.py |   2 +-
 14 files changed, 695 insertions(+), 1 deletion(-)
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrimeXMLHelper.h
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrime_Module.h
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/GeoBCMPrimeTool.h
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/CMakeLists.txt
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrimeXMLHelper.cxx
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrime_Module.cxx
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/GeoBCMPrimeTool.cxx
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_entries.cxx
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_load.cxx
 create mode 100644 InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces/PixelInterfaces/IGeoBCMPrimeTool.h

diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrimeXMLHelper.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrimeXMLHelper.h
new file mode 100644
index 000000000000..a7aa28e2946c
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrimeXMLHelper.h
@@ -0,0 +1,44 @@
+/*
+Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/ 
+#ifndef BCMPRIMEXMLHELPER_H
+#define BCMPRIMEXMLHELPER_H
+
+#include "PixelGeoModel/PixelGeoBuilder.h"
+
+// XML library
+ #include <xercesc/dom/DOM.hpp>
+#include <xercesc/parsers/XercesDOMParser.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+#include "PixelLayoutUtils/GeoXMLUtils.h"
+
+using namespace xercesc;
+
+class BCMPrimeXMLHelper :  public GeoXMLUtils, public PixelGeoBuilder  {
+
+ public:
+  BCMPrimeXMLHelper(int module, const PixelGeoBuilderBasics* basics);
+  ~BCMPrimeXMLHelper();
+
+  double getTransX() const;
+  double getTransY() const;
+  double getTransZ() const;
+  double getRotX() const;
+  double getRotY() const;
+  double getRotZ() const;
+  double getModuleLength() const;
+  double getModuleWidth() const;
+  double getModuleTilt() const;
+  double getDiamSize() const;
+  double getDiamOffsetY() const;
+  double getDiamSeparZ() const;
+  double getTilt() const;
+  double getRingOffset() const;
+
+ private:
+  int m_module;
+  std::vector<int> m_moduleIndices;
+
+};
+
+#endif
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrime_Module.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrime_Module.h
new file mode 100644
index 000000000000..39036536ab4d
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrime_Module.h
@@ -0,0 +1,57 @@
+/*
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+///////////////////////////////////////////////////////////////////
+// BCMPrime_Module.h, (c) ATLAS Detector software
+///////////////////////////////////////////////////////////////////
+#ifndef BCMPRIME_MODULE_H
+#define BCMPRIME_MODULE_H
+
+#include "PixelGeoModel/PixelGeoBuilder.h"
+#include "GeoModelKernel/GeoPhysVol.h"
+#include <iostream>
+
+#include "InDetGeoModelUtils/InDetMaterialManager.h"
+
+/** @class BCMPrime_Module 
+
+  BCM-prime module builder
+      @author  Jakob Novak <jakobn.novak@cern.ch>
+
+*/
+
+class BCMPrime_Module
+{
+ public:
+    GeoPhysVol* Build(int iLayer, const PixelGeoBuilderBasics *basics);
+
+    double getTransX() {return m_transX;}
+    double getTransY() {return m_transY;}
+    double getTransZ() {return m_transZ;}
+
+    double getRotX() {return m_rotX;}
+    double getRotY() {return m_rotY;}
+    double getRotZ() {return m_rotZ;}
+
+    double getTilt() {return m_tilt;}
+    double getRingOffset() {return m_ringOffset;}
+
+ private:
+    mutable InDetMaterialManager *m_matMgr;
+    mutable Athena::MsgStreamMember m_msg;
+    
+    double m_transX{};
+    double m_transY{};
+    double m_transZ{};
+
+    double m_rotX{};
+    double m_rotY{};
+    double m_rotZ{};
+
+    double m_tilt{};
+    double m_ringOffset{};
+
+};
+
+#endif
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/GeoBCMPrimeTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/GeoBCMPrimeTool.h
new file mode 100644
index 000000000000..015a790e4cd5
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/GeoBCMPrimeTool.h
@@ -0,0 +1,55 @@
+/*
+Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/ 
+#ifndef GEOBCMPRIMETOOL_H
+#define GEOBCMPRIMETOOL_H
+
+#include "GeoModelKernel/GeoPhysVol.h"
+
+#include "PixelInterfaces/IGeoBCMPrimeTool.h"
+#include "PixelGeoModel/PixelGeoBuilder.h"
+#include "GeoModelInterfaces/IGeoModelSvc.h"
+
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "AthenaKernel/IOVSvcDefs.h"
+#include "GaudiKernel/ServiceHandle.h"
+
+#include "BCM/BCMPrime_Module.h"
+
+namespace InDet {
+  class XMLReaderSvc;
+}
+class PixelGeoBuilderBasics;
+
+class GeoBCMPrimeTool : virtual public IGeoBCMPrimeTool, public AthAlgTool {
+
+ public:
+  GeoBCMPrimeTool(const std::string&,const std::string&,const IInterface*);
+//   virtual InDet::GeoComponent* getGeoCompVol() const {return 0; } // Do I need?
+
+  virtual StatusCode initialize();
+  virtual StatusCode create();
+  virtual StatusCode finalize();
+  
+  // Register callback function on ConDB object
+  virtual StatusCode registerCallback( StoreGateSvc* detStore );
+
+  virtual GeoPhysVol *buildModule(int iLayer, const PixelGeoBuilderBasics *basics);
+  
+  virtual double getTransX();
+  virtual double getTransY();
+  virtual double getTransZ();
+  virtual double getRotX();
+  virtual double getRotY();
+  virtual double getRotZ();
+  virtual double getTilt();
+  virtual double getRingOffset();
+
+private:
+
+  BCMPrime_Module m_module;
+  unsigned int m_moduleon;
+  
+};
+
+#endif
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/CMakeLists.txt
new file mode 100644
index 000000000000..b7700329cb7c
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/CMakeLists.txt
@@ -0,0 +1,49 @@
+################################################################################
+# Package: BCM
+################################################################################
+
+# Declare the package name:
+atlas_subdir( BCM )
+
+# Declare the package's dependencies:
+atlas_depends_on_subdirs( PUBLIC
+                          Control/AthenaBaseComps
+                          Control/AthenaKernel
+                          DetectorDescription/GeoModel/GeoModelKernel
+                          DetectorDescription/GeoModel/GeoModelSvc
+                          GaudiKernel
+                          InnerDetector/InDetDetDescr/InDetTrackingGeometryXML
+                          InnerDetector/InDetDetDescr/PixelGeoModel
+                          InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule
+                          InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces
+                          InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils
+                          InnerDetector/InDetDetDescr/BCM_GeoModel
+                          PRIVATE
+                          DetectorDescription/GeoModel/GeoModelInterfaces
+ 			              DetectorDescription/GeoPrimitives
+                          DetectorDescription/Identifier
+                          InnerDetector/InDetDetDescr/InDetGeoModelUtils
+                          InnerDetector/InDetDetDescr/InDetIdentifier
+                          InnerDetector/InDetDetDescr/PixelReadoutGeometry
+                          InnerDetector/InDetDetDescr/InDetReadoutGeometry
+                          InnerDetector/InDetDetDescr/BCMPrime_GeoModel
+                          Tools/PathResolver )
+
+# External dependencies:
+find_package( CLHEP )
+find_package( XercesC )
+find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
+
+# Component(s) in the package:
+atlas_add_component( BCM
+                     src/*.cxx
+                     src/components/*.cxx
+                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} 
+		     AthenaBaseComps AthenaKernel GeoModelKernel GeoModelSvc GaudiKernel
+		     PixelGeoModelModule PixelLayoutUtils 
+		     PRIVATE_LINK_LIBRARIES Identifier InDetGeoModelUtils InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry PathResolver InDetTrackingGeometryXMLLib BCM_GeoModel)
+
+# Install files from the package:
+atlas_install_headers( BCM )
+
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrimeXMLHelper.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrimeXMLHelper.cxx
new file mode 100644
index 000000000000..9b85cbfb604c
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrimeXMLHelper.cxx
@@ -0,0 +1,114 @@
+/*
+Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "BCM/BCMPrimeXMLHelper.h"
+#include "PathResolver/PathResolver.h"
+#include "PixelLayoutUtils/DBXMLUtils.h"
+
+#include "CLHEP/Evaluator/Evaluator.h"
+
+BCMPrimeXMLHelper::BCMPrimeXMLHelper(int module, const PixelGeoBuilderBasics *basics) : GeoXMLUtils(), PixelGeoBuilder(basics), m_module(module)
+{
+
+    std::string fileName = "BcmPrime.xml";
+    if (const char *env_p = std::getenv("PIXEL_BCMPRIME_GEO_XML"))
+        fileName = std::string(env_p);
+
+    bool readXMLfromDB = getBasics()->ReadInputDataFromDB();
+    bool bParsed = false;
+    if (readXMLfromDB)
+    {
+        basics->msgStream() << MSG::DEBUG << "XML input : DB CLOB " << fileName << "  (DB flag : " << readXMLfromDB << ")" << endreq;
+        DBXMLUtils dbUtils(getBasics());
+        std::string XMLtext = dbUtils.readXMLFromDB(fileName);
+        InitializeXML();
+        bParsed = ParseBuffer(XMLtext, std::string(""));
+    }
+    else
+    {
+        basics->msgStream() << MSG::DEBUG << "XML input : from file " << fileName << "  (DB flag : " << readXMLfromDB << ")" << endreq;
+        std::string file = PathResolver::find_file(fileName, "DATAPATH");
+        InitializeXML();
+        bParsed = ParseFile(file);
+    }
+
+    // No XML file was parsed
+    if (!bParsed)
+    {
+        basics->msgStream() << MSG::ERROR << "XML file " << fileName << " not found" << endreq;
+        return;
+    }
+
+    m_moduleIndices = getChildValue_Indices("BCMPrimeGeo", "Module", m_module);
+}
+
+BCMPrimeXMLHelper::~BCMPrimeXMLHelper()
+{
+    TerminateXML();
+}
+
+double BCMPrimeXMLHelper::getTransX() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "TransX");
+}
+
+double BCMPrimeXMLHelper::getTransY() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "TransY");
+}
+
+double BCMPrimeXMLHelper::getTransZ() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "TransZ");
+}
+
+double BCMPrimeXMLHelper::getRotX() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "RotX");
+}
+
+double BCMPrimeXMLHelper::getRotY() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "RotY");
+}
+
+double BCMPrimeXMLHelper::getRotZ() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "RotZ");
+}
+
+double BCMPrimeXMLHelper::getModuleLength() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "ModuleLength");
+}
+
+double BCMPrimeXMLHelper::getModuleWidth() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "ModuleWidth");
+}
+
+double BCMPrimeXMLHelper::getModuleTilt() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "ModuleTilt");
+}
+
+double BCMPrimeXMLHelper::getDiamSize() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "DiamSize");
+}
+
+double BCMPrimeXMLHelper::getDiamOffsetY() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "DiamOffsetY");
+}
+
+double BCMPrimeXMLHelper::getDiamSeparZ() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "DiamSeparZ");
+}
+
+double BCMPrimeXMLHelper::getRingOffset() const
+{
+    return getDouble("BCMPrimeGeo", m_moduleIndices, "RingOffset");
+}
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrime_Module.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrime_Module.cxx
new file mode 100644
index 000000000000..c02f576e1806
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrime_Module.cxx
@@ -0,0 +1,145 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "BCM/BCMPrime_Module.h"
+#include "BCM/BCMPrimeXMLHelper.h"
+
+#include "BCM_GeoModel/BCM_Module.h"
+#include "BCM_GeoModel/BCM_Wall.h"
+
+#include "GeoModelKernel/GeoBox.h"
+#include "GeoModelKernel/GeoLogVol.h"
+#include "GeoModelKernel/GeoTransform.h"
+#include "GeoModelKernel/GeoNameTag.h"
+#include "GeoModelKernel/GeoIdentifierTag.h"
+#include "GeoModelKernel/GeoSimplePolygonBrep.h"
+
+GeoPhysVol* BCMPrime_Module::Build(int iModule, const PixelGeoBuilderBasics *basics)
+{
+    //module outside dimensions
+
+    BCMPrimeXMLHelper BCMPrimeDBHelper(iModule, basics);
+
+    m_transX = BCMPrimeDBHelper.getTransX();
+    m_transY = BCMPrimeDBHelper.getTransY();
+    m_transZ = BCMPrimeDBHelper.getTransZ();
+
+    m_rotX = BCMPrimeDBHelper.getRotX();
+    m_rotY = BCMPrimeDBHelper.getRotY();
+    m_rotZ = BCMPrimeDBHelper.getRotZ();
+
+    m_tilt = BCMPrimeDBHelper.getModuleTilt();
+    m_ringOffset = BCMPrimeDBHelper.getRingOffset();
+
+    double ModLength = BCMPrimeDBHelper.getModuleLength();
+    double ModWidth = BCMPrimeDBHelper.getModuleWidth();
+    double ModTilt = BCMPrimeDBHelper.getModuleTilt();
+
+    double MainWallCuThick = 0.035;
+    double MainWallG10Thick = 1.4;
+    double MainWallThick = MainWallCuThick + MainWallG10Thick;
+
+    double diamondThick = 0.5;
+    double diamondSize = BCMPrimeDBHelper.getDiamSize();
+    double safety = 0.001;
+    //outside box
+    // In BCMPrime_Module.h: mutable InDetMaterialManager *m_matMgr;
+
+    m_msg = basics->msgStream();
+
+    if ( tan(ModTilt*CLHEP::deg) * BCMPrimeDBHelper.getDiamOffsetY() < diamondThick ) {
+        m_msg << MSG::ERROR << "Incompatible values of BCMPrime parameters \"ModuleTilt\" and \"DiamOffsetY\": diamond too thick. Increase diamond offset or module tilt." << endreq;
+    }
+
+    m_matMgr = basics->matMgr();
+
+    // const GeoMaterial *air = m_matMgr->getMaterial("std::Air");
+    const GeoMaterial *ether = m_matMgr->getMaterial("special::Ether");
+    const GeoMaterial *copper = m_matMgr->getMaterial("std::Copper");
+    const GeoMaterial *g10 = m_matMgr->getMaterial("std::G10");
+    //first try the Diamond
+    const GeoMaterial *diamond = m_matMgr->getMaterial("pix::Diamond");
+
+    // ----------------------------------------------------------------------------------
+    // Intermediate Ether envelope volume (same as the one defined in previous release)
+    // ----------------------------------------------------------------------------------
+
+    GeoSimplePolygonBrep *complexEnvShape = new GeoSimplePolygonBrep(ModWidth / 2 + safety);
+    std::vector<double> xShape, yShape;
+
+    double width = ModWidth / 2 + safety;
+    double length = ModLength + MainWallThick / tan(ModTilt*CLHEP::deg) + MainWallThick * tan(ModTilt*CLHEP::deg) + safety;
+    xShape.push_back(0.);
+    yShape.push_back(0.);
+    xShape.push_back(0.);
+    yShape.push_back(length);
+    xShape.push_back(-length * cos(ModTilt*CLHEP::deg) * sin(ModTilt*CLHEP::deg));
+    yShape.push_back(length * pow(cos(ModTilt*CLHEP::deg), 2));
+
+    for (unsigned int iPt = 0; iPt < xShape.size(); iPt++)
+        complexEnvShape->addVertex(xShape[iPt], yShape[iPt]);
+/*
+    const GeoLogVol *bcmModLog = new GeoLogVol("bcmModLog", complexEnvShape, air);
+    GeoPhysVol *bcmModPhys = new GeoPhysVol(bcmModLog);
+
+*/
+    double bcmModLogPocket = MainWallThick / tan(ModTilt*CLHEP::deg) + safety / 2;
+
+    const GeoLogVol *env_bcmModLog = new GeoLogVol("EnvBcmModLog", complexEnvShape, ether);
+    GeoPhysVol *env_bcmModPhys = new GeoPhysVol(env_bcmModLog);
+
+    //diamond //bcmDiamondLog
+
+    BCM_Wall wall;
+    GeoPhysVol *DiamondVolA = wall.Build(diamondThick / 2, diamondSize / 2, diamondSize, "bcmDiamondLog", diamond);
+
+    CLHEP::HepRotation rmC;
+
+    double diamond_x = - MainWallThick - diamondThick / 2 ;
+    CLHEP::Hep3Vector DiamondPosA(diamond_x, bcmModLogPocket + BCMPrimeDBHelper.getDiamOffsetY() + diamondSize / 2, (BCMPrimeDBHelper.getDiamSeparZ() + diamondSize) / 2);
+    GeoTransform* xform = new GeoTransform(HepGeom::Transform3D(rmC, DiamondPosA));
+    GeoNameTag* tag = new GeoNameTag("Diamond");
+    env_bcmModPhys->add(tag);
+    env_bcmModPhys->add(new GeoIdentifierTag(11950));
+    env_bcmModPhys->add(xform);
+    env_bcmModPhys->add(DiamondVolA);
+    
+    GeoPhysVol *DiamondVolB = wall.Build(diamondThick / 2, diamondSize / 2, diamondSize, "bcmDiamondLog", diamond);
+
+    CLHEP::Hep3Vector DiamondPosB(diamond_x, bcmModLogPocket + BCMPrimeDBHelper.getDiamOffsetY() + diamondSize / 2, -(BCMPrimeDBHelper.getDiamSeparZ() + diamondSize) / 2);
+    xform = new GeoTransform(HepGeom::Transform3D(rmC, DiamondPosB));
+    tag = new GeoNameTag("Diamond");
+    env_bcmModPhys->add(tag);
+    env_bcmModPhys->add(new GeoIdentifierTag(11951));
+    env_bcmModPhys->add(xform);
+    env_bcmModPhys->add(DiamondVolB);
+
+    //Main BCM' wall
+
+    const GeoBox* bcmWallBox = new GeoBox(MainWallThick / 2, ModLength / 2, ModWidth / 2);
+    const GeoLogVol* bcmWallLog = new GeoLogVol("bcmWallLog", bcmWallBox, g10);
+    GeoPhysVol* bcmWallPhys = new GeoPhysVol(bcmWallLog);
+
+    CLHEP::Hep3Vector bcmWallPos( - MainWallThick / 2, bcmModLogPocket + ModLength / 2, 0.);
+    CLHEP::HepRotation rmA;
+    xform = new GeoTransform(HepGeom::Transform3D(rmA, bcmWallPos));
+    tag = new GeoNameTag("bcmWall");
+    env_bcmModPhys->add(tag);
+    env_bcmModPhys->add(xform);
+    env_bcmModPhys->add(bcmWallPhys);
+
+    // --------------------------------------------------------------------------------------
+    // Add the BCM envelope inside the new complex encompassing volume
+    // --------------------------------------------------------------------------------------
+/*
+    CLHEP::HepRotation rmEnv;
+    CLHEP::Hep3Vector WallEnvPos( safety / 2, height 0., 0.);
+    xform = new GeoTransform(HepGeom::Transform3D(rmEnv, WallEnvPos));
+    tag = new GeoNameTag("EnvBcmWallLog");
+    bcmModPhys->add(tag);
+    bcmModPhys->add(xform);
+    bcmModPhys->add(env_bcmModPhys);
+*/
+    return env_bcmModPhys;
+}
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/GeoBCMPrimeTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/GeoBCMPrimeTool.cxx
new file mode 100644
index 000000000000..f5c0c3cb4686
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/GeoBCMPrimeTool.cxx
@@ -0,0 +1,125 @@
+/*
+Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/
+#include "BCM/GeoBCMPrimeTool.h"
+
+#include "BCM/BCMPrimeXMLHelper.h"
+
+// #include "InDetIdentifier/PixelID.h"
+
+// #include "PathResolver/PathResolver.h"
+
+// #include <sstream>
+
+GeoBCMPrimeTool::GeoBCMPrimeTool(const std::string &type, const std::string &name, const IInterface *parent)
+    : AthAlgTool(type, name, parent),
+    m_module()
+{
+  declareInterface<IGeoBCMPrimeTool>(this);
+
+  declareProperty("ModulesOn", m_moduleon = 255);
+}
+
+
+//================ Initialisation =================================================
+
+StatusCode GeoBCMPrimeTool::initialize()
+{
+  
+  StatusCode sc = AthAlgTool::initialize();
+  if (sc.isFailure()) return sc;
+  ATH_MSG_INFO("GeoBCMPrimeTool initialize() successful in " << name());
+  
+  return StatusCode::SUCCESS;
+}
+
+
+//================ Create =================================================
+
+StatusCode GeoBCMPrimeTool::create()
+{
+  
+  StatusCode result = StatusCode::SUCCESS;
+
+  return result;
+
+}
+
+//================ Finalisation =================================================
+
+StatusCode GeoBCMPrimeTool::finalize()
+{
+  StatusCode sc = AthAlgTool::finalize();
+  return sc;
+}
+
+
+// Register callback function on ConDB object
+// Empty for now
+StatusCode GeoBCMPrimeTool::registerCallback( StoreGateSvc*)
+{
+
+  return StatusCode::SUCCESS;
+}
+
+GeoPhysVol *GeoBCMPrimeTool::buildModule(int iModule, const PixelGeoBuilderBasics *basics)
+{
+
+  msg(MSG::DEBUG)<<"GeoBCMPrime : StatusCode GeoBCMPrimeTool::buildModule( )"<<endreq;
+  // ATH_MSG_INFO("GeoBCMPrimeTool buliding BCMPrime module " << name());
+
+  unsigned int mask = (1 << iModule);
+  if ((mask & m_moduleon) != mask)
+  {
+    //this module is not supposed to be built
+    return 0;
+  }
+
+  ATH_MSG_DEBUG(" --> Number succesfully read from XML file");
+
+  ATH_MSG_INFO("GeoBCMPrimeTool buliding BCMPrime module " << iModule);
+
+  GeoPhysVol* bcmModPhys = m_module.Build(iModule, basics);
+  
+  return bcmModPhys;
+}
+
+double GeoBCMPrimeTool::getTransX()
+{
+  return m_module.getTransX();
+}
+
+double GeoBCMPrimeTool::getTransY()
+{
+  return m_module.getTransY();
+}
+
+double GeoBCMPrimeTool::getTransZ()
+{
+  return m_module.getTransZ();
+}
+
+double GeoBCMPrimeTool::getRotX()
+{
+  return m_module.getRotX();
+}
+
+double GeoBCMPrimeTool::getRotY()
+{
+  return m_module.getRotY();
+}
+
+double GeoBCMPrimeTool::getRotZ()
+{
+  return m_module.getRotZ();
+}
+
+double GeoBCMPrimeTool::getTilt()
+{
+  return m_module.getTilt();
+}
+
+double GeoBCMPrimeTool::getRingOffset()
+{
+  return m_module.getRingOffset();
+}
\ No newline at end of file
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_entries.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_entries.cxx
new file mode 100644
index 000000000000..70ed532f4a86
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_entries.cxx
@@ -0,0 +1,11 @@
+#include "GaudiKernel/DeclareFactoryEntries.h"
+#include "BCM/GeoBCMTool.h"
+#include "BCM/GeoBCMPrimeTool.h"
+
+DECLARE_TOOL_FACTORY(GeoBCMTool)
+DECLARE_TOOL_FACTORY(GeoBCMPrimeTool)
+
+DECLARE_FACTORY_ENTRIES(PixelLayoutInclRef) {
+  DECLARE_TOOL(GeoBCMTool)
+  DECLARE_TOOL(GeoBCMPrimeTool)
+}
\ No newline at end of file
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_load.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_load.cxx
new file mode 100644
index 000000000000..ea1ec708a666
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_load.cxx
@@ -0,0 +1,3 @@
+#include "GaudiKernel/LoadFactoryEntries.h"
+
+LOAD_FACTORY_ENTRIES(PixelLayoutInclRef)
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelEnvelopeInclRefTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelEnvelopeInclRefTool.h
index 93424c582cb3..582fcc71cb6a 100755
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelEnvelopeInclRefTool.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/BarrelInclinedRef/GeoPixelEnvelopeInclRefTool.h
@@ -16,6 +16,7 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 class IGeoPixelBarrelTool;
 class IGeoPixelEndcapTool;
+class IGeoBCMPrimeTool;
 class IPixelServicesTool;
 namespace InDet{
   class GeoComponent;
@@ -44,6 +45,7 @@ class GeoPixelEnvelopeInclRefTool : virtual public IGeoPixelEnvelopeTool, public
  private:
   ToolHandle<IGeoPixelBarrelTool> m_barrelTool;
   ToolHandle<IGeoPixelEndcapTool> m_endcapTool;
+  ToolHandle<IGeoBCMPrimeTool> m_bcmTool;
   ToolHandle<IPixelServicesTool> m_IDserviceTool;
   ToolHandle<IGeoPixelTrackingVolumeBuilder> m_tgBuilder;
 
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
index 5efbbaaf794b..27ee225e163a 100755
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
@@ -9,6 +9,7 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 #include "PixelInterfaces/IGeoPixelBarrelTool.h"
 #include "PixelInterfaces/IGeoPixelEndcapTool.h"
+#include "PixelInterfaces/IGeoBCMPrimeTool.h"
 #include "PixelInterfaces/IPixelServicesTool.h"
 
 #include "GeoModelKernel/GeoTube.h"
@@ -37,6 +38,7 @@ GeoPixelEnvelopeInclRefTool::GeoPixelEnvelopeInclRefTool(const std::string& type
   : AthAlgTool(type, name, parent),
     m_barrelTool("GeoPixelBarrelTool"),
     m_endcapTool("GeoPixelEndcapTool"),
+    m_bcmTool("GeoBCMPrimeTool"),
     m_IDserviceTool(),
     m_tgBuilder("GeoPixelTrackingVolumeBuilder"),
     m_buildTrackingVolume(false)
@@ -47,6 +49,7 @@ GeoPixelEnvelopeInclRefTool::GeoPixelEnvelopeInclRefTool(const std::string& type
   //default settings
   declareProperty("GeoPixelBarrelTool",m_barrelTool);
   declareProperty("GeoPixelEndcapTool",m_endcapTool);
+  declareProperty("GeoBCMPrimeTool",m_bcmTool);
   declareProperty("PixelServicesTool", m_IDserviceTool);
   declareProperty("GeoPixelTrackingVolumeBuilder", m_tgBuilder);
   declareProperty("BuildPixelTrackingVolume", m_buildTrackingVolume);
@@ -268,6 +271,41 @@ GeoVPhysVol* GeoPixelEnvelopeInclRefTool::buildEnvelope(const PixelGeoBuilderBas
     }
   }
 
+  bool BCMPresent = true;
+
+  if (BCMPresent) {
+    
+    // basics->getDetectorManager()->numerology().addBarrel(0);
+    //
+    // Add the BCM:
+    //
+
+    int nModules = 8;
+
+    for (int i = 0; i < nModules; i++) {
+      GeoPhysVol* bcmModPhys = m_bcmTool->buildModule(i, basics);
+      if (bcmModPhys) {
+        CLHEP::Hep3Vector pos(m_bcmTool->getTransX(), m_bcmTool->getTransY(), m_bcmTool->getTransZ());
+        CLHEP::HepRotation rm;
+        rm.rotateY(90*CLHEP::deg);
+        rm.rotateX(-m_bcmTool->getTilt()*CLHEP::deg);
+        rm.rotateX(m_bcmTool->getRotX()*CLHEP::deg);
+        rm.rotateY(m_bcmTool->getRotY()*CLHEP::deg);
+        rm.rotateZ((m_bcmTool->getRotZ()+m_bcmTool->getRingOffset())*CLHEP::deg);
+
+        int k = i + 951;
+        GeoTransform* xform = new GeoTransform(HepGeom::Transform3D(rm,pos.rotateZ(m_bcmTool->getRingOffset()*CLHEP::deg)));
+        double radius = sqrt(pow(pos.x(),2) + pow(pos.y(),2));
+        std::cout << "BCM module placed at radius: " << radius << std::endl;
+        GeoNameTag *tag = new GeoNameTag("BCM Module");
+        envelopePhys->add(tag);
+        envelopePhys->add(new GeoIdentifierTag(k));
+        envelopePhys->add(xform);
+        envelopePhys->add(bcmModPhys);
+      }
+    }
+  }
+
   //   pixServices = false;
   
 //     if(pixServices) {
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces/PixelInterfaces/IGeoBCMPrimeTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces/PixelInterfaces/IGeoBCMPrimeTool.h
new file mode 100644
index 000000000000..34badce0d140
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces/PixelInterfaces/IGeoBCMPrimeTool.h
@@ -0,0 +1,38 @@
+/*
+Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+*/ 
+#ifndef InDet_GeoBCMPrimeTool_H
+#define InDet_GeoBCMPrimeTool_H
+
+#include "GaudiKernel/IAlgTool.h"
+#include "AthenaKernel/IOVSvcDefs.h"
+
+#include "GeoModelKernel/GeoPhysVol.h"
+
+// class GeoVPixelBasics;
+// class GeoVPhysVol;
+class PixelGeoBuilderBasics;
+
+static const InterfaceID IID_IGeoBCMPrimeTool( "InDet::IGeoBCMPrimeTool", 1, 0 );
+
+class IGeoBCMPrimeTool : public virtual IAlgTool {
+ public:
+  
+  /// Retrieve Interface ID
+   static const InterfaceID& interfaceID( ) { return IID_IGeoBCMPrimeTool; }
+   
+   virtual GeoPhysVol* buildModule( int , const PixelGeoBuilderBasics* ) = 0;
+
+   virtual double getTransX() = 0;
+   virtual double getTransY() = 0;
+   virtual double getTransZ() = 0;
+   virtual double getRotX() = 0;
+   virtual double getRotY() = 0;
+   virtual double getRotZ() = 0;
+   virtual double getTilt() = 0;
+   virtual double getRingOffset() = 0;
+
+};
+
+
+#endif
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
index 245f7b081a61..a7f067e66dde 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
@@ -126,6 +126,7 @@ class SLHC_Setup :
                 "PIXELDISCSUPPORT":"InclBrl4_InclinedAlternative_DiskSupport",
                 "MATERIAL":"InclBrl_Material",
                 "PIXELROUTINGSERVICE":"InclBrl4_InclinedAlternative_PixelRoutingService",
+                "BCMPRIME":"BCMPrime_InclinedAlternative"
                 }
         else:
             xmlFileDict["Pixel"]={
@@ -205,12 +206,24 @@ class SLHC_Setup :
         geoEndcapTool.PixelServicesTool = serviceTool
         toolSvc+=geoEndcapTool
 
+        print "******************************************************************************************"
+        print "PixelGeoModel - import GeoBCMPrimeTool"
+
+        # from BCM.BCMConf import GeoBCMTool
+        # geoBCMTool = GeoBCMTool(name="GeoBCMTool")
+        # toolSvc += geoBCMTool
+
+        from BCM.BCMConf import GeoBCMPrimeTool
+        geoBCMPrimeTool = GeoBCMPrimeTool(name="GeoBCMPrimeTool")
+        toolSvc += geoBCMPrimeTool
+
         print "******************************************************************************************"
         print "PixelGeoModel - import GeoPixelEnvelopeInclRefTool"
         from BarrelInclinedRef.BarrelInclinedRefConf import GeoPixelEnvelopeInclRefTool
         geoEnvelopeTool=GeoPixelEnvelopeInclRefTool(name="GeoPixelEnvelopeInclRefTool")
         geoEnvelopeTool.GeoPixelBarrelTool = geoBarrelTool
         geoEnvelopeTool.GeoPixelEndcapTool = geoEndcapTool
+        geoEnvelopeTool.GeoBCMPrimeTool = geoBCMPrimeTool
         geoEnvelopeTool.PixelServicesTool = serviceTool
         toolSvc+=geoEnvelopeTool
 
diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py b/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
index 6ee85f55851c..974778579616 100644
--- a/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
+++ b/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
@@ -75,7 +75,7 @@ def generateInDetSensitiveDetectorList():
     isRUN1 = not (isRUN2 or isUpgrade)
 
     from AthenaCommon.DetFlags import DetFlags
-    if (isRUN1 or isRUN2) and DetFlags.simulate.BCM_on():
+    if DetFlags.simulate.BCM_on():
         SensitiveDetectorList += [ 'BCMSensorSD' ]
     #if isRUN2 and DetFlags.simulation.DBM_on():
     #    SensitiveDetectorList += [ 'DBMSensorSD' ]
-- 
GitLab


From 5950fbeb3f6230bb8aae500f8cecbb55e57f5e4a Mon Sep 17 00:00:00 2001
From: Jakob Novak <janovak@cern.ch>
Date: Fri, 13 Dec 2019 12:07:36 +0100
Subject: [PATCH 02/11] Renaming of directories, modification of BCM SD, to
 accept hits from the correct volume copy numbers and implementing the
 possibility to turn BCM' GeoModel off, from the pixel xml file.

---
 .../BCM => BCMPrime/BCMPrime}/BCMPrimeXMLHelper.h     |  0
 .../{BCM/BCM => BCMPrime/BCMPrime}/BCMPrime_Module.h  |  0
 .../{BCM/BCM => BCMPrime/BCMPrime}/GeoBCMPrimeTool.h  |  6 +++++-
 .../PixelLayouts/{BCM => BCMPrime}/CMakeLists.txt     |  8 ++++----
 .../{BCM => BCMPrime}/src/BCMPrimeXMLHelper.cxx       |  2 +-
 .../{BCM => BCMPrime}/src/BCMPrime_Module.cxx         |  4 ++--
 .../{BCM => BCMPrime}/src/GeoBCMPrimeTool.cxx         | 10 ++--------
 .../{BCM => BCMPrime}/src/components/BCM_entries.cxx  |  4 ++--
 .../{BCM => BCMPrime}/src/components/BCM_load.cxx     |  0
 .../src/GeoPixelEnvelopeExtInclTool.cxx               |  8 +++-----
 .../PixelLayoutUtils/PixelGeneralXMLHelper.h          |  1 +
 .../PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx    |  5 +++++
 InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx   | 11 +++++++++--
 13 files changed, 34 insertions(+), 25 deletions(-)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM/BCM => BCMPrime/BCMPrime}/BCMPrimeXMLHelper.h (100%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM/BCM => BCMPrime/BCMPrime}/BCMPrime_Module.h (100%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM/BCM => BCMPrime/BCMPrime}/GeoBCMPrimeTool.h (93%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM => BCMPrime}/CMakeLists.txt (95%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM => BCMPrime}/src/BCMPrimeXMLHelper.cxx (98%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM => BCMPrime}/src/BCMPrime_Module.cxx (98%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM => BCMPrime}/src/GeoBCMPrimeTool.cxx (93%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM => BCMPrime}/src/components/BCM_entries.cxx (76%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/{BCM => BCMPrime}/src/components/BCM_load.cxx (100%)

diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrimeXMLHelper.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h
similarity index 100%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrimeXMLHelper.h
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrime_Module.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrime_Module.h
similarity index 100%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/BCMPrime_Module.h
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrime_Module.h
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/GeoBCMPrimeTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
similarity index 93%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/GeoBCMPrimeTool.h
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
index 015a790e4cd5..e36b3fbbd1d4 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/BCM/GeoBCMPrimeTool.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
@@ -1,5 +1,9 @@
 /*
 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+
+Jakob Novak, 13. December 2019
+jakob.novak@cern.ch
+
 */ 
 #ifndef GEOBCMPRIMETOOL_H
 #define GEOBCMPRIMETOOL_H
@@ -14,7 +18,7 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 #include "AthenaKernel/IOVSvcDefs.h"
 #include "GaudiKernel/ServiceHandle.h"
 
-#include "BCM/BCMPrime_Module.h"
+#include "BCMPrime/BCMPrime_Module.h"
 
 namespace InDet {
   class XMLReaderSvc;
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
similarity index 95%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/CMakeLists.txt
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
index b7700329cb7c..165474b55482 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/CMakeLists.txt
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
@@ -1,9 +1,9 @@
 ################################################################################
-# Package: BCM
+# Package: BCMPrime
 ################################################################################
 
 # Declare the package name:
-atlas_subdir( BCM )
+atlas_subdir( BCMPrime )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
@@ -35,7 +35,7 @@ find_package( XercesC )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 
 # Component(s) in the package:
-atlas_add_component( BCM
+atlas_add_component( BCMPrime
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
@@ -45,5 +45,5 @@ atlas_add_component( BCM
 		     PRIVATE_LINK_LIBRARIES Identifier InDetGeoModelUtils InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry PathResolver InDetTrackingGeometryXMLLib BCM_GeoModel)
 
 # Install files from the package:
-atlas_install_headers( BCM )
+atlas_install_headers( BCMPrime )
 
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrimeXMLHelper.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
similarity index 98%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrimeXMLHelper.cxx
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
index 9b85cbfb604c..4f0df65721a0 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrimeXMLHelper.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
@@ -2,7 +2,7 @@
 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "BCM/BCMPrimeXMLHelper.h"
+#include "BCMPrime/BCMPrimeXMLHelper.h"
 #include "PathResolver/PathResolver.h"
 #include "PixelLayoutUtils/DBXMLUtils.h"
 
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrime_Module.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrime_Module.cxx
similarity index 98%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrime_Module.cxx
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrime_Module.cxx
index c02f576e1806..55e5e4810833 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/BCMPrime_Module.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrime_Module.cxx
@@ -2,8 +2,8 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "BCM/BCMPrime_Module.h"
-#include "BCM/BCMPrimeXMLHelper.h"
+#include "BCMPrime/BCMPrime_Module.h"
+#include "BCMPrime/BCMPrimeXMLHelper.h"
 
 #include "BCM_GeoModel/BCM_Module.h"
 #include "BCM_GeoModel/BCM_Wall.h"
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/GeoBCMPrimeTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
similarity index 93%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/GeoBCMPrimeTool.cxx
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
index f5c0c3cb4686..e518edbe30b1 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/GeoBCMPrimeTool.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
@@ -1,15 +1,9 @@
 /*
 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
-#include "BCM/GeoBCMPrimeTool.h"
 
-#include "BCM/BCMPrimeXMLHelper.h"
-
-// #include "InDetIdentifier/PixelID.h"
-
-// #include "PathResolver/PathResolver.h"
-
-// #include <sstream>
+#include "BCMPrime/GeoBCMPrimeTool.h"
+#include "BCMPrime/BCMPrimeXMLHelper.h"
 
 GeoBCMPrimeTool::GeoBCMPrimeTool(const std::string &type, const std::string &name, const IInterface *parent)
     : AthAlgTool(type, name, parent),
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_entries.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_entries.cxx
similarity index 76%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_entries.cxx
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_entries.cxx
index 70ed532f4a86..293cfb09a043 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_entries.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_entries.cxx
@@ -1,6 +1,6 @@
 #include "GaudiKernel/DeclareFactoryEntries.h"
-#include "BCM/GeoBCMTool.h"
-#include "BCM/GeoBCMPrimeTool.h"
+#include "BCMPrime/GeoBCMTool.h"
+#include "BCMPrime/GeoBCMPrimeTool.h"
 
 DECLARE_TOOL_FACTORY(GeoBCMTool)
 DECLARE_TOOL_FACTORY(GeoBCMPrimeTool)
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_load.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_load.cxx
similarity index 100%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCM/src/components/BCM_load.cxx
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_load.cxx
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
index 27ee225e163a..f3fe9eafcbb2 100755
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
@@ -151,6 +151,7 @@ GeoVPhysVol* GeoPixelEnvelopeInclRefTool::buildEnvelope(const PixelGeoBuilderBas
   bool barrelPresent   = genDBHelper.isBarrelPresent();
   bool endcapAPresent  = genDBHelper.isEndcapPresentA();
   bool endcapCPresent  = genDBHelper.isEndcapPresentC();
+  bool bcmPresent   = genDBHelper.isBCMPrimePresent();
 
   // Service regions
   if(m_IDserviceTool){
@@ -271,9 +272,7 @@ GeoVPhysVol* GeoPixelEnvelopeInclRefTool::buildEnvelope(const PixelGeoBuilderBas
     }
   }
 
-  bool BCMPresent = true;
-
-  if (BCMPresent) {
+  if (bcmPresent) {
     
     // basics->getDetectorManager()->numerology().addBarrel(0);
     //
@@ -293,10 +292,9 @@ GeoVPhysVol* GeoPixelEnvelopeInclRefTool::buildEnvelope(const PixelGeoBuilderBas
         rm.rotateY(m_bcmTool->getRotY()*CLHEP::deg);
         rm.rotateZ((m_bcmTool->getRotZ()+m_bcmTool->getRingOffset())*CLHEP::deg);
 
-        int k = i + 951;
+        int k = 2*i + 4;
         GeoTransform* xform = new GeoTransform(HepGeom::Transform3D(rm,pos.rotateZ(m_bcmTool->getRingOffset()*CLHEP::deg)));
         double radius = sqrt(pow(pos.x(),2) + pow(pos.y(),2));
-        std::cout << "BCM module placed at radius: " << radius << std::endl;
         GeoNameTag *tag = new GeoNameTag("BCM Module");
         envelopePhys->add(tag);
         envelopePhys->add(new GeoIdentifierTag(k));
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/PixelGeneralXMLHelper.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/PixelGeneralXMLHelper.h
index e381062a4f02..23c2e6a83504 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/PixelGeneralXMLHelper.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/PixelLayoutUtils/PixelGeneralXMLHelper.h
@@ -58,6 +58,7 @@ class PixelGeneralXMLHelper :  public GeoXMLUtils, public PixelGeoBuilder  {
   bool isBarrelPresent() const;
   bool isEndcapPresentA() const;
   bool isEndcapPresentC() const;
+  bool isBCMPrimePresent() const;
     
  private:
 
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx
index cbb9ec2e340f..364e499e1301 100755
--- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx
@@ -251,6 +251,11 @@ bool PixelGeneralXMLHelper::isEndcapPresentC() const
   return getBoolean("PixelGeneral", 0, "EndcapC");
 }
 
+bool PixelGeneralXMLHelper::isBCMPrimePresent() const
+{
+  return getBoolean("PixelGeneral", 0, "BCMPrime");
+}
+
 double PixelGeneralXMLHelper::getLayerRMin(int ilayer) const
 {
   std::ostringstream ostr; 
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx
index 7caadb22ce5f..0499b410a1fb 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx
+++ b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx
@@ -77,7 +77,14 @@ G4bool BCMSensorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*ROhist*/)
   lP2[SiHit::xDep] = localPosition2[0]*CLHEP::mm;
 
   //BCM hit stuff
-  if(BEcopyNo == 11950 || BEcopyNo == 11951)
+  if(BEcopyNo == 11954 || BEcopyNo == 11955 || 
+    BEcopyNo == 11956 || BEcopyNo == 11957 || 
+    BEcopyNo == 11958 || BEcopyNo == 11959 ||
+    BEcopyNo == 11960 || BEcopyNo == 11961 ||
+    BEcopyNo == 11962 || BEcopyNo == 11963 ||
+    BEcopyNo == 11964 || BEcopyNo == 11965 ||
+    BEcopyNo == 11966 || BEcopyNo == 11967 ||
+    BEcopyNo == 11968 || BEcopyNo == 11969)
     {
       TrackHelper trHelp(aStep->GetTrack());
       //primary or not
@@ -101,7 +108,7 @@ G4bool BCMSensorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*ROhist*/)
         produced_in_diamond = 3;
 
       m_HitColl->Emplace(lP1, lP2, edep, aStep->GetPreStepPoint()->GetGlobalTime(), trHelp.GetParticleLink(),
-                         0, 0, myTouch->GetVolume(1)->GetCopyNo()-951, BEcopyNo - 11950, primaren, produced_in_diamond);
+                         0, 0, (myTouch->GetVolume(1)->GetCopyNo()-4)/2., (BEcopyNo - 11954) % 2, primaren, produced_in_diamond);
     }
   return true;
 }
-- 
GitLab


From f6279a84e7e7caa7fd3c38d0d1d6195129827e7c Mon Sep 17 00:00:00 2001
From: Jakob Novak <janovak@cern.ch>
Date: Mon, 23 Dec 2019 17:28:01 +0100
Subject: [PATCH 03/11] Removing dependencies on the old BCM GeoModel classes,
 cleaning the code

---
 .../{BCMPrime_Module.h => BCMPrimeModule.h}   | 10 +++----
 .../BCMPrime/BCMPrime/GeoBCMPrimeTool.h       |  4 +--
 .../PixelLayouts/BCMPrime/CMakeLists.txt      |  4 +--
 ...BCMPrime_Module.cxx => BCMPrimeModule.cxx} | 28 ++++++++-----------
 .../{BCM_entries.cxx => BCMPrime_entries.cxx} |  3 --
 .../{BCM_load.cxx => BCMPrime_load.cxx}       |  0
 .../python/SLHC_Setup_InclBrl_4.py            |  6 +---
 .../G4AtlasTools/python/G4AtlasToolsConfig.py |  2 +-
 8 files changed, 21 insertions(+), 36 deletions(-)
 rename InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/{BCMPrime_Module.h => BCMPrimeModule.h} (88%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/{BCMPrime_Module.cxx => BCMPrimeModule.cxx} (85%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/{BCM_entries.cxx => BCMPrime_entries.cxx} (68%)
 rename InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/{BCM_load.cxx => BCMPrime_load.cxx} (100%)

diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrime_Module.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
similarity index 88%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrime_Module.h
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
index 39036536ab4d..a5a43b362139 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrime_Module.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
@@ -3,10 +3,10 @@
 */
 
 ///////////////////////////////////////////////////////////////////
-// BCMPrime_Module.h, (c) ATLAS Detector software
+// BCMPrimeModule.h, (c) ATLAS Detector software
 ///////////////////////////////////////////////////////////////////
-#ifndef BCMPRIME_MODULE_H
-#define BCMPRIME_MODULE_H
+#ifndef BCMPRIMEMODULE_H
+#define BCMPRIMEMODULE_H
 
 #include "PixelGeoModel/PixelGeoBuilder.h"
 #include "GeoModelKernel/GeoPhysVol.h"
@@ -14,14 +14,14 @@
 
 #include "InDetGeoModelUtils/InDetMaterialManager.h"
 
-/** @class BCMPrime_Module 
+/** @class BCMPrimeModule 
 
   BCM-prime module builder
       @author  Jakob Novak <jakobn.novak@cern.ch>
 
 */
 
-class BCMPrime_Module
+class BCMPrimeModule
 {
  public:
     GeoPhysVol* Build(int iLayer, const PixelGeoBuilderBasics *basics);
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
index e36b3fbbd1d4..b094f2a0b403 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
@@ -18,7 +18,7 @@ jakob.novak@cern.ch
 #include "AthenaKernel/IOVSvcDefs.h"
 #include "GaudiKernel/ServiceHandle.h"
 
-#include "BCMPrime/BCMPrime_Module.h"
+#include "BCMPrime/BCMPrimeModule.h"
 
 namespace InDet {
   class XMLReaderSvc;
@@ -51,7 +51,7 @@ class GeoBCMPrimeTool : virtual public IGeoBCMPrimeTool, public AthAlgTool {
 
 private:
 
-  BCMPrime_Module m_module;
+  BCMPrimeModule m_module;
   unsigned int m_moduleon;
   
 };
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
index 165474b55482..4fef04af00fb 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
@@ -17,7 +17,6 @@ atlas_depends_on_subdirs( PUBLIC
                           InnerDetector/InDetDetDescr/PixelLayouts/PixelGeoModelModule
                           InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces
                           InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils
-                          InnerDetector/InDetDetDescr/BCM_GeoModel
                           PRIVATE
                           DetectorDescription/GeoModel/GeoModelInterfaces
  			              DetectorDescription/GeoPrimitives
@@ -26,7 +25,6 @@ atlas_depends_on_subdirs( PUBLIC
                           InnerDetector/InDetDetDescr/InDetIdentifier
                           InnerDetector/InDetDetDescr/PixelReadoutGeometry
                           InnerDetector/InDetDetDescr/InDetReadoutGeometry
-                          InnerDetector/InDetDetDescr/BCMPrime_GeoModel
                           Tools/PathResolver )
 
 # External dependencies:
@@ -42,7 +40,7 @@ atlas_add_component( BCMPrime
                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} 
 		     AthenaBaseComps AthenaKernel GeoModelKernel GeoModelSvc GaudiKernel
 		     PixelGeoModelModule PixelLayoutUtils 
-		     PRIVATE_LINK_LIBRARIES Identifier InDetGeoModelUtils InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry PathResolver InDetTrackingGeometryXMLLib BCM_GeoModel)
+		     PRIVATE_LINK_LIBRARIES Identifier InDetGeoModelUtils InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry PathResolver InDetTrackingGeometryXMLLib)
 
 # Install files from the package:
 atlas_install_headers( BCMPrime )
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrime_Module.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
similarity index 85%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrime_Module.cxx
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
index 55e5e4810833..6a879a331cfe 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrime_Module.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
@@ -2,12 +2,9 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "BCMPrime/BCMPrime_Module.h"
+#include "BCMPrime/BCMPrimeModule.h"
 #include "BCMPrime/BCMPrimeXMLHelper.h"
 
-#include "BCM_GeoModel/BCM_Module.h"
-#include "BCM_GeoModel/BCM_Wall.h"
-
 #include "GeoModelKernel/GeoBox.h"
 #include "GeoModelKernel/GeoLogVol.h"
 #include "GeoModelKernel/GeoTransform.h"
@@ -15,7 +12,7 @@
 #include "GeoModelKernel/GeoIdentifierTag.h"
 #include "GeoModelKernel/GeoSimplePolygonBrep.h"
 
-GeoPhysVol* BCMPrime_Module::Build(int iModule, const PixelGeoBuilderBasics *basics)
+GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basics)
 {
     //module outside dimensions
 
@@ -43,8 +40,6 @@ GeoPhysVol* BCMPrime_Module::Build(int iModule, const PixelGeoBuilderBasics *bas
     double diamondThick = 0.5;
     double diamondSize = BCMPrimeDBHelper.getDiamSize();
     double safety = 0.001;
-    //outside box
-    // In BCMPrime_Module.h: mutable InDetMaterialManager *m_matMgr;
 
     m_msg = basics->msgStream();
 
@@ -54,21 +49,17 @@ GeoPhysVol* BCMPrime_Module::Build(int iModule, const PixelGeoBuilderBasics *bas
 
     m_matMgr = basics->matMgr();
 
-    // const GeoMaterial *air = m_matMgr->getMaterial("std::Air");
     const GeoMaterial *ether = m_matMgr->getMaterial("special::Ether");
-    const GeoMaterial *copper = m_matMgr->getMaterial("std::Copper");
     const GeoMaterial *g10 = m_matMgr->getMaterial("std::G10");
-    //first try the Diamond
     const GeoMaterial *diamond = m_matMgr->getMaterial("pix::Diamond");
 
-    // ----------------------------------------------------------------------------------
-    // Intermediate Ether envelope volume (same as the one defined in previous release)
-    // ----------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------
+    // Intermediate Ether envelope volume (G4Assemly when GeoModel is built)
+    // ---------------------------------------------------------------------
 
     GeoSimplePolygonBrep *complexEnvShape = new GeoSimplePolygonBrep(ModWidth / 2 + safety);
     std::vector<double> xShape, yShape;
 
-    double width = ModWidth / 2 + safety;
     double length = ModLength + MainWallThick / tan(ModTilt*CLHEP::deg) + MainWallThick * tan(ModTilt*CLHEP::deg) + safety;
     xShape.push_back(0.);
     yShape.push_back(0.);
@@ -91,8 +82,9 @@ GeoPhysVol* BCMPrime_Module::Build(int iModule, const PixelGeoBuilderBasics *bas
 
     //diamond //bcmDiamondLog
 
-    BCM_Wall wall;
-    GeoPhysVol *DiamondVolA = wall.Build(diamondThick / 2, diamondSize / 2, diamondSize, "bcmDiamondLog", diamond);
+    const GeoBox* DiamondBoxA = new GeoBox(diamondThick / 2, diamondSize / 2, diamondSize /2);
+    const GeoLogVol* DiamondLogA = new GeoLogVol("bcmDiamondLog", DiamondBoxA, diamond);
+    GeoPhysVol *DiamondVolA = new GeoPhysVol(DiamondLogA);
 
     CLHEP::HepRotation rmC;
 
@@ -105,7 +97,9 @@ GeoPhysVol* BCMPrime_Module::Build(int iModule, const PixelGeoBuilderBasics *bas
     env_bcmModPhys->add(xform);
     env_bcmModPhys->add(DiamondVolA);
     
-    GeoPhysVol *DiamondVolB = wall.Build(diamondThick / 2, diamondSize / 2, diamondSize, "bcmDiamondLog", diamond);
+    const GeoBox* DiamondBoxB = new GeoBox(diamondThick / 2, diamondSize / 2, diamondSize /2);
+    const GeoLogVol* DiamondLogB = new GeoLogVol("bcmDiamondLog", DiamondBoxB, diamond);
+    GeoPhysVol *DiamondVolB = new GeoPhysVol(DiamondLogB);
 
     CLHEP::Hep3Vector DiamondPosB(diamond_x, bcmModLogPocket + BCMPrimeDBHelper.getDiamOffsetY() + diamondSize / 2, -(BCMPrimeDBHelper.getDiamSeparZ() + diamondSize) / 2);
     xform = new GeoTransform(HepGeom::Transform3D(rmC, DiamondPosB));
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_entries.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCMPrime_entries.cxx
similarity index 68%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_entries.cxx
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCMPrime_entries.cxx
index 293cfb09a043..a6be618641f4 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_entries.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCMPrime_entries.cxx
@@ -1,11 +1,8 @@
 #include "GaudiKernel/DeclareFactoryEntries.h"
-#include "BCMPrime/GeoBCMTool.h"
 #include "BCMPrime/GeoBCMPrimeTool.h"
 
-DECLARE_TOOL_FACTORY(GeoBCMTool)
 DECLARE_TOOL_FACTORY(GeoBCMPrimeTool)
 
 DECLARE_FACTORY_ENTRIES(PixelLayoutInclRef) {
-  DECLARE_TOOL(GeoBCMTool)
   DECLARE_TOOL(GeoBCMPrimeTool)
 }
\ No newline at end of file
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_load.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCMPrime_load.cxx
similarity index 100%
rename from InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCM_load.cxx
rename to InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/components/BCMPrime_load.cxx
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
index a7f067e66dde..fb3b4e22b88c 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
@@ -209,11 +209,7 @@ class SLHC_Setup :
         print "******************************************************************************************"
         print "PixelGeoModel - import GeoBCMPrimeTool"
 
-        # from BCM.BCMConf import GeoBCMTool
-        # geoBCMTool = GeoBCMTool(name="GeoBCMTool")
-        # toolSvc += geoBCMTool
-
-        from BCM.BCMConf import GeoBCMPrimeTool
+        from BCMPrime.BCMPrimeConf import GeoBCMPrimeTool
         geoBCMPrimeTool = GeoBCMPrimeTool(name="GeoBCMPrimeTool")
         toolSvc += geoBCMPrimeTool
 
diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py b/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
index 974778579616..98741bb1b49d 100644
--- a/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
+++ b/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
@@ -75,7 +75,7 @@ def generateInDetSensitiveDetectorList():
     isRUN1 = not (isRUN2 or isUpgrade)
 
     from AthenaCommon.DetFlags import DetFlags
-    if DetFlags.simulate.BCM_on():
+    if (isRUN1 or isRUN2 or isUpgrade) and DetFlags.simulate.BCM_on():
         SensitiveDetectorList += [ 'BCMSensorSD' ]
     #if isRUN2 and DetFlags.simulation.DBM_on():
     #    SensitiveDetectorList += [ 'DBMSensorSD' ]
-- 
GitLab


From 11041df33f652ddcf84d760cc9610fc47404a746 Mon Sep 17 00:00:00 2001
From: Jakob Novak <jakob.novak@cern.ch>
Date: Wed, 8 Jan 2020 12:58:50 +0100
Subject: [PATCH 04/11] More clear handling of GeoIdentifierTags, cleaning the
 code

---
 .../PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx  |  8 ++++----
 .../src/GeoPixelEnvelopeExtInclTool.cxx           |  6 ++----
 .../InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx         | 15 ++++++---------
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
index 6a879a331cfe..f03cda7a24e8 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "BCMPrime/BCMPrimeModule.h"
@@ -14,7 +14,7 @@
 
 GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basics)
 {
-    //module outside dimensions
+    // module parameters
 
     BCMPrimeXMLHelper BCMPrimeDBHelper(iModule, basics);
 
@@ -93,7 +93,7 @@ GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basi
     GeoTransform* xform = new GeoTransform(HepGeom::Transform3D(rmC, DiamondPosA));
     GeoNameTag* tag = new GeoNameTag("Diamond");
     env_bcmModPhys->add(tag);
-    env_bcmModPhys->add(new GeoIdentifierTag(11950));
+    env_bcmModPhys->add(new GeoIdentifierTag(0));
     env_bcmModPhys->add(xform);
     env_bcmModPhys->add(DiamondVolA);
     
@@ -105,7 +105,7 @@ GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basi
     xform = new GeoTransform(HepGeom::Transform3D(rmC, DiamondPosB));
     tag = new GeoNameTag("Diamond");
     env_bcmModPhys->add(tag);
-    env_bcmModPhys->add(new GeoIdentifierTag(11951));
+    env_bcmModPhys->add(new GeoIdentifierTag(1));
     env_bcmModPhys->add(xform);
     env_bcmModPhys->add(DiamondVolB);
 
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
index f3fe9eafcbb2..eb60e1438ff0 100755
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BarrelInclinedRef/src/GeoPixelEnvelopeExtInclTool.cxx
@@ -274,9 +274,8 @@ GeoVPhysVol* GeoPixelEnvelopeInclRefTool::buildEnvelope(const PixelGeoBuilderBas
 
   if (bcmPresent) {
     
-    // basics->getDetectorManager()->numerology().addBarrel(0);
     //
-    // Add the BCM:
+    // Add the BCM
     //
 
     int nModules = 8;
@@ -292,9 +291,8 @@ GeoVPhysVol* GeoPixelEnvelopeInclRefTool::buildEnvelope(const PixelGeoBuilderBas
         rm.rotateY(m_bcmTool->getRotY()*CLHEP::deg);
         rm.rotateZ((m_bcmTool->getRotZ()+m_bcmTool->getRingOffset())*CLHEP::deg);
 
-        int k = 2*i + 4;
+        int k = 2*i + 11950;
         GeoTransform* xform = new GeoTransform(HepGeom::Transform3D(rm,pos.rotateZ(m_bcmTool->getRingOffset()*CLHEP::deg)));
-        double radius = sqrt(pow(pos.x(),2) + pow(pos.y(),2));
         GeoNameTag *tag = new GeoNameTag("BCM Module");
         envelopePhys->add(tag);
         envelopePhys->add(new GeoIdentifierTag(k));
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx
index 0499b410a1fb..5c3655fd3ab5 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx
+++ b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx
@@ -54,6 +54,7 @@ G4bool BCMSensorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*ROhist*/)
   //Get the Touchable History:
   G4TouchableHistory*  myTouch = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
 
+  int minCopyNumBCM = 11954;
   int BEcopyNo =  myTouch->GetVolume()->GetCopyNo();
 
   // Get the hit coordinates. Start and End Point
@@ -77,14 +78,7 @@ G4bool BCMSensorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*ROhist*/)
   lP2[SiHit::xDep] = localPosition2[0]*CLHEP::mm;
 
   //BCM hit stuff
-  if(BEcopyNo == 11954 || BEcopyNo == 11955 || 
-    BEcopyNo == 11956 || BEcopyNo == 11957 || 
-    BEcopyNo == 11958 || BEcopyNo == 11959 ||
-    BEcopyNo == 11960 || BEcopyNo == 11961 ||
-    BEcopyNo == 11962 || BEcopyNo == 11963 ||
-    BEcopyNo == 11964 || BEcopyNo == 11965 ||
-    BEcopyNo == 11966 || BEcopyNo == 11967 ||
-    BEcopyNo == 11968 || BEcopyNo == 11969)
+  if(BEcopyNo >= 11950 || BEcopyNo <= 11965)
     {
       TrackHelper trHelp(aStep->GetTrack());
       //primary or not
@@ -107,8 +101,11 @@ G4bool BCMSensorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*ROhist*/)
       else if(aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() == "Pixel::bcmWallLog")
         produced_in_diamond = 3;
 
+      int diamondNo = (BEcopyNo - minCopyNumBCM) % 2;
+      int moduleNo = (BEcopyNo - minCopyNumBCM - diamondNo) / 2;
+
       m_HitColl->Emplace(lP1, lP2, edep, aStep->GetPreStepPoint()->GetGlobalTime(), trHelp.GetParticleLink(),
-                         0, 0, (myTouch->GetVolume(1)->GetCopyNo()-4)/2., (BEcopyNo - 11954) % 2, primaren, produced_in_diamond);
+                         0, 0, moduleNo, diamondNo, primaren, produced_in_diamond);
     }
   return true;
 }
-- 
GitLab


From 257d83445de02be002c1c5db7016a700993eabd9 Mon Sep 17 00:00:00 2001
From: Jakob Novak <jakob.novak@cern.ch>
Date: Thu, 9 Jan 2020 09:47:09 +0100
Subject: [PATCH 05/11] Removing commented lines, removing empty declarations,
 standardising copyright statements

---
 .../BCMPrime/BCMPrime/BCMPrimeModule.h        |  8 +---
 .../BCMPrime/BCMPrime/BCMPrimeXMLHelper.h     |  7 ++--
 .../BCMPrime/BCMPrime/GeoBCMPrimeTool.h       | 37 ++++++++++---------
 .../BCMPrime/src/BCMPrimeModule.cxx           | 18 +--------
 .../BCMPrime/src/BCMPrimeXMLHelper.cxx        |  2 +-
 .../BCMPrime/src/GeoBCMPrimeTool.cxx          | 23 +-----------
 .../PixelInterfaces/IGeoBCMPrimeTool.h        |  4 +-
 7 files changed, 27 insertions(+), 72 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
index a5a43b362139..c29c94e0a0d8 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -14,12 +14,6 @@
 
 #include "InDetGeoModelUtils/InDetMaterialManager.h"
 
-/** @class BCMPrimeModule 
-
-  BCM-prime module builder
-      @author  Jakob Novak <jakobn.novak@cern.ch>
-
-*/
 
 class BCMPrimeModule
 {
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h
index a7aa28e2946c..41c30e44b7ac 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h
@@ -1,6 +1,7 @@
 /*
-Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
-*/ 
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
 #ifndef BCMPRIMEXMLHELPER_H
 #define BCMPRIMEXMLHELPER_H
 
@@ -12,8 +13,6 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 #include <xercesc/util/PlatformUtils.hpp>
 #include "PixelLayoutUtils/GeoXMLUtils.h"
 
-using namespace xercesc;
-
 class BCMPrimeXMLHelper :  public GeoXMLUtils, public PixelGeoBuilder  {
 
  public:
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
index b094f2a0b403..9c52ca522d78 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
@@ -1,10 +1,14 @@
 /*
-Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
 
-Jakob Novak, 13. December 2019
-jakob.novak@cern.ch
+/** @class GeoBCMPrimeTool
+
+  Tool for building BCM' GeoModel
+      @author  Jakob Novak <jakobn.novak@cern.ch>
+
+*/
 
-*/ 
 #ifndef GEOBCMPRIMETOOL_H
 #define GEOBCMPRIMETOOL_H
 
@@ -29,25 +33,22 @@ class GeoBCMPrimeTool : virtual public IGeoBCMPrimeTool, public AthAlgTool {
 
  public:
   GeoBCMPrimeTool(const std::string&,const std::string&,const IInterface*);
-//   virtual InDet::GeoComponent* getGeoCompVol() const {return 0; } // Do I need?
 
-  virtual StatusCode initialize();
-  virtual StatusCode create();
-  virtual StatusCode finalize();
+  virtual StatusCode initialize() override;
   
   // Register callback function on ConDB object
-  virtual StatusCode registerCallback( StoreGateSvc* detStore );
+  StatusCode registerCallback( StoreGateSvc* detStore );
 
-  virtual GeoPhysVol *buildModule(int iLayer, const PixelGeoBuilderBasics *basics);
+  virtual GeoPhysVol *buildModule(int iLayer, const PixelGeoBuilderBasics *basics) override;
   
-  virtual double getTransX();
-  virtual double getTransY();
-  virtual double getTransZ();
-  virtual double getRotX();
-  virtual double getRotY();
-  virtual double getRotZ();
-  virtual double getTilt();
-  virtual double getRingOffset();
+  virtual double getTransX() override;
+  virtual double getTransY() override;
+  virtual double getTransZ() override;
+  virtual double getRotX() override;
+  virtual double getRotY() override;
+  virtual double getRotZ() override;
+  virtual double getTilt() override;
+  virtual double getRingOffset() override;
 
 private:
 
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
index f03cda7a24e8..f698f1bb8348 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "BCMPrime/BCMPrimeModule.h"
@@ -70,11 +70,7 @@ GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basi
 
     for (unsigned int iPt = 0; iPt < xShape.size(); iPt++)
         complexEnvShape->addVertex(xShape[iPt], yShape[iPt]);
-/*
-    const GeoLogVol *bcmModLog = new GeoLogVol("bcmModLog", complexEnvShape, air);
-    GeoPhysVol *bcmModPhys = new GeoPhysVol(bcmModLog);
 
-*/
     double bcmModLogPocket = MainWallThick / tan(ModTilt*CLHEP::deg) + safety / 2;
 
     const GeoLogVol *env_bcmModLog = new GeoLogVol("EnvBcmModLog", complexEnvShape, ether);
@@ -123,17 +119,5 @@ GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basi
     env_bcmModPhys->add(xform);
     env_bcmModPhys->add(bcmWallPhys);
 
-    // --------------------------------------------------------------------------------------
-    // Add the BCM envelope inside the new complex encompassing volume
-    // --------------------------------------------------------------------------------------
-/*
-    CLHEP::HepRotation rmEnv;
-    CLHEP::Hep3Vector WallEnvPos( safety / 2, height 0., 0.);
-    xform = new GeoTransform(HepGeom::Transform3D(rmEnv, WallEnvPos));
-    tag = new GeoNameTag("EnvBcmWallLog");
-    bcmModPhys->add(tag);
-    bcmModPhys->add(xform);
-    bcmModPhys->add(env_bcmModPhys);
-*/
     return env_bcmModPhys;
 }
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
index 4f0df65721a0..ed3283f0dcfb 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "BCMPrime/BCMPrimeXMLHelper.h"
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
index e518edbe30b1..b82f948efea7 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "BCMPrime/GeoBCMPrimeTool.h"
@@ -28,26 +28,6 @@ StatusCode GeoBCMPrimeTool::initialize()
 }
 
 
-//================ Create =================================================
-
-StatusCode GeoBCMPrimeTool::create()
-{
-  
-  StatusCode result = StatusCode::SUCCESS;
-
-  return result;
-
-}
-
-//================ Finalisation =================================================
-
-StatusCode GeoBCMPrimeTool::finalize()
-{
-  StatusCode sc = AthAlgTool::finalize();
-  return sc;
-}
-
-
 // Register callback function on ConDB object
 // Empty for now
 StatusCode GeoBCMPrimeTool::registerCallback( StoreGateSvc*)
@@ -60,7 +40,6 @@ GeoPhysVol *GeoBCMPrimeTool::buildModule(int iModule, const PixelGeoBuilderBasic
 {
 
   msg(MSG::DEBUG)<<"GeoBCMPrime : StatusCode GeoBCMPrimeTool::buildModule( )"<<endreq;
-  // ATH_MSG_INFO("GeoBCMPrimeTool buliding BCMPrime module " << name());
 
   unsigned int mask = (1 << iModule);
   if ((mask & m_moduleon) != mask)
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces/PixelInterfaces/IGeoBCMPrimeTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces/PixelInterfaces/IGeoBCMPrimeTool.h
index 34badce0d140..841d0ee704f8 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces/PixelInterfaces/IGeoBCMPrimeTool.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelInterfaces/PixelInterfaces/IGeoBCMPrimeTool.h
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */ 
 #ifndef InDet_GeoBCMPrimeTool_H
 #define InDet_GeoBCMPrimeTool_H
@@ -9,8 +9,6 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
 
 #include "GeoModelKernel/GeoPhysVol.h"
 
-// class GeoVPixelBasics;
-// class GeoVPhysVol;
 class PixelGeoBuilderBasics;
 
 static const InterfaceID IID_IGeoBCMPrimeTool( "InDet::IGeoBCMPrimeTool", 1, 0 );
-- 
GitLab


From 8bad1c3707b8e8ff0a3dff20b2fe13dedd0bb071 Mon Sep 17 00:00:00 2001
From: Jakob Novak <jakob.novak@cern.ch>
Date: Mon, 3 Feb 2020 17:50:52 +0100
Subject: [PATCH 06/11] Updating BCMSensorSDTool to work for upgrade and Run2
 simulation

---
 .../python/SLHC_Setup_InclBrl_4.py            |  1 +
 .../InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx     | 71 ++++++++++---------
 .../InDetG4/BCM_G4_SD/src/BCMSensorSD.h       |  5 +-
 .../InDetG4/BCM_G4_SD/src/BCMSensorSDTool.cxx |  5 +-
 .../InDetG4/BCM_G4_SD/src/BCMSensorSDTool.h   |  5 +-
 5 files changed, 50 insertions(+), 37 deletions(-)

diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
index fb3b4e22b88c..316a0608329f 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
@@ -211,6 +211,7 @@ class SLHC_Setup :
 
         from BCMPrime.BCMPrimeConf import GeoBCMPrimeTool
         geoBCMPrimeTool = GeoBCMPrimeTool(name="GeoBCMPrimeTool")
+        geoBCMPrimeTool.IsUpgrade = True
         toolSvc += geoBCMPrimeTool
 
         print "******************************************************************************************"
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx
index 5c3655fd3ab5..91ac938a46b0 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.cxx
+++ b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.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
 */
 
 //###############################################
@@ -27,9 +27,10 @@
 #include "CLHEP/Geometry/Transform3D.h"
 #include "CLHEP/Units/SystemOfUnits.h"
 
-BCMSensorSD::BCMSensorSD(const std::string& name, const std::string& hitCollectionName)
+BCMSensorSD::BCMSensorSD(const std::string& name, const std::string& hitCollectionName, bool isUpgrade)
   : G4VSensitiveDetector( name )
   , m_HitColl( hitCollectionName )
+  , m_isUpgrade(isUpgrade)
 {
 }
 
@@ -54,7 +55,7 @@ G4bool BCMSensorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*ROhist*/)
   //Get the Touchable History:
   G4TouchableHistory*  myTouch = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
 
-  int minCopyNumBCM = 11954;
+  int minCopyNumBCM = 11950;
   int BEcopyNo =  myTouch->GetVolume()->GetCopyNo();
 
   // Get the hit coordinates. Start and End Point
@@ -78,34 +79,40 @@ G4bool BCMSensorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* /*ROhist*/)
   lP2[SiHit::xDep] = localPosition2[0]*CLHEP::mm;
 
   //BCM hit stuff
-  if(BEcopyNo >= 11950 || BEcopyNo <= 11965)
-    {
-      TrackHelper trHelp(aStep->GetTrack());
-      //primary or not
-      int primaren = 0;
-      if(trHelp.IsPrimary())
-        primaren = 1;
-      else if(trHelp.IsRegeneratedPrimary())
-        primaren = 2;
-      else if(trHelp.IsSecondary())
-        primaren = 3;
-      else if(trHelp.IsRegisteredSecondary())
-        primaren = 4;
-      //std::cout << "BCMBarcode == " << trHelp.GetBarcode() << " Vertex: " << aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() << std::endl;
-
-      int produced_in_diamond = 0;
-      if(aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() == "Pixel::bcmDiamondLog")
-        produced_in_diamond = 1;
-      else if(aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() == "Pixel::bcmModLog")
-        produced_in_diamond = 2;
-      else if(aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() == "Pixel::bcmWallLog")
-        produced_in_diamond = 3;
-
-      int diamondNo = (BEcopyNo - minCopyNumBCM) % 2;
-      int moduleNo = (BEcopyNo - minCopyNumBCM - diamondNo) / 2;
-
-      m_HitColl->Emplace(lP1, lP2, edep, aStep->GetPreStepPoint()->GetGlobalTime(), trHelp.GetParticleLink(),
-                         0, 0, moduleNo, diamondNo, primaren, produced_in_diamond);
-    }
+
+  TrackHelper trHelp(aStep->GetTrack());
+  //primary or not
+  int primaren = 0;
+  if(trHelp.IsPrimary())
+    primaren = 1;
+  else if(trHelp.IsRegeneratedPrimary())
+    primaren = 2;
+  else if(trHelp.IsSecondary())
+    primaren = 3;
+  else if(trHelp.IsRegisteredSecondary())
+    primaren = 4;
+  //std::cout << "BCMBarcode == " << trHelp.GetBarcode() << " Vertex: " << aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() << std::endl;
+
+  int produced_in_diamond = 0;
+  if(aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() == "Pixel::bcmDiamondLog")
+    produced_in_diamond = 1;
+  else if(aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() == "Pixel::bcmModLog")
+    produced_in_diamond = 2;
+  else if(aStep->GetTrack()->GetLogicalVolumeAtVertex()->GetName() == "Pixel::bcmWallLog")
+    produced_in_diamond = 3;
+
+  int diamondNo;
+  int moduleNo;
+
+  if (m_isUpgrade) {
+    diamondNo = (BEcopyNo - minCopyNumBCM) % 2;
+    moduleNo = (BEcopyNo - minCopyNumBCM - diamondNo) / 2;
+  } else {
+    diamondNo = (BEcopyNo - minCopyNumBCM) % 2;
+    moduleNo = myTouch->GetVolume(1)->GetCopyNo() - 951;
+  }
+
+  m_HitColl->Emplace(lP1, lP2, edep, aStep->GetPreStepPoint()->GetGlobalTime(), trHelp.GetParticleLink(),
+                      0, 0, moduleNo, diamondNo, primaren, produced_in_diamond);
   return true;
 }
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.h b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.h
index a327aaa9615a..e0f551a8eb2e 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.h
+++ b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSD.h
@@ -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
 */
 
 //###############################################
@@ -24,7 +24,7 @@ class BCMSensorSD : public G4VSensitiveDetector
 {
  public:
   // Constructor
-  BCMSensorSD(const std::string& name, const std::string& hitCollectionName);
+  BCMSensorSD(const std::string& name, const std::string& hitCollectionName, bool isUpgrade);
 
   // Destructor
   ~BCMSensorSD() { /* I don't own myHitColl if all has gone well */ }
@@ -43,6 +43,7 @@ class BCMSensorSD : public G4VSensitiveDetector
  private:
   // The hits collection
   SG::WriteHandle<SiHitCollection> m_HitColl;
+  bool m_isUpgrade;
 };
 
 #endif
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSDTool.cxx b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSDTool.cxx
index e51a5507e5b9..5ff8eec14d14 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSDTool.cxx
+++ b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSDTool.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
 */
 
 //###############################################
@@ -16,6 +16,7 @@
 BCMSensorSDTool::BCMSensorSDTool(const std::string& type, const std::string& name, const IInterface *parent) :
   SensitiveDetectorBase(type,name,parent)
 {
+  declareProperty("IsUpgrade", m_isUpgrade = false);
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -25,7 +26,7 @@ G4VSensitiveDetector* BCMSensorSDTool::makeSD()
   ATH_MSG_DEBUG( "Initializing SD" );
 
   // Create a fresh SD
-  return new BCMSensorSD(name(), m_outputCollectionNames[0]);
+  return new BCMSensorSD(name(), m_outputCollectionNames[0], m_isUpgrade);
 }
 
 
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSDTool.h b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSDTool.h
index 4bc16b28e94a..35d31fbd4e37 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSDTool.h
+++ b/InnerDetector/InDetG4/BCM_G4_SD/src/BCMSensorSDTool.h
@@ -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
 */
 
 //###############################################
@@ -26,6 +26,9 @@ protected:
   // Make me an SD!
   G4VSensitiveDetector* makeSD() override final;
 
+private:
+  bool m_isUpgrade;
+
 };
 
 #endif //BCM_G4_SD_BCMSENSORSDTOOL_H
-- 
GitLab


From f4175b4fd7a0b8f9aaf05673e1da063e7c42442f Mon Sep 17 00:00:00 2001
From: Jakob Novak <jakob.novak@cern.ch>
Date: Fri, 7 Feb 2020 09:16:34 +0100
Subject: [PATCH 07/11] Removing GeoModelSvc dependence, some modifications in
 comments

---
 .../PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h            | 3 ---
 .../PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h           | 3 +--
 .../InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt         | 2 +-
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
index c29c94e0a0d8..556150a025b6 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeModule.h
@@ -2,9 +2,6 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-///////////////////////////////////////////////////////////////////
-// BCMPrimeModule.h, (c) ATLAS Detector software
-///////////////////////////////////////////////////////////////////
 #ifndef BCMPRIMEMODULE_H
 #define BCMPRIMEMODULE_H
 
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
index 9c52ca522d78..95b6fbd7f701 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/GeoBCMPrimeTool.h
@@ -5,7 +5,7 @@
 /** @class GeoBCMPrimeTool
 
   Tool for building BCM' GeoModel
-      @author  Jakob Novak <jakobn.novak@cern.ch>
+      @author  Jakob Novak <jakob.novak@cern.ch>
 
 */
 
@@ -16,7 +16,6 @@
 
 #include "PixelInterfaces/IGeoBCMPrimeTool.h"
 #include "PixelGeoModel/PixelGeoBuilder.h"
-#include "GeoModelInterfaces/IGeoModelSvc.h"
 
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "AthenaKernel/IOVSvcDefs.h"
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
index 4fef04af00fb..822f2df0508d 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/CMakeLists.txt
@@ -38,7 +38,7 @@ atlas_add_component( BCMPrime
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} 
-		     AthenaBaseComps AthenaKernel GeoModelKernel GeoModelSvc GaudiKernel
+		     AthenaBaseComps AthenaKernel GeoModelKernel GaudiKernel
 		     PixelGeoModelModule PixelLayoutUtils 
 		     PRIVATE_LINK_LIBRARIES Identifier InDetGeoModelUtils InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry PathResolver InDetTrackingGeometryXMLLib)
 
-- 
GitLab


From 2c346771622647291f74c4a80201b83693ade3a6 Mon Sep 17 00:00:00 2001
From: Jakob Novak <jakob.novak@cern.ch>
Date: Fri, 7 Feb 2020 10:41:24 +0100
Subject: [PATCH 08/11] ATH_CHECK to check the StatusCode, ATH_MSG_DEBUG, names
 of the variables to smallcase, moving some dependencies from header to cxx

---
 .../BCMPrime/BCMPrime/BCMPrimeXMLHelper.h     |  3 --
 .../BCMPrime/src/BCMPrimeModule.cxx           | 54 +++++++++----------
 .../BCMPrime/src/BCMPrimeXMLHelper.cxx        |  4 ++
 .../BCMPrime/src/GeoBCMPrimeTool.cxx          |  5 +-
 4 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h
index 41c30e44b7ac..3bbd449d75af 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/BCMPrime/BCMPrimeXMLHelper.h
@@ -8,9 +8,6 @@
 #include "PixelGeoModel/PixelGeoBuilder.h"
 
 // XML library
- #include <xercesc/dom/DOM.hpp>
-#include <xercesc/parsers/XercesDOMParser.hpp>
-#include <xercesc/util/PlatformUtils.hpp>
 #include "PixelLayoutUtils/GeoXMLUtils.h"
 
 class BCMPrimeXMLHelper :  public GeoXMLUtils, public PixelGeoBuilder  {
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
index f698f1bb8348..0408ed09b533 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeModule.cxx
@@ -29,13 +29,13 @@ GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basi
     m_tilt = BCMPrimeDBHelper.getModuleTilt();
     m_ringOffset = BCMPrimeDBHelper.getRingOffset();
 
-    double ModLength = BCMPrimeDBHelper.getModuleLength();
-    double ModWidth = BCMPrimeDBHelper.getModuleWidth();
-    double ModTilt = BCMPrimeDBHelper.getModuleTilt();
+    double modLength = BCMPrimeDBHelper.getModuleLength();
+    double modWidth = BCMPrimeDBHelper.getModuleWidth();
+    double modTilt = BCMPrimeDBHelper.getModuleTilt();
 
-    double MainWallCuThick = 0.035;
-    double MainWallG10Thick = 1.4;
-    double MainWallThick = MainWallCuThick + MainWallG10Thick;
+    double mainWallCuThick = 0.035;
+    double mainWallG10Thick = 1.4;
+    double mainWallThick = mainWallCuThick + mainWallG10Thick;
 
     double diamondThick = 0.5;
     double diamondSize = BCMPrimeDBHelper.getDiamSize();
@@ -43,7 +43,7 @@ GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basi
 
     m_msg = basics->msgStream();
 
-    if ( tan(ModTilt*CLHEP::deg) * BCMPrimeDBHelper.getDiamOffsetY() < diamondThick ) {
+    if ( tan(modTilt*CLHEP::deg) * BCMPrimeDBHelper.getDiamOffsetY() < diamondThick ) {
         m_msg << MSG::ERROR << "Incompatible values of BCMPrime parameters \"ModuleTilt\" and \"DiamOffsetY\": diamond too thick. Increase diamond offset or module tilt." << endreq;
     }
 
@@ -57,61 +57,61 @@ GeoPhysVol* BCMPrimeModule::Build(int iModule, const PixelGeoBuilderBasics *basi
     // Intermediate Ether envelope volume (G4Assemly when GeoModel is built)
     // ---------------------------------------------------------------------
 
-    GeoSimplePolygonBrep *complexEnvShape = new GeoSimplePolygonBrep(ModWidth / 2 + safety);
+    GeoSimplePolygonBrep *complexEnvShape = new GeoSimplePolygonBrep(modWidth / 2 + safety);
     std::vector<double> xShape, yShape;
 
-    double length = ModLength + MainWallThick / tan(ModTilt*CLHEP::deg) + MainWallThick * tan(ModTilt*CLHEP::deg) + safety;
+    double length = modLength + mainWallThick / tan(modTilt*CLHEP::deg) + mainWallThick * tan(modTilt*CLHEP::deg) + safety;
     xShape.push_back(0.);
     yShape.push_back(0.);
     xShape.push_back(0.);
     yShape.push_back(length);
-    xShape.push_back(-length * cos(ModTilt*CLHEP::deg) * sin(ModTilt*CLHEP::deg));
-    yShape.push_back(length * pow(cos(ModTilt*CLHEP::deg), 2));
+    xShape.push_back(-length * cos(modTilt*CLHEP::deg) * sin(modTilt*CLHEP::deg));
+    yShape.push_back(length * pow(cos(modTilt*CLHEP::deg), 2));
 
     for (unsigned int iPt = 0; iPt < xShape.size(); iPt++)
         complexEnvShape->addVertex(xShape[iPt], yShape[iPt]);
 
-    double bcmModLogPocket = MainWallThick / tan(ModTilt*CLHEP::deg) + safety / 2;
+    double bcmModLogPocket = mainWallThick / tan(modTilt*CLHEP::deg) + safety / 2;
 
     const GeoLogVol *env_bcmModLog = new GeoLogVol("EnvBcmModLog", complexEnvShape, ether);
     GeoPhysVol *env_bcmModPhys = new GeoPhysVol(env_bcmModLog);
 
     //diamond //bcmDiamondLog
 
-    const GeoBox* DiamondBoxA = new GeoBox(diamondThick / 2, diamondSize / 2, diamondSize /2);
-    const GeoLogVol* DiamondLogA = new GeoLogVol("bcmDiamondLog", DiamondBoxA, diamond);
-    GeoPhysVol *DiamondVolA = new GeoPhysVol(DiamondLogA);
+    const GeoBox* diamondBoxA = new GeoBox(diamondThick / 2, diamondSize / 2, diamondSize /2);
+    const GeoLogVol* diamondLogA = new GeoLogVol("bcmDiamondLog", diamondBoxA, diamond);
+    GeoPhysVol *diamondVolA = new GeoPhysVol(diamondLogA);
 
     CLHEP::HepRotation rmC;
 
-    double diamond_x = - MainWallThick - diamondThick / 2 ;
-    CLHEP::Hep3Vector DiamondPosA(diamond_x, bcmModLogPocket + BCMPrimeDBHelper.getDiamOffsetY() + diamondSize / 2, (BCMPrimeDBHelper.getDiamSeparZ() + diamondSize) / 2);
-    GeoTransform* xform = new GeoTransform(HepGeom::Transform3D(rmC, DiamondPosA));
+    double diamond_x = - mainWallThick - diamondThick / 2 ;
+    CLHEP::Hep3Vector diamondPosA(diamond_x, bcmModLogPocket + BCMPrimeDBHelper.getDiamOffsetY() + diamondSize / 2, (BCMPrimeDBHelper.getDiamSeparZ() + diamondSize) / 2);
+    GeoTransform* xform = new GeoTransform(HepGeom::Transform3D(rmC, diamondPosA));
     GeoNameTag* tag = new GeoNameTag("Diamond");
     env_bcmModPhys->add(tag);
     env_bcmModPhys->add(new GeoIdentifierTag(0));
     env_bcmModPhys->add(xform);
-    env_bcmModPhys->add(DiamondVolA);
+    env_bcmModPhys->add(diamondVolA);
     
-    const GeoBox* DiamondBoxB = new GeoBox(diamondThick / 2, diamondSize / 2, diamondSize /2);
-    const GeoLogVol* DiamondLogB = new GeoLogVol("bcmDiamondLog", DiamondBoxB, diamond);
-    GeoPhysVol *DiamondVolB = new GeoPhysVol(DiamondLogB);
+    const GeoBox* diamondBoxB = new GeoBox(diamondThick / 2, diamondSize / 2, diamondSize /2);
+    const GeoLogVol* diamondLogB = new GeoLogVol("bcmDiamondLog", diamondBoxB, diamond);
+    GeoPhysVol *diamondVolB = new GeoPhysVol(diamondLogB);
 
-    CLHEP::Hep3Vector DiamondPosB(diamond_x, bcmModLogPocket + BCMPrimeDBHelper.getDiamOffsetY() + diamondSize / 2, -(BCMPrimeDBHelper.getDiamSeparZ() + diamondSize) / 2);
-    xform = new GeoTransform(HepGeom::Transform3D(rmC, DiamondPosB));
+    CLHEP::Hep3Vector diamondPosB(diamond_x, bcmModLogPocket + BCMPrimeDBHelper.getDiamOffsetY() + diamondSize / 2, -(BCMPrimeDBHelper.getDiamSeparZ() + diamondSize) / 2);
+    xform = new GeoTransform(HepGeom::Transform3D(rmC, diamondPosB));
     tag = new GeoNameTag("Diamond");
     env_bcmModPhys->add(tag);
     env_bcmModPhys->add(new GeoIdentifierTag(1));
     env_bcmModPhys->add(xform);
-    env_bcmModPhys->add(DiamondVolB);
+    env_bcmModPhys->add(diamondVolB);
 
     //Main BCM' wall
 
-    const GeoBox* bcmWallBox = new GeoBox(MainWallThick / 2, ModLength / 2, ModWidth / 2);
+    const GeoBox* bcmWallBox = new GeoBox(mainWallThick / 2, modLength / 2, modWidth / 2);
     const GeoLogVol* bcmWallLog = new GeoLogVol("bcmWallLog", bcmWallBox, g10);
     GeoPhysVol* bcmWallPhys = new GeoPhysVol(bcmWallLog);
 
-    CLHEP::Hep3Vector bcmWallPos( - MainWallThick / 2, bcmModLogPocket + ModLength / 2, 0.);
+    CLHEP::Hep3Vector bcmWallPos( - mainWallThick / 2, bcmModLogPocket + modLength / 2, 0.);
     CLHEP::HepRotation rmA;
     xform = new GeoTransform(HepGeom::Transform3D(rmA, bcmWallPos));
     tag = new GeoNameTag("bcmWall");
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
index ed3283f0dcfb..85cd6509b30f 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/BCMPrimeXMLHelper.cxx
@@ -2,6 +2,10 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/parsers/XercesDOMParser.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+
 #include "BCMPrime/BCMPrimeXMLHelper.h"
 #include "PathResolver/PathResolver.h"
 #include "PixelLayoutUtils/DBXMLUtils.h"
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
index b82f948efea7..9700418a59b9 100644
--- a/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/BCMPrime/src/GeoBCMPrimeTool.cxx
@@ -20,8 +20,7 @@ GeoBCMPrimeTool::GeoBCMPrimeTool(const std::string &type, const std::string &nam
 StatusCode GeoBCMPrimeTool::initialize()
 {
   
-  StatusCode sc = AthAlgTool::initialize();
-  if (sc.isFailure()) return sc;
+  ATH_CHECK( AthAlgTool::initialize() );
   ATH_MSG_INFO("GeoBCMPrimeTool initialize() successful in " << name());
   
   return StatusCode::SUCCESS;
@@ -39,7 +38,7 @@ StatusCode GeoBCMPrimeTool::registerCallback( StoreGateSvc*)
 GeoPhysVol *GeoBCMPrimeTool::buildModule(int iModule, const PixelGeoBuilderBasics *basics)
 {
 
-  msg(MSG::DEBUG)<<"GeoBCMPrime : StatusCode GeoBCMPrimeTool::buildModule( )"<<endreq;
+  ATH_MSG_DEBUG("GeoBCMPrime : StatusCode GeoBCMPrimeTool::buildModule( )");
 
   unsigned int mask = (1 << iModule);
   if ((mask & m_moduleon) != mask)
-- 
GitLab


From 3810d7d082135ea7ccdc2145b794cf544b6b42d6 Mon Sep 17 00:00:00 2001
From: Jakob Novak <jakob.novak@cern.ch>
Date: Fri, 7 Feb 2020 13:46:59 +0100
Subject: [PATCH 09/11] Fixing configuration of BCMSensorSDTool to work with
 the upgrade geometry

---
 .../InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py        | 1 -
 InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py   | 6 +++++-
 InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfigDb.py | 3 ++-
 .../G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py       | 4 +++-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
index 316a0608329f..fb3b4e22b88c 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl_4.py
@@ -211,7 +211,6 @@ class SLHC_Setup :
 
         from BCMPrime.BCMPrimeConf import GeoBCMPrimeTool
         geoBCMPrimeTool = GeoBCMPrimeTool(name="GeoBCMPrimeTool")
-        geoBCMPrimeTool.IsUpgrade = True
         toolSvc += geoBCMPrimeTool
 
         print "******************************************************************************************"
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py
index ca581ae91a12..692968ff501f 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py
+++ b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfig.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 from AthenaCommon import CfgMgr
 from G4AtlasApps.SimFlags import simFlags
@@ -16,3 +16,7 @@ def getBCMSensorSD(name="BCMSensorSD", **kwargs):
     kwargs.setdefault("LogicalVolumeNames", ["Pixel::bcmDiamondLog"])
     kwargs.setdefault("OutputCollectionNames", [hits_collection_name])
     return CfgMgr.BCMSensorSDTool(name, **kwargs)
+
+def getSLHC_BCMSensorSD(name="SLHC_BCMSensorSD", **kwargs):
+    kwargs.setdefault("IsUpgrade", True )
+    return getBCMSensorSD(name, **kwargs)
diff --git a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfigDb.py b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfigDb.py
index 1fbe09862b55..2445b9589b1f 100644
--- a/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfigDb.py
+++ b/InnerDetector/InDetG4/BCM_G4_SD/python/BCM_G4_SDConfigDb.py
@@ -1,4 +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
 
 from AthenaCommon.CfgGetter import addTool
 addTool("BCM_G4_SD.BCM_G4_SDConfig.getBCMSensorSD"       , "BCMSensorSD" )
+addTool("BCM_G4_SD.BCM_G4_SDConfig.getSLHC_BCMSensorSD"  , "SLHC_BCMSensorSD" )
\ No newline at end of file
diff --git a/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py b/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
index 98741bb1b49d..af13640f40bd 100644
--- a/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
+++ b/Simulation/G4Atlas/G4AtlasTools/python/G4AtlasToolsConfig.py
@@ -75,8 +75,10 @@ def generateInDetSensitiveDetectorList():
     isRUN1 = not (isRUN2 or isUpgrade)
 
     from AthenaCommon.DetFlags import DetFlags
-    if (isRUN1 or isRUN2 or isUpgrade) and DetFlags.simulate.BCM_on():
+    if (isRUN1 or isRUN2) and DetFlags.simulate.BCM_on():
         SensitiveDetectorList += [ 'BCMSensorSD' ]
+    elif isUpgrade and DetFlags.simulate.BCM_on():
+        SensitiveDetectorList += [ 'SLHC_BCMSensorSD' ]
     #if isRUN2 and DetFlags.simulation.DBM_on():
     #    SensitiveDetectorList += [ 'DBMSensorSD' ]
     if DetFlags.simulate.pixel_on():
-- 
GitLab


From 7c047bceef0d555b89d77cf454d90fc5e7e09ee5 Mon Sep 17 00:00:00 2001
From: Jakob Novak <jakob.novak@cern.ch>
Date: Mon, 10 Feb 2020 11:25:25 +0100
Subject: [PATCH 10/11] Disable BCM' building for old geometry versions,
 prevent automatic switching of the BCM' on, when ID is

---
 Control/AthenaCommon/python/DetFlags.py                | 10 +++++++++-
 .../PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx     |  6 +++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Control/AthenaCommon/python/DetFlags.py b/Control/AthenaCommon/python/DetFlags.py
index bf9aaf5f4b98..693df234888c 100755
--- a/Control/AthenaCommon/python/DetFlags.py
+++ b/Control/AthenaCommon/python/DetFlags.py
@@ -59,6 +59,11 @@
 #if DetFlags.detdescr.LAr_allOn() : true if all LAr det is true 
 #if DetFlags.haveRIO.Calo_on() : true if any Calo RIO are present (made or read from file) 
     
+from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
+from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
+
+isUpgrade = commonGeoFlags.Run()=="RUN4" or (commonGeoFlags.Run()=="UNDEFINED" and geoFlags.isSLHC())
+
 class DetFlags:
     # detectors
     class SubDetectors:
@@ -142,7 +147,8 @@ class DetFlags:
             self.pixel_setOn()
             self.SCT_setOn()
             self.TRT_setOn()
-            self.BCM_setOn()
+            if not isUpgrade: 
+                self.BCM_setOn()
             self.DBM_setOn()
         def ID_setOff (self):
             self.bpipe_setOff()
@@ -214,6 +220,8 @@ class DetFlags:
         def ID_on (self):
             return self.bpipe_on() | self.pixel_on() | self.SCT_on() | self.TRT_on() | self.BCM_on() | self.DBM_on()
         def ID_allOn (self):
+            if isUpgrade:
+                return self.bpipe_on() & self.pixel_on() & self.SCT_on() & self.TRT_on() & self.DBM_on()
             return self.bpipe_on() & self.pixel_on() & self.SCT_on() & self.TRT_on() & self.BCM_on() & self.DBM_on()
         def LAr_on (self):
             return self.em_on() | self.HEC_on() | self.FCal_on() 
diff --git a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx
index 364e499e1301..ee9bc90c1d0c 100755
--- a/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx
+++ b/InnerDetector/InDetDetDescr/PixelLayouts/PixelLayoutUtils/src/PixelGeneralXMLHelper.cxx
@@ -253,7 +253,11 @@ bool PixelGeneralXMLHelper::isEndcapPresentC() const
 
 bool PixelGeneralXMLHelper::isBCMPrimePresent() const
 {
-  return getBoolean("PixelGeneral", 0, "BCMPrime");
+  if (getSchemaVersion() > 4) return getBoolean("PixelGeneral", 0, "BCMPrime");
+  else  {
+    msg(MSG::DEBUG)<<"XML: Old schema ("<<getSchemaVersion()<<"), disabling BCM'";
+    return false;
+  }
 }
 
 double PixelGeneralXMLHelper::getLayerRMin(int ilayer) const
-- 
GitLab


From fa823b9d6bb70e5ea79a70cc4d243cef878ff794 Mon Sep 17 00:00:00 2001
From: Jakob Novak <jakob.novak@cern.ch>
Date: Tue, 11 Feb 2020 13:04:32 +0100
Subject: [PATCH 11/11] Moving BCM' switch off from DetFlags to top-level
 config files

---
 Control/AthenaCommon/python/DetFlags.py                | 10 +---------
 .../InDetSLHC_Example/run/test_G4AtlasGeo_Alpine_VF.py |  1 +
 .../InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl32.py  |  1 +
 .../InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl4.py   |  1 +
 .../InDetSLHC_Example/run/test_G4AtlasGeo_IExtBrl4.py  |  1 +
 .../InDetSLHC_Example/run/test_G4AtlasGeo_overlap.py   |  1 +
 .../share/ExtrapolationEngineTest_ITk_jobOptions.py    |  1 +
 .../ExtrapolationEngineTest_jobOptions_InclBrl4.py     |  1 +
 .../share/GeantinoMapping_ITk_jobOptions.py            |  1 +
 .../InDetExample/InDetSLHC_Example/share/ID_only.py    |  1 +
 .../share/InDetPerformanceRTT_jobOptions_IBL.py        |  1 +
 .../share/MaterialMapping_ITk_jobOptions.py            |  1 +
 .../share/MaterialValidation_ITk_jobOptions.py         |  1 +
 ...jobOptions_SLHC_nn_prodTrainingSample_standAlone.py |  1 +
 .../share/jobOptions_SLHC_nn_tracking.py               |  1 +
 .../InDetSLHC_Example/share/jobOptions_display_SLHC.py |  1 +
 .../InDetSLHC_Example/share/jobOptions_fatras_SLHC.py  |  2 ++
 .../share/jobOptions_fatras_SLHC_refit.py              |  1 +
 .../share/jobOptions_materialmapping_SLHC.py           |  1 +
 .../share/jobOptions_materialvalidation_SLHC.py        |  1 +
 .../share/jobOptions_prod_nn_input_trf_RIO_SLHC.py     |  1 +
 .../share/jobOptions_prod_nn_input_trf_ROT_SLHC.py     |  1 +
 .../share/jobOptions_tracking_SLHC.py                  |  1 +
 .../share/jobOptions_tracking_SLHC_trf.py              |  1 +
 .../share/jobOptions_tracking_SLHC_trf_UtopiaTest.py   |  1 +
 .../share/jobOptions_tracking_SLHC_trf_splitOn.py      |  1 +
 .../share/jobOptions_tracking_pileup_SLHC.py           |  1 +
 .../share/jobOptions_trkgeometry_SLHC.py               |  1 +
 .../share/preInclude.JetTagD3PDs_SLHC_Setup.py         |  1 +
 .../share/preInclude.SLHC.NoTRT.Ana.py                 |  1 +
 .../share/preInclude.SLHC.SiliconOnly.Ana.py           |  1 +
 .../InDetSLHC_Example/share/preInclude.SiliconOnly.py  |  1 +
 32 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/Control/AthenaCommon/python/DetFlags.py b/Control/AthenaCommon/python/DetFlags.py
index 693df234888c..bf9aaf5f4b98 100755
--- a/Control/AthenaCommon/python/DetFlags.py
+++ b/Control/AthenaCommon/python/DetFlags.py
@@ -59,11 +59,6 @@
 #if DetFlags.detdescr.LAr_allOn() : true if all LAr det is true 
 #if DetFlags.haveRIO.Calo_on() : true if any Calo RIO are present (made or read from file) 
     
-from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as commonGeoFlags
-from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as geoFlags
-
-isUpgrade = commonGeoFlags.Run()=="RUN4" or (commonGeoFlags.Run()=="UNDEFINED" and geoFlags.isSLHC())
-
 class DetFlags:
     # detectors
     class SubDetectors:
@@ -147,8 +142,7 @@ class DetFlags:
             self.pixel_setOn()
             self.SCT_setOn()
             self.TRT_setOn()
-            if not isUpgrade: 
-                self.BCM_setOn()
+            self.BCM_setOn()
             self.DBM_setOn()
         def ID_setOff (self):
             self.bpipe_setOff()
@@ -220,8 +214,6 @@ class DetFlags:
         def ID_on (self):
             return self.bpipe_on() | self.pixel_on() | self.SCT_on() | self.TRT_on() | self.BCM_on() | self.DBM_on()
         def ID_allOn (self):
-            if isUpgrade:
-                return self.bpipe_on() & self.pixel_on() & self.SCT_on() & self.TRT_on() & self.DBM_on()
             return self.bpipe_on() & self.pixel_on() & self.SCT_on() & self.TRT_on() & self.BCM_on() & self.DBM_on()
         def LAr_on (self):
             return self.em_on() | self.HEC_on() | self.FCal_on() 
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_Alpine_VF.py b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_Alpine_VF.py
index ee5df272fa34..e1b1af2922bc 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_Alpine_VF.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_Alpine_VF.py
@@ -15,6 +15,7 @@ ServiceMgr.MessageSvc.OutputLevel = WARNING
 ## Detector flags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.TRT_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl32.py b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl32.py
index 82cdfd375646..1cb56f9111b3 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl32.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl32.py
@@ -15,6 +15,7 @@ ServiceMgr.MessageSvc.OutputLevel = WARNING
 ## Detector flags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.TRT_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl4.py b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl4.py
index b1e505ccb802..e6904af8c3dc 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl4.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_ExtBrl4.py
@@ -15,6 +15,7 @@ ServiceMgr.MessageSvc.OutputLevel = WARNING
 ## Detector flags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.TRT_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_IExtBrl4.py b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_IExtBrl4.py
index 2f97359bac37..35cae77236a9 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_IExtBrl4.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_IExtBrl4.py
@@ -15,6 +15,7 @@ ServiceMgr.MessageSvc.OutputLevel = WARNING
 ## Detector flags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.TRT_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_overlap.py b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_overlap.py
index 3a621d6b8058..21cf42d6b304 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_overlap.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/run/test_G4AtlasGeo_overlap.py
@@ -15,6 +15,7 @@ ServiceMgr.MessageSvc.OutputLevel = WARNING
 ## Detector flags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.TRT_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/ExtrapolationEngineTest_ITk_jobOptions.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/ExtrapolationEngineTest_ITk_jobOptions.py
index 359c9700d941..6dde8cc0fd9c 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/ExtrapolationEngineTest_ITk_jobOptions.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/ExtrapolationEngineTest_ITk_jobOptions.py
@@ -25,6 +25,7 @@ import AthenaCommon.AtlasUnixGeneratorJob
 
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
 include("InDetSLHC_Example/preInclude.SLHC.py")
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/ExtrapolationEngineTest_jobOptions_InclBrl4.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/ExtrapolationEngineTest_jobOptions_InclBrl4.py
index 93fc13818ba7..e2bdadbf98b9 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/ExtrapolationEngineTest_jobOptions_InclBrl4.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/ExtrapolationEngineTest_jobOptions_InclBrl4.py
@@ -23,6 +23,7 @@ import AthenaCommon.AtlasUnixGeneratorJob
 
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
 include("InDetSLHC_Example/preInclude.SLHC.py")
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/GeantinoMapping_ITk_jobOptions.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/GeantinoMapping_ITk_jobOptions.py
index bb7aec3e61cf..373f4fc4937b 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/GeantinoMapping_ITk_jobOptions.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/GeantinoMapping_ITk_jobOptions.py
@@ -60,6 +60,7 @@ globalflags.DetDescrVersion = myGeo
 
 # Set everything to ATLAS
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
 
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/ID_only.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/ID_only.py
index 1821dbdc63ad..a69963f5a750 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/ID_only.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/ID_only.py
@@ -4,6 +4,7 @@
 #
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # DetFlags.pixel_setOff()
 # DetFlags.SCT_setOff()
 DetFlags.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_IBL.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_IBL.py
index 12b7db1d386c..89c92366c6a6 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_IBL.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/InDetPerformanceRTT_jobOptions_IBL.py
@@ -63,6 +63,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- and switch off all the rest
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/MaterialMapping_ITk_jobOptions.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/MaterialMapping_ITk_jobOptions.py
index 444a2979d56b..2f422f8b0a6c 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/MaterialMapping_ITk_jobOptions.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/MaterialMapping_ITk_jobOptions.py
@@ -29,6 +29,7 @@ import AthenaCommon.AtlasUnixStandardJob
 # the global detflags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
 
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/MaterialValidation_ITk_jobOptions.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/MaterialValidation_ITk_jobOptions.py
index 12a04cb170e7..2e72ce73cfb5 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/MaterialValidation_ITk_jobOptions.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/MaterialValidation_ITk_jobOptions.py
@@ -7,6 +7,7 @@ import AthenaCommon.AtlasUnixGeneratorJob
 # the global detflags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
 
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_SLHC_nn_prodTrainingSample_standAlone.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_SLHC_nn_prodTrainingSample_standAlone.py
index db3e74b822c8..adc68f972452 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_SLHC_nn_prodTrainingSample_standAlone.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_SLHC_nn_prodTrainingSample_standAlone.py
@@ -83,6 +83,7 @@ globalflags.ConditionsTag = "OFLCOND-SDR-BS14T-ATLAS-00"
 #
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 #DetFlags.SCT_setOff()
 DetFlags.TRT_setOff()
 DetFlags.Calo_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_SLHC_nn_tracking.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_SLHC_nn_tracking.py
index 9af56bb7a86c..b31281811a78 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_SLHC_nn_tracking.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_SLHC_nn_tracking.py
@@ -72,6 +72,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_display_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_display_SLHC.py
index 5815d00a8745..9dd26ca11c01 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_display_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_display_SLHC.py
@@ -18,6 +18,7 @@ globalflags.DataSource='geant4'
 #
 
 DetFlags.detdescr.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.detdescr.TRT_setOff()
 
 # Select the geometry version. 
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC.py
index 3904d5ee5955..187bc288c603 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC.py
@@ -18,6 +18,7 @@ from FatrasExample.FatrasJobProperties import FatrasFlags
 # set the detectors on/off and steer the fast simulation flags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
@@ -82,6 +83,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC_refit.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC_refit.py
index 920d10e219fd..42b078734960 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC_refit.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_fatras_SLHC_refit.py
@@ -18,6 +18,7 @@ from FatrasExample.FatrasJobProperties import FatrasFlags
 # set the detectors on/off and steer the fast simulation flags
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_materialmapping_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_materialmapping_SLHC.py
index ec2bceb87997..67b8baba8477 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_materialmapping_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_materialmapping_SLHC.py
@@ -34,6 +34,7 @@ topSequence = AlgSequence()
 from AthenaCommon.DetFlags import DetFlags
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_materialvalidation_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_materialvalidation_SLHC.py
index 1d48366b7cd2..2d91dc8134b5 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_materialvalidation_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_materialvalidation_SLHC.py
@@ -19,6 +19,7 @@ topSequence = AlgSequence()
 from AthenaCommon.DetFlags import DetFlags
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_prod_nn_input_trf_RIO_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_prod_nn_input_trf_RIO_SLHC.py
index fb1ebcdd0f14..abc94d8624e2 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_prod_nn_input_trf_RIO_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_prod_nn_input_trf_RIO_SLHC.py
@@ -85,6 +85,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_prod_nn_input_trf_ROT_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_prod_nn_input_trf_ROT_SLHC.py
index bdf29671fbb5..528e24f83b32 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_prod_nn_input_trf_ROT_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_prod_nn_input_trf_ROT_SLHC.py
@@ -85,6 +85,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC.py
index a7d81a29f923..d6d6dd6b6a3e 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC.py
@@ -69,6 +69,7 @@ rec.doTrigger=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf.py
index 3612a0b741c0..8331df2c73eb 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf.py
@@ -79,6 +79,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_UtopiaTest.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_UtopiaTest.py
index 3f5ec69f91e0..2335bbce204c 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_UtopiaTest.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_UtopiaTest.py
@@ -78,6 +78,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_splitOn.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_splitOn.py
index 26703b6bbb1b..01a6a3a73f7a 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_splitOn.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_SLHC_trf_splitOn.py
@@ -76,6 +76,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_pileup_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_pileup_SLHC.py
index d3b54295bac5..7efc8437d02b 100755
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_pileup_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_tracking_pileup_SLHC.py
@@ -68,6 +68,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_trkgeometry_SLHC.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_trkgeometry_SLHC.py
index c707b6f6b602..5bae0ee9fd2b 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_trkgeometry_SLHC.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/jobOptions_trkgeometry_SLHC.py
@@ -30,6 +30,7 @@ topSequence = AlgSequence()
 from AthenaCommon.DetFlags import DetFlags
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.JetTagD3PDs_SLHC_Setup.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.JetTagD3PDs_SLHC_Setup.py
index 3046f806febc..bb9c3f5bf131 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.JetTagD3PDs_SLHC_Setup.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.JetTagD3PDs_SLHC_Setup.py
@@ -4,6 +4,7 @@ rec.Commissioning=False
 from AthenaCommon.DetFlags import DetFlags 
 # --- switch on InnerDetector
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 # --- no TRT for SLHC
 DetFlags.TRT_setOff()
 DetFlags.detdescr.TRT_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC.NoTRT.Ana.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC.NoTRT.Ana.py
index d9b156a8d939..b4290954c7a2 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC.NoTRT.Ana.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC.NoTRT.Ana.py
@@ -3,5 +3,6 @@ include("InDetSLHC_Example/preInclude.SLHC.NoTRT.Reco.py")
 DetFlags.all_setOff()
 DetFlags.dcs.all_setOn()
 DetFlags.detdescr.all_setOn()
+DetFlags.BCM_setOff()
 DetFlags.TRT_setOff()
 DetFlags.BField_setOn()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC.SiliconOnly.Ana.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC.SiliconOnly.Ana.py
index 80a034abb978..01045dfe9609 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC.SiliconOnly.Ana.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SLHC.SiliconOnly.Ana.py
@@ -3,6 +3,7 @@ include("InDetSLHC_Example/preInclude.SLHC.SiliconOnly.Reco.py")
 DetFlags.all_setOff()
 DetFlags.dcs.all_setOn()
 DetFlags.detdescr.all_setOn()
+DetFlags.BCM_setOff()
 DetFlags.TRT_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SiliconOnly.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SiliconOnly.py
index 02249eeca5e5..3a12eef57449 100644
--- a/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SiliconOnly.py
+++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/preInclude.SiliconOnly.py
@@ -1,5 +1,6 @@
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.ID_setOn()
+DetFlags.BCM_setOff()
 DetFlags.TRT_setOff()
 DetFlags.Calo_setOff()
 DetFlags.Muon_setOff()
-- 
GitLab