Skip to content
Snippets Groups Projects
Commit f09b9e81 authored by Sergei Zharko's avatar Sergei Zharko
Browse files

CA: the life-time of L1ConfigRW object was limited

parent 9d898740
No related branches found
No related tags found
1 merge request!1302CA: New scheme of CA tracking parameterisation
Pipeline #23886 passed
......@@ -18,6 +18,7 @@
#include "L1Algo.h"
#include "L1Assert.h"
#include "L1ConfigRW.h"
using L1Constants::clrs::kCL; // end colored log
using L1Constants::clrs::kGNb; // bold green log
......@@ -106,7 +107,7 @@ bool L1InitManager::FormParametersContainer()
// Read configuration files
LOG(info) << "L1InitManager: reading parameter configuration ...";
try {
fConfigRW.Read();
this->ReadInputConfigs();
LOG(info) << "L1InitManager: reading parameter configuration ... \033[1;32mdone\033[0m";
}
catch (const std::runtime_error& err) {
......@@ -289,6 +290,16 @@ void L1InitManager::PushBackCAIteration(const L1CAIteration& iteration)
fParameters.fCAIterations.push_back(iteration);
}
// ---------------------------------------------------------------------------------------------------------------------
//
void L1InitManager::ReadInputConfigs()
{
L1ConfigRW configRW = L1ConfigRW(this, 4);
configRW.SetMainConfigPath(fsConfigInputMain);
configRW.SetUserConfigPath(fsConfigInputUser);
configRW.Read();
}
// ---------------------------------------------------------------------------------------------------------------------
//
void L1InitManager::ReadParametersObject(const std::string& fileName)
......
......@@ -19,7 +19,6 @@
#include "L1BaseStationInfo.h"
#include "L1CAIteration.h"
#include "L1ConfigRW.h"
#include "L1Constants.h"
#include "L1EArray.h"
#include "L1Field.h"
......@@ -139,10 +138,6 @@ public:
/// \return Success flag
bool FormParametersContainer();
/// @brief Accessor to configuration module
/// @return Reference to configuration module
L1ConfigRW& GetConfigRW() { return fConfigRW; }
/// @brief Gets name of the detector
/// @param detId Index of the detector
/// @return Name of the detector
......@@ -151,8 +146,11 @@ public:
/// Gets ghost suppression flag
int GetGhostSuppression() const { return fParameters.fGhostSuppression; }
/// Gets a name of the input configuration file
const std::string& GetInputConfigName() const { return fConfigInputName; }
/// @brief Gets a name of the main input configuration file
const std::string& GetInputConfigMain() const { return fsConfigInputMain; }
/// @brief Gets a name of the user input configuration file
const std::string& GetInputConfigUser() const { return fsConfigInputMain; }
/// Gets a const reference to L1ObjectInitController
const InitController_t& GetInitController() const { return fInitController; }
......@@ -196,6 +194,9 @@ public:
/// Pushes an CA track finder iteration into a sequence of iteration using std::unique_ptr
void PushBackCAIteration(const std::unique_ptr<L1CAIteration>& puIteration) { PushBackCAIteration(*puIteration); }
/// @brief Reads main and user parameters configs
void ReadInputConfigs();
/// Reads parameters object from boost-serialized binary file
/// \param fileName Name of input file
void ReadParametersObject(const std::string& fileName);
......@@ -211,15 +212,15 @@ public:
void SetCAIterationsNumberCrosscheck(int nIterations);
/// @brief Sets base configuration file
/// @param baseConfig Path to base configuration file
/// @param mainConfig Path to main configuration file
/// @note The base configuraiton file is mandatory until the tracking configuration is initialized from
/// beforehand created L1Parameters file.
void SetConfigMain(const std::string& baseConfig) { fConfigRW.SetMainConfigPath(baseConfig); }
void SetConfigMain(const std::string& mainConfig) { fsConfigInputMain = mainConfig; }
/// @brief Sets user configuration file
/// @param userConfig Path to user configuration file
/// @note The user configuraiton file is optional
void SetConfigUser(const std::string& userConfig) { fConfigRW.SetUserConfigPath(userConfig); }
void SetConfigUser(const std::string& userConfig) { fsConfigInputUser = userConfig; }
/// @brief Sets detector names
/// @param container Container of the detector names
......@@ -348,9 +349,10 @@ private:
L1Parameters fParameters {}; ///< L1Algo parameters object
// * Configuration related *
std::string fConfigInputName {""}; ///< name for the input configuration file
std::string fConfigOutputName {""}; ///< name for the output configuration file
L1ConfigRW fConfigRW {this, /*verbose = */ 4}; ///< configuration file reader and writer
std::string fsConfigInputMain = ""; ///< name for the input configuration file
std::string fsConfigInputUser = ""; ///< name for the input configuration file
std::string fConfigOutputName = ""; ///< name for the output configuration file
//L1ConfigRW fConfigRW {this, /*verbose = */ 4}; ///< configuration file reader and writer
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment