forked from cms-analysis/flashgg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnergyScaleCorrection.patch
79 lines (66 loc) · 3.27 KB
/
EnergyScaleCorrection.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From e560d494c2b06fdba5f2aa1fcb5642f8a59f2c68 Mon Sep 17 00:00:00 2001
From: Thomas Reitenspiess <[email protected]>
Date: Fri, 18 Oct 2019 10:54:57 +0200
Subject: [PATCH] Patch for EgammaTools/src/EnergyScaleCorrection.cc to improve
speed when reading scales and smearings files and fabs(eta) bugfix
---
RecoEgamma/EgammaTools/src/EnergyScaleCorrection.cc | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/RecoEgamma/EgammaTools/src/EnergyScaleCorrection.cc b/RecoEgamma/EgammaTools/src/EnergyScaleCorrection.cc
index dd41135e5e4..f6e38c09264 100644
--- a/RecoEgamma/EgammaTools/src/EnergyScaleCorrection.cc
+++ b/RecoEgamma/EgammaTools/src/EnergyScaleCorrection.cc
@@ -67,7 +67,7 @@ float EnergyScaleCorrection::smearingSigma(int runnr, double et, double eta, dou
{
const SmearCorrection* smearCorr = getSmearCorr(runnr,et,eta,r9,gainSeed);
- if(smearCorr!=nullptr) return smearCorr->sigma(nrSigmaRho,nrSigmaPhi);
+ if(smearCorr!=nullptr) return smearCorr->sigma(et, nrSigmaRho,nrSigmaPhi);
else return kDefaultSmearVal_;
}
@@ -76,7 +76,7 @@ const EnergyScaleCorrection::ScaleCorrection*
EnergyScaleCorrection::getScaleCorr(unsigned int runnr, double et, double eta, double r9,
unsigned int gainSeed) const
{
-
+ eta=fabs(eta);
// buld the category based on the values of the object
CorrectionCategory category(runnr, et, eta, r9, gainSeed);
auto result = std::equal_range(scales_.begin(),scales_.end(),category,Sorter<CorrectionCategory,ScaleCorrection>());
@@ -102,7 +102,7 @@ const EnergyScaleCorrection::SmearCorrection*
EnergyScaleCorrection::getSmearCorr(unsigned int runnr, double et, double eta, double r9,
unsigned int gainSeed) const
{
-
+ eta=fabs(eta);
// buld the category based on the values of the object
CorrectionCategory category(runnr, et, eta, r9, gainSeed);
auto result = std::equal_range(smearings_.begin(),smearings_.end(),category,Sorter<CorrectionCategory,SmearCorrection>());
@@ -138,8 +138,6 @@ void EnergyScaleCorrection::addScale(const std::string& category, int runMin, in
ScaleCorrection corr(energyScale,energyScaleErrStat,energyScaleErrSyst,energyScaleErrGain);
scales_.push_back({cat,corr});
- std::sort(scales_.begin(),scales_.end(),Sorter<CorrectionCategory,ScaleCorrection>());
-
}
void EnergyScaleCorrection::addSmearing(const std::string& category,int runMin, int runMax,
@@ -157,7 +155,6 @@ void EnergyScaleCorrection::addSmearing(const std::string& category,int runMin,
SmearCorrection corr(rho,errRho,phi,errPhi,eMean,errEMean);
smearings_.push_back({cat,corr});
- std::sort(smearings_.begin(),smearings_.end(),Sorter<CorrectionCategory,SmearCorrection>());
}
@@ -189,6 +186,8 @@ void EnergyScaleCorrection::readScalesFromFile(const std::string& filename)
addScale(category, runMin, runMax, energyScale, energyScaleErrStat, energyScaleErrSyst, energyScaleErrGain);
}
+ std::sort(scales_.begin(),scales_.end(),Sorter<CorrectionCategory,ScaleCorrection>());
+
file.close();
return;
}
@@ -252,6 +251,8 @@ void EnergyScaleCorrection::readSmearingsFromFile(const std::string& filename)
}
+ std::sort(smearings_.begin(),smearings_.end(),Sorter<CorrectionCategory,SmearCorrection>());
+
file.close();
return;
}
--
2.19.0