CbmRoot
Loading...
Searching...
No Matches
CbmCaParametersHandler.cxx
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
11
12#include "CaInitManager.h"
14
15#include <sstream>
16
17namespace cbm::ca
18{
19 // -------------------------------------------------------------------------------------------------------------------
20 //
22 {
23 if (fpInstance == nullptr) {
24 std::lock_guard<std::mutex> lock(fMutex);
26 }
27 return fpInstance;
28 }
29
30 // -------------------------------------------------------------------------------------------------------------------
31 //
33 {
34 if (fsInputName.empty()) {
35 fsInputName = name;
36 }
37 else if (fsInputName != name) {
38 // TODO: More accurate check on the files (the path can be different, but files can be the same)
39 std::stringstream msg;
40 msg << "ParametersHandler::Get: an attempt to re-define an instance of CA-parameters from "
41 << "a different path: \"" << name << "\". The parameters were provided previously from \"" << fsInputName
42 << "\"";
43 throw std::logic_error(msg.str());
44 }
45
46 if (!fpParameters.get()) {
49 // TODO: Probably, make a template from the floating-point data-type?
50 // Point: having setup of double, defined in the parameters.
51 // But, if the kf-setup will not be a part of the ca::Parameters, it would not be needed;
52 ca::InitManager manager;
53 manager.ReadParametersObject(fsInputName.c_str());
54 manager.SetGeometrySetup(TrackingSetupBuilder::Instance()->MakeSetup<ca::fvec>(EFieldMode::Orig));
55 fpParameters = std::make_shared<ca::Parameters<float>>(ca::Parameters<float>(manager.TakeParameters()));
56 }
57
58 return fpParameters;
59 }
60} // namespace cbm::ca
Input data management class for the CA tracking algorithm (header)
Handles an instance of the CA-parameters as a shared pointer (header)
A CA Parameters object initialization class.
Parameters< fvec > && TakeParameters()
Takes parameters object from the init-manager instance.
void SetGeometrySetup(const cbm::algo::kf::Setup< DataT > &setup)
Sets setup.
void ReadParametersObject(const std::string &fileName)
Reads parameters object from boost-serialized binary file.
A container for all external parameters of the CA tracking algorithm.
Handles an shared pointer of CA parameters.
std::string fsInputName
Name of the input ca.par file.
const ParametersPtr_t Get(const std::string &filename)
Returns an shared pointer to the parameters instance.
static ParametersHandler * fpInstance
ParametersPtr_t fpParameters
ca::Parameters instance (double precision)
static ParametersHandler * Instance()
Instance access.
std::shared_ptr< cbm::algo::ca::Parameters< float > > ParametersPtr_t
Encapsulation of the kf::Setup initialization routines for CBM.
EFieldMode
Enumiration for the magnetic field representation variants in the track fitting algorithm.
Definition KfDefs.h:27