CbmRoot
Loading...
Searching...
No Matches
cbm::algo::kf::ModuleIndexMap Class Reference

Maps local detector and station indices to the material maps and field slices. More...

#include <KfModuleIndexMap.h>

Collaboration diagram for cbm::algo::kf::ModuleIndexMap:
[legend]

Public Member Functions

int GetNofLayers () const
 Gets total number of components.
 
template<class EDetID = int>
std::pair< EDetID, int > GlobalToLocal (int globId) const
 Converts internal layer index to pair (detID, locID)
 
template<class EDetID >
int LocalToGlobal (EDetID detId, int locId) const
 Converts external pair (detID, locID) to internal layer index.
 
template<class EDetID >
void Disable (EDetID detId, int locId)
 Disables a component.
 
void Reset ()
 Resets the instance.
 
std::string ToString (int indentLevel=0) const
 String representation of the instance.
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int)
 

Private Attributes

std::vector< int > fvLocToGlb {}
 
std::vector< std::pair< int, int > > fvGlbToLoc {}
 
std::vector< int > fvDetLocOffset {}
 First index of component for det.
 
std::vector< int > fvDetIntToExt {}
 Maps external detID to internal.
 
std::vector< int > fvDetExtToInt {}
 Maps internal detID to external.
 

Friends

class ModuleIndexMapFactory
 
class boost::serialization::access
 

Detailed Description

Maps local detector and station indices to the material maps and field slices.

The class maps external indices of components combined into subsets to a plain global index. The indices both of the components inside a subset (iLoc) and the indices of the subsets themselves (iDetExt) must be unique, but can be unsorted and can have holes in their ranges. The global index (iGlob) is assigned automatically depending on the element ordering.

The mapping is organized with the sequential contiguous containers (std::vector). The containers used are: (i) fvDetExtToInt [ iDetExt ] => iDetInt size: max(iDetExt) (ii) fvDetIntToExt [ iDetInt ] => iDetExt (int) size: number of registered subsystems (iii) fvDetLocOffset [ iDetInt ] => max number of elements for iDetInt - 1 size: max possible number of elements (including inactive/unused) fvDetLocOffset[0] = 0, fvDetLocOffset.back() = n of max possible elements (iv) fvGlbToLoc [ iGlob ] => pair(iDetInt, iLoc) size: number of registered components (v) fvLocToGlb [ fvDetLocOffset[iDetInt] + iLoc] => iGlob size: max possible number of components (including inactive/unused)

Definition at line 49 of file KfModuleIndexMap.h.

Member Function Documentation

◆ Disable()

template<class EDetID >
void cbm::algo::kf::ModuleIndexMap::Disable ( EDetID detId,
int locId )

Disables a component.

Template Parameters
EDetIDconcrete index type of the det ID (can be either an enum, or an integral type)
Parameters
locIdLocal ID of the layer
detIdDetector ID of the component

Definition at line 141 of file KfModuleIndexMap.h.

◆ GetNofLayers()

int cbm::algo::kf::ModuleIndexMap::GetNofLayers ( ) const
inline

Gets total number of components.

Definition at line 55 of file KfModuleIndexMap.h.

Referenced by ToString().

◆ GlobalToLocal()

template<class EDetID >
std::pair< EDetID, int > cbm::algo::kf::ModuleIndexMap::GlobalToLocal ( int globId) const
inline

Converts internal layer index to pair (detID, locID)

Template Parameters
EDetIDconcrete index type of the det ID (can be either an enum, or an integral type)
Parameters
globIdInternal layer index
Returns
pair(detector ID, local ID) of the layer

Definition at line 166 of file KfModuleIndexMap.h.

◆ LocalToGlobal()

template<class EDetID >
int cbm::algo::kf::ModuleIndexMap::LocalToGlobal ( EDetID detId,
int locId ) const
inline

Converts external pair (detID, locID) to internal layer index.

Template Parameters
EDetIDconcrete index type of the det ID (can be either an enum, or an integral type)
Parameters
locIdLocal ID of the layer
detIdDetector ID of the component
Note
if the (detId, locId) pair was not registered, returns -1
Returns
global index of the layer

Definition at line 71 of file KfModuleIndexMap.h.

◆ Reset()

void cbm::algo::kf::ModuleIndexMap::Reset ( )

Resets the instance.

Definition at line 16 of file KfModuleIndexMap.cxx.

References fvDetExtToInt, fvDetIntToExt, fvDetLocOffset, fvGlbToLoc, and fvLocToGlb.

◆ serialize()

template<class Archive >
void cbm::algo::kf::ModuleIndexMap::serialize ( Archive & ar,
const unsigned int  )
inlineprivate

Definition at line 91 of file KfModuleIndexMap.h.

◆ ToString()

std::string cbm::algo::kf::ModuleIndexMap::ToString ( int indentLevel = 0) const

String representation of the instance.

Definition at line 27 of file KfModuleIndexMap.cxx.

References fvGlbToLoc, and GetNofLayers().

Friends And Related Symbol Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 51 of file KfModuleIndexMap.h.

◆ ModuleIndexMapFactory

friend class ModuleIndexMapFactory
friend

Definition at line 50 of file KfModuleIndexMap.h.

Member Data Documentation

◆ fvDetExtToInt

std::vector<int> cbm::algo::kf::ModuleIndexMap::fvDetExtToInt {}
private

Maps internal detID to external.

Definition at line 104 of file KfModuleIndexMap.h.

Referenced by cbm::algo::kf::ModuleIndexMapFactory::MakeIndexMap(), and Reset().

◆ fvDetIntToExt

std::vector<int> cbm::algo::kf::ModuleIndexMap::fvDetIntToExt {}
private

Maps external detID to internal.

Definition at line 103 of file KfModuleIndexMap.h.

Referenced by cbm::algo::kf::ModuleIndexMapFactory::MakeIndexMap(), and Reset().

◆ fvDetLocOffset

std::vector<int> cbm::algo::kf::ModuleIndexMap::fvDetLocOffset {}
private

First index of component for det.

Definition at line 102 of file KfModuleIndexMap.h.

Referenced by cbm::algo::kf::ModuleIndexMapFactory::MakeIndexMap(), and Reset().

◆ fvGlbToLoc

std::vector<std::pair<int, int> > cbm::algo::kf::ModuleIndexMap::fvGlbToLoc {}
private

◆ fvLocToGlb

std::vector<int> cbm::algo::kf::ModuleIndexMap::fvLocToGlb {}
private

The documentation for this class was generated from the following files: