11/* *******************************************************************************
2- * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+ * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33 * *
44 * This software is distributed under the terms of the *
55 * GNU Lesser General Public Licence (LGPL) version 3, *
@@ -90,9 +90,14 @@ class FairModule : public TNamed
9090 /* * Finish worker run (used in MT mode only) */
9191 virtual void FinishWorkerRun () const { ; }
9292
93- /* *template function to construct geometry. to be used in derived classes.*/
93+ /* * @deprecated template function to construct geometry. to be used in derived classes.
94+ * The first and the third argument are meaningless, just pass nullptr */
9495 template <class T , class U >
95- void ConstructASCIIGeometry (T* dataType1, TString containerName = " " , U* datatype2 = nullptr );
96+ [[deprecated(" Broken signature, use ConstructASCIIGeometry(TString) instead" )]] void
97+ ConstructASCIIGeometry (T*, TString containerName = " " , U* = nullptr );
98+ /* * Helper function to construct geometry. */
99+ template <class T , class U >
100+ void ConstructASCIIGeometry (TString containerName = " " );
96101
97102 /* *Set the sensitivity flag for volumes, called from ConstructASCIIRootGeometry(), and has to be implimented for
98103 * detectors which use ConstructASCIIRootGeometry() to build the geometry */
@@ -169,14 +174,14 @@ class FairModule : public TNamed
169174};
170175
171176template <class T , class U >
172- void FairModule::ConstructASCIIGeometry (T* dataType1, TString containerName, U* )
177+ void FairModule::ConstructASCIIGeometry (TString containerName)
173178{
174179 FairGeoLoader* loader = FairGeoLoader::Instance ();
175180 FairGeoInterface* GeoInterface = loader->getGeoInterface ();
176181 T* MGeo = new T ();
177182 MGeo->print ();
178183 MGeo->setGeomFile (GetGeometryFileName ());
179- GeoInterface->addGeoModule (MGeo);
184+ GeoInterface->addGeoModule (MGeo); // takes ownership!
180185 Bool_t rc = GeoInterface->readSet (MGeo);
181186 if (rc) {
182187 MGeo->create (loader->getGeoBuilder ());
@@ -187,8 +192,6 @@ void FairModule::ConstructASCIIGeometry(T* dataType1, TString containerName, U*)
187192 FairRun* fRun = FairRun::Instance ();
188193 FairRuntimeDb* rtdb = FairRun::Instance ()->GetRuntimeDb ();
189194
190- dataType1 = MGeo;
191-
192195 if (" " != containerName) {
193196 LOG (info) << " Add GeoNodes for " << MGeo->getDescription () << " to container " << containerName;
194197
@@ -215,4 +218,10 @@ void FairModule::ConstructASCIIGeometry(T* dataType1, TString containerName, U*)
215218 }
216219}
217220
221+ template <class T , class U >
222+ void FairModule::ConstructASCIIGeometry (T*, TString containerName, U*)
223+ {
224+ ConstructASCIIGeometry<T, U>(containerName);
225+ }
226+
218227#endif // FAIRMODULE_H
0 commit comments