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
{
36
m_pidCalibWeightDB
= std::make_unique<DBObjPtr<PIDCalibrationWeight>>();
37
38
if
(!(*
m_pidCalibWeightDB
))
39
B2FATAL(
"The dbobject PIDCalibrationWeight could not be found! It is necessary for the weighted PID variables."
);
40
};
41
45
PIDCalibrationWeightUtil
(std::string matrixName)
46
{
47
m_matrixName
= matrixName;
48
49
if
(
m_matrixName
.find(
"PIDDetectorWeights"
) != std::string::npos) {
50
m_pidDetWeightDB
= std::make_unique<DBObjPtr<PIDDetectorWeights>>(
m_matrixName
);
51
if
(!(*
m_pidDetWeightDB
))
52
B2FATAL(
"The dbobject PIDDetectorWeights, "
<<
m_matrixName
<<
53
" could not be found! It is necessary for the weighted PID variables."
);
54
}
else
{
55
m_pidCalibWeightDB
= std::make_unique<DBObjPtr<PIDCalibrationWeight>>(
m_matrixName
);
56
if
(!(*
m_pidCalibWeightDB
))
57
B2FATAL(
"The dbobject PIDCalibrationWeight, "
<<
m_matrixName
<<
58
" could not be found! It is necessary for the weighted PID variables."
);
59
}
60
};
61
65
double
getWeight
(
int
pdg,
Const::EDetector
det,
double
p,
double
theta)
const
66
{
67
if
(
m_matrixName
.find(
"PIDDetectorWeights"
) != std::string::npos) {
68
return
(*m_pidDetWeightDB)->getWeight(
Const::ParticleType
(pdg), det, p, theta);
69
}
else
{
70
return
(*m_pidCalibWeightDB)->getWeight(pdg, det);
71
}
72
}
73
74
private
:
75
std::string
m_matrixName
=
"PIDCalibrationWeight"
;
76
std::unique_ptr<DBObjPtr<PIDCalibrationWeight>>
m_pidCalibWeightDB
;
77
std::unique_ptr<DBObjPtr<PIDDetectorWeights>>
78
m_pidDetWeightDB
;
79
80
81
};
82
84
}
// Belle2 namespace
85
86
87
88
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::PIDCalibrationWeightUtil::PIDCalibrationWeightUtil
PIDCalibrationWeightUtil(std::string matrixName)
Constructor with the name of the calibration weight matrix.
Definition
PIDCalibrationWeightUtil.h:45
Belle2::PIDCalibrationWeightUtil::m_pidCalibWeightDB
std::unique_ptr< DBObjPtr< PIDCalibrationWeight > > m_pidCalibWeightDB
db object for the calibration weight matrix.
Definition
PIDCalibrationWeightUtil.h:76
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:65
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:78
Belle2::PIDCalibrationWeightUtil::m_matrixName
std::string m_matrixName
name of the matrix.
Definition
PIDCalibrationWeightUtil.h:75
Belle2
Abstract base class for different kinds of events.
Definition
MillepedeAlgorithm.h:17
analysis
utility
include
PIDCalibrationWeightUtil.h
Generated on Mon Sep 1 2025 02:46:19 for Belle II Software by
1.13.2