22#include "FairRootManager.h"
23#include "FairRunAna.h"
28#include <boost/filesystem.hpp>
40 LOG(info) <<
"TrackingSetupBuilder: detector subsystems in geometry: ";
49 Check(EDetectorID::kMvd);
50 Check(EDetectorID::kSts);
51 Check(EDetectorID::kMuch);
52 Check(EDetectorID::kTrd);
53 Check(EDetectorID::kTof);
79 if (
auto* pField = FairRunAna::Instance()->GetField()) {
80 LOG(info) << fabs(pField->GetBx(0., 0., 0.)) <<
", " << fabs(pField->GetBy(0., 0., 0.)) <<
", "
81 << fabs(pField->GetBz(0., 0., 0.)) <<
", " << pField->GetType();
83 pField->GetType() == 0
84 && fabs(pField->GetBx(0., 0., 0.)) < MinField<
85 double> && fabs(pField->GetBy(0., 0., 0.)) < MinField<double> && fabs(pField->GetBz(0., 0., 0.)) < MinField<double>) {
97 auto CollectStations = [&](
const auto* pIfs,
EDetectorID detID) ->
void {
101 for (
int iSt = 0; iSt < pIfs->GetNtrackingStations(); ++iSt) {
104 pIfs->GetZref(iSt), pIfs->GetZmin(iSt), pIfs->GetZmax(iSt),
105 std::max(std::fabs(pIfs->GetXmin(iSt)), std::fabs(pIfs->GetXmax(iSt))),
106 std::max(std::fabs(pIfs->GetYmin(iSt)), std::fabs(pIfs->GetYmax(iSt)))});
120 auto pMaterialFactory = std::make_shared<MaterialMapFactory>();
122 pMaterialFactory->SetDoRadialProjection(pTarget->GetZ());
128 LOG(info) <<
"ca::TrackingSetupBuilder: Tracking setup was initialized successfully";
130catch (
const std::exception& err) {
131 fbInitialized =
false;
132 LOG(error) <<
"ca::TrackingSetupBuilder: Tracking setup was not initialized. Reason: " << err.what();
139 namespace fs = boost::filesystem;
141 std::lock_guard<std::mutex> lock(
fMutex);
147 if (setupTag.empty()) {
148 throw std::logic_error(
"The setup tag in CbmSetup is not defined");
152 TString sinkName = FairRootManager::Instance()->GetSink()->GetFileName();
153 auto sinkPath = fs::path{sinkName.Data()};
154 std::string sDataDir = sinkPath.parent_path().string();
155 if (sDataDir.empty()) {
159 std::string sCacheFile = Form(
"%s/%s.mat.kf.bin", sDataDir.c_str(), setupTag.c_str());
std::string ToString(ECbmModuleId modId)
Thread-safe representation of the magnetic field (header)
Target property initialization and access in CBM (source)
Common constant definitions for the Kalman Filter library.
Utility to generate material budget map from the TGeoNavigator representation of the Setup (implement...
CbmGeoSetup & GetSetup()
Direct access to underlying geometry setup representation. Allows for fine-tuning of parameters,...
static CbmMuchTrackingInterface * Instance()
Gets pointer to the instance of the CbmMuchTrackingInterface.
static CbmMvdTrackingInterface * Instance()
Gets pointer to the instance of the CbmMvdTrackingInterface.
Bool_t IsActive(ECbmModuleId moduleId)
static CbmSetup * Instance()
CbmGeoSetupProvider * GetProvider()
Get the geo setup provider.
static CbmStsTrackingInterface * Instance()
Gets pointer to the instance of the CbmStsTrackingInterface class.
static CbmTofTrackingInterface * Instance()
Gets pointer to the instance of the CbmTofTrackingInterface.
static CbmTrdTrackingInterface * Instance()
Gets pointer to the instance of the CbmTrdTrackingInterface.
void AddLayer(const GeoLayer< EDetID > &geoLayer)
Adds material layer.
void Reset()
Resets the instance.
void SetMaterialMapFactory(const std::shared_ptr< IMaterialMapFactory > &pMaterialFactory)
Sets material map creator.
void SetFieldFunction(const FieldFn_t &fieldFn, EFieldType fieldType)
Sets magnetic field function.
void SetTargetProperty(double x, double y, double z, double dz, double r)
Sets target initialization properties.
KF-framework representation of the detector setup.
Thread-safe representation of the magnetic field in CBM.
static Target * Instance()
Instance access.
Encapsulation of the kf::Setup initialization routines for CBM.
static constexpr bool kMatCreatorSafeMode
Safe mode of the material map creation.
cbm::algo::kf::Setup< T > MakeSetup(cbm::algo::kf::EFieldMode fldMode)
Makes setup object.
void SetMaterialCacheFile(const TString &filename, size_t geoHash)
Sets the material budget cache file name.
std::shared_ptr< const cbm::algo::kf::Setup< double > > GetSharedGeoSetup()
Gets a shared pointer to the geometry setup.
bool fbInitialized
Checks, if the setup was already initialized.
static constexpr int kMatCreatorNrays
Number of rays per dimension for the material budget.
static TrackingSetupBuilder * Instance()
Instance access.
void Init()
Initializes the instance.
cbm::algo::kf::SetupBuilder fBuilder
KF-setup builder.
std::shared_ptr< cbm::algo::kf::Setup< double > > fpGeoSetup
An instance of the tracking KF-setup in a double precision.
static constexpr DetectorIDArray_t< const char * > kDetHitBrName
Hit branch names vs. cbm::algo::ca::EDetectorID.
DetectorIDArray_t< bool > fvbDetHasHits
Does detector subsystem have hits?
void CheckDetectorPresence()
Check detector presence.
static TrackingSetupBuilder * fpInstance
DetectorIDArray_t< bool > fvbDetInGeometry
Is detector subsystem in geometry?
EDetectorID
Enumeration for the tracking detector subsystems in CBM-CA.
ECbmModuleId ToCbmModuleId(EDetectorID detID)
Conversion map from EDetectorID to ECbmModuleId.
constexpr auto MinField
Minimal (negligible) magnetic field value [kG].
EFieldMode
Enumiration for the magnetic field representation variants in the track fitting algorithm.
EFieldType
Magnetic field type in different setup regions.
A helper structure to store geometrical information of the layers.