File indexing completed on 2024-04-06 12:24:45
0001
0002
0003 #include "RecoEcal/EgammaCoreTools/interface/MustacheSCParametersHelper.h"
0004
0005 #include <algorithm>
0006 #include <utility>
0007
0008 using namespace reco;
0009
0010 MustacheSCParametersHelper::MustacheSCParametersHelper(EcalMustacheSCParameters ¶ms,
0011 const edm::ParameterSet &iConfig)
0012 : parameters_(params) {
0013 setSqrtLogClustETuning(iConfig.getParameter<double>("sqrtLogClustETuning"));
0014
0015
0016
0017 if (!parameters_.parabolaParametersCollection_.empty()) {
0018 parameters_.parabolaParametersCollection_.clear();
0019 }
0020 const auto parabolaPSets = iConfig.getParameter<std::vector<edm::ParameterSet>>("parabolaParameterSets");
0021 for (const auto &pSet : parabolaPSets) {
0022 EcalMustacheSCParameters::ParabolaParameters parabolaParams = {pSet.getParameter<double>("log10EMin"),
0023 pSet.getParameter<double>("etaMin"),
0024 pSet.getParameter<std::vector<double>>("pUp"),
0025 pSet.getParameter<std::vector<double>>("pLow"),
0026 pSet.getParameter<std::vector<double>>("w0Up"),
0027 pSet.getParameter<std::vector<double>>("w1Up"),
0028 pSet.getParameter<std::vector<double>>("w0Low"),
0029 pSet.getParameter<std::vector<double>>("w1Low")};
0030 addParabolaParameters(parabolaParams);
0031 sortParabolaParametersCollection();
0032 }
0033 }
0034
0035 void MustacheSCParametersHelper::setSqrtLogClustETuning(const float sqrtLogClustETuning) {
0036 parameters_.sqrtLogClustETuning_ = sqrtLogClustETuning;
0037 }
0038
0039 void MustacheSCParametersHelper::addParabolaParameters(
0040 const EcalMustacheSCParameters::ParabolaParameters ¶bolaParams) {
0041 parameters_.parabolaParametersCollection_.emplace_back(parabolaParams);
0042 }
0043
0044 void MustacheSCParametersHelper::sortParabolaParametersCollection() {
0045 std::sort(parameters_.parabolaParametersCollection_.begin(),
0046 parameters_.parabolaParametersCollection_.end(),
0047 [](const EcalMustacheSCParameters::ParabolaParameters &p1,
0048 const EcalMustacheSCParameters::ParabolaParameters &p2) {
0049 const auto p1Mins = std::make_pair(p1.log10EMin, p1.etaMin);
0050 const auto p2Mins = std::make_pair(p2.log10EMin, p2.etaMin);
0051 return p1Mins < p2Mins;
0052 });
0053 }