53{
55 ATH_MSG_FATAL(
"LAr GeoModel description has already been built. LArDetectorToolNV::create() cannot be called more than once!");
56 return StatusCode::FAILURE;
57 }
58
59
60 LArHVManager* hvManager = new LArHVManager();;
62
63
64 ServiceHandle<IGeoDbTagSvc> geoDbTag(
"GeoDbTagSvc",
name());
66
67 ServiceHandle<IRDBAccessSvc> accessSvc(geoDbTag->getParamSvcName(),
name());
69
70 GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
71 std::string detectorKey{""};
72 std::string detectorNode{""};
73
74 if(!sqliteReader) {
75
77 std::string LArVersion = geoDbTag->LAr_VersionOverride();
78
79 detectorKey = LArVersion.empty() ?
AtlasVersion : LArVersion;
80 detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
81 ATH_MSG_INFO(
"Keys for LAr are " << detectorKey <<
" " << detectorNode);
82 ATH_MSG_INFO(
"Building LAr version " << geoDbTag->LAr_Version()
83 << " while ATLAS version is " << AtlasVersion);
84 }
85
86 IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr(
"LArSwitches", detectorKey, detectorNode);
87 if ((*switchSet).size()==0) {
88 ATH_MSG_ERROR(
"Unable to retrieve LArSwitches from Geometry DB");
89 return StatusCode::FAILURE;
90 }
91
92 const IRDBRecord* switches = (*switchSet)[0];
94
97 }
98
101 }
102
107
108
109 GeoModelExperiment* theExpt = nullptr;
111
112
113 int testbeam = 0;
114
115 GeoIntrusivePtr<GeoPhysVol>world=theExpt->
getPhysVol();
116 if(sqliteReader) {
117
118 LArGeo::LArDetectorFactoryLite theLArFactoryLite(
detStore().operator->()
119 , accessSvc.operator->()
120 , sqliteReader
121 , hvManager);
123 theLArFactoryLite.create(world);
124 m_manager = theLArFactoryLite.getDetectorManager();
125
126 std::unique_ptr<LArGeo::VDetectorParameters>
params = std::make_unique<LArGeo::RAL>();
128 }
129 else {
130
131
132
133
134 std::string LArTag = accessSvc->getChildTag("LAr",detectorKey,detectorNode);
135 if(LArTag.find("H8")!=std::string::npos) {
136 testbeam = 1 ;
137 }
138 else if(LArTag.find("H6")!=std::string::npos) {
139 testbeam = 2 ;
140 }
141
142 LArGeo::LArDetectorFactory theLArFactory(
detStore().operator->()
143 , hvManager
144 , testbeam
146
155
156 theLArFactory.create(world);
157 m_manager = theLArFactory.getDetectorManager();
159
161 }
162 }
163
166
167 return StatusCode::SUCCESS;
168}
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
static void SetInstance(std::unique_ptr< VDetectorParameters >)