ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
9
11#include <GeoModelKernel/GeoPhysVol.h>
13
14
16 const std::string &name,
17 const IInterface *parent)
18 : GeoModelXmlTool(type, name, 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
86StatusCode 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
114StatusCode BCMPrimeDetectorTool::align(IOVSVC_CALLBACK_ARGS_P(I, keys))
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
StatusCode BCMPrimeDetectorTool::registerCallback ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
#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
static Double_t sc
#define I(x, y, z)
Definition MD5.cxx:116
Gaudi::Property< bool > m_alignable
virtual StatusCode clear() override final
const InDetDD::BCMPrimeDetectorManager * m_detManager
BCMPrimeDetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode create() override final
an iterator over instances of a given type in StoreGateSvc.
Definition DataHandle.h:43
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
virtual GeoVDetectorManager * manager()
StatusCode createBaseTool()
bool isAvailable(const std::string &versionNode, const std::string &tableNode) const
GeoModelXmlTool(const std::string &type, const std::string &name, const IInterface *parent)
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
Gaudi::Property< std::string > m_detectorName
GeoModelIO::ReadGeoModel * getSqliteReader() const
Definition node.h:24
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114