ATLAS Offline Software
LUCID_DetectorTool.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 "LUCID_DetectorTool.h"
6 #include "LUCID_DetectorFactory.h"
8 
11 #include "GaudiKernel/IService.h"
12 #include "GaudiKernel/ISvcLocator.h"
13 #include "GaudiKernel/MsgStream.h"
15 
16 #include "StoreGate/StoreGateSvc.h"
17 
20 #include "SGTools/DataProxy.h"
21 
23  const std::string& name,
24  const IInterface* parent):
26  m_manager(nullptr)
27 {
28 }
29 
31 
33 
34  MsgStream log(msgSvc(), name());
35 
36  ATH_MSG_INFO("Building LUCID geometry");
37 
38  ServiceHandle<IGeoDbTagSvc> geoDbTag("GeoDbTagSvc", name());
39  ATH_CHECK( geoDbTag.retrieve() );
40 
41  ServiceHandle<IRDBAccessSvc> raccess("RDBAccessSvc", name());
42  ATH_CHECK( raccess.retrieve() );
43 
44  const std::string AtlasVersion = geoDbTag->atlasVersion();
45  const std::string LucidVersion = raccess->getChildTag("LUCID",AtlasVersion,"ATLAS");
46 
47  if(LucidVersion.empty()) {
48  ATH_MSG_DEBUG("LUCID is not part of the selected ATLAS geometry. Skipping");
49  return StatusCode::SUCCESS;
50  }
51 
52  GeoModelExperiment* theExpt = nullptr;
53  ATH_CHECK( detStore()->retrieve(theExpt, "ATLAS") );
54 
55  if(nullptr == m_detector) {
56 
57  GeoPhysVol* world = &*theExpt->getPhysVol();
58 
59  LUCID_DetectorFactory theLUCID_Factory(detStore().get(),raccess.get());
60 
61  theLUCID_Factory.create(world);
62  m_manager = theLUCID_Factory.getDetectorManager();
63  theExpt->addManager(m_manager);
64 
65  ATH_CHECK( detStore()->record(m_manager, m_manager->getName()) );
66  return StatusCode::SUCCESS;
67  }
68 
69  return StatusCode::FAILURE;
70 }
71 
73 
75 
76  if(proxy) {
77  proxy->reset();
78  m_manager = nullptr;
79  }
80 
81  proxy = detStore()->proxy(ClassID_traits<GeoBorderSurfaceContainer>::ID(), "LUCID", false);
82 
83  if(proxy) {
84  proxy->reset();
85  }
86 
87  return StatusCode::SUCCESS;
88 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
LUCID_DetectorTool::m_manager
const LUCID_DetectorManager * m_manager
Definition: LUCID_DetectorTool.h:22
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LUCID_DetectorFactory.h
LUCID_DetectorTool::~LUCID_DetectorTool
virtual ~LUCID_DetectorTool() override final
Definition: LUCID_DetectorTool.cxx:30
GeoModelExperiment
Definition: GeoModelExperiment.h:32
LUCID_DetectorFactory::create
virtual void create(GeoPhysVol *)
Definition: LUCID_DetectorFactory.cxx:54
GeoBorderSurfaceContainer.h
GeoModelExperiment.h
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GeoModelTool
Definition: GeoModelTool.h:17
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LUCID_DetectorManager.h
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:228
LUCID_DetectorTool::LUCID_DetectorTool
LUCID_DetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LUCID_DetectorTool.cxx:22
LUCID_DetectorTool::create
virtual StatusCode create() override final
Definition: LUCID_DetectorTool.cxx:32
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
LUCID_DetectorFactory::getDetectorManager
virtual const LUCID_DetectorManager * getDetectorManager() const
Definition: LUCID_DetectorFactory.cxx:416
LUCID_DetectorTool.h
LUCID_DetectorTool::clear
virtual StatusCode clear() override final
Definition: LUCID_DetectorTool.cxx:72
SG::DataProxy
Definition: DataProxy.h:45
StoreGateSvc.h
IGeoDbTagSvc.h
LUCID_DetectorFactory
Definition: LUCID_DetectorFactory.h:23
ServiceHandle< IGeoDbTagSvc >
DataProxy.h