|
CbmRoot
|
Creates a valid initialized Setup instance. More...
#include <KfSetupBuilder.h>
Classes | |
| struct | LayerProperty |
| A helper structure to store geometrical information of the layers. More... | |
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. | |
| void | AddLayer (LayerProperty geoLayer) |
| Adds material layer. | |
| const FieldFn_t & | GetFieldFunction () const |
| Access to field funciton. | |
| void | Init () |
| Initializes, validates and caches the parameters. | |
| template<typename F> | |
| Setup< F > | MakeSetup (EFieldMode fldMode) const |
| Creates a setup instance. | |
| void | Reset () |
| Resets the instance. | |
| void | SetFieldFunction (const FieldFn_t &fieldFn, EFieldType fieldType) |
| Sets magnetic field function. | |
| template<typename F> | |
| void | SetFromSetup (const Setup< F > &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 F> | |
| static Setup< F > | Load (const std::string &fileName) |
| Loads a serialized setup from a file. | |
Private Member Functions | |
| 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< LayerProperty > | fGeoLayers {} |
| Set of geometrical 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. | |
| FieldBuilder | fFieldBuilder |
| 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} |
| Offset from target center [cm]. | |
| static constexpr double | kTargetMaterialOffset {2.} |
| Offset of the target material [in dz]. | |
| static constexpr double | kTargetMaterialTransverseSizeMargin {1.3} |
| Margin of target transverse size. | |
| static constexpr double | kTargetFieldInitStep |
| Step between nodal points to determine field near target [cm]. | |
| static constexpr int | kTargetMaterialMapNofBins {20} |
| Number of bins along x- and y-axis in the target region;. | |
Creates a valid initialized Setup instance.
Initialization scenarios: (a) Manual:
Definition at line 43 of file KfSetupBuilder.h.
|
default |
Default constructor.
Referenced by operator=(), operator=(), SetupBuilder(), and SetupBuilder().
|
delete |
Copy constructor.
References SetupBuilder().
|
delete |
Move constructor.
References SetupBuilder().
|
virtualdefault |
Destructor.
| void SetupBuilder::AddLayer | ( | SetupBuilder::LayerProperty | geoLayer | ) |
Adds material layer.
| geoLayer | A geometrical layer |
Definition at line 33 of file KfSetupBuilder.cxx.
References fbReady, and fGeoLayers.
Referenced by SetFromSetup().
|
inline |
Access to field funciton.
Definition at line 103 of file KfSetupBuilder.h.
References fFieldBuilder.
| void SetupBuilder::Init | ( | ) |
Initializes, validates and caches the parameters.
| std::runtime_error | If pre-initialization was incomplete |
Definition at line 51 of file KfSetupBuilder.cxx.
References fbIfFieldFunctionSet, fbIfGeoLayersInit, fbIfSetFromSetup, fbIfTargetSet, fbReady, fFieldBuilder, fGeoLayers, fMatMapNofBins, fModuleIndexFactory, fpMaterialMapFactory, fsMaterialCacheFile, fTarget, fvMaterial, kTargetCenterOffset, kTargetMaterialMapNofBins, kTargetMaterialOffset, kTargetMaterialTransverseSizeMargin, LoadMaterial(), and StoreMaterial().
|
private |
Prints initialization status message.
Definition at line 141 of file KfSetupBuilder.cxx.
References fbIfFieldFunctionSet, fbIfGeoLayersInit, fbIfSetFromSetup, fbIfTargetSet, and fpMaterialMapFactory.
|
static |
Loads a serialized setup from a file.
| F | 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 308 of file KfSetupBuilder.h.
|
private |
Reads material from file.
Definition at line 155 of file KfSetupBuilder.cxx.
References fGeoHash, fsMaterialCacheFile, fTarget, and fvMaterial.
Referenced by Init().
| Setup< F > cbm::algo::kf::SetupBuilder::MakeSetup | ( | EFieldMode | fldMode | ) | const |
Creates a setup instance.
| F | Floating point underlying type |
| fldMode | Field mode of the setup |
| std::runtime_error | If the setup is not initialized |
Definition at line 287 of file KfSetupBuilder.h.
References F, fbReady, fFieldBuilder, fGeoLayers, fModuleIndexFactory, fTarget, and fvMaterial.
|
delete |
Copy assignment operator.
References SetupBuilder().
|
delete |
Move assignment operator.
References SetupBuilder().
| void SetupBuilder::Reset | ( | ) |
Resets the instance.
Definition at line 192 of file KfSetupBuilder.cxx.
References fbIfFieldFunctionSet, fbIfGeoLayersInit, fbIfSetFromSetup, fbIfTargetSet, fbReady, fFieldBuilder, fGeoLayers, fModuleIndexFactory, fpMaterialMapFactory, and fvMaterial.
|
inline |
Sets magnetic field function.
| fieldFn | Magnetic field function |
| fieldType | Magnetic field type |
Definition at line 125 of file KfSetupBuilder.h.
References fbIfFieldFunctionSet, fbReady, fFieldBuilder, and kTargetFieldInitStep.
Initializes the setup builder from existing setup.
| F | Underlying data type of the setup |
| inSetup |
Definition at line 237 of file KfSetupBuilder.h.
References AddLayer(), cbm::algo::kf::utils::simd::Cast(), fbIfGeoLayersInit, fbIfSetFromSetup, fbIfTargetSet, fbReady, fFieldBuilder, fGeoLayers, fModuleIndexFactory, cbm::algo::kf::Setup< F >::fTarget, fTarget, fvMaterial, cbm::algo::kf::Setup< F >::GetActiveLayer(), cbm::algo::kf::Setup< F >::GetIndexMap(), cbm::algo::kf::Setup< F >::GetMaterial(), cbm::algo::kf::Setup< F >::GetNofLayers(), and cbm::algo::kf::Setup< F >::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 155 of file KfSetupBuilder.h.
References fGeoHash, and fsMaterialCacheFile.
|
inline |
Sets material map creator.
| pMaterialFactory | Pointer to the actual material map creator instance |
Definition at line 141 of file KfSetupBuilder.h.
References fbReady, and fpMaterialMapFactory.
| 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 208 of file KfSetupBuilder.cxx.
References fbIfTargetSet, fbReady, fFieldBuilder, fTarget, x, and y.
|
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 222 of file KfSetupBuilder.cxx.
|
private |
Stores material to file.
Definition at line 239 of file KfSetupBuilder.cxx.
References fGeoHash, fsMaterialCacheFile, fTarget, and fvMaterial.
Referenced by Init().
|
private |
Field function initialized.
Definition at line 223 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), and SetFieldFunction().
|
private |
Geo layers initialized.
Definition at line 222 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), and SetFromSetup().
|
private |
Definition at line 224 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), and SetFromSetup().
|
private |
Target initialized.
Definition at line 221 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), SetFromSetup(), and SetTargetProperty().
|
private |
Instance is ready for setup generation.
Definition at line 225 of file KfSetupBuilder.h.
Referenced by AddLayer(), Init(), MakeSetup(), Reset(), SetFieldFunction(), SetFromSetup(), SetMaterialMapFactory(), and SetTargetProperty().
|
private |
Instance of field factory.
Definition at line 216 of file KfSetupBuilder.h.
Referenced by GetFieldFunction(), Init(), MakeSetup(), Reset(), SetFieldFunction(), SetFromSetup(), and SetTargetProperty().
|
private |
A hash of the geometry.
Definition at line 218 of file KfSetupBuilder.h.
Referenced by LoadMaterial(), SetMaterialCacheFile(), and StoreMaterial().
|
private |
Set of geometrical layers.
Definition at line 211 of file KfSetupBuilder.h.
Referenced by AddLayer(), Init(), MakeSetup(), Reset(), and SetFromSetup().
|
private |
Number of bins in material maps.
Definition at line 219 of file KfSetupBuilder.h.
Referenced by Init().
|
private |
Module index factory.
Definition at line 215 of file KfSetupBuilder.h.
Referenced by Init(), MakeSetup(), Reset(), and SetFromSetup().
|
private |
Material map creator.
Definition at line 214 of file KfSetupBuilder.h.
Referenced by Init(), InitStatusMsg(), Reset(), and SetMaterialMapFactory().
|
private |
A cache file for the material.
Definition at line 212 of file KfSetupBuilder.h.
Referenced by Init(), LoadMaterial(), SetMaterialCacheFile(), and StoreMaterial().
|
private |
Target properties.
Definition at line 217 of file KfSetupBuilder.h.
Referenced by Init(), LoadMaterial(), MakeSetup(), SetFromSetup(), SetTargetProperty(), and StoreMaterial().
|
private |
Material map container.
Definition at line 213 of file KfSetupBuilder.h.
Referenced by Init(), LoadMaterial(), MakeSetup(), Reset(), SetFromSetup(), and StoreMaterial().
|
staticconstexprprivate |
Offset from target center [cm].
Definition at line 204 of file KfSetupBuilder.h.
Referenced by Init().
|
staticconstexprprivate |
Step between nodal points to determine field near target [cm].
Definition at line 207 of file KfSetupBuilder.h.
Referenced by SetFieldFunction().
|
staticconstexprprivate |
Number of bins along x- and y-axis in the target region;.
Definition at line 209 of file KfSetupBuilder.h.
Referenced by Init().
|
staticconstexprprivate |
Offset of the target material [in dz].
Definition at line 205 of file KfSetupBuilder.h.
Referenced by Init().
|
staticconstexprprivate |
Margin of target transverse size.
Definition at line 206 of file KfSetupBuilder.h.
Referenced by Init().