CbmRoot
Loading...
Searching...
No Matches
kf::tools::MaterialMapFactory Class Reference

An utility class to create a material budget map from the TGeo. More...

#include <KfMaterialMapFactory.h>

Inheritance diagram for kf::tools::MaterialMapFactory:
[legend]
Collaboration diagram for kf::tools::MaterialMapFactory:
[legend]

Public Member Functions

 MaterialMapFactory (int verbose=0)
 Constructor from parameters.
 
 ~MaterialMapFactory ()
 Destructor.
 
void SetDoRadialProjection (double targetZ)
 Project rays radially from the targetZ througth the XY-bins at a reference z.
 
void SetDoHorisontalProjection ()
 Project rays horisontally along the Z axis (default)
 
void SetNraysPerDim (int nRaysDim)
 Shoots nRaysDim * nRaysDim rays for each bin in the map.
 
cbm::algo::kf::MaterialMap GenerateMaterialMap (double zRef, double zMin, double zMax, double xyMax, int nBinsDim) override
 Generates a material budget map.
 
void SetSafeMaterialInitialization (bool val=true)
 Enables safe mode of the material initialization.
 

Private Member Functions

void InitThreads ()
 Initializes the necessary amount of threads in TGeoManager.
 
void CleanUpThreads ()
 Cleans up the TGeoManager: threadIds, create a default navigator.
 
TGeoNavigator * GetCurrentNavigator (int iThread)
 Gets navigator for current thread, creates it if it does not exist.
 

Private Attributes

std::vector< TGeoNavigator * > fNavigators {}
 list of created navigators
 
double fTargetZ {0.}
 z of the target for the radial projection
 
int fNthreadsOld {0}
 number of threads in TGeoManager before the helper was created
 
int fNthreads {0}
 number of threads
 
int fNraysBinPerDim {3}
 shoot fNraysBinPerDim * fNraysBinPerDim rays in each map bin
 
int fVerbose {0}
 verbosity level
 
bool fDoRadialProjection {false}
 if project rays horizontally along the Z axis (special mode)
 
bool fDoSafeInitialization {false}
 

Static Private Attributes

static constexpr double kMinRadLength = 0.3
 Minimal radiational length allowed [cm].
 

Detailed Description

An utility class to create a material budget map from the TGeo.

Definition at line 27 of file KfMaterialMapFactory.h.

Constructor & Destructor Documentation

◆ MaterialMapFactory()

MaterialMapFactory::MaterialMapFactory ( int verbose = 0)

Constructor from parameters.

Parameters
verboseVerbosity level (0 - only warning/error output)

Definition at line 31 of file KfMaterialMapFactory.cxx.

References fDoSafeInitialization, fNthreads, fNthreadsOld, fVerbose, and InitThreads().

◆ ~MaterialMapFactory()

MaterialMapFactory::~MaterialMapFactory ( )

Destructor.

Definition at line 146 of file KfMaterialMapFactory.cxx.

References CleanUpThreads(), fNavigators, fNthreadsOld, and GetCurrentNavigator().

Member Function Documentation

◆ CleanUpThreads()

void MaterialMapFactory::CleanUpThreads ( )
private

Cleans up the TGeoManager: threadIds, create a default navigator.

Definition at line 203 of file KfMaterialMapFactory.cxx.

References GetCurrentNavigator().

Referenced by GenerateMaterialMap(), InitThreads(), and ~MaterialMapFactory().

◆ GenerateMaterialMap()

MaterialMap MaterialMapFactory::GenerateMaterialMap ( double zRef,
double zMin,
double zMax,
double xyMax,
int nBinsDim )
overridevirtual

Generates a material budget map.

Parameters
zRefReference z-coordinate of the material layer [cm]
zMinz-coordinate of the material layer lower boundary [cm]
zMaxz-coordinate of the material layer upper boundary [cm]
xyMaxTransverse size of the material layer [cm]
nBinsDimNumber of bins in the x(y) axis

generate a material map, collecting the material between [zMin, zMax] with radial rays from (0,0,targetZ) through the XY-bins at z == zRef.

It creates a map with [nBinsDim x nBinsDim] bins, of a size of [+-xyMax, +-xyMax] shooting fNraysBinPerDim x fNraysBinPerDim through each bin

The calculated radiation thickness is a projection of the rad.thickness along the ray onto the Z axis. RadThick = sum of (dZ / radLength) over ray trajectory pieces

When doRadialProjection==false the rays are shoot horizontally along the Z axis

Implements cbm::algo::kf::IMaterialMapFactory.

Definition at line 233 of file KfMaterialMapFactory.cxx.

References CleanUpThreads(), fDoRadialProjection, fNraysBinPerDim, fNthreads, fTargetZ, fVerbose, GetCurrentNavigator(), InitThreads(), kMinRadLength, cbm::algo::kf::MaterialMap::SetRadThickBin(), sqrt(), x, and y.

◆ GetCurrentNavigator()

TGeoNavigator * MaterialMapFactory::GetCurrentNavigator ( int iThread)
private

Gets navigator for current thread, creates it if it does not exist.

Parameters
iThreadIndex of the thread
Exceptions
std::runtime_errorIf the TGeoNavigator is not found

Definition at line 175 of file KfMaterialMapFactory.cxx.

References fNavigators.

Referenced by CleanUpThreads(), GenerateMaterialMap(), and ~MaterialMapFactory().

◆ InitThreads()

void MaterialMapFactory::InitThreads ( )
private

Initializes the necessary amount of threads in TGeoManager.

Definition at line 215 of file KfMaterialMapFactory.cxx.

References CleanUpThreads(), and fNthreads.

Referenced by GenerateMaterialMap(), and MaterialMapFactory().

◆ SetDoHorisontalProjection()

void kf::tools::MaterialMapFactory::SetDoHorisontalProjection ( )
inline

Project rays horisontally along the Z axis (default)

Definition at line 45 of file KfMaterialMapFactory.h.

References fDoRadialProjection.

◆ SetDoRadialProjection()

void kf::tools::MaterialMapFactory::SetDoRadialProjection ( double targetZ)
inline

Project rays radially from the targetZ througth the XY-bins at a reference z.

Parameters
targetZz-coordinate of the target [cm]

Definition at line 38 of file KfMaterialMapFactory.h.

References fDoRadialProjection, and fTargetZ.

◆ SetNraysPerDim()

void kf::tools::MaterialMapFactory::SetNraysPerDim ( int nRaysDim)
inline

Shoots nRaysDim * nRaysDim rays for each bin in the map.

Definition at line 48 of file KfMaterialMapFactory.h.

References fNraysBinPerDim.

◆ SetSafeMaterialInitialization()

void kf::tools::MaterialMapFactory::SetSafeMaterialInitialization ( bool val = true)
inline

Enables safe mode of the material initialization.

Definition at line 73 of file KfMaterialMapFactory.h.

References fDoSafeInitialization.

Member Data Documentation

◆ fDoRadialProjection

bool kf::tools::MaterialMapFactory::fDoRadialProjection {false}
private

if project rays horizontally along the Z axis (special mode)

Definition at line 96 of file KfMaterialMapFactory.h.

Referenced by GenerateMaterialMap(), SetDoHorisontalProjection(), and SetDoRadialProjection().

◆ fDoSafeInitialization

bool kf::tools::MaterialMapFactory::fDoSafeInitialization {false}
private

performs slow but safe initialization to get around the crashes in TGeoVoxelFinder

Definition at line 97 of file KfMaterialMapFactory.h.

Referenced by MaterialMapFactory(), and SetSafeMaterialInitialization().

◆ fNavigators

std::vector<TGeoNavigator*> kf::tools::MaterialMapFactory::fNavigators {}
private

list of created navigators

Definition at line 90 of file KfMaterialMapFactory.h.

Referenced by GetCurrentNavigator(), and ~MaterialMapFactory().

◆ fNraysBinPerDim

int kf::tools::MaterialMapFactory::fNraysBinPerDim {3}
private

shoot fNraysBinPerDim * fNraysBinPerDim rays in each map bin

Definition at line 94 of file KfMaterialMapFactory.h.

Referenced by GenerateMaterialMap(), and SetNraysPerDim().

◆ fNthreads

int kf::tools::MaterialMapFactory::fNthreads {0}
private

number of threads

Definition at line 93 of file KfMaterialMapFactory.h.

Referenced by GenerateMaterialMap(), InitThreads(), and MaterialMapFactory().

◆ fNthreadsOld

int kf::tools::MaterialMapFactory::fNthreadsOld {0}
private

number of threads in TGeoManager before the helper was created

Definition at line 92 of file KfMaterialMapFactory.h.

Referenced by MaterialMapFactory(), and ~MaterialMapFactory().

◆ fTargetZ

double kf::tools::MaterialMapFactory::fTargetZ {0.}
private

z of the target for the radial projection

Definition at line 91 of file KfMaterialMapFactory.h.

Referenced by GenerateMaterialMap(), and SetDoRadialProjection().

◆ fVerbose

int kf::tools::MaterialMapFactory::fVerbose {0}
private

verbosity level

Definition at line 95 of file KfMaterialMapFactory.h.

Referenced by GenerateMaterialMap(), and MaterialMapFactory().

◆ kMinRadLength

double kf::tools::MaterialMapFactory::kMinRadLength = 0.3
staticconstexprprivate

Minimal radiational length allowed [cm].

Definition at line 88 of file KfMaterialMapFactory.h.

Referenced by GenerateMaterialMap().


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