ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_DetectorTool Class Referencefinal

#include <TRT_DetectorTool.h>

Inheritance diagram for TRT_DetectorTool:
Collaboration diagram for TRT_DetectorTool:

Public Member Functions

 TRT_DetectorTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~TRT_DetectorTool ()=default
virtual StatusCode create () override final
virtual StatusCode clear () override final
virtual StatusCode align () override final
virtual GeoVDetectorManager * manager ()
virtual const GeoVDetectorManager * manager () const

Protected Attributes

GeoVDetectorManager * m_detector {nullptr}

Private Attributes

Gaudi::Property< bool > m_useOldActiveGasMixture {this,"UseOldActiveGasMixture",false}
Gaudi::Property< bool > m_DC2CompatibleBarrelCoordinates {this,"DC2CompatibleBarrelCoordinates",false}
Gaudi::Property< bool > m_alignable {this,"Alignable",true}
Gaudi::Property< bool > m_useDynamicAlignFolders {this,"useDynamicAlignFolders",false}
Gaudi::Property< bool > m_doArgonMixture {this,"DoXenonArgonMixture",true}
Gaudi::Property< bool > m_doKryptonMixture {this,"DoKryptonMixture",true}
ServiceHandle< IGeoDbTagSvcm_geoDbTagSvc {this,"GeoDbTagSvc","GeoDbTagSvc"}
Gaudi::Property< bool > m_dumpStrawStatus {this, "DumpStrawStatus", false}
Gaudi::Property< std::string > m_strawStatusFile {this, "StrawStatusFile", ""}
ToolHandle< ITRT_StrawStatusSummaryToolm_sumTool {this, "SummaryTool", ""}
const InDetDD::TRT_DetectorManagerm_manager {nullptr}
InDetDD::AthenaComps m_athenaComps {"TRT_GeoModel"}
bool m_initialLayout {true}

Detailed Description

Definition at line 22 of file TRT_DetectorTool.h.

Constructor & Destructor Documentation

◆ TRT_DetectorTool()

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

Definition at line 25 of file TRT_DetectorTool.cxx.

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

◆ ~TRT_DetectorTool()

virtual TRT_DetectorTool::~TRT_DetectorTool ( )
virtualdefault

Member Function Documentation

◆ align()

StatusCode TRT_DetectorTool::align ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

Definition at line 168 of file TRT_DetectorTool.cxx.

170{
171 MsgStream log(msgSvc(), name());
172 if (!m_manager) {
173 msg(MSG::WARNING) << "Manager does not exist" << endmsg;
174 return StatusCode::FAILURE;
175 }
176 if (m_alignable) {
177 return const_cast<InDetDD::TRT_DetectorManager*>(m_manager)->align();
178 } else {
179 msg(MSG::DEBUG) << "Alignment disabled. No alignments applied" << endmsg;
180 return StatusCode::SUCCESS;
181 }
182}
#define endmsg
virtual StatusCode align() override final
Gaudi::Property< bool > m_alignable
const InDetDD::TRT_DetectorManager * m_manager
MsgStream & msg
Definition testRead.cxx:32

◆ clear()

StatusCode TRT_DetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

Definition at line 157 of file TRT_DetectorTool.cxx.

158{
159 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<InDetDD::TRT_DetectorManager>::ID(),m_manager->getName());
160 if(proxy) {
161 proxy->reset();
162 m_manager = nullptr;
163 }
164 return StatusCode::SUCCESS;
165}

◆ create()

StatusCode TRT_DetectorTool::create ( )
finaloverridevirtual

Definition at line 32 of file TRT_DetectorTool.cxx.

33{
34 // Get the detector configuration.
35 ATH_CHECK( m_geoDbTagSvc.retrieve());
36
37 ServiceHandle<IRDBAccessSvc> accessSvc(m_geoDbTagSvc->getParamSvcName(),name());
38 ATH_CHECK( accessSvc.retrieve());
39
40 // Locate the top level experiment node
41 GeoModelExperiment* theExpt{nullptr};
42 ATH_CHECK(detStore()->retrieve(theExpt,"ATLAS"));
43 GeoPhysVol *world = theExpt->getPhysVol();
44
45 // Pass athena services to factory, etc
46 m_athenaComps.setDetStore(detStore().operator->());
47 m_athenaComps.setGeoDbTagSvc(m_geoDbTagSvc.get());
48 m_athenaComps.setRDBAccessSvc(accessSvc.get());
49
50 std::unique_ptr<TRTStrawStatusAccessor> strawStatusAccessor;
51 ATH_CHECK(m_sumTool.retrieve(DisableTool{ !m_dumpStrawStatus }));
53 // Read Straw Statuses from the ASCII file
54 strawStatusAccessor = std::make_unique<TRTStrawStatusAccessor>();
55 const std::string strawStatusPath = PathResolverFindCalibFile(m_strawStatusFile);
56 if (strawStatusPath.empty()) {
57 ATH_MSG_ERROR("Failed to resolve path for StrawStatusFile: " << m_strawStatusFile << ", the job will fail now.");
58 return StatusCode::FAILURE;
59 }
60 ATH_MSG_VERBOSE("StrawStatusFile: " << m_strawStatusFile << ", resolved path: " << strawStatusPath);
61 strawStatusAccessor->fill(strawStatusPath);
62 }
63
64 GeoModelIO::ReadGeoModel* sqliteReader = m_geoDbTagSvc->getSqliteReader();
65 //
66 // If we are using the SQLite reader, then we are not building the raw geometry but
67 // just locating it and attaching to readout geometry and various other actions
68 // taken in this factory.
69 //
70 if (sqliteReader) {
71 ATH_MSG_INFO( " Building TRT geometry from GeoModel factory TRTDetectorFactory_Lite" );
72 TRTDetectorFactory_Lite theTRTFactory(sqliteReader,
74 std::move(strawStatusAccessor),
79 );
80
81 theTRTFactory.create(world);
82 m_manager=theTRTFactory.getDetectorManager();
83 }
84 else {
85 DecodeVersionKey versionKey(m_geoDbTagSvc.get(), "TRT");
86
87 ATH_MSG_INFO( "Building TRT with Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node() );
88
89 // Print the TRT version tag:
90 std::string trtVersionTag = accessSvc->getChildTag("TRT", versionKey.tag(), versionKey.node());
91 ATH_MSG_INFO("TRT Version: " << trtVersionTag );
92
93 // Check if version is empty. If so, then the TRT cannot be built. This may or may not be intentional. We
94 // just issue an INFO message.
95 if (trtVersionTag.empty()) {
96 ATH_MSG_INFO("No TRT Version. TRT will not be built." );
97 return StatusCode::SUCCESS;
98 }
99
100 ATH_MSG_DEBUG( "Keys for TRT Switches are " << versionKey.tag() << " " << versionKey.node() );
101 IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr("TRTSwitches", versionKey.tag(), versionKey.node());
102 const IRDBRecord *switches = (*switchSet)[0];
103
104 if (switches->getInt("DC1COMPATIBLE")) {
105 ATH_MSG_ERROR( "DC1COMPATIBLE flag set in database, but DC1 is no longer supported in the code!!");
106 return StatusCode::FAILURE;
107 }
108
109 m_DC2CompatibleBarrelCoordinates = switches->getInt("DC2COMPATIBLE");
110 m_useOldActiveGasMixture = ( switches->getInt("GASVERSION") == 0 );
111 m_initialLayout = switches->getInt("INITIALLAYOUT");
112
113 // Check if the new switches exists:
115 if ( switches->getInt("DOARGONMIXTURE") == 0) { m_doArgonMixture = false; }
116 else if ( switches->getInt("DOARGONMIXTURE") == 1) { m_doArgonMixture = true; }
117
118 if ( switches->getInt("DOKRYPTONMIXTURE") == 0) { m_doKryptonMixture = false; }
119 else if ( switches->getInt("DOKRYPTONMIXTURE") == 1) { m_doKryptonMixture = true; }
120 }
121
122 ATH_MSG_INFO( "Creating the TRT" );
123 ATH_MSG_INFO( "TRT Geometry Options:" << std::boolalpha );
124 ATH_MSG_INFO( " UseOldActiveGasMixture = " << m_useOldActiveGasMixture );
125 ATH_MSG_INFO( " Do Argon = " << m_doArgonMixture );
126 ATH_MSG_INFO( " Do Krypton = " << m_doKryptonMixture );
127 ATH_MSG_INFO( " DC2CompatibleBarrelCoordinates = " << m_DC2CompatibleBarrelCoordinates );
128 ATH_MSG_INFO( " InitialLayout = " << m_initialLayout );
129 ATH_MSG_INFO( " Alignable = " << m_alignable );
130 ATH_MSG_INFO( " VersioName = " << switches->getString("VERSIONNAME") );
131
132 ATH_MSG_INFO( " Building TRT geometry from GeoModel factory TRTDetectorFactory_Full" );
133
134 TRTDetectorFactory_Full theTRTFactory(&m_athenaComps,
135 m_dumpStrawStatus ? m_sumTool.get() : nullptr,
136 std::move(strawStatusAccessor),
143 );
144 theTRTFactory.create(world);
145 m_manager=theTRTFactory.getDetectorManager();
146
147 }
148
149 // Register the TRTDetectorNode instance with the Transient Detector Store
150 if (!m_manager) return StatusCode::FAILURE;
151
152 theExpt->addManager(m_manager);
153 ATH_CHECK(detStore()->record(m_manager,m_manager->getName()));
154 return StatusCode::SUCCESS;
155}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
InDetDD::AthenaComps m_athenaComps
Gaudi::Property< bool > m_dumpStrawStatus
Gaudi::Property< bool > m_useOldActiveGasMixture
Gaudi::Property< bool > m_DC2CompatibleBarrelCoordinates
Gaudi::Property< bool > m_doArgonMixture
Gaudi::Property< bool > m_doKryptonMixture
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
ToolHandle< ITRT_StrawStatusSummaryTool > m_sumTool
Gaudi::Property< std::string > m_strawStatusFile
Gaudi::Property< bool > 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

Gaudi::Property<bool> TRT_DetectorTool::m_alignable {this,"Alignable",true}
private

Definition at line 40 of file TRT_DetectorTool.h.

40{this,"Alignable",true};

◆ m_athenaComps

InDetDD::AthenaComps TRT_DetectorTool::m_athenaComps {"TRT_GeoModel"}
private

Definition at line 55 of file TRT_DetectorTool.h.

55{"TRT_GeoModel"};

◆ m_DC2CompatibleBarrelCoordinates

Gaudi::Property<bool> TRT_DetectorTool::m_DC2CompatibleBarrelCoordinates {this,"DC2CompatibleBarrelCoordinates",false}
private

Definition at line 39 of file TRT_DetectorTool.h.

39{this,"DC2CompatibleBarrelCoordinates",false};

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 28 of file GeoModelTool.h.

28{nullptr};

◆ m_doArgonMixture

Gaudi::Property<bool> TRT_DetectorTool::m_doArgonMixture {this,"DoXenonArgonMixture",true}
private

Definition at line 44 of file TRT_DetectorTool.h.

44{this,"DoXenonArgonMixture",true};

◆ m_doKryptonMixture

Gaudi::Property<bool> TRT_DetectorTool::m_doKryptonMixture {this,"DoKryptonMixture",true}
private

Definition at line 46 of file TRT_DetectorTool.h.

46{this,"DoKryptonMixture",true};

◆ m_dumpStrawStatus

Gaudi::Property<bool> TRT_DetectorTool::m_dumpStrawStatus {this, "DumpStrawStatus", false}
private

Definition at line 50 of file TRT_DetectorTool.h.

50{this, "DumpStrawStatus", false};

◆ m_geoDbTagSvc

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

Definition at line 48 of file TRT_DetectorTool.h.

48{this,"GeoDbTagSvc","GeoDbTagSvc"};

◆ m_initialLayout

bool TRT_DetectorTool::m_initialLayout {true}
private

Definition at line 56 of file TRT_DetectorTool.h.

56{true};

◆ m_manager

const InDetDD::TRT_DetectorManager* TRT_DetectorTool::m_manager {nullptr}
private

Definition at line 54 of file TRT_DetectorTool.h.

54{nullptr};

◆ m_strawStatusFile

Gaudi::Property<std::string> TRT_DetectorTool::m_strawStatusFile {this, "StrawStatusFile", ""}
private

Definition at line 51 of file TRT_DetectorTool.h.

51{this, "StrawStatusFile", ""};

◆ m_sumTool

ToolHandle<ITRT_StrawStatusSummaryTool> TRT_DetectorTool::m_sumTool {this, "SummaryTool", ""}
private

Definition at line 52 of file TRT_DetectorTool.h.

52{this, "SummaryTool", ""}; // added for Argon

◆ m_useDynamicAlignFolders

Gaudi::Property<bool> TRT_DetectorTool::m_useDynamicAlignFolders {this,"useDynamicAlignFolders",false}
private

Definition at line 41 of file TRT_DetectorTool.h.

41{this,"useDynamicAlignFolders",false};

◆ m_useOldActiveGasMixture

Gaudi::Property<bool> TRT_DetectorTool::m_useOldActiveGasMixture {this,"UseOldActiveGasMixture",false}
private

Definition at line 38 of file TRT_DetectorTool.h.

38{this,"UseOldActiveGasMixture",false};

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