ATLAS Offline Software
LArDetectorToolH62002.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
9 
10 
13 #include "GaudiKernel/IService.h"
14 #include "GaudiKernel/ISvcLocator.h"
15 #include "GaudiKernel/MsgStream.h"
16 #include "StoreGate/StoreGateSvc.h"
17 
21 
22 
26 LArDetectorToolH62002::LArDetectorToolH62002( const std::string& type, const std::string& name, const IInterface* parent )
28 {
29 }
30 
35 {
36  // This will need to be modified once we register the Toy DetectorNode in
37  // the Transient Detector Store
38  if ( nullptr != m_detector ) {
39  delete m_detector;
40  m_detector = nullptr;
41  }
42 }
43 
49 {
50  MsgStream log(msgSvc(), name());
51 
52  // Get the detector configuration.
53  IGeoDbTagSvc *geoDbTag;
54  ATH_CHECK(service ("GeoModelSvc",geoDbTag));
55 
56  std::string AtlasVersion = geoDbTag->atlasVersion();
57  std::string LArVersion = geoDbTag->LAr_VersionOverride();
58 
59  IRDBAccessSvc *accessSvc;
60  ATH_CHECK(service("RDBAccessSvc",accessSvc));
61 
62  std::string detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
63  std::string detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
64  log << MSG::INFO << "Keys for LAr are " << detectorKey << " " << detectorNode << endmsg;
65 
66 
67  log << MSG::INFO << "Creating the LAr " << endmsg;
68  log << MSG::INFO << "LAr Geometry Options:" << endmsg;
69 
70  //
71  // Locate the top level experiment node
72  //
73  GeoModelExperiment* theExpt = nullptr;
74  if (StatusCode::SUCCESS != detStore()->retrieve( theExpt, "ATLAS" )) {
75  log << MSG::ERROR
76  << "Could not find GeoModelExperiment ATLAS"
77  << endmsg;
78  return (StatusCode::FAILURE);
79  }
80 
81 
82  // determine the geometry layout - Atlas/Testbeam
83  std::string geometryLayout = "Atlas";
84  std::string LArTag = accessSvc->getChildTag("LAr",detectorKey,detectorNode);
85 
86  //if(LArTag.find("H6")!=std::string::npos) {
87  // geometryLayout = "H6";
88  //}
89 
90 
91  LArGeo::LArDetectorFactoryH62002 theLArFactory(detStore().operator->());
92 
93 
94 
95 
96 
97  if ( nullptr == m_detector ) {
98  // Create the H62002Node instance
99  try {
100  //
101  // This strange way of casting is to avoid an
102  // utterly brain damaged compiler warning.
103  //
104  GeoIntrusivePtr<GeoPhysVol>world=&*theExpt->getPhysVol();
105  theLArFactory.create(world);
106  } catch (const std::bad_alloc&) {
107  log << MSG::FATAL << "Could not create new H62002Node!" << endmsg;
108  return StatusCode::FAILURE;
109  }
110  // Register the H62002Node instance with the Transient Detector Store
111  theExpt->addManager(theLArFactory.getDetectorManager());
112  ATH_CHECK(detStore()->record(theLArFactory.getDetectorManager(),
113  theLArFactory.getDetectorManager()->getName()));
114 
115 
116  return StatusCode::SUCCESS;
117 
118 
119  }
120 
121 
122  return StatusCode::FAILURE;
123 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
GeoModelExperiment
Definition: GeoModelExperiment.h:32
IGeoDbTagSvc::LAr_VersionOverride
virtual const std::string & LAr_VersionOverride() const =0
LArDetectorFactoryH62002.h
LArGeo::LArDetectorFactoryH62002
Definition: LArDetectorFactoryH62002.h:17
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
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GeoModelTool
Definition: GeoModelTool.h:17
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IGeoDbTagSvc
Definition: IGeoDbTagSvc.h:26
LArDetectorToolH62002::~LArDetectorToolH62002
virtual ~LArDetectorToolH62002() override final
Destructor.
Definition: LArDetectorToolH62002.cxx:34
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
LArDetectorToolH62002.h
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
LArDetectorToolH62002::LArDetectorToolH62002
LArDetectorToolH62002(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
Definition: LArDetectorToolH62002.cxx:26
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
IGeoDbTagSvc::atlasVersion
virtual const std::string & atlasVersion() const =0
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArDetectorToolH62002::create
virtual StatusCode create() override final
Create the Detector Node corresponding to this tool.
Definition: LArDetectorToolH62002.cxx:48
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
StoreGateSvc.h
HECDetectorManager.h
IGeoDbTagSvc.h