Belle II Software development
ECLPhotonEnergyResolution.cc
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#include <analysis/dbobjects/ECLPhotonEnergyResolution.h>
10#include <framework/logging/Logger.h>
11
12using namespace Belle2;
13
15{
19 WeightInfo energyResolutionInfo = {
20 {"RelativeEnergyResolution", -1.},
21 {"RelativeEnergyResolutionUncertUp", -1.},
22 {"RelativeEnergyResolutionUncertDown", -1.}
23 };
24
26}
27
28void ECLPhotonEnergyResolution::addRelativeEnergyResolution(std::vector<double> energyResolution, Binning binning)
29{
33 WeightInfo energyResolutionInfo = {
34 {"RelativeEnergyResolution", energyResolution.at(0)},
35 {"RelativeEnergyResolutionUncertUp", energyResolution.at(1)},
36 {"RelativeEnergyResolutionUncertDown", energyResolution.at(2)}
37 };
38
42 ParticleWeightingBinLimits* energyBinValues = new ParticleWeightingBinLimits(binning.at(0).first, binning.at(0).second);
43 ParticleWeightingBinLimits* thetaBinValues = new ParticleWeightingBinLimits(binning.at(1).first, binning.at(1).second);
44 ParticleWeightingBinLimits* phiBinValues = new ParticleWeightingBinLimits(binning.at(2).first, binning.at(2).second);
45
46 NDBin energyBinning = {{"Energy", energyBinValues}, {"Theta", thetaBinValues}, {"Phi", phiBinValues}};
47
51 m_resolutionBinningTable.addEntry(energyResolutionInfo, energyBinning);
52}
53
54double ECLPhotonEnergyResolution::getRelativeEnergyResolution(double energy, double theta, double phi) const
55{
59 std::map<std::string, double> binning = {{"Energy", energy}, {"Theta", theta}, {"Phi", phi}};
60
64 WeightInfo energyResolutionInfo = m_resolutionBinningTable.getInfo(binning);
65
66 if (energyResolutionInfo.at("RelativeEnergyResolution") == -1.) {
67 B2DEBUG(20, "Energy resolution was returned as -1 since provided energy was not within energy resolution binning.");
68 }
69
70 return energyResolutionInfo.at("RelativeEnergyResolution");
71}
72
73void ECLPhotonEnergyResolution::addThetaPhiResolution(std::vector<double> thetaResolution, std::vector<double> phiResolution,
74 Binning binning)
75{
79 WeightInfo resolutionInfo = {
80 {"ThetaResolution", thetaResolution.at(0)},
81 {"ThetaResolutionUncertUp", thetaResolution.at(1)},
82 {"ThetaResolutionUncertDown", thetaResolution.at(2)},
83 {"PhiResolution", phiResolution.at(0)},
84 {"PhiResolutionUncertUp", phiResolution.at(1)},
85 {"PhiResolutionUncertDown", phiResolution.at(2)}
86 };
87
91 ParticleWeightingBinLimits* energyBinValues = new ParticleWeightingBinLimits(binning.at(0).first, binning.at(0).second);
92 ParticleWeightingBinLimits* thetaBinValues = new ParticleWeightingBinLimits(binning.at(1).first, binning.at(1).second);
93 ParticleWeightingBinLimits* phiBinValues = new ParticleWeightingBinLimits(binning.at(2).first, binning.at(2).second);
94
95 NDBin energyBinning = {{"Energy", energyBinValues}, {"Theta", thetaBinValues}, {"Phi", phiBinValues}};
96
100 m_resolutionBinningTable.addEntry(resolutionInfo, energyBinning);
101}
102
103double ECLPhotonEnergyResolution::getThetaPhiResolution(double energy, double theta, double phi, bool thetaOrPhi) const
104{
108 std::map<std::string, double> binning = {{"Energy", energy}, {"Theta", theta}, {"Phi", phi}};
109
113 WeightInfo resolutionInfo = m_resolutionBinningTable.getInfo(binning);
114
115 if (thetaOrPhi) {
116 if (resolutionInfo.at("PhiResolution") == -1.) {
117 B2DEBUG(20, "Phi resolution was returned as -1 since provided energy was not within theta resolution binning.");
118 }
119 return resolutionInfo.at("PhiResolution");
120 } else {
121 if (resolutionInfo.at("ThetaResolution") == -1.) {
122 B2DEBUG(20, "Theta resolution was returned as -1 since provided energy was not within theta resolution binning.");
123 }
124 return resolutionInfo.at("ThetaResolution");
125 }
126}
void addThetaPhiResolution(std::vector< double > thetaResolution, std::vector< double > phiResolution, Binning binning)
For neutral hadrons Add theta resolution [vector of three values] and phi resolution [vector of three...
double getRelativeEnergyResolution(double energy, double theta, double phi) const
Get energy resolution for given energy, theta, phi.
void addRelativeEnergyResolution(std::vector< double > energyResolution, Binning binning)
Add energy bin [vector of three pairs] and energy resolution [vector of three values] Energy resoluti...
ParticleWeightingLookUpTable m_resolutionBinningTable
Utilise ParticleWeighting modules as holders for binning of energy resolution.
double getThetaPhiResolution(double energy, double theta, double phi, bool thetaOrPhi) const
Get theta or phi resolution for given energy, theta, phi.
Just pair of numbers - min and max values of bin border.
WeightInfo getInfo(std::map< std::string, double > values) const
Get axes names.
void addEntry(WeightInfo entryValue, NDBin bin)
Adds entry to the LookUp table and also adds entry to key table if needed.
void defineOutOfRangeWeight(const WeightInfo &entryValue)
Define reweight info for particles out of range.
std::map< std::string, ParticleWeightingBinLimits * > NDBin
N-dim bin: pairs of bin limits with name of the axis variable.
std::map< std::string, double > WeightInfo
Weight information: a line from the weight lookup table.
std::vector< std::pair< double, double > > Binning
Bin holder as vector for bin limit pairs: [energy limits, theta limits, phi limits].
Abstract base class for different kinds of events.