ATLAS Offline Software
Loading...
Searching...
No Matches
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 align () override
virtual GeoVDetectorManager * manager ()
virtual const GeoVDetectorManager * manager () const

Protected Attributes

GeoVDetectorManager * m_detector {nullptr}

Private Attributes

BooleanProperty m_alignable {this, "Alignable", true}
BooleanProperty m_useDynamicAlignFolders {this, "useDynamicAlignFolders", false}
bool m_cosmic {false}
const InDetDD::SCT_DetectorManagerm_manager {nullptr}
SCT_GeoModelAthenaComps m_athenaComps
ServiceHandle< IGeoDbTagSvcm_geoDbTagSvc {this,"GeoDbTagSvc","GeoDbTagSvc"}

Detailed Description

Definition at line 21 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 22 of file SCT_DetectorTool.cxx.

25 : GeoModelTool(type, name, parent)
26{
27}

Member Function Documentation

◆ align()

StatusCode SCT_DetectorTool::align ( )
overridevirtual

Reimplemented from GeoModelTool.

Definition at line 145 of file SCT_DetectorTool.cxx.

146{
147 if (m_manager==nullptr) {
148 ATH_MSG_FATAL("Manager does not exist");
149 return StatusCode::FAILURE;
150 }
151 if (m_alignable.value()) {
152 return const_cast<InDetDD::SCT_DetectorManager*>(m_manager)->align();
153 } else {
154 ATH_MSG_DEBUG("Alignment disabled. No alignments applied");
155 return StatusCode::SUCCESS;
156 }
157}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
BooleanProperty m_alignable
const InDetDD::SCT_DetectorManager * m_manager
virtual StatusCode align() override

◆ clear()

StatusCode SCT_DetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

Definition at line 134 of file SCT_DetectorTool.cxx.

135{
136 SG::DataProxy* proxy{detStore()->proxy(ClassID_traits<SCT_DetectorManager>::ID(), m_manager->getName())};
137 if (proxy) {
138 proxy->reset();
139 m_manager = nullptr;
140 }
141 return StatusCode::SUCCESS;
142}

◆ create()

StatusCode SCT_DetectorTool::create ( )
finaloverridevirtual

Definition at line 32 of file SCT_DetectorTool.cxx.

33{
34
35 // Get the detector configuration.
36 ATH_CHECK(m_geoDbTagSvc.retrieve());
37
38 ServiceHandle<IRDBAccessSvc> accessSvc(m_geoDbTagSvc->getParamSvcName(),name());
39 ATH_CHECK(accessSvc.retrieve());
40
41 // Print the SCT version tag:
42 std::string detectorTag{""};
43 std::string detectorNode{""};
44 GeoModelIO::ReadGeoModel* sqliteReader = m_geoDbTagSvc->getSqliteReader();
45
46 if(!sqliteReader) {
47 DecodeVersionKey versionKey{m_geoDbTagSvc.get(), "SCT"};
48 ATH_MSG_INFO("Building SCT with Version Tag: " << versionKey.tag() << " at Node: " << versionKey.node());
49
50 detectorTag = versionKey.tag();
51 detectorNode = versionKey.node();
52
53 std::string sctVersionTag{accessSvc->getChildTag("SCT", detectorTag, detectorNode)};
54
55 ATH_MSG_INFO("SCT Version: " << sctVersionTag);
56 if (sctVersionTag.empty()) {
57 ATH_MSG_INFO("No SCT Version. SCT will not be built.");
58 return StatusCode::SUCCESS;
59 }
60 else {
61 ATH_MSG_DEBUG("Keys for SCT Switches are " << detectorTag << " " << detectorNode);
62 }
63 }
64 std::string versionName;
65 IRDBRecordset_ptr switchSet{accessSvc->getRecordsetPtr("SctSwitches", detectorTag, detectorNode)};
66 const IRDBRecord* switches{(*switchSet)[0]};
67 if (not switches->isFieldNull("COSMICLAYOUT")) {
68 m_cosmic = switches->getInt("COSMICLAYOUT");
69 }
70 if (not switches->isFieldNull("VERSIONNAME")) {
71 versionName = switches->getString("VERSIONNAME");
72 }
73
74 if (versionName.empty() && m_cosmic) {
75 versionName = "SR1";
76 }
77
78 ATH_MSG_DEBUG("Creating the SCT");
79 ATH_MSG_DEBUG("SCT Geometry Options: ");
80 ATH_MSG_DEBUG(" Alignable: " << (m_alignable.value() ? "true" : "false"));
81 ATH_MSG_DEBUG(" CosmicLayout: " << (m_cosmic ? "true" : "false"));
82 ATH_MSG_DEBUG(" VersionName: " << versionName);
83
84 SCT_Options options;
85 options.setAlignable(m_alignable.value());
86 options.setDynamicAlignFolders(m_useDynamicAlignFolders.value());
87
88 // Locate the top level experiment node
89 GeoModelExperiment* theExpt{nullptr};
90 ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
91
92 // Pass athena services to factory, etc
93 m_athenaComps.setDetStore(detStore().operator->());
94 m_athenaComps.setGeoDbTagSvc(&*m_geoDbTagSvc);
95 m_athenaComps.setRDBAccessSvc(&*accessSvc);
96 const SCT_ID* idHelper{nullptr};
97 ATH_CHECK(detStore()->retrieve(idHelper, "SCT_ID"));
98 m_athenaComps.setIdHelper(idHelper);
99
100 GeoPhysVol* world{theExpt->getPhysVol()};
101
102 // If we are using the SQLite reader, then we are not building the raw geometry but
103 // just locating it and attaching to readout geometry and various other actions
104 // taken in this factory.
105 if (sqliteReader) {
106 ATH_MSG_INFO("Building the geometry from the SQLite file");
107 SCT_DetectorFactoryLite theSCT{sqliteReader, &m_athenaComps, options};
108 theSCT.create(world);
109 m_manager = theSCT.getDetectorManager();
110 }
111 else {
112 SCT_DetectorFactory theSCT{&m_athenaComps, options};
113 theSCT.create(world);
114 m_manager = theSCT.getDetectorManager();
115 }
116
117 if (m_manager==nullptr) {
118 ATH_MSG_FATAL("SCT_DetectorManager not created");
119 return StatusCode::FAILURE;
120 }
121
122 ATH_MSG_DEBUG("Registering SCT_DetectorManager. ");
123 ATH_CHECK(detStore()->record(m_manager, m_manager->getName()));
124 theExpt->addManager(m_manager);
125
126 // Create a symLink to the SiDetectorManager base class
127 const SiDetectorManager* siDetManager{m_manager};
128 ATH_CHECK(detStore()->symLink(m_manager, siDetManager));
129
130 return StatusCode::SUCCESS;
131}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
const std::string & tag() const
Return version tag.
const std::string & node() const
Return the version node.
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
virtual void create(GeoPhysVol *world) override
virtual const InDetDD::SCT_DetectorManager * getDetectorManager() const override
virtual void create(GeoPhysVol *world)
virtual const InDetDD::SCT_DetectorManager * getDetectorManager() const
SCT_GeoModelAthenaComps m_athenaComps
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
BooleanProperty m_useDynamicAlignFolders

◆ manager() [1/2]

virtual GeoVDetectorManager * GeoModelTool::manager ( )
inlinevirtualinherited

Definition at line 21 of file GeoModelTool.h.

21{return m_detector;}
GeoVDetectorManager * m_detector

◆ manager() [2/2]

virtual const GeoVDetectorManager * GeoModelTool::manager ( ) const
inlinevirtualinherited

Definition at line 22 of file GeoModelTool.h.

22{return m_detector;}

Member Data Documentation

◆ m_alignable

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

Definition at line 34 of file SCT_DetectorTool.h.

34{this, "Alignable", true};

◆ m_athenaComps

SCT_GeoModelAthenaComps SCT_DetectorTool::m_athenaComps
private

Definition at line 40 of file SCT_DetectorTool.h.

◆ m_cosmic

bool SCT_DetectorTool::m_cosmic {false}
private

Definition at line 36 of file SCT_DetectorTool.h.

36{false};

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 28 of file GeoModelTool.h.

28{nullptr};

◆ m_geoDbTagSvc

ServiceHandle< IGeoDbTagSvc > SCT_DetectorTool::m_geoDbTagSvc {this,"GeoDbTagSvc","GeoDbTagSvc"}
private

Definition at line 42 of file SCT_DetectorTool.h.

42{this,"GeoDbTagSvc","GeoDbTagSvc"};

◆ m_manager

const InDetDD::SCT_DetectorManager* SCT_DetectorTool::m_manager {nullptr}
private

Definition at line 38 of file SCT_DetectorTool.h.

38{nullptr};

◆ m_useDynamicAlignFolders

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

Definition at line 35 of file SCT_DetectorTool.h.

35{this, "useDynamicAlignFolders", false};

The documentation for this class was generated from the following files: