20#include <boost/serialization/access.hpp>
27#include <unordered_map>
28#include <unordered_set>
37 class alignas(VcMemAlign)
Setup {
53 const std::vector<MaterialMap>& materialLayers,
64 throw std::logic_error(
"Attempt to create a kf::Setup from inconsistent set of parameters. Please, use the "
65 "kf::SetupBuilder to create a valid setup.");
71 template<
typename FSrc>
80 fvActiveLayers.emplace_back(layer);
103 template<
class EDetID>
110 template<
class EDetID>
124 template<
class EDetID>
142 template<
class EDetID>
156 template<
class EDetID>
168 std::string
ToString(
int verbosity = 1,
int indentLevel = 0)
const;
183 bool Validate()
const;
186 friend class boost::serialization::access;
187 template<
class Archive>
202 template<
class EDetID>
210 using Inp_t =
typename std::remove_cv_t<std::remove_reference_t<
decltype(toDisableInp)>>;
219 std::unordered_map<EDetID, std::unordered_set<int>> filtered;
221 for (
auto [iDet, iLoc] : toDisableInp) {
224 filtered[iDet].insert(iLoc);
229 auto& locIds = filtered[iDet];
237 sorted.reserve(std::accumulate(filtered.begin(), filtered.end(), 0,
238 [](
int sum,
const auto& item) { return sum + item.second.size(); }));
239 for (
const auto& [iDet, locIds] : filtered) {
241 std::transform(locIds.begin(), locIds.end(), std::back_inserter(sorted), [iDet = iDet](
int iLoc) {
242 return std::pair{iDet, iLoc};
248 std::sort(sorted.begin(), sorted.end(), [&](
auto l,
auto r) {
249 return fModuleIndexMap.LocalToGlobal(l.first, l.second) > fModuleIndexMap.LocalToGlobal(r.first, r.second);
253 for (
auto [iDet, iLoc] : sorted)
254 res.DisableLayer(iDet, iLoc);
261 template<
class EDetID>
279 fField.RemoveSlice(iLayer);
std::string ToString(CbmCutId id)
Convert CbmCutId to a string representation.
Properties of an active surface of the layer.
Common constant definitions for the Kalman Filter library.
Magnetic field representation in KF (header)
A helper class to map external indices with the ones of KF-setup.
A target layer in the KF-setup (header)
std::vector with an additional utility set
Properties of an active surface of the layer.
Magnetic field manager class.
A map of station thickness in units of radiation length (X0) to the specific point in XY plane.
Maps local detector and station indices to the material maps and field slices.
const Field< F > & GetField() const
Makes an instance of the field depending on the template parameter.
Setup()=default
Default constructor (for boost serialization)
Setup & operator=(Setup &&)=default
Move assignment operator.
Target< F > fTarget
Target layer.
int GetNofLayers(EDetID iDet) const
Gets number of layers for detector.
const auto & GetActiveLayers() const
Gets active layers container.
Setup(Setup &&)=default
Move constructor.
const Target< F > & GetTarget() const
Gets target.
Setup & operator=(const Setup &other)=default
Copy assignment operator.
void DisableLayer(EDetID iDet, int iLoc)
Disables geo layer.
bool Validate() const
Validates setup as a system of magnetic field, target and field.
const ActiveLayer< F > & GetActiveLayer(EDetID iDet, int iLoc) const
Gets active layer instance.
Setup CreateSetupWithDisabledLayers(const std::vector< std::pair< EDetID, int > > &toDisable) const
Creates another setup from this with some of the layers disabled.
const MaterialMap & GetMaterial(EDetID iDet, int iLoc) const
Gets material layer from external indices.
int GetNofLayers() const
Gets number of geometry layers.
Field< F > fField
Magnetic field.
const ModuleIndexMap & GetIndexMap() const
Gets module index map.
std::vector< ActiveLayer< F > > fvActiveLayers
Container for active layers.
~Setup()=default
Destructor.
ModuleIndexMap fModuleIndexMap
Index map (internal->external)
const MaterialMap & GetMaterial(int iLayer) const
Gets material layer.
Setup(const ModuleIndexMap &moduleIndexMap, const std::vector< MaterialMap > &materialLayers, std::vector< ActiveLayer< F > > activeLayers, const Field< F > &field, const Target< F > &target)
Constructor.
const ActiveLayer< F > & GetActiveLayer(int iLayer) const
Gets active layer instance.
void serialize(Archive &ar, const unsigned int)
Setup(const Setup &)=default
Default copy constructor.
std::vector< MaterialMap > fvMaterialLayers
Container for material maps.
Setup(const Setup< FSrc > &other)
Copy-convert constructor.
A geometry layer in the target region.
void DisableLayer(EDetID iDet, int iLoc)
Disables geo layer.
ModuleIndexMap fModuleIndexMap
DataOut Cast(const DataT &val)
Converts a value of type DataT to type DataOut.