ATLAS Offline Software
LUCID_DetectorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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  log << MSG::INFO << "Building LUCID geometry" << endmsg;
37 
38  IGeoDbTagSvc* geoDbTag{nullptr};
39  StatusCode sc = service("GeoDbTagSvc",geoDbTag);
40  if (sc.isFailure()) { log << MSG::FATAL << "Could not locate GeoDbTagSvc" << endmsg; return StatusCode::FAILURE; }
41 
42  IRDBAccessSvc* raccess = nullptr;
43 
44  sc = service("RDBAccessSvc",raccess);
45 
46  if(sc.isFailure()) { log << MSG::FATAL << "Could not locate RDBAccessSvc" << endmsg; return StatusCode::FAILURE; }
47 
48  std::string AtlasVersion = geoDbTag->atlasVersion();
49  std::string LucidVersion = raccess->getChildTag("LUCID",AtlasVersion,"ATLAS");
50 
51  if(LucidVersion.empty()) {
52  log << MSG::DEBUG << "LUCID is not part of the selected ATLAS geometry. Skipping" << endmsg;
53  return StatusCode::SUCCESS;
54  }
55 
56  GeoModelExperiment* theExpt;
57 
58  if (StatusCode::SUCCESS != detStore()->retrieve(theExpt, "ATLAS")) {
59 
60  log << MSG::ERROR << "Could not find GeoModelExperiment ATLAS" << endmsg;
61  return StatusCode::FAILURE;
62  }
63 
64  if(nullptr == m_detector) {
65 
66  GeoPhysVol* world = &*theExpt->getPhysVol();
67 
68  LUCID_DetectorFactory theLUCID_Factory(detStore().operator->(),raccess);
69 
70  theLUCID_Factory.create(world);
71  m_manager = theLUCID_Factory.getDetectorManager();
72  theExpt->addManager(m_manager);
73 
74  sc = detStore()->record(m_manager,
75  m_manager->getName());
76 
77  if (sc.isFailure()) { log << MSG::ERROR << "Could not register LUCID detector manager" << endmsg; return StatusCode::FAILURE; }
78 
79  return StatusCode::SUCCESS;
80  }
81 
82  return StatusCode::FAILURE;
83 }
84 
86 
88 
89  if(proxy) {
90  proxy->reset();
91  m_manager = nullptr;
92  }
93 
94  proxy = detStore()->proxy(ClassID_traits<GeoBorderSurfaceContainer>::ID(), "LUCID", false);
95 
96  if(proxy) {
97  proxy->reset();
98  }
99 
100  return StatusCode::SUCCESS;
101 }
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
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
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
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
GeoModelExperiment.h
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
IRDBAccessSvc::getChildTag
virtual std::string getChildTag(const std::string &childNode, const std::string &parentTag, const std::string &parentNode, const std::string &connName="ATLASDD")=0
Gets the tag name for the node by giving its parent node tag.
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...
IRDBAccessSvc
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
Definition: IRDBAccessSvc.h:45
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
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
IGeoDbTagSvc
Definition: IGeoDbTagSvc.h:26
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:195
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
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LUCID_DetectorTool.h
LUCID_DetectorTool::clear
virtual StatusCode clear() override final
Definition: LUCID_DetectorTool.cxx:85
SG::DataProxy
Definition: DataProxy.h:44
StoreGateSvc.h
IGeoDbTagSvc.h
LUCID_DetectorFactory
Definition: LUCID_DetectorFactory.h:23
DataProxy.h