|
11 | 11 | #include "FairGeoInterface.h" // for FairGeoInterface |
12 | 12 | #include "FairGeoLoader.h" // for FairGeoLoader |
13 | 13 | #include "FairGeoNode.h" // for FairGeoNode |
14 | | -#include "FairGeoVolume.h" // for FairGeoVolume |
15 | | -#include "FairLogger.h" |
| 14 | +#include "FairGeoSet.h" |
| 15 | +#include "FairGeoVolume.h" |
16 | 16 | #include "FairRun.h" // for FairRun |
17 | 17 | #include "FairRuntimeDb.h" // for FairRuntimeDb |
18 | 18 |
|
|
26 | 26 | #include <TRefArray.h> // for TRefArray |
27 | 27 | #include <TString.h> // for TString, operator!= |
28 | 28 | #include <TVirtualMC.h> |
| 29 | +#include <fairlogger/Logger.h> |
29 | 30 | #include <string> |
| 31 | +#include <type_traits> |
| 32 | +#include <utility> |
30 | 33 | #include <vector> |
31 | 34 |
|
32 | 35 | class FairRunSim; |
@@ -197,24 +200,17 @@ class FairModule : public TNamed |
197 | 200 | template<class T, class U> |
198 | 201 | void FairModule::ConstructASCIIGeometry(TString containerName) |
199 | 202 | { |
200 | | - FairGeoLoader& loader = GetGeometryLoader(); |
201 | | - FairGeoInterface* GeoInterface = loader.getGeoInterface(); |
202 | | - T* MGeo = new T(); |
203 | | - MGeo->print(); |
204 | | - MGeo->setGeomFile(GetGeometryFileName()); |
205 | | - GeoInterface->addGeoModule(MGeo); // takes ownership! |
206 | | - Bool_t rc = GeoInterface->readSet(MGeo); |
207 | | - if (rc) { |
208 | | - MGeo->create(loader.getGeoBuilder()); |
209 | | - } |
| 203 | + static_assert(std::is_base_of_v<FairGeoSet, T>); |
| 204 | + static_assert(std::is_base_of_v<FairParSet, U>); |
| 205 | + FairGeoSet& MGeo = GetGeometryLoader().LoadAndCreate<T>(GetGeometryFileName()); |
210 | 206 |
|
211 | | - TList* volList = MGeo->getListOfVolumes(); |
| 207 | + TList* volList = MGeo.getListOfVolumes(); |
212 | 208 | // store geo parameter |
213 | 209 | FairRun* fRun = FairRun::Instance(); |
214 | 210 | FairRuntimeDb* rtdb = FairRun::Instance()->GetRuntimeDb(); |
215 | 211 |
|
216 | 212 | if ("" != containerName) { |
217 | | - LOG(info) << "Add GeoNodes for " << MGeo->getDescription() << " to container " << containerName; |
| 213 | + LOG(info) << "Add GeoNodes for " << MGeo.getDescription() << " to container " << containerName; |
218 | 214 |
|
219 | 215 | // U par=(U)(rtdb->getContainer(containerName)); |
220 | 216 | U* par = static_cast<U*>(rtdb->getContainer(containerName)); |
|
0 commit comments