Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h"
0002 #include <algorithm>
0003 
0004 float EcalMustacheSCParameters::sqrtLogClustETuning() const { return sqrtLogClustETuning_; }
0005 
0006 const EcalMustacheSCParameters::ParabolaParameters* EcalMustacheSCParameters::parabolaParameters(
0007     float log10ClustE, float absSeedEta) const {
0008   // assume the collection is lexicographically sorted in ascending ParabolaParameters.log10EMin and ascending ParabolaParameters.etaMin
0009   // find the matching log10EMin value
0010   auto it1 = std::lower_bound(parabolaParametersCollection_.begin(),
0011                               parabolaParametersCollection_.end(),
0012                               log10ClustE,
0013                               [](const EcalMustacheSCParameters::ParabolaParameters& params, const double var) {
0014                                 return params.log10EMin < var;
0015                               });
0016   if (it1 != parabolaParametersCollection_.begin()) {
0017     --it1;
0018   }
0019 
0020   // find the matching log10EMin and etaMin entry going only up to the sets matching for log10ClustE
0021   const auto vars = std::make_pair(it1->log10EMin, absSeedEta);
0022   auto it2 = std::lower_bound(
0023       parabolaParametersCollection_.begin(),
0024       it1 + 1,
0025       vars,
0026       [](const EcalMustacheSCParameters::ParabolaParameters& params, const std::pair<double, double> vars) {
0027         return params.log10EMin < vars.first || params.etaMin < vars.second;
0028       });
0029 
0030   return (it2 != parabolaParametersCollection_.begin()) ? &*(it2 - 1) : nullptr;
0031 }
0032 
0033 void EcalMustacheSCParameters::print(std::ostream& out) const {
0034   out << "Mustache SC parameters:" << std::endl;
0035   out << " sqrtLogClustETuning: " << sqrtLogClustETuning_ << std::endl;
0036   out << " Parabola parameters are binned in " << parabolaParametersCollection_.size() << " (log10(E), |eta|) regions."
0037       << std::endl;
0038   for (const auto& params : parabolaParametersCollection_) {
0039     out << " Parameters for log10(E_min)=" << params.log10EMin << " and |eta_min|=" << params.etaMin << ":"
0040         << std::endl;
0041 
0042     out << "  pUp:" << std::endl;
0043     for (size_t i = 0; i < params.pUp.size(); ++i) {
0044       out << "   [" << i << "]: " << params.pUp[i] << std::endl;
0045     }
0046 
0047     out << "  pLow:" << std::endl;
0048     for (size_t i = 0; i < params.pLow.size(); ++i) {
0049       out << "   [" << i << "]: " << params.pLow[i] << std::endl;
0050     }
0051 
0052     out << "  w0Up:" << std::endl;
0053     for (size_t i = 0; i < params.w0Up.size(); ++i) {
0054       out << "   [" << i << "]: " << params.w0Up[i] << std::endl;
0055     }
0056 
0057     out << "  w1Up:" << std::endl;
0058     for (size_t i = 0; i < params.w1Up.size(); ++i) {
0059       out << "   [" << i << "]: " << params.w1Up[i] << std::endl;
0060     }
0061 
0062     out << "  w0Low:" << std::endl;
0063     for (size_t i = 0; i < params.w0Low.size(); ++i) {
0064       out << "   [" << i << "]: " << params.w0Low[i] << std::endl;
0065     }
0066 
0067     out << "  w1Low:" << std::endl;
0068     for (size_t i = 0; i < params.w1Low.size(); ++i) {
0069       out << "   [" << i << "]: " << params.w1Low[i] << std::endl;
0070     }
0071   }
0072 }