ATLAS Offline Software
BCMPrimeDetectorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "BCMPrimeDetectorTool.h"
6 #include "BCMPrimeGmxInterface.h"
7 
9 
11 #include <GeoModelKernel/GeoPhysVol.h>
13 
14 
16  const std::string &name,
17  const IInterface *parent)
19 {
20 }
21 
22 
24 {
25  // retrieve the common stuff
27 
28  GeoModelExperiment *theExpt = nullptr;
29  ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
30 
31  //
32  // Check the availability
33  //
34  std::string node{"InnerDetector"};
35  std::string table{"BCMPrimeXDD"};
36 
37  const GeoModelIO::ReadGeoModel* sqlreader = getSqliteReader();
38  if(!sqlreader){
39  if (!isAvailable(node, table)) {
40  ATH_MSG_ERROR("No BCMPrime geometry found. BCMPrime can not be built.");
41  return StatusCode::FAILURE;
42  }
43  }
44  //
45  // Create the detector manager
46  //
47  // The * converts a ConstPVLink to a ref to a GeoVPhysVol
48  // The & takes the address of the GeoVPhysVol
49  GeoPhysVol *world = &*theExpt->getPhysVol();
52 
53  // Load the geometry, create the volume,
54  // node,table are the location in the DB to look for the clob
55  // empty strings are the (optional) containing detector and envelope names
56  // allowed to pass a null sqlreader ptr - it will be used to steer the source of the geometry
57  const GeoVPhysVol* topVolume = createTopVolume(world, gmxInterface, node, table,"ITkPixel","ITkPixelDetector",sqlreader);
58  if (topVolume) { //see that a valid pointer is returned
59  manager->addTreeTop(topVolume);
60  } else {
61  ATH_MSG_FATAL("Could not find the BCMPrime Top Volume!!!");
62  return StatusCode::FAILURE;
63  }
64 
65  // set the manager
67 
68  ATH_CHECK(detStore()->record(m_detManager, m_detManager->getName()));
69  theExpt->addManager(m_detManager);
70 
71  return StatusCode::SUCCESS;
72 }
73 
74 
76 {
78  if (proxy) {
79  proxy->reset();
80  m_detManager = nullptr;
81  }
82  return StatusCode::SUCCESS;
83 }
84 
85 
86 StatusCode BCMPrimeDetectorTool::registerCallback ATLAS_NOT_THREAD_SAFE ()
87 {
88  //
89  // Register call-back for software alignment
90  //
91  if (m_alignable) {
92  std::string folderName = "/ITk/Align";
93  if (detStore()->contains<AlignableTransformContainer>(folderName)) {
94  ATH_MSG_DEBUG( "Registering callback on AlignableTransformContainer with folder " << folderName );
96  StatusCode sc = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, folderName);
97  if (sc.isFailure()) {
98  ATH_MSG_ERROR( "Could not register callback on AlignableTransformContainer with folder " <<
99  folderName );
100  }
101  return StatusCode::FAILURE;
102  } else {
103  ATH_MSG_WARNING( "Unable to register callback on AlignableTransformContainer with folder " <<
104  folderName << ", Alignment disabled (only if no Run2 scheme is loaded)!" );
105  }
106  } else {
107  ATH_MSG_INFO( "Alignment disabled. No callback registered" );
108  // We return failure otherwise it will try and register a GeoModelSvc callback associated with this callback.
109  }
110  return StatusCode::SUCCESS;
111 }
112 
113 
115 {
116  //
117  // The call-back routine, which just calls the real call-back routine from the manager.
118  //
119  if (!m_detManager) {
120  ATH_MSG_WARNING( "Manager does not exist" );
121  return StatusCode::FAILURE;
122  }
123  if (m_alignable) {
124  return m_detManager->align(I, keys);
125  } else {
126  ATH_MSG_DEBUG( "Alignment disabled. No alignments applied" );
127  return StatusCode::SUCCESS;
128  }
129 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATLAS_NOT_THREAD_SAFE
StatusCode BCMPrimeDetectorTool::registerCallback ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
Definition: BCMPrimeDetectorTool.cxx:86
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
GeoModelXmlTool::createBaseTool
StatusCode createBaseTool()
Definition: GeoModelXmlTool.cxx:26
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
BCMPrimeDetectorManager.h
BCMPrimeDetectorTool::clear
virtual StatusCode clear() override final
Definition: BCMPrimeDetectorTool.cxx:75
GeoModelExperiment
Definition: GeoModelExperiment.h:32
InDetDD::BCMPrimeDetectorManager
Definition: BCMPrimeDetectorManager.h:31
GeoModelXmlTool::isAvailable
bool isAvailable(const std::string &versionNode, const std::string &tableNode) const
Definition: GeoModelXmlTool.cxx:78
IOVSVC_CALLBACK_ARGS_P
#define IOVSVC_CALLBACK_ARGS_P(I, K)
short hand for IOVSvc call back argument list, to be used when access to formal arguments is needed,...
Definition: IOVSvcDefs.h:42
BCMPrimeDetectorTool::create
virtual StatusCode create() override final
Definition: BCMPrimeDetectorTool.cxx:23
IGeoModelTool::align
virtual StatusCode align(IOVSVC_CALLBACK_ARGS)=0
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
GeoModelExperiment.h
GeoModelXmlTool::createTopVolume
const GeoVPhysVol * createTopVolume(GeoPhysVol *worldVol, GmxInterface &interface, const std::string &versionNode, const std::string &tableNode, const std::string &containingDetector="", const std::string &envelopeName="", const GeoModelIO::ReadGeoModel *sqlreader=nullptr) const
Definition: GeoModelXmlTool.cxx:35
GeoModelXmlTool::m_detectorName
Gaudi::Property< std::string > m_detectorName
Definition: GeoModelXmlTool.h:42
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
GeoModelXmlTool::getSqliteReader
GeoModelIO::ReadGeoModel * getSqliteReader() const
Definition: GeoModelXmlTool.cxx:174
GeoModelTool::manager
virtual GeoVDetectorManager * manager()
The Detector Node corresponding to this tool.
Definition: GeoModelTool.cxx:21
BCMPrimeGmxInterface.h
BCMPrimeDetectorTool::m_alignable
Gaudi::Property< bool > m_alignable
Definition: BCMPrimeDetectorTool.h:37
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AlignableTransformContainer.h
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
BCMPrimeDetectorTool::align
virtual StatusCode align(IOVSVC_CALLBACK_ARGS_P(I, keys)) override final
Definition: BCMPrimeDetectorTool.cxx:114
InDetDD::BCMPrimeGmxInterface
Definition: BCMPrimeGmxInterface.h:19
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
InDetDD::BCMPrimeDetectorManager::align
StatusCode align(IOVSVC_CALLBACK_ARGS) const
Definition: BCMPrimeDetectorManager.cxx:34
CaloCellTimeCorrFiller.folderName
string folderName
Definition: CaloCellTimeCorrFiller.py:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
BCMPrimeDetectorTool::m_detManager
const InDetDD::BCMPrimeDetectorManager * m_detManager
Definition: BCMPrimeDetectorTool.h:35
python.ext.table_printer.table
list table
Definition: table_printer.py:81
DataHandle
an iterator over instances of a given type in StoreGateSvc. It d-casts and caches locally the pointed...
Definition: DataHandle.h:42
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
IGeoModelTool
Definition: IGeoModelTool.h:12
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
GeoModelXmlTool
Definition: GeoModelXmlTool.h:21
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
BCMPrimeDetectorTool.h
I
#define I(x, y, z)
Definition: MD5.cxx:116
SG::DataProxy
Definition: DataProxy.h:44
BCMPrimeDetectorTool::BCMPrimeDetectorTool
BCMPrimeDetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: BCMPrimeDetectorTool.cxx:15
node
Definition: memory_hooks-stdcmalloc.h:74