ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Attributes | List of all members
SCT_DetectorTool Class Reference

#include <SCT_DetectorTool.h>

Inheritance diagram for SCT_DetectorTool:
Collaboration diagram for SCT_DetectorTool:

Public Member Functions

 SCT_DetectorTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode create () override final
 
virtual StatusCode clear () override final
 
virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE () override final
 
virtual StatusCode align (IOVSVC_CALLBACK_ARGS) override
 
virtual GeoVDetectorManager * manager ()
 The Detector Node corresponding to this tool. More...
 
virtual const GeoVDetectorManager * manager () const
 

Protected Attributes

GeoVDetectorManager * m_detector
 

Private Attributes

StringProperty m_detectorName {this, "DetectorName", "SCT"}
 
BooleanProperty m_alignable {this, "Alignable", true}
 
BooleanProperty m_useDynamicAlignFolders {this, "useDynamicAlignFolders", false}
 
bool m_cosmic
 
const InDetDD::SCT_DetectorManagerm_manager
 
SCT_GeoModelAthenaComps m_athenaComps
 
ServiceHandle< IGeoDbTagSvcm_geoDbTagSvc
 
ServiceHandle< IGeometryDBSvcm_geometryDBSvc
 
StringProperty m_run1Folder {this, "Run1Folder", "/Indet/Align"}
 
StringProperty m_run2L1Folder {this, "Run2L1Folder", "/Indet/AlignL1/ID"}
 
StringProperty m_run2L2Folder {this, "Run2L2Folder", "/Indet/AlignL2/SCT"}
 
StringProperty m_run2L3Folder {this, "Run2L3Folder", "/Indet/AlignL3"}
 

Detailed Description

Definition at line 24 of file SCT_DetectorTool.h.

Constructor & Destructor Documentation

◆ SCT_DetectorTool()

SCT_DetectorTool::SCT_DetectorTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 31 of file SCT_DetectorTool.cxx.

35  m_cosmic{false},
36  m_manager{nullptr},
37  m_geoDbTagSvc{"GeoDbTagSvc", name},
38  m_geometryDBSvc{"InDetGeometryDBSvc", name}
39 {
40  // Get parameter values from jobOptions file
41  declareProperty("GeoDbTagSvc", m_geoDbTagSvc);
42  declareProperty("GeometryDBSvc", m_geometryDBSvc);
43 }

Member Function Documentation

◆ align()

StatusCode SCT_DetectorTool::align ( IOVSVC_CALLBACK_ARGS  )
overridevirtual

Reimplemented from GeoModelTool.

Definition at line 261 of file SCT_DetectorTool.cxx.

262 {
263  if (m_manager==nullptr) {
264  ATH_MSG_FATAL("Manager does not exist");
265  return StatusCode::FAILURE;
266  }
267  if (m_alignable.value()) {
268  return m_manager->align(I, keys);
269  } else {
270  ATH_MSG_DEBUG("Alignment disabled. No alignments applied");
271  return StatusCode::SUCCESS;
272  }
273 }

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode registerCallback SCT_DetectorTool::ATLAS_NOT_THREAD_SAFE ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

◆ clear()

StatusCode SCT_DetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

Definition at line 190 of file SCT_DetectorTool.cxx.

191 {
193  if (proxy) {
194  proxy->reset();
195  m_manager = nullptr;
196  }
197  return StatusCode::SUCCESS;
198 }

◆ create()

StatusCode SCT_DetectorTool::create ( )
finaloverridevirtual

Definition at line 50 of file SCT_DetectorTool.cxx.

51 {
52 
53  // Get the detector configuration.
54  ATH_CHECK(m_geoDbTagSvc.retrieve());
55 
56  ServiceHandle<IRDBAccessSvc> accessSvc(m_geoDbTagSvc->getParamSvcName(),name());
57  ATH_CHECK(accessSvc.retrieve());
58 
59  // Print the SCT version tag:
60  std::string detectorTag{""};
61  std::string detectorNode{""};
62  GeoModelIO::ReadGeoModel* sqliteReader = m_geoDbTagSvc->getSqliteReader();
63 
64  if(!sqliteReader) {
65 
66  DecodeVersionKey versionKey{&*m_geoDbTagSvc, "SCT"};
67  // Issue error if AUTO.
68  if (versionKey.tag() == "AUTO") {
69  ATH_MSG_ERROR("AUTO Atlas version. Please select a version.");
70  }
71  ATH_MSG_INFO("Building SCT with Version Tag: " << versionKey.tag() << " at Node: " << versionKey.node());
72 
73  detectorTag = versionKey.tag();
74  detectorNode = versionKey.node();
75 
76  std::string sctVersionTag{accessSvc->getChildTag("SCT", detectorTag, detectorNode)};
77 
78  ATH_MSG_INFO("SCT Version: " << sctVersionTag);
79  // Check if version is empty. If so, then the SCT cannot be built. This may or may not be intentional. We
80  // just issue an INFO message.
81 
82  if (sctVersionTag.empty()) {
83  ATH_MSG_INFO("No SCT Version. SCT will not be built.");
84  } else {
85 
86  if (versionKey.custom()) {
87  ATH_MSG_WARNING("SCT_DetectorTool: Detector Information coming from a custom configuration!!");
88  } else {
89  ATH_MSG_DEBUG("SCT_DetectorTool: Detector Information coming from the database and job options IGNORED.");
90  ATH_MSG_DEBUG("Keys for SCT Switches are " << detectorTag << " " << detectorNode);
91  }
92 
93  }
94  }
95  std::string versionName;
96  IRDBRecordset_ptr switchSet{accessSvc->getRecordsetPtr("SctSwitches", detectorTag, detectorNode)};
97  const IRDBRecord* switches{(*switchSet)[0]};
98  m_detectorName.setValue(switches->getString("DETECTORNAME"));
99  m_cosmic = false;
100  if (not switches->isFieldNull("COSMICLAYOUT")) {
101  m_cosmic = switches->getInt("COSMICLAYOUT");
102  }
103  if (not switches->isFieldNull("VERSIONNAME")) {
104  versionName = switches->getString("VERSIONNAME");
105  }
106 
107  if (versionName.empty()) {
108  if (m_cosmic) {
109  versionName = "SR1";
110  }
111  }
112 
113  ATH_MSG_DEBUG("Creating the SCT");
114  ATH_MSG_DEBUG("SCT Geometry Options: ");
115  ATH_MSG_DEBUG(" Alignable: " << (m_alignable.value() ? "true" : "false"));
116  ATH_MSG_DEBUG(" CosmicLayout: " << (m_cosmic ? "true" : "false"));
117  ATH_MSG_DEBUG(" VersionName: " << versionName);
118 
119 
121  options.setAlignable(m_alignable.value());
122  options.setDynamicAlignFolders(m_useDynamicAlignFolders.value());
123  m_manager = nullptr;
124 
125  //
126  // Locate the top level experiment node
127  //
128  GeoModelExperiment* theExpt{nullptr};
129  ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
130 
131  // Retrieve the Geometry DB Interface
132  ATH_CHECK(m_geometryDBSvc.retrieve());
133 
134  // Pass athena services to factory, etc
135  m_athenaComps.setDetStore(detStore().operator->());
138  m_athenaComps.setRDBAccessSvc(&*accessSvc);
139  const SCT_ID* idHelper{nullptr};
140  ATH_CHECK(detStore()->retrieve(idHelper, "SCT_ID"));
141  m_athenaComps.setIdHelper(idHelper);
142 
143  //
144  // This strange way of casting is to avoid an
145  // utterly brain damaged compiler warning.
146  //
147  GeoPhysVol* world{&*theExpt->getPhysVol()};
148 
149  // If we are using the SQLite reader, then we are not building the raw geometry but
150  // just locating it and attaching to readout geometry and various other actions
151  // taken in this factory.
152  if (sqliteReader){
153 
154  msg(MSG::INFO)<<"Building the geometry from the SQLite file"<<endmsg;
155  //Build the raw geometry from the SQLite file
156  SCT_DetectorFactoryLite theSCT{sqliteReader, &m_athenaComps, options};
157 
158  theSCT.create(world);
159  m_manager = theSCT.getDetectorManager();
160  }
161  else
162  {
164  theSCT.create(world);
165  m_manager = theSCT.getDetectorManager();
166  }
167 
168 
169  if (m_manager==nullptr) {
170  ATH_MSG_FATAL("SCT_DetectorManager not created");
171  return StatusCode::FAILURE;
172  }
173 
174  // Get the manager from the factory and store it in the detector store.
175  // m_detector is non constant so I can not set it to a const pointer.
176  // m_detector = theSCT.getDetectorManager();
177 
178  ATH_MSG_DEBUG("Registering SCT_DetectorManager. ");
179  ATH_CHECK(detStore()->record(m_manager, m_manager->getName()));
180  theExpt->addManager(m_manager);
181 
182  // Create a symLink to the SiDetectorManager base class
183  const SiDetectorManager* siDetManager{m_manager};
184  ATH_CHECK(detStore()->symLink(m_manager, siDetManager));
185 
186  return StatusCode::SUCCESS;
187 }

◆ manager() [1/2]

GeoVDetectorManager * GeoModelTool::manager ( )
virtualinherited

The Detector Node corresponding to this tool.

Definition at line 21 of file GeoModelTool.cxx.

21  {
22  return m_detector;
23 }

◆ manager() [2/2]

const GeoVDetectorManager * GeoModelTool::manager ( ) const
virtualinherited

Definition at line 24 of file GeoModelTool.cxx.

24  {
25  return m_detector;
26 }

Member Data Documentation

◆ m_alignable

BooleanProperty SCT_DetectorTool::m_alignable {this, "Alignable", true}
private

Definition at line 41 of file SCT_DetectorTool.h.

◆ m_athenaComps

SCT_GeoModelAthenaComps SCT_DetectorTool::m_athenaComps
private

Definition at line 47 of file SCT_DetectorTool.h.

◆ m_cosmic

bool SCT_DetectorTool::m_cosmic
private

Definition at line 43 of file SCT_DetectorTool.h.

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector
protectedinherited

Definition at line 36 of file GeoModelTool.h.

◆ m_detectorName

StringProperty SCT_DetectorTool::m_detectorName {this, "DetectorName", "SCT"}
private

Definition at line 40 of file SCT_DetectorTool.h.

◆ m_geoDbTagSvc

ServiceHandle< IGeoDbTagSvc > SCT_DetectorTool::m_geoDbTagSvc
private

Definition at line 49 of file SCT_DetectorTool.h.

◆ m_geometryDBSvc

ServiceHandle< IGeometryDBSvc > SCT_DetectorTool::m_geometryDBSvc
private

Definition at line 50 of file SCT_DetectorTool.h.

◆ m_manager

const InDetDD::SCT_DetectorManager* SCT_DetectorTool::m_manager
private

Definition at line 45 of file SCT_DetectorTool.h.

◆ m_run1Folder

StringProperty SCT_DetectorTool::m_run1Folder {this, "Run1Folder", "/Indet/Align"}
private

Definition at line 52 of file SCT_DetectorTool.h.

◆ m_run2L1Folder

StringProperty SCT_DetectorTool::m_run2L1Folder {this, "Run2L1Folder", "/Indet/AlignL1/ID"}
private

Definition at line 53 of file SCT_DetectorTool.h.

◆ m_run2L2Folder

StringProperty SCT_DetectorTool::m_run2L2Folder {this, "Run2L2Folder", "/Indet/AlignL2/SCT"}
private

Definition at line 54 of file SCT_DetectorTool.h.

◆ m_run2L3Folder

StringProperty SCT_DetectorTool::m_run2L3Folder {this, "Run2L3Folder", "/Indet/AlignL3"}
private

Definition at line 55 of file SCT_DetectorTool.h.

◆ m_useDynamicAlignFolders

BooleanProperty SCT_DetectorTool::m_useDynamicAlignFolders {this, "useDynamicAlignFolders", false}
private

Definition at line 42 of file SCT_DetectorTool.h.


The documentation for this class was generated from the following files:
SCT_DetectorFactory
Definition: SCT_DetectorFactory.h:23
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_DetectorTool::m_useDynamicAlignFolders
BooleanProperty m_useDynamicAlignFolders
Definition: SCT_DetectorTool.h:42
SCT_DetectorTool::m_athenaComps
SCT_GeoModelAthenaComps m_athenaComps
Definition: SCT_DetectorTool.h:47
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
SCT_DetectorFactoryLite
Definition: SCT_DetectorFactoryLite.h:33
SCT_DetectorTool::m_detectorName
StringProperty m_detectorName
Definition: SCT_DetectorTool.h:40
SCT_DetectorTool::m_cosmic
bool m_cosmic
Definition: SCT_DetectorTool.h:43
GeoModelExperiment
Definition: GeoModelExperiment.h:32
SCT_GeoModelAthenaComps::setIdHelper
void setIdHelper(const SCT_ID *idHelper)
Definition: SCT_GeoModelAthenaComps.cxx:13
GeoModelTool::GeoModelTool
GeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
Definition: GeoModelTool.cxx:12
InDetDD::AthenaComps::setGeoDbTagSvc
void setGeoDbTagSvc(IGeoDbTagSvc *)
Definition: InDetDDAthenaComps.cxx:22
InDetDD::AthenaComps::setDetStore
void setDetStore(StoreGateSvc *)
Definition: InDetDDAthenaComps.cxx:17
SCT_Options
Definition: SCT_Options.h:12
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
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
InDetDD::AthenaComps::setRDBAccessSvc
void setRDBAccessSvc(IRDBAccessSvc *)
Definition: InDetDDAthenaComps.cxx:27
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:379
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
GeoModelTool::m_detector
GeoVDetectorManager * m_detector
Definition: GeoModelTool.h:36
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
InDetDD::InDetDetectorManager::align
StatusCode align(IOVSVC_CALLBACK_ARGS) const
SCT_DetectorTool::m_geometryDBSvc
ServiceHandle< IGeometryDBSvc > m_geometryDBSvc
Definition: SCT_DetectorTool.h:50
SCT_ID
Definition: SCT_ID.h:68
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
InDetDD::AthenaComps::setGeometryDBSvc
void setGeometryDBSvc(IGeometryDBSvc *)
Definition: InDetDDAthenaComps.cxx:32
InDetDD::SiDetectorManager
Definition: SiDetectorManager.h:60
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
I
#define I(x, y, z)
Definition: MD5.cxx:116
SG::DataProxy
Definition: DataProxy.h:44
SCT_DetectorTool::m_manager
const InDetDD::SCT_DetectorManager * m_manager
Definition: SCT_DetectorTool.h:45
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
SCT_DetectorTool::m_geoDbTagSvc
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition: SCT_DetectorTool.h:49
SCT_DetectorTool::m_alignable
BooleanProperty m_alignable
Definition: SCT_DetectorTool.h:41
ServiceHandle< IRDBAccessSvc >