CbmRoot
|
Creates a valid initialized Setup instance. More...
#include <KfSetupBuilder.h>
Public Member Functions | |
SetupBuilder ()=default | |
Default constructor. | |
SetupBuilder (const SetupBuilder &)=delete | |
Copy constructor. | |
SetupBuilder (SetupBuilder &&)=delete | |
Move constructor. | |
virtual | ~SetupBuilder ()=default |
Destructor. | |
SetupBuilder & | operator= (const SetupBuilder &)=delete |
Copy assignment operator. | |
SetupBuilder & | operator= (SetupBuilder &&)=delete |
Move assignment operator. | |
template<class EDetID > | |
void | AddLayer (const GeoLayer< EDetID > &geoLayer) |
Adds material layer. | |
template<typename T > | |
Setup< T > | MakeSetup (EFieldMode fldMode) |
Creates a setup instance. | |
void | Reset () |
Resets the instance. | |
void | SetFieldFunction (const FieldFn_t &fieldFn, EFieldType fieldType) |
Sets magnetic field function. | |
template<typename T > | |
void | SetFromSetup (const Setup< T > &inSetup) |
Initializes the setup builder from existing setup. | |
void | SetMaterialMapFactory (const std::shared_ptr< IMaterialMapFactory > &pMaterialFactory) |
Sets material map creator. | |
void | SetMaterialCacheFile (const std::string &filename, size_t refHash) |
Sets the material budget cache file name. | |
void | SetTargetProperty (double x, double y, double z, double dz, double r) |
Sets target initialization properties. | |
Static Public Member Functions | |
static void | Store (const Setup< double > &setup, const std::string &fileName) |
Stores a serialized setup to a file. | |
template<typename T > | |
static Setup< T > | Load (const std::string &fileName) |
Loads a serialized setup from a file. | |
Private Member Functions | |
void | Init () |
Initializes, validates and caches the parameters. | |
std::string | InitStatusMsg () const |
Prints initialization status message. | |
bool | LoadMaterial () |
Reads material from file. | |
void | StoreMaterial () const |
Stores material to file. | |
Private Attributes | |
std::set< GeoLayer< int > > | fGeoLayers {} |
Set of geo layers. | |
std::string | fsMaterialCacheFile {""} |
A cache file for the material. | |
std::vector< MaterialMap > | fvMaterial {} |
Material map container. | |
std::shared_ptr< IMaterialMapFactory > | fpMaterialMapFactory {nullptr} |
Material map creator. | |
ModuleIndexMapFactory | fModuleIndexFactory |
Module index factory. | |
FieldFactory | fFieldFactory |
Instance of field factory. | |
Target< double > | fTarget |
Target properties. | |
size_t | fGeoHash {0} |
A hash of the geometry. | |
int | fMatMapNofBins {100} |
Number of bins in material maps. | |
bool | fbIfTargetSet {false} |
Target initialized. | |
bool | fbIfGeoLayersInit {false} |
Geo layers initialized. | |
bool | fbIfFieldFunctionSet {false} |
Field function initialized. | |
bool | fbIfSetFromSetup {false} |
bool | fbReady {false} |
Instance is ready for setup generation. | |
Static Private Attributes | |
static constexpr double | kTargetCenterOffset {0.05} |
static constexpr double | kTargetMaterialOffset {2.} |
static constexpr double | kTargetMaterialTransverseSizeMargin {1.3} |
static constexpr double | kTargetFieldInitStep {2.5} |
static constexpr int | kTargetMaterialMapNofBins {20} |
Creates a valid initialized Setup instance.
Initialization scenarios: (a) Manual:
Definition at line 64 of file KfSetupBuilder.h.
|
default |
Default constructor.
|
delete |
Copy constructor.
|
delete |
Move constructor.
|
virtualdefault |
Destructor.
void cbm::algo::kf::SetupBuilder::AddLayer | ( | const GeoLayer< EDetID > & | geoLayer | ) |
Adds material layer.
EDetID | detector ID index type |
geoLayer | A geometrical layer |
Definition at line 215 of file KfSetupBuilder.h.
References fbReady, cbm::algo::kf::GeoLayer< EDetID >::fDetID, fGeoLayers, cbm::algo::kf::GeoLayer< EDetID >::fLocID, cbm::algo::kf::GeoLayer< EDetID >::fXmax, cbm::algo::kf::GeoLayer< EDetID >::fYmax, cbm::algo::kf::GeoLayer< EDetID >::fZmax, cbm::algo::kf::GeoLayer< EDetID >::fZmin, and cbm::algo::kf::GeoLayer< EDetID >::fZref.
Referenced by cbm::kf::TrackingSetupBuilder::Init().
|
private |
Initializes, validates and caches the parameters.
std::runtime_error | If pre-initialization was incomplete |
Definition at line 20 of file KfSetupBuilder.cxx.
References cbm::algo::kf::ModuleIndexMapFactory::AddComponent(), cbm::algo::kf::FieldFactory::AddSliceReference(), fbIfFieldFunctionSet, fbIfGeoLayersInit, fbIfSetFromSetup, fbIfTargetSet, fbReady, fFieldFactory, fGeoLayers, fMatMapNofBins, fModuleIndexFactory, fpMaterialMapFactory, fsMaterialCacheFile, fTarget, fvMaterial, cbm::algo::kf::Target< T >::GetDz(), cbm::algo::kf::Target< T >::GetR(), cbm::algo::kf::Target< T >::GetZ(), kTargetCenterOffset, kTargetMaterialMapNofBins, kTargetMaterialOffset, kTargetMaterialTransverseSizeMargin, LoadMaterial(), cbm::algo::kf::Target< T >::SetMaterial(), and StoreMaterial().
Referenced by MakeSetup().
|
private |
Prints initialization status message.
Definition at line 105 of file KfSetupBuilder.cxx.
References fbIfFieldFunctionSet, fbIfGeoLayersInit, fbIfSetFromSetup, fbIfTargetSet, and fpMaterialMapFactory.
|
static |
Loads a serialized setup from a file.
T | Underlying floating-point type for the output setup object |
fileName | Input file name |
std::runtime_error | If the fileName cannot be opened |
Definition at line 287 of file KfSetupBuilder.h.
References cbm::algo::kf::Intrpl.
Referenced by cbm::algo::ca::InitManager::ReadGeometrySetup().
|
private |
Reads material from file.
Definition at line 119 of file KfSetupBuilder.cxx.
References fGeoHash, fsMaterialCacheFile, fTarget, fvMaterial, and cbm::algo::kf::Target< T >::SetMaterial().
Referenced by Init().
Setup< T > cbm::algo::kf::SetupBuilder::MakeSetup | ( | EFieldMode | fldMode | ) |
Creates a setup instance.
fldMode | Field mode of the setup |
Definition at line 269 of file KfSetupBuilder.h.
References fbReady, cbm::algo::kf::Setup< T >::fField, fFieldFactory, fModuleIndexFactory, cbm::algo::kf::Setup< T >::fModuleIndexMap, cbm::algo::kf::Setup< T >::fTarget, fTarget, fvMaterial, cbm::algo::kf::Setup< T >::fvMaterialLayers, Init(), cbm::algo::kf::FieldFactory::MakeField(), and cbm::algo::kf::ModuleIndexMapFactory::MakeIndexMap().
Referenced by cbm::kf::TrackingSetupBuilder::MakeSetup().
|
delete |
Copy assignment operator.
|
delete |
Move assignment operator.
void SetupBuilder::Reset | ( | ) |
Resets the instance.
Definition at line 154 of file KfSetupBuilder.cxx.
References fbIfFieldFunctionSet, fbIfGeoLayersInit, fbIfSetFromSetup, fbIfTargetSet, fbReady, fFieldFactory, fGeoLayers, fModuleIndexFactory, fpMaterialMapFactory, fvMaterial, cbm::algo::kf::FieldFactory::Reset(), and cbm::algo::kf::ModuleIndexMapFactory::Reset().
Referenced by cbm::kf::TrackingSetupBuilder::Init().
|
inline |
Sets magnetic field function.
fieldFn | Magnetic field function |
fieldType | Magnetic field type |
Definition at line 101 of file KfSetupBuilder.h.
References fbIfFieldFunctionSet, fbReady, fFieldFactory, kTargetFieldInitStep, cbm::algo::kf::FieldFactory::SetFieldFunction(), and cbm::algo::kf::FieldFactory::SetStep().
Referenced by cbm::kf::TrackingSetupBuilder::Init().
void cbm::algo::kf::SetupBuilder::SetFromSetup | ( | const Setup< T > & | inSetup | ) |
Initializes the setup builder from existing setup.
T | Underlying data type of the setup |
inSetup |
Definition at line 239 of file KfSetupBuilder.h.
References cbm::algo::kf::ModuleIndexMapFactory::AddComponent(), cbm::algo::kf::FieldFactory::AddSliceReference(), fbIfGeoLayersInit, fbIfSetFromSetup, fbIfTargetSet, fbReady, fFieldFactory, fGeoLayers, fModuleIndexFactory, cbm::algo::kf::Setup< T >::fTarget, fTarget, fvMaterial, cbm::algo::kf::Setup< T >::GetIndexMap(), cbm::algo::kf::Setup< T >::GetMaterial(), cbm::algo::kf::ModuleIndexMapFactory::Reset(), cbm::algo::kf::FieldFactory::ResetSliceReferences(), and cbm::algo::kf::Setup< T >::ToString().
|
inline |
Sets the material budget cache file name.
filename | Material budget cache file name |
refHash | Reference hash of the geometry |
If provided, the instance will try to read the material budget maps from the file. If the file does not exist,or the geometry hash was changed since the last time (reference hash differs from the one read from the file), a warning will be produced, the material budget maps will be recreated on the fly and they will be stored again to the file (meaning a new cache file will be generated over the existing one).
Definition at line 131 of file KfSetupBuilder.h.
References fGeoHash, and fsMaterialCacheFile.
Referenced by cbm::kf::TrackingSetupBuilder::SetMaterialCacheFile().
|
inline |
Sets material map creator.
pMaterialFactory | Pointer to the actual material map creator instance |
Definition at line 117 of file KfSetupBuilder.h.
References fbReady, and fpMaterialMapFactory.
Referenced by cbm::kf::TrackingSetupBuilder::Init().
void SetupBuilder::SetTargetProperty | ( | double | x, |
double | y, | ||
double | z, | ||
double | dz, | ||
double | r ) |
Sets target initialization properties.
x | Target x-coordinate [cm] |
y | Target y-coordinate [cm] |
z | Target z-coordinate [cm] |
dz | Target half-thickness [cm] |
r | Target transverse size (XYmax) |
Definition at line 170 of file KfSetupBuilder.cxx.
References fbIfTargetSet, fbReady, fFieldFactory, fTarget, cbm::algo::kf::Target< T >::SetDz(), cbm::algo::kf::Target< T >::SetR(), cbm::algo::kf::FieldFactory::SetTarget(), cbm::algo::kf::Target< T >::SetX(), cbm::algo::kf::Target< T >::SetY(), cbm::algo::kf::Target< T >::SetZ(), x, and y.
Referenced by cbm::kf::TrackingSetupBuilder::Init().
|
static |
Stores a serialized setup to a file.
setup | A reference to the Setup (NOTE: a double-Setup must be passed explicitly) |
fileName | Output file name |
Only a Setup with T = double can be serialized, so if a particular setup instance has another floating-point type, it will be converted to the double-version. In the serialization only the interpolated magnetic field variant is stored, the original field version will be set to nullopt during the loading from the file.
Definition at line 184 of file KfSetupBuilder.cxx.
Referenced by CbmL1::Init().
|
private |
Stores material to file.
Definition at line 198 of file KfSetupBuilder.cxx.
References fGeoHash, fsMaterialCacheFile, fTarget, fvMaterial, and cbm::algo::kf::Target< T >::GetMaterial().
Referenced by Init().
|
private |
Field function initialized.
Definition at line 201 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), and SetFieldFunction().
|
private |
Geo layers initialized.
Definition at line 200 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), and SetFromSetup().
|
private |
Definition at line 202 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), and SetFromSetup().
|
private |
Target initialized.
Definition at line 199 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), SetFromSetup(), and SetTargetProperty().
|
private |
Instance is ready for setup generation.
Definition at line 203 of file KfSetupBuilder.h.
Referenced by AddLayer(), Init(), MakeSetup(), Reset(), SetFieldFunction(), SetFromSetup(), SetMaterialMapFactory(), and SetTargetProperty().
|
private |
Instance of field factory.
Definition at line 194 of file KfSetupBuilder.h.
Referenced by Init(), MakeSetup(), Reset(), SetFieldFunction(), SetFromSetup(), and SetTargetProperty().
|
private |
A hash of the geometry.
Definition at line 196 of file KfSetupBuilder.h.
Referenced by LoadMaterial(), SetMaterialCacheFile(), and StoreMaterial().
|
private |
Set of geo layers.
Definition at line 189 of file KfSetupBuilder.h.
Referenced by AddLayer(), Init(), Reset(), and SetFromSetup().
|
private |
Number of bins in material maps.
Definition at line 197 of file KfSetupBuilder.h.
Referenced by Init().
|
private |
Module index factory.
Definition at line 193 of file KfSetupBuilder.h.
Referenced by Init(), MakeSetup(), Reset(), and SetFromSetup().
|
private |
Material map creator.
Definition at line 192 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), and SetMaterialMapFactory().
|
private |
A cache file for the material.
Definition at line 190 of file KfSetupBuilder.h.
Referenced by Init(), LoadMaterial(), SetMaterialCacheFile(), and StoreMaterial().
|
private |
Target properties.
Definition at line 195 of file KfSetupBuilder.h.
Referenced by Init(), LoadMaterial(), MakeSetup(), SetFromSetup(), SetTargetProperty(), and StoreMaterial().
|
private |
Material map container.
Definition at line 191 of file KfSetupBuilder.h.
Referenced by Init(), LoadMaterial(), MakeSetup(), Reset(), SetFromSetup(), and StoreMaterial().
|
staticconstexprprivate |
Definition at line 183 of file KfSetupBuilder.h.
Referenced by Init().
|
staticconstexprprivate |
Definition at line 186 of file KfSetupBuilder.h.
Referenced by SetFieldFunction().
|
staticconstexprprivate |
Definition at line 187 of file KfSetupBuilder.h.
Referenced by Init().
|
staticconstexprprivate |
Definition at line 184 of file KfSetupBuilder.h.
Referenced by Init().
|
staticconstexprprivate |
Definition at line 185 of file KfSetupBuilder.h.
Referenced by Init().