Belle II Software
development
PIDCalibrationWeightUtil.h
1
/**************************************************************************
2
* basf2 (Belle II Analysis Software Framework) *
3
* Author: The Belle II Collaboration *
4
* *
5
* See git log for contributors and copyright holders. *
6
* This file is licensed under LGPL-3.0, see LICENSE.md. *
7
**************************************************************************/
8
9
#pragma once
10
11
#include <analysis/dbobjects/PIDCalibrationWeight.h>
12
#include <analysis/dbobjects/PIDDetectorWeights.h>
13
#include <framework/database/DBObjPtr.h>
14
#include <framework/logging/Logger.h>
15
16
#include <framework/gearbox/Const.h>
17
18
namespace
Belle2
{
23
27
class
PIDCalibrationWeightUtil
{
28
29
public
:
30
34
PIDCalibrationWeightUtil
()
35
:
m_pidCalibWeightDB
(
std
::make_unique<
DBObjPtr
<
PIDCalibrationWeight
>>())
36
{
37
if
(!(*
m_pidCalibWeightDB
))
38
B2FATAL(
"The dbobject PIDCalibrationWeight could not be found! It is necessary for the weighted PID variables."
);
39
};
40
44
explicit
PIDCalibrationWeightUtil
(
const
std::string& matrixName)
45
:
m_matrixName
(matrixName)
46
{
47
if
(
m_matrixName
.find(
"PIDDetectorWeights"
) != std::string::npos) {
48
m_pidDetWeightDB = std::make_unique<DBObjPtr<PIDDetectorWeights>>(m_matrixName);
49
if (!(*m_pidDetWeightDB))
50
B2FATAL(
"The dbobject PIDDetectorWeights, "
<< m_matrixName <<
51
" could not be found! It is necessary for the weighted PID variables."
);
52
}
else
{
53
m_pidCalibWeightDB = std::make_unique<DBObjPtr<PIDCalibrationWeight>>(m_matrixName);
54
if (!(*m_pidCalibWeightDB))
55
B2FATAL(
"The dbobject PIDCalibrationWeight, "
<< m_matrixName <<
56
" could not be found! It is necessary for the weighted PID variables."
);
57
}
58
};
59
63
double
getWeight
(
int
pdg,
Const::EDetector
det,
double
p,
double
theta)
const
64
{
65
if
(
m_matrixName
.find(
"PIDDetectorWeights"
) != std::string::npos) {
66
return
(*m_pidDetWeightDB)->getWeight(
Const::ParticleType
(pdg), det, p, theta);
67
}
else
{
68
return
(*m_pidCalibWeightDB)->getWeight(pdg, det);
69
}
70
}
71
72
private
:
73
std::string
m_matrixName
=
"PIDCalibrationWeight"
;
74
std::unique_ptr<DBObjPtr<PIDCalibrationWeight>>
m_pidCalibWeightDB
;
75
std::unique_ptr<DBObjPtr<PIDDetectorWeights>>
76
m_pidDetWeightDB
;
77
78
79
};
80
82
}
// Belle2 namespace
83
84
85
86
Belle2::Const::ParticleType
The ParticleType class for identifying different particle types.
Definition
Const.h:408
Belle2::Const::EDetector
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition
Const.h:42
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition
DBObjPtr.h:21
Belle2::PIDCalibrationWeightUtil::m_pidCalibWeightDB
std::unique_ptr< DBObjPtr< PIDCalibrationWeight > > m_pidCalibWeightDB
db object for the calibration weight matrix.
Definition
PIDCalibrationWeightUtil.h:74
Belle2::PIDCalibrationWeightUtil::PIDCalibrationWeightUtil
PIDCalibrationWeightUtil()
Constructor.
Definition
PIDCalibrationWeightUtil.h:34
Belle2::PIDCalibrationWeightUtil::getWeight
double getWeight(int pdg, Const::EDetector det, double p, double theta) const
Get the weight for the given combination of the PDG code and the detector in Const::EDetector.
Definition
PIDCalibrationWeightUtil.h:63
Belle2::PIDCalibrationWeightUtil::m_pidDetWeightDB
std::unique_ptr< DBObjPtr< PIDDetectorWeights > > m_pidDetWeightDB
db object for the detector weight matrix for momentum and theta dependent matrix.
Definition
PIDCalibrationWeightUtil.h:76
Belle2::PIDCalibrationWeightUtil::PIDCalibrationWeightUtil
PIDCalibrationWeightUtil(const std::string &matrixName)
Constructor with the name of the calibration weight matrix.
Definition
PIDCalibrationWeightUtil.h:44
Belle2::PIDCalibrationWeightUtil::m_matrixName
std::string m_matrixName
name of the matrix.
Definition
PIDCalibrationWeightUtil.h:73
Belle2::PIDCalibrationWeight
Class for handling the PID calibration weight matrix.
Definition
PIDCalibrationWeight.h:35
Belle2
Abstract base class for different kinds of events.
Definition
MillepedeAlgorithm.h:17
std
STL namespace.
analysis
utility
include
PIDCalibrationWeightUtil.h
Generated on Tue Jul 14 2026 02:57:20 for Belle II Software by
1.13.2