27#include <unordered_map>
40struct std::hash<
cbm::algo::ca::EDetectorID> {
79 using FieldFunction_t = std::function<void(
const double (&xyz)[3],
double (&B)[3])>;
214 template<
size_t Size>
218 "Please, be ensured that the constants::size::MaxNdetectors is not lower then the "
219 "EDetectorID::kEND value, provided by your setup");
220 std::copy(container.begin(), container.end(),
fvDetectorNames.begin());
255 template<
typename DataT>
259 std::stringstream msg;
260 msg <<
"ca::InitManager: setup cannot be set until the station layout is initialized";
261 throw std::runtime_error(msg.str());
267 for (
int iStGeo = setup.
GetNofLayers() - 1; iStGeo >= 0; --iStGeo) {
268 auto [detID, locID] =
fParameters.GetStationIndexLocal(iStGeo);
269 int iStActive =
fParameters.GetStationIndexActive(locID, detID);
271 fParameters.fActiveSetup.DisableLayer(detID, locID);
274 LOG(info) <<
"Geometry setup:" <<
fParameters.fGeometrySetup.ToString(1);
275 LOG(info) <<
"Active setup:" <<
fParameters.fActiveSetup.ToString(1);
286 fParameters.fMisalignmentX[
static_cast<int>(detectorId)] =
x;
287 fParameters.fMisalignmentY[
static_cast<int>(detectorId)] =
y;
288 fParameters.fMisalignmentT[
static_cast<int>(detectorId)] = t;
Compile-time constants definition for the CA tracking algorithm.
An interface for the CA Station object initialization.
Magnetic flux density interpolation along the track vs. z-coordinate (header)
A CA Parameters object initialization class.
InitManager(const InitManager &)=delete
Copy constructor is forbidden.
std::vector< StationInitializer > & GetStationInfo()
Gets a reference to the stations array.
void SetTargetPosition(double x, double y, double z)
Sets target position.
void ClearStationLayout()
Returns station layout into undefined condition.
InitManager & operator=(InitManager &&)=delete
Move assignment operator is forbidden.
void SetConfigUser(const std::string &userConfig)
Sets user configuration file.
void SetFieldFunction(const FieldFunction_t &fieldFcn)
Sets a magnetic field function, which will be applied for all the stations.
InitController_t fInitController
Initialization flags.
void ReadSearchWindows(const std::string &fileName)
Reads search windows from file.
void InitTargetField(double zStep)
Calculates kf::FieldValue and L1FieldReference values for a selected step in z-axis from the target p...
Parameters< fvec > fParameters
CA parameters object.
int fCAIterationsNumberCrosscheck
Number of iterations to be passed (must be used for cross-checks)
bool fbConfigIsRead
Flag, if configuration file was read.
void SetCAIterationsNumberCrosscheck(int nIterations)
Sets a number of CA track finder iterations to provide initialization cross-check.
void SetConfigMain(const std::string &mainConfig)
Sets base configuration file.
~InitManager()=default
Destructor.
void ReadGeometrySetup(const std::string &fileName)
Reads geometry setup from file.
int GetNstationsGeometry() const
Gets total number of stations, provided by setup geometry.
InitManager & operator=(const InitManager &)=delete
Copy assignment operator is forbidden.
void ClearCAIterations()
Clears vector of CA track finder iterations.
InitManager(InitManager &&)=delete
Move constructor is forbidden.
void DevSetIsExtendTracksViaMc(bool value=true)
Flag to match triplets using Mc information.
void InitStationLayout()
Initializes station layout.
Parameters< fvec > && TakeParameters()
Takes parameters object from the init-manager instance.
bool fbGeometryConfigLock
Lock geometry initialization.
void SetGeometrySetup(const cbm::algo::kf::Setup< DataT > &setup)
Sets setup.
void SetDefaultMass(double mass)
Sets default fitter mass.
void ReadParametersObject(const std::string &fileName)
Reads parameters object from boost-serialized binary file.
void SetMaxDoubletsPerSinglet(unsigned int value)
Sets upper-bound cut on max number of doublets per one singlet.
bool IsPresent(EDetectorID detectorID) const
Checks, if the detector is present in the geometry.
std::function< void(const double(&xyz)[3], double(&B)[3])> FieldFunction_t
void SetGhostSuppression(int ghostSuppression)
Sets the flag to enable/disable the ghost suppression routine.
std::set< EDetectorID > DetectorIDSet_t
void CheckCAIterationsInit()
Checker for Iteration container initialization (sets EInitKey::kCAIterations)
void ClearSetupInfo()
Clears vector of base setup.
void DevSetIsMatchTripletsViaMc(bool value=true)
Flag to match triplets using Mc information.
void WriteParametersObject(const std::string &fileName) const
Writes parameters object from boost-serialized binary file.
const InitController_t & GetInitController() const
Gets a const reference to ca::ObjectInitController.
double fTargetZ
Target position z component in double precision.
void PushBackCAIteration(const Iteration *pIteration)
Pushes an CA track finder iteration into a sequence of iteration using raw pointer.
void SetRandomSeed(unsigned int seed)
Sets pseudo-random numbers generator seed.
std::string fsConfigInputMain
name for the input configuration file
void ReadInputConfigs()
Reads main and user parameters configs.
void DevSetUseOfOriginalField(bool value=true)
Force use of the original field (not approximated)
FieldFunction_t fFieldFunction
A function which returns magnetic field vector B in a radius-vector xyz.
bool IsActive(EDetectorID detectorID) const
Checks, if the detector is active.
void SetDetectorNames(const std::array< const char *, Size > &container)
Sets detector names.
int GetNstationsActive() const
Gets total number of active stations.
void DevSetIsMatchDoubletsViaMc(bool value=true)
Flag to match doublets using MC information.
void DevSetIgnoreHitSearchAreas(bool value=true)
Ignore hit search areas.
void DevSetIsParSearchWUsed(bool value=true)
Flag to use estimated hit search windows.
void PushBackCAIteration(const Iteration &iteration)
Pushes an CA track finder iteration into a sequence of iteration using reference.
const std::string & GetDetectorName(EDetectorID detId) const
Gets name of the detector.
std::vector< StationInitializer > fvStationInfo
Vector of StationInitializer objects (active + inactive)
void SetMisalignmentTolerance(EDetectorID detectorId, double x, double y, double t)
Sets misalignment parameters in X direction.
std::unordered_map< EDetectorID, int > DetectorIDIntMap_t
const std::string & GetOutputConfigName() const
Gets a name of the output configuration file.
void AddStation(const StationInitializer &station)
Adds a tracking station to the geometry.
void CheckInit()
Provides final checks of the parameters object.
EInitKey
Init-controller key set.
@ kSearchWindows
6) If the hit search windows were initialized
@ kEnd
11) [technical] number of entries in the enumeration
@ kFieldFunction
0) If magnetic field getter function is set
@ kTargetPos
1) If target position was defined
@ kSetupInitialized
10) If KF-setup initialized
@ kCAIterationsNumberCrosscheck
4) If the number of CA track finder is initialized
@ kStationLayoutInitialized
9) If stations layout is initialized
@ kRandomSeed
8) If the random seed is provided
@ kStationsInfo
3) If all the planned stations were added to the manager
@ kPrimaryVertexField
2) If magnetic field value and region defined at primary vertex
@ kCAIterations
5) If the CA track finder iterations were initialized
DetectorIDArr_t< std::string > fvDetectorNames
Names of the detectors.
bool FormParametersContainer()
Forms parameters container.
void PushBackCAIteration(const std::unique_ptr< Iteration > &puIteration)
Pushes an CA track finder iteration into a sequence of iteration using std::unique_ptr.
const std::string & GetInputConfigMain() const
Gets a name of the main input configuration file.
std::string fConfigOutputName
name for the output configuration file
int GetGhostSuppression() const
Gets ghost suppression flag.
void CheckStationsInfoInit()
Checker for StationInitializer set initialization (sets EInitKey::kStationsInfo)
InitManager()=default
Default constructor.
std::string fsConfigInputUser
name for the input configuration file
const std::string & GetInputConfigUser() const
Gets a name of the user input configuration file.
void DevSetIsSuppressOverlapHitsViaMc(bool value=true)
Flag to match triplets using Mc information.
std::array< T, constants::size::MaxNdetectors > DetectorIDArr_t
void SetMaxTripletPerDoublets(unsigned int value)
Sets upper-bound cut on max number of triplets per one doublet.
void SetOutputConfigName(const std::string &filename)
Sets a name of the output configuration file.
A set of parameters for the CA Track finder iteration.
bool GetFlag(InitKeyEnum bitKey) const
void SetFlag(InitKeyEnum bitKey, bool newStatus=true)
A container for all external parameters of the CA tracking algorithm.
A base class which provides interface to L1Algo station geometry.
KF-framework representation of the detector setup.
int GetNofLayers() const
Gets number of geometry layers.
constexpr int MaxNdetectors
Max number of tracking detectors.
TODO: SZh 8.11.2022: add selection of parameterisation.
std::underlying_type_t< EDetectorID > DetectorID_t
Underlying integer type for the DetectorID.
EDetectorID
Enumeration for the tracking detector subsystems in CBM-CA.
int operator()(cbm::algo::ca::EDetectorID t) const