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 <analysis/dbobjects/ParticleWeightingBinLimits.h>
11#include <framework/logging/Logger.h>
12
13using namespace Belle2;
14
16{
20 WeightInfo energyResolutionInfo = {
21 {"RelativeEnergyResolution", -1.},
22 {"RelativeEnergyResolutionUncertUp", -1.},
23 {"RelativeEnergyResolutionUncertDown", -1.}
24 };
25
26 m_resolutionBinningTable.defineOutOfRangeWeight(energyResolutionInfo);
27}
28
29void ECLPhotonEnergyResolution::addRelativeEnergyResolution(std::vector<double> energyResolution, Binning binning)
30{
34 WeightInfo energyResolutionInfo = {
35 {"RelativeEnergyResolution", energyResolution.at(0)},
36 {"RelativeEnergyResolutionUncertUp", energyResolution.at(1)},
37 {"RelativeEnergyResolutionUncertDown", energyResolution.at(2)}
38 };
39
43 ParticleWeightingBinLimits* energyBinValues = new ParticleWeightingBinLimits(binning.at(0).first, binning.at(0).second);
44 ParticleWeightingBinLimits* thetaBinValues = new ParticleWeightingBinLimits(binning.at(1).first, binning.at(1).second);
45 ParticleWeightingBinLimits* phiBinValues = new ParticleWeightingBinLimits(binning.at(2).first, binning.at(2).second);
46
47 NDBin energyBinning = {{"Energy", energyBinValues}, {"Theta", thetaBinValues}, {"Phi", phiBinValues}};
48
52 m_resolutionBinningTable.addEntry(energyResolutionInfo, energyBinning);
53}
54
55double ECLPhotonEnergyResolution::getRelativeEnergyResolution(double energy, double theta, double phi) const
56{
60 std::map<std::string, double> binning = {{"Energy", energy}, {"Theta", theta}, {"Phi", phi}};
61
65 WeightInfo energyResolutionInfo = m_resolutionBinningTable.getInfo(binning);
66
67 if (energyResolutionInfo.at("RelativeEnergyResolution") == -1.) {
68 B2DEBUG(20, "Energy resolution was returned as -1 since provided energy was not within energy resolution binning.");
69 }
70
71 return energyResolutionInfo.at("RelativeEnergyResolution");
72}
73
74void ECLPhotonEnergyResolution::addThetaPhiResolution(std::vector<double> thetaResolution, std::vector<double> phiResolution,
75 Binning binning)
76{
80 WeightInfo resolutionInfo = {
81 {"ThetaResolution", thetaResolution.at(0)},
82 {"ThetaResolutionUncertUp", thetaResolution.at(1)},
83 {"ThetaResolutionUncertDown", thetaResolution.at(2)},
84 {"PhiResolution", phiResolution.at(0)},
85 {"PhiResolutionUncertUp", phiResolution.at(1)},
86 {"PhiResolutionUncertDown", phiResolution.at(2)}
87 };
88
92 ParticleWeightingBinLimits* energyBinValues = new ParticleWeightingBinLimits(binning.at(0).first, binning.at(0).second);
93 ParticleWeightingBinLimits* thetaBinValues = new ParticleWeightingBinLimits(binning.at(1).first, binning.at(1).second);
94 ParticleWeightingBinLimits* phiBinValues = new ParticleWeightingBinLimits(binning.at(2).first, binning.at(2).second);
95
96 NDBin energyBinning = {{"Energy", energyBinValues}, {"Theta", thetaBinValues}, {"Phi", phiBinValues}};
97
101 m_resolutionBinningTable.addEntry(resolutionInfo, energyBinning);
102}
103
104double ECLPhotonEnergyResolution::getThetaPhiResolution(double energy, double theta, double phi, bool thetaOrPhi) const
105{
109 std::map<std::string, double> binning = {{"Energy", energy}, {"Theta", theta}, {"Phi", phi}};
110
114 WeightInfo resolutionInfo = m_resolutionBinningTable.getInfo(binning);
115
116 if (thetaOrPhi) {
117 if (resolutionInfo.at("PhiResolution") == -1.) {
118 B2DEBUG(20, "Phi resolution was returned as -1 since provided energy was not within theta resolution binning.");
119 }
120 return resolutionInfo.at("PhiResolution");
121 } else {
122 if (resolutionInfo.at("ThetaResolution") == -1.) {
123 B2DEBUG(20, "Theta resolution was returned as -1 since provided energy was not within theta resolution binning.");
124 }
125 return resolutionInfo.at("ThetaResolution");
126 }
127}
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.
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.