ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Attributes | List of all members
InDetServMatTool Class Referencefinal

#include <InDetServMatTool.h>

Inheritance diagram for InDetServMatTool:
Collaboration diagram for InDetServMatTool:

Public Member Functions

 InDetServMatTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor(s) More...
 
virtual ~InDetServMatTool () override
 Destructor. More...
 
virtual StatusCode create () override
 Create the Detector Node corresponding to this tool. More...
 
virtual StatusCode clear () override
 
virtual GeoVDetectorManager * manager ()
 The Detector Node corresponding to this tool. More...
 
virtual const GeoVDetectorManager * manager () const
 
virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE () override
 
virtual StatusCode align (IOVSVC_CALLBACK_ARGS) override
 

Protected Attributes

GeoVDetectorManager * m_detector
 

Private Attributes

ServiceHandle< IGeoDbTagSvcm_geoDbTagSvc
 
ServiceHandle< IGeometryDBSvcm_geometryDBSvc
 
ToolHandle< IInDetServMatBuilderToolm_builderTool
 
bool m_devVersion {false}
 
std::string m_overrideVersionName {}
 
const InDetDD::InDetServMatManagerm_manager {nullptr}
 
InDetServMatAthenaCompsm_athenaComps {nullptr}
 

Detailed Description

Definition at line 24 of file InDetServMatTool.h.

Constructor & Destructor Documentation

◆ InDetServMatTool()

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

Constructor(s)

Definition at line 29 of file InDetServMatTool.cxx.

31  m_geoDbTagSvc("GeoDbTagSvc",name),
32  m_geometryDBSvc("InDetGeometryDBSvc",name),
33  m_builderTool("")
34 {
35  declareProperty("DevVersion",m_devVersion);
36  declareProperty("OverrideVersionName", m_overrideVersionName);
37  declareProperty("GeometryDBSvc", m_geometryDBSvc);
38  declareProperty("ServiceBuilderTool", m_builderTool);
39  declareProperty("GeoDbTagSvc", m_geoDbTagSvc);
40  // add here the properties
41 }

◆ ~InDetServMatTool()

InDetServMatTool::~InDetServMatTool ( )
overridevirtual

Destructor.

Definition at line 45 of file InDetServMatTool.cxx.

46 {
47  delete m_athenaComps;
48 }

Member Function Documentation

◆ align()

StatusCode GeoModelTool::align ( IOVSVC_CALLBACK_ARGS  )
overridevirtualinherited

Reimplemented in ALFA_DetectorTool, HGTD_DetectorTool, TRT_DetectorTool, LArDetectorToolNV, PixelDetectorTool, and SCT_DetectorTool.

Definition at line 33 of file GeoModelTool.cxx.

34 {
35  return StatusCode::SUCCESS;
36 }

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode registerCallback GeoModelTool::ATLAS_NOT_THREAD_SAFE ( )
overridevirtualinherited

◆ clear()

StatusCode InDetServMatTool::clear ( )
overridevirtual

Reimplemented from GeoModelTool.

Definition at line 195 of file InDetServMatTool.cxx.

196 {
198  if(proxy) {
199  proxy->reset();
200  m_manager = nullptr;
201  }
202  return StatusCode::SUCCESS;
203 }

◆ create()

StatusCode InDetServMatTool::create ( )
overridevirtual

Create the Detector Node corresponding to this tool.

Definition at line 53 of file InDetServMatTool.cxx.

54 {
55 
56 
57  if (m_devVersion) {
58  msg(MSG::WARNING) << "You are using a development version. There are no guarantees of stability"
59  << endmsg;
60  }
61 
62  //
63  // Locate the top level experiment node
64  //
65  GeoModelExperiment * theExpt;
66  if (StatusCode::SUCCESS != detStore()->retrieve( theExpt, "ATLAS" )) {
67  msg(MSG::ERROR)
68  << "Could not find GeoModelExperiment ATLAS"
69  << endmsg;
70  return (StatusCode::FAILURE);
71  }
72 
73  StatusCode result = StatusCode::SUCCESS;
74 
75 
76  // Get the detector configuration.
77  StatusCode sc = m_geoDbTagSvc.retrieve();
78  if (sc.isFailure()) {
79  msg(MSG::FATAL) << "Could not locate GeoDbTagSvc" << endmsg;
80  return (StatusCode::FAILURE);
81  }
82 
83  ServiceHandle<IRDBAccessSvc> accessSvc(m_geoDbTagSvc->getParamSvcName(),name());
84  ATH_CHECK( accessSvc.retrieve());
85 
86  GeoPhysVol *world=&*theExpt->getPhysVol();
87 
88  GeoModelIO::ReadGeoModel* sqliteReader = m_geoDbTagSvc->getSqliteReader();
89 
90  if (sqliteReader) {
91  InDetServMatFactory_Lite factoryLite;;
92  factoryLite.create(world);
93  m_manager = factoryLite.getDetectorManager();
94  }
95  else {
96  DecodeVersionKey versionKey(&*m_geoDbTagSvc, "InnerDetector");
97 
98  std::string versionTag = accessSvc->getChildTag("InDetServices", versionKey.tag(), versionKey.node());
99  if(msgLvl(MSG::DEBUG)) msg() << "versionTag=" << versionTag <<" %%%"<< endmsg;
100 
101  // If versionTag is NULL then don't build.
102  if (versionTag.empty()) {
103  msg(MSG::INFO) << "No InDetService Version. InDetService will not be built." << endmsg;
104  if(msgLvl(MSG::DEBUG)) msg() << "InnerDetector Version Tag: " << versionKey.tag() << " at Node: "
105  << versionKey.node() << endmsg;
106  return StatusCode::SUCCESS;
107  }
108 
109  if(msgLvl(MSG::DEBUG)) msg() << "Keys for InDetServMat Switches are " << versionKey.tag() << " " << versionKey.node() << endmsg;
110 
111  std::string versionName;
112  std::string descrName="noDescr";
113  if (!accessSvc->getChildTag("InDetServSwitches", versionKey.tag(), versionKey.node()).empty()) {
114  IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr("InDetServSwitches", versionKey.tag(), versionKey.node());
115  const IRDBRecord *switchTable = (*switchSet)[0];
116  versionName = switchTable->getString("VERSIONNAME");
117  if (!switchTable->isFieldNull("DESCRIPTION")) descrName = switchTable->getString("DESCRIPTION");
118  }
119 
120  if (!m_overrideVersionName.empty()) {
121  versionName = m_overrideVersionName;
122  msg(MSG::INFO) << "Overriding version name: " << versionName << endmsg;
123  }
124 
125  msg(MSG::INFO) << "Building Inner Detector Service Material. Version: " << versionName << endmsg;
126 
127  // Retrieve the Geometry DB Interface
128  sc = m_geometryDBSvc.retrieve();
129  if (sc.isFailure()) {
130  msg(MSG::FATAL) << "Could not locate Geometry DB Interface: " << m_geometryDBSvc.name() << endmsg;
131  return (StatusCode::FAILURE);
132  }
133 
134  // Pass athena services to factory, etc
136  m_athenaComps->setDetStore(detStore().operator->());
138  m_athenaComps->setRDBAccessSvc(&*accessSvc);
140 
141  // Retrieve builder tool (SLHC only)
142  if (versionName == "SLHC") {
143  if (!m_builderTool.empty()) {
144  sc = m_builderTool.retrieve();
145  if (!sc.isFailure()) {
146  msg(MSG::INFO) << "Service builder tool retrieved: " << m_builderTool << endmsg;
148  } else {
149  msg(MSG::ERROR) << "Could not retrieve " << m_builderTool << ", some services will not be built." << endmsg;
150  }
151  } else {
152  // This will become an error once the tool is ready.
153  //msg(MSG::ERROR) << "Service builder tool not specified. Some services will not be built" << endmsg;
154  msg(MSG::INFO) << "Service builder tool not specified." << endmsg;
155  }
156  }
157 
158  if(!m_detector) {
159  try {
160  if(!m_devVersion) {
161  if (versionName == "CSC") {
162  if(msgLvl(MSG::DEBUG)) msg() << " InDetServMat Factory CSC " << endmsg;
164  theIDSM.create(world);
165  m_manager=theIDSM.getDetectorManager();
166  } else {
167  // Unrecognized name.
168  msg(MSG::ERROR) << " Unrecognized VersionName: " << versionName << endmsg;
169  return StatusCode::FAILURE;
170  }
171  } else { // Development Versions
172  // CSC
173  if(msgLvl(MSG::DEBUG)) msg() << " InDetServMat Factory Development version " << endmsg;
175  theIDSM.create(world);
176  m_manager=theIDSM.getDetectorManager();
177  }
178  }
179  catch (const std::bad_alloc&) {
180  msg(MSG::FATAL) << "Could not create new InDetServMatNode!" << endmsg;
181  return StatusCode::FAILURE;
182  }
183  }
184  }
185  if (m_manager) {
186  theExpt->addManager(m_manager);
187  CHECK( detStore()->record (m_manager, m_manager->getName()) );
188  } else {
189  msg(MSG::FATAL) << "Could not create InDetServMatManager!" << endmsg;
190  return StatusCode::FAILURE;
191  }
192  return result;
193 }

◆ 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_athenaComps

InDetServMatAthenaComps* InDetServMatTool::m_athenaComps {nullptr}
private

Definition at line 43 of file InDetServMatTool.h.

◆ m_builderTool

ToolHandle<IInDetServMatBuilderTool> InDetServMatTool::m_builderTool
private

Definition at line 38 of file InDetServMatTool.h.

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector
protectedinherited

Definition at line 36 of file GeoModelTool.h.

◆ m_devVersion

bool InDetServMatTool::m_devVersion {false}
private

Definition at line 40 of file InDetServMatTool.h.

◆ m_geoDbTagSvc

ServiceHandle< IGeoDbTagSvc > InDetServMatTool::m_geoDbTagSvc
private

Definition at line 36 of file InDetServMatTool.h.

◆ m_geometryDBSvc

ServiceHandle< IGeometryDBSvc > InDetServMatTool::m_geometryDBSvc
private

Definition at line 37 of file InDetServMatTool.h.

◆ m_manager

const InDetDD::InDetServMatManager* InDetServMatTool::m_manager {nullptr}
private

Definition at line 42 of file InDetServMatTool.h.

◆ m_overrideVersionName

std::string InDetServMatTool::m_overrideVersionName {}
private

Definition at line 41 of file InDetServMatTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
InDetServMatAthenaComps
Class to hold various Athena components.
Definition: InDetServMatAthenaComps.h:13
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
get_generator_info.result
result
Definition: get_generator_info.py:21
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
InDetServMatFactory_Lite
Definition: InDetServMatFactory_Lite.h:13
IRDBRecord::getString
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
GeoModelExperiment
Definition: GeoModelExperiment.h:32
GeoModelTool::GeoModelTool
GeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
Definition: GeoModelTool.cxx:12
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
InDetDD::AthenaComps::setGeoDbTagSvc
void setGeoDbTagSvc(IGeoDbTagSvc *)
Definition: InDetDDAthenaComps.cxx:22
InDetDD::AthenaComps::setDetStore
void setDetStore(StoreGateSvc *)
Definition: InDetDDAthenaComps.cxx:17
InDetServMatTool::m_athenaComps
InDetServMatAthenaComps * m_athenaComps
Definition: InDetServMatTool.h:43
InDetServMatFactory
Definition: InDetServMatFactory.h:15
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
InDetServMatAthenaComps::setBuilderTool
void setBuilderTool(IInDetServMatBuilderTool *builderTool)
Definition: InDetServMatAthenaComps.cxx:15
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
InDetServMatTool::m_overrideVersionName
std::string m_overrideVersionName
Definition: InDetServMatTool.h:41
InDetDD::AthenaComps::setRDBAccessSvc
void setRDBAccessSvc(IRDBAccessSvc *)
Definition: InDetDDAthenaComps.cxx:27
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
InDetServMatTool::m_geometryDBSvc
ServiceHandle< IGeometryDBSvc > m_geometryDBSvc
Definition: InDetServMatTool.h:37
InDetServMatTool::m_geoDbTagSvc
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition: InDetServMatTool.h:36
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
InDetServMatTool::m_builderTool
ToolHandle< IInDetServMatBuilderTool > m_builderTool
Definition: InDetServMatTool.h:38
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:221
InDetServMatTool::m_manager
const InDetDD::InDetServMatManager * m_manager
Definition: InDetServMatTool.h:42
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
IRDBRecord::isFieldNull
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
InDetServMatTool::m_devVersion
bool m_devVersion
Definition: InDetServMatTool.h:40
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
InDetDD::AthenaComps::setGeometryDBSvc
void setGeometryDBSvc(IGeometryDBSvc *)
Definition: InDetDDAthenaComps.cxx:32
InDetServMatFactory_Lite::getDetectorManager
virtual const InDetDD::InDetServMatManager * getDetectorManager() const override
Definition: InDetServMatFactory_Lite.cxx:22
SG::DataProxy
Definition: DataProxy.h:44
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
InDetServMatFactory_Lite::create
virtual void create(GeoPhysVol *world) override
Definition: InDetServMatFactory_Lite.cxx:11
ServiceHandle< IRDBAccessSvc >