Belle II Software development
PIDCalibrationWeight Class Reference

Class for handling the PID calibration weight matrix. More...

#include <PIDCalibrationWeight.h>

Inheritance diagram for PIDCalibrationWeight:

Public Member Functions

 PIDCalibrationWeight ()
 Constructor.
 
 PIDCalibrationWeight (const WeightMatrix &weightMatrix)
 Constructor with the initial WeightMatrix.
 
void setWeightMatrix (const WeightMatrix &weightMatrix)
 Set the WeightMatrix.
 
const WeightMatrixgetWeightMatrix () const
 Get the WeightMatrix.
 
double getWeight (int pdg, std::string detector) const
 Get the weight for the given combination of the PDG code and the detector name.
 
double getWeight (int pdg, Const::EDetector det) const
 Get the weight for the given combination of the PDG code and the detector in Const::EDetector.
 
std::vector< double > getWeights (int pdg) const
 Get the weights for the given PDG code.
 

Private Member Functions

 ClassDef (PIDCalibrationWeight, 1)
 ClassDef as this is a TObject.
 

Private Attributes

WeightMatrix m_weightMatrix
 PID calibration weight matrix.
 

Detailed Description

Class for handling the PID calibration weight matrix.

Definition at line 35 of file PIDCalibrationWeight.h.

Constructor & Destructor Documentation

◆ PIDCalibrationWeight() [1/2]

Constructor.

Definition at line 39 of file PIDCalibrationWeight.h.

39{};

◆ PIDCalibrationWeight() [2/2]

PIDCalibrationWeight ( const WeightMatrix & weightMatrix)
inlineexplicit

Constructor with the initial WeightMatrix.

Definition at line 42 of file PIDCalibrationWeight.h.

43 : m_weightMatrix(weightMatrix)
44 {};

Member Function Documentation

◆ getWeight() [1/2]

double getWeight ( int pdg,
Const::EDetector det ) const
inline

Get the weight for the given combination of the PDG code and the detector in Const::EDetector.

Parameters
pdgis the PDG code
detis the detector in Const::EDetector
Returns
weight for the given set of the PDG code and the detector in Const::EDetector

Definition at line 93 of file PIDCalibrationWeight.h.

94 {
95 std::vector<double> weightVector = getWeights(pdg);
96
97 int det_index = Const::PIDDetectors::c_set.getIndex(det);
98 return weightVector[det_index];
99 };
Eigen::VectorXd getWeights(int Size)
Get the vector of weights to calculate the integral over the Chebyshev nodes The nodes are by definit...
Definition nodes.cc:29

◆ getWeight() [2/2]

double getWeight ( int pdg,
std::string detector ) const
inline

Get the weight for the given combination of the PDG code and the detector name.

Parameters
pdgis the PDG code
detectoris the detector name
Returns
weight for the given combination of the PDG code and the detector name

Definition at line 69 of file PIDCalibrationWeight.h.

70 {
71 std::vector<double> weightVector = getWeights(pdg);
72
73 Const::EDetector det = Const::invalidDetector; // default value, will be overwritten
74 boost::to_lower(detector);
75 if (detector == "svd") det = Const::SVD;
76 else if (detector == "cdc") det = Const::CDC;
77 else if (detector == "top") det = Const::TOP;
78 else if (detector == "arich") det = Const::ARICH;
79 else if (detector == "ecl") det = Const::ECL;
80 else if (detector == "klm") det = Const::KLM;
81 else B2FATAL("Unknown detector component: " << detector);
82 int det_index = Const::PIDDetectors::c_set.getIndex(det);
83
84 return weightVector[det_index];
85 };

◆ getWeightMatrix()

const WeightMatrix & getWeightMatrix ( ) const
inline

Get the WeightMatrix.

Definition at line 58 of file PIDCalibrationWeight.h.

59 {
60 return m_weightMatrix;
61 };

◆ getWeights()

std::vector< double > getWeights ( int pdg) const
inline

Get the weights for the given PDG code.

Parameters
pdgis the PDG code
Returns
weights for the given PDG code

Definition at line 106 of file PIDCalibrationWeight.h.

107 {
108 int p_index = -1;
109 for (const auto& pdgIter : Const::chargedStableSet) {
110 if (pdgIter.getPDGCode() == pdg) {
111 p_index = pdgIter.getIndex();
112 break;
113 }
114 }
115 if (p_index == -1)
116 B2FATAL("Invalid particle: " << pdg);
117
118 return m_weightMatrix[p_index];
119 };

◆ setWeightMatrix()

void setWeightMatrix ( const WeightMatrix & weightMatrix)
inline

Set the WeightMatrix.

Parameters
weightMatrixis the weight matrix to be set.

Definition at line 50 of file PIDCalibrationWeight.h.

51 {
52 m_weightMatrix = weightMatrix;
53 };

Member Data Documentation

◆ m_weightMatrix

WeightMatrix m_weightMatrix
private

PID calibration weight matrix.

Definition at line 126 of file PIDCalibrationWeight.h.


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