77{
79 ATH_MSG_FATAL(
"LAr GeoModel description has already been built. LArDetectorToolNV::create() cannot be called more than once!");
80 return StatusCode::FAILURE;
81 }
82
83
84 LArHVManager* hvManager = new LArHVManager();;
86
87
88 ServiceHandle<IGeoDbTagSvc> geoDbTag(
"GeoDbTagSvc",
name());
90
91 ServiceHandle<IRDBAccessSvc> accessSvc(geoDbTag->getParamSvcName(),
name());
93
94 GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
95 std::string detectorKey{""};
96 std::string detectorNode{""};
97
98 if(!sqliteReader) {
99
101 std::string LArVersion = geoDbTag->LAr_VersionOverride();
102
103 detectorKey = LArVersion.empty() ?
AtlasVersion : LArVersion;
104 detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
105 ATH_MSG_INFO(
"Keys for LAr are " << detectorKey <<
" " << detectorNode);
106 ATH_MSG_INFO(
"Building LAr version " << geoDbTag->LAr_Version()
107 << " while ATLAS version is " << AtlasVersion);
108 }
109
110 IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr(
"LArSwitches", detectorKey, detectorNode);
111 if ((*switchSet).size()==0) {
112 ATH_MSG_ERROR(
"Unable to retrieve LArSwitches from Geometry DB");
113 return StatusCode::FAILURE;
114 }
115
116 const IRDBRecord* switches = (*switchSet)[0];
118
121 }
122
125 }
126
131
132
133 GeoModelExperiment* theExpt = nullptr;
135
136
137 int testbeam = 0;
138
139 GeoIntrusivePtr<GeoPhysVol>world=theExpt->
getPhysVol();
140 if(sqliteReader) {
141
142 LArGeo::LArDetectorFactoryLite theLArFactoryLite(
detStore().operator->()
143 , accessSvc.operator->()
144 , sqliteReader
145 , hvManager);
147 theLArFactoryLite.create(world);
148 m_manager = theLArFactoryLite.getDetectorManager();
149
150 std::unique_ptr<LArGeo::VDetectorParameters>
params = std::make_unique<LArGeo::RAL>();
152 }
153 else {
154
155
156
157
158 std::string LArTag = accessSvc->getChildTag("LAr",detectorKey,detectorNode);
159 if(LArTag.find("H8")!=std::string::npos) {
160 testbeam = 1 ;
161 }
162 else if(LArTag.find("H6")!=std::string::npos) {
163 testbeam = 2 ;
164 }
165
166 LArGeo::LArDetectorFactory theLArFactory(
detStore().operator->()
167 , hvManager
168 , testbeam
170
179
180 theLArFactory.create(world);
181 m_manager = theLArFactory.getDetectorManager();
183
185 }
186 }
187
190
191 return StatusCode::SUCCESS;
192}
#define ATH_CHECK
Evaluate an expression and check for errors.
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 >)
retrieve(aClass, aKey=None)