1111
1212#include " FastTracker.h"
1313
14+ #include " Common/Core/TableHelper.h"
15+
1416#include " ReconstructionDataFormats/TrackParametrization.h"
1517
16- #include " TMath.h"
17- #include " TMatrixD.h"
18- #include " TMatrixDSymEigen.h"
19- #include " TRandom.h"
20- #include < TEnv.h>
21- #include < THashList.h>
18+ #include < TMath.h>
19+ #include < TMatrixD.h>
20+ #include < TMatrixDSymEigen.h>
2221#include < TObject.h>
22+ #include < TRandom.h>
2323
2424#include < fstream>
2525#include < map>
@@ -31,6 +31,21 @@ namespace o2
3131namespace fastsim
3232{
3333
34+ void GeometryContainer::init (o2::framework::InitContext& initContext)
35+ {
36+ std::vector<std::string> detectorConfiguration;
37+ const bool found = common::core::getTaskOptionValue (initContext, " on-the-fly-detector-geometry-provider" , " detectorConfiguration" , detectorConfiguration, false );
38+ if (!found) {
39+ LOG (fatal) << " Could not retrieve detector configuration from OnTheFlyDetectorGeometryProvider task." ;
40+ return ;
41+ }
42+ LOG (info) << " Size of detector configuration: " << detectorConfiguration.size ();
43+ for (const auto & configFile : detectorConfiguration) {
44+ LOG (info) << " Detector geometry configuration file used: " << configFile;
45+ addEntry (configFile);
46+ }
47+ }
48+
3449// +-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+-~-<*>-~-+
3550
3651DetLayer* FastTracker::AddLayer (TString name, float r, float z, float x0, float xrho, float resRPhi, float resZ, float eff, int type)
@@ -238,38 +253,7 @@ void FastTracker::AddTPC(float phiResMean, float zResMean)
238253
239254std::map<std::string, std::map<std::string, std::string>> FastTracker::parseTEnvConfiguration (std::string filename)
240255{
241- std::map<std::string, std::map<std::string, std::string>> configMap;
242-
243- TEnv env (filename.c_str ());
244- THashList* table = env.GetTable ();
245- std::vector<std::string> layers;
246- for (int i = 0 ; i < table->GetEntries (); ++i) {
247- const std::string key = table->At (i)->GetName ();
248- // key should contain exactly one dot
249- if (key.find (' .' ) == std::string::npos || key.find (' .' ) != key.rfind (' .' )) {
250- LOG (fatal) << " Key " << key << " does not contain exactly one dot" ;
251- continue ;
252- }
253- const std::string firstPart = key.substr (0 , key.find (' .' ));
254- if (std::find (layers.begin (), layers.end (), firstPart) == layers.end ()) {
255- layers.push_back (firstPart);
256- }
257- }
258- env.Print ();
259-
260- // Layers
261- for (const auto & layer : layers) {
262- LOG (info) << " Reading layer " << layer;
263- for (int i = 0 ; i < table->GetEntries (); ++i) {
264- const std::string key = table->At (i)->GetName ();
265- if (key.find (layer + " ." ) == 0 ) {
266- const std::string paramName = key.substr (key.find (' .' ) + 1 );
267- const std::string value = env.GetValue (key.c_str (), " " );
268- configMap[layer][paramName] = value;
269- }
270- }
271- }
272- return configMap;
256+ return GeometryContainer::parseTEnvConfiguration (filename);
273257}
274258
275259void FastTracker::AddGenericDetector (std::string filename, o2::ccdb::BasicCCDBManager* ccdbManager)
0 commit comments