Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-24 09:52:49

0001 #include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h"
0002 #include <algorithm>
0003 
0004 const EcalSCDynamicDPhiParameters::DynamicDPhiParameters* EcalSCDynamicDPhiParameters::dynamicDPhiParameters(
0005     double clustE, double absSeedEta) const {
0006   // assume the collection is lexicographically sorted in ascending DynamicDPhiParams.eMin and ascending DynamicDPhiParams.etaMin
0007   // find the matching eMin value
0008   auto it1 = std::lower_bound(dynamicDPhiParametersCollection_.begin(),
0009                               dynamicDPhiParametersCollection_.end(),
0010                               clustE,
0011                               [](const EcalSCDynamicDPhiParameters::DynamicDPhiParameters& params, const double var) {
0012                                 return params.eMin < var;
0013                               });
0014   if (it1 != dynamicDPhiParametersCollection_.begin()) {
0015     --it1;
0016   }
0017 
0018   // find the matching eMin and etaMin entry going only up to the sets matching for clustE
0019   const auto vars = std::make_pair(it1->eMin, absSeedEta);
0020   auto it2 = std::lower_bound(
0021       dynamicDPhiParametersCollection_.begin(),
0022       it1 + 1,
0023       vars,
0024       [](const EcalSCDynamicDPhiParameters::DynamicDPhiParameters& params, const std::pair<double, double> vars) {
0025         return params.eMin < vars.first || params.etaMin < vars.second;
0026       });
0027 
0028   return (it2 != dynamicDPhiParametersCollection_.begin()) ? &*(it2 - 1) : nullptr;
0029 }
0030 
0031 void EcalSCDynamicDPhiParameters::print(std::ostream& out) const {
0032   out << "SC dynamic dPhi parameters:" << std::endl;
0033   out << " Parameters are binned in " << dynamicDPhiParametersCollection_.size() << " (E, |eta|) regions." << std::endl;
0034   for (const auto& params : dynamicDPhiParametersCollection_) {
0035     out << " Parameters for E_min=" << params.eMin << " and |eta_min|=" << params.etaMin << ":" << std::endl;
0036     out << "  yoffset:    " << params.yoffset << std::endl;
0037     out << "  scale:      " << params.scale << std::endl;
0038     out << "  xoffset:    " << params.xoffset << std::endl;
0039     out << "  width:      " << params.width << std::endl;
0040     out << "  saturation: " << params.saturation << std::endl;
0041     out << "  cutoff:     " << params.cutoff << std::endl;
0042   }
0043 }