ATLAS Offline Software
BeamPipeDetectorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "BeamPipeDetectorTool.h"
9 
12 #include "GaudiKernel/IService.h"
13 #include "GaudiKernel/ISvcLocator.h"
14 
15 #include "StoreGate/StoreGateSvc.h"
16 
19 #include "SGTools/DataProxy.h"
20 
21 #include "GeoModelKernel/GeoVolumeCursor.h"
22 
24  const std::string& name,
25  const IInterface* parent ):
27 {
28 }
29 
31 
32 
34 {
35  ATH_MSG_INFO("Building Beam Pipe");
36 
37  SmartIF<IGeoDbTagSvc> geoDbTag{Gaudi::svcLocator()->service("GeoDbTagSvc")};
38  ATH_CHECK(geoDbTag.isValid());
39 
40  std::string atlasVersion = geoDbTag->atlasVersion();
41  std::string versionNode = "ATLAS";
42 
43  GeoModelExperiment* theExpt{nullptr};
44  ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
45 
46  GeoPhysVol* world=theExpt->getPhysVol();
47 
48  ServiceHandle<IRDBAccessSvc> accessSvc(geoDbTag->getParamSvcName(),name());
49  ATH_CHECK(accessSvc.retrieve());
50 
51  GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
52  if (sqliteReader) {
53  BeamPipeDetectorFactory_Lite theBeamPipeFactory;
54  theBeamPipeFactory.create(world);
55  m_manager = theBeamPipeFactory.getDetectorManager();
56  }
57  else {
58  // Check we have the beampipe and print its version
59  // Print the version tag:
60  std::string beampipeVersionTag;
61  beampipeVersionTag = accessSvc->getChildTag("BeamPipe", atlasVersion,versionNode);
62  ATH_MSG_DEBUG("Beampipe Version: " << beampipeVersionTag);
63 
64  if (beampipeVersionTag.empty()) {
65  ATH_MSG_INFO("No BeamPipe Version. Beam pipe will not be built.");
66  }
67  else {
68  BeamPipeDetectorFactory theBeamPipeFactory(detStore().operator->(),accessSvc.operator->());
69  theBeamPipeFactory.setTagNode(atlasVersion,versionNode,m_mode);
70  theBeamPipeFactory.create(world);
71 
72  m_manager = theBeamPipeFactory.getDetectorManager();
73  }
74  }
75 
76  if (m_manager) {
77  theExpt->addManager(m_manager);
78  ATH_CHECK(detStore()->record(m_manager,m_manager->getName()));
79  return StatusCode::SUCCESS;
80  }
81 
82  return StatusCode::FAILURE;
83 }
84 
86 {
88  if(proxy) {
89  proxy->reset();
90  m_manager = nullptr;
91  }
92  return StatusCode::SUCCESS;
93 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
BeamPipeDetectorFactory_Lite::getDetectorManager
virtual const BeamPipeDetectorManager * getDetectorManager() const override
Definition: BeamPipeDetectorFactory_Lite.cxx:28
BeamPipeDetectorTool::m_mode
StringProperty m_mode
Definition: BeamPipeDetectorTool.h:26
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
BeamPipeDetectorTool::create
virtual StatusCode create() override final
Definition: BeamPipeDetectorTool.cxx:33
GeoModelExperiment
Definition: GeoModelExperiment.h:32
BeamPipeDetectorTool::~BeamPipeDetectorTool
virtual ~BeamPipeDetectorTool() override final
BeamPipeDetectorTool::BeamPipeDetectorTool
BeamPipeDetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: BeamPipeDetectorTool.cxx:23
GeoModelExperiment.h
BeamPipeDetectorManager.h
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
BeamPipeDetectorFactory_Lite.h
BeamPipeDetectorTool::clear
virtual StatusCode clear() override final
Definition: BeamPipeDetectorTool.cxx:85
BeamPipeDetectorFactory.h
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
BeamPipeDetectorFactory::setTagNode
void setTagNode(std::string tag, std::string node, std::string mode)
Definition: BeamPipeDetectorFactory.cxx:310
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GeoModelTool
Definition: GeoModelTool.h:17
BeamPipeDetectorFactory
Definition: BeamPipeDetectorFactory.h:19
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
BeamPipeDetectorFactory_Lite::create
virtual void create(GeoPhysVol *world) override
Definition: BeamPipeDetectorFactory_Lite.cxx:18
BeamPipeDetectorTool.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
BeamPipeDetectorFactory_Lite
Definition: BeamPipeDetectorFactory_Lite.h:12
BeamPipeDetectorTool::m_manager
const BeamPipeDetectorManager * m_manager
Definition: BeamPipeDetectorTool.h:25
SG::DataProxy
Definition: DataProxy.h:45
StoreGateSvc.h
IGeoDbTagSvc.h
ServiceHandle< IRDBAccessSvc >
DataProxy.h