Belle II Software  release-08-01-10
MaterialScan2D Class Referenceabstract

Base class to create a Material Scan of the detector geometry. More...

#include <MaterialScan.h>

Inheritance diagram for MaterialScan2D:
Collaboration diagram for MaterialScan2D:

Classes

struct  ScanParams
 Helper struct to Store Parameters of a Scan. More...
 

Public Member Functions

 MaterialScan2D (TFile *rootFile, const std::string &name, const std::string &axisLabel, const ScanParams &params)
 Constructor. More...
 
bool createNext (G4ThreeVector &origin, G4ThreeVector &direction) override
 Get the origin and direction for the next scan particle. More...
 
int getNRays () const override
 Return the number of rays in this scan.
 
void UserSteppingAction (const G4Step *step) override
 Record the material budget for each step of the particles.
 
std::string getName () const
 Return the name of the scan.
 

Protected Member Functions

virtual void getRay (G4ThreeVector &origin, G4ThreeVector &direction)=0
 Get the origin and direction for the next scan particle. More...
 
TH2D * getHistogram (const std::string &name)
 get histogram for a given name, create if needed. More...
 
void fillValue (const std::string &name, double value)
 Fill the recorded material budget into the corresponding histogram. More...
 
bool checkStep (const G4Step *step)
 check for stuck tracks by looking at the step length
 

Protected Attributes

ScanParams m_params
 Parameters for the scan.
 
double m_curU
 Current value of the parametetr u.
 
double m_stepU
 Stepsize for the parameter u.
 
double m_curV
 Current value of the parametetr v.
 
double m_stepV
 Stepsize for the parameter v.
 
double m_curDepth
 Tracklength of the current Ray.
 
std::map< std::string, std::unique_ptr< TH2D > > m_regions
 Map holding pointers to all created histograms.
 
TFile * m_rootFile
 Pointer to the root file for the histograms.
 
std::string m_name
 Name of the scan, will be prefixed to all histogram names.
 
std::string m_axisLabel
 Labels for the coordinate axes.
 

Private Attributes

int m_zeroSteps {0}
 Count the number of steps with (almost) zero length.
 

Static Private Attributes

static constexpr double c_zeroTolerance = 1e-6
 maximum Step length to be considered zero
 
static constexpr int c_maxZeroStepsNudge = 10
 maximum number of consecutive zero steps before nudging the track along
 
static constexpr int c_maxZeroStepsKill = 20
 maximum number of consecutive zero steps before killing the track
 

Detailed Description

Base class to create a Material Scan of the detector geometry.

This class is used to record the Material budget encountered by a particle and provide origin and directions of all particles used for the scan.

Definition at line 80 of file MaterialScan.h.

Constructor & Destructor Documentation

◆ MaterialScan2D()

MaterialScan2D ( TFile *  rootFile,
const std::string &  name,
const std::string &  axisLabel,
const ScanParams params 
)

Constructor.

Parameters
rootFilePointer to the ROOTFile where the histograms will be stored.
namePrefix to preprend to all Histograms
axisLabelLabels for the histogram axes, separated by semicolon
paramsParameters for the scan

Definition at line 78 of file MaterialScan.cc.

78  :
79  MaterialScanBase(rootFile, name, axisLabel), m_params(params), m_curDepth(0)
80 {
81  //Sort the parameters accordingly
82  if (m_params.minU > m_params.maxU) std::swap(m_params.minU, m_params.maxU);
83  if (m_params.minV > m_params.maxV) std::swap(m_params.minV, m_params.maxV);
84  //Calculate step size of the parameters
87  //Set Start values
88  m_curU = m_params.minU - m_stepU / 2.;
89  m_curV = m_params.minV + m_stepV / 2.;
90  //Convert max depth to G4 units
92  //Sort the list of ignored materials so that we can use binary search
93  std::sort(m_params.ignoredMaterials.begin(), m_params.ignoredMaterials.end());
94 }
double m_stepU
Stepsize for the parameter u.
Definition: MaterialScan.h:150
double m_curDepth
Tracklength of the current Ray.
Definition: MaterialScan.h:156
double m_curU
Current value of the parametetr u.
Definition: MaterialScan.h:148
double m_curV
Current value of the parametetr v.
Definition: MaterialScan.h:152
double m_stepV
Stepsize for the parameter v.
Definition: MaterialScan.h:154
ScanParams m_params
Parameters for the scan.
Definition: MaterialScan.h:146
MaterialScanBase(TFile *rootFile, const std::string &name, const std::string &axisLabel)
This is indeed the constructor and it creates a TDirectory in the output root file and sets all varia...
Definition: MaterialScan.h:37
static const double mm
[millimeters]
Definition: Unit.h:70
double maxU
Maximum u value to scan.
Definition: MaterialScan.h:93
double minV
Minimum v value to scan.
Definition: MaterialScan.h:95
double maxDepth
Maximum depth of the scan.
Definition: MaterialScan.h:99
int nU
Number of rays along u coordinate.
Definition: MaterialScan.h:87
double minU
Minimum u value to scan.
Definition: MaterialScan.h:91
double maxV
Maximum v value to scan.
Definition: MaterialScan.h:97
std::vector< std::string > ignoredMaterials
Names of ignored Materials.
Definition: MaterialScan.h:101
int nV
Number of rays along v coordinate.
Definition: MaterialScan.h:89

Member Function Documentation

◆ createNext()

bool createNext ( G4ThreeVector &  origin,
G4ThreeVector &  direction 
)
overridevirtual

Get the origin and direction for the next scan particle.

Parameters
[out]originOrigin of the next scan particle
[out]directionDirection of the next scan particle
Returns
false if the scan is finished

Implements MaterialScanBase.

Definition at line 97 of file MaterialScan.cc.

◆ fillValue()

void fillValue ( const std::string &  name,
double  value 
)
protected

Fill the recorded material budget into the corresponding histogram.

Parameters
nameName of the histogram
valueValue to store

Definition at line 138 of file MaterialScan.cc.

◆ getHistogram()

TH2D * getHistogram ( const std::string &  name)
protected

get histogram for a given name, create if needed.

Parameters
nameName of the histogram

Definition at line 125 of file MaterialScan.cc.

◆ getRay()

virtual void getRay ( G4ThreeVector &  origin,
G4ThreeVector &  direction 
)
protectedpure virtual

Get the origin and direction for the next scan particle.

To be overridden by descendents

Parameters
[out]originOrigin of the next scan particle
[out]directionDirection of the next scan particle

Implemented in MaterialScanPlanar, and MaterialScanSpherical.


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