22#include "FairRootManager.h"
23#include "FairRunAna.h"
28#include <boost/filesystem.hpp>
40 LOG(info) <<
"TrackingSetupBuilder: detector subsystems in geometry: ";
55 Check(EDetectorID::kMvd);
56 Check(EDetectorID::kSts);
57 Check(EDetectorID::kMuch);
58 Check(EDetectorID::kTrd);
59 Check(EDetectorID::kTof);
85 if (
auto* pField = FairRunAna::Instance()->GetField()) {
86 LOG(info) << fabs(pField->GetBx(0., 0., 0.)) <<
", " << fabs(pField->GetBy(0., 0., 0.)) <<
", "
87 << fabs(pField->GetBz(0., 0., 0.)) <<
", " << pField->GetType();
89 pField->GetType() == 0
90 && fabs(pField->GetBx(0., 0., 0.)) < MinField<
91 double> && fabs(pField->GetBy(0., 0., 0.)) < MinField<double> && fabs(pField->GetBz(0., 0., 0.)) < MinField<double>) {
103 auto CollectStations = [&](
const auto* pIfs,
EDetectorID detID) ->
void {
107 for (
int iSt = 0; iSt < pIfs->GetNtrackingStations(); ++iSt) {
110 pIfs->GetZref(iSt), pIfs->GetZmin(iSt), pIfs->GetZmax(iSt),
111 std::max(std::fabs(pIfs->GetXmin(iSt)), std::fabs(pIfs->GetXmax(iSt))),
112 std::max(std::fabs(pIfs->GetYmin(iSt)), std::fabs(pIfs->GetYmax(iSt)))});
126 auto pMaterialFactory = std::make_shared<MaterialMapFactory>();
128 pMaterialFactory->SetDoRadialProjection(pTarget->GetZ());
134 LOG(info) <<
"ca::TrackingSetupBuilder: Tracking setup was initialized successfully";
136catch (
const std::exception& err) {
137 fbInitialized =
false;
138 LOG(error) <<
"ca::TrackingSetupBuilder: Tracking setup was not initialized. Reason: " << err.what();
145 namespace fs = boost::filesystem;
147 std::lock_guard<std::mutex> lock(
fMutex);
153 if (setupTag.empty()) {
154 throw std::logic_error(
"The setup tag in CbmSetup is not defined");
158 TString sinkName = FairRootManager::Instance()->GetSink()->GetFileName();
159 auto sinkPath = fs::path{sinkName.Data()};
160 std::string sDataDir = sinkPath.parent_path().string();
161 if (sDataDir.empty()) {
165 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
bool fbIgnoreHitPresence
Ignores hit presence, when active subsystems are determined.
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.