7 #include "Math/ProbFunc.h"
10 std::vector<float> vd2vf(
const std::vector<double> &
vd) {
11 std::vector<float>
ret;
21 puppiPriors_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiPriors"))),
22 puppiPriorsPhotons_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiPriorsPhotons"))),
23 puppiPtSlopes_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiPtSlopes"))),
24 puppiPtSlopesPhotons_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiPtSlopesPhotons"))),
25 puppiPtZeros_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiPtZeros"))),
26 puppiPtZerosPhotons_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiPtZerosPhotons"))),
27 puppiAlphaSlopes_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiAlphaSlopes"))),
28 puppiAlphaSlopesPhotons_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiAlphaSlopesPhotons"))),
29 puppiAlphaZeros_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiAlphaZeros"))),
30 puppiAlphaZerosPhotons_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiAlphaZerosPhotons"))),
31 puppiAlphaCrops_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiAlphaCrops"))),
32 puppiAlphaCropsPhotons_(vd2vf(iConfig.getParameter<
std::vector<double>>(
"puppiAlphaCropsPhotons"))) {
34 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiPriors\n");
36 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiPtSlopes\n");
38 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiPtZeros\n");
40 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiAlphaSlopes\n");
42 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiAlphaZeros\n");
44 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiAlphaCrops\n");
46 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiPriorsPhotons\n");
48 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiPtSlopesPhotons\n");
50 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiPtZerosPhotons\n");
52 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiAlphaSlopesPhotons\n");
54 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiAlphaZerosPhotons\n");
56 throw cms::Exception(
"Configuration",
"Mismatched lenght for puppiAlphaCropsPhotons\n");
62 static const std::vector<std::string> names_{};
69 std::vector<float> alphaC, alphaF;
77 const std::vector<float> &alphaC,
78 const std::vector<float> &alphaF)
const {
80 dbgPrintf(
"LinPup\t npu estimate %7.2f --> log(npu/200) = %+6.2f \n", npu,
std::log(npu / 200.
f));
81 for (
unsigned int ip = 0,
np =
r.pf.size(); ip <
np; ++ip) {
89 "LinPup\t charged id %1d pt %7.2f eta %+5.2f phi %+5.2f fromPV %1d "
90 " --> puppi weight %.3f puppi pt %7.2f \n",
97 p.floatPt() *
p.floatPuppiW());
101 float absEta =
r.relativeCoordinates ?
r.globalAbsEta(
p.floatEta()) :
std::abs(
p.floatEta());
108 unsigned int ietaBin = 0, lastBin =
puppiEtaCuts_.size() - 1;
109 while (ietaBin < lastBin && absEta >
puppiEtaCuts_[ietaBin]) {
115 float x2a = std::clamp(alphaSlope * (
alpha - alphaZero), -alphaCrop, alphaCrop);
119 float x2pt = ptSlope * (
p.floatPt() - ptZero);
124 float x2 = x2a + x2pt - x2prior;
128 "LinPup\t neutral id %1d pt %7.2f eta %+5.2f phi %+5.2f alpha %+6.2f x2a %+5.2f x2pt %+6.2f x2prior "
129 "%+6.2f --> x2 %+6.2f --> puppi weight %.3f puppi pt %7.2f \n",
140 p.floatPt() *
p.floatPuppiW());