3 #include "Math/QuantFuncMathCore.h" 4 #include "Math/SpecFuncMathCore.h" 5 #include "Math/ProbFunc.h" 18 std::vector<edm::ParameterSet> lAlgos = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"puppiAlgos");
21 std::vector<double> tmprms;
22 std::vector<double> tmpmed;
24 for (
unsigned int i0 = 0; i0 < lAlgos.size(); i0++) {
25 int pAlgoId = lAlgos[i0].getParameter<
int>(
"algoId");
26 bool pCharged = lAlgos[i0].getParameter<
bool>(
"useCharged");
27 bool pWeight0 = lAlgos[i0].getParameter<
bool>(
"applyLowPUCorr");
28 int pComb = lAlgos[i0].getParameter<
int>(
"combOpt");
29 double pConeSize = lAlgos[i0].getParameter<
double>(
"cone");
30 double pRMSPtMin = lAlgos[i0].getParameter<
double>(
"rmsPtMin");
31 double pRMSSF = lAlgos[i0].getParameter<
double>(
"rmsScaleFactor");
45 fMean.push_back(pMean);
50 for (
unsigned int j0 = 0; j0 <
fEtaMin.size(); j0++) {
51 tmprms.push_back(pRMS);
52 tmpmed.push_back(pMed);
71 for (
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
94 int puppi_id = iParticle.
id;
95 if (puppi_id == std::numeric_limits<int>::lowest()) {
96 throw cms::Exception(
"PuppiRegisterNotSet") <<
"The puppi register is not set. This must be set before use.\n";
101 fPups.push_back(iVal);
121 for (
unsigned int i0 = 0; i0 < iAlgo; i0++)
127 for (
int i0 = lNBefore; i0 < lNBefore +
fNCount[iAlgo]; i0++) {
129 lNum0 = i0 - lNBefore;
133 int lNHalfway = lNBefore + lNum0 +
int(
double(
fNCount[iAlgo] - lNum0) * 0.50);
138 for (
int i0 = lNBefore; i0 < lNBefore +
fNCount[iAlgo]; i0++) {
150 fRMS[iAlgo] /= lNRMS;
151 if (
fRMS[iAlgo] == 0)
162 for (
unsigned int i0 = 0; i0 <
fPupsPV.size(); i0++)
165 double lAdjust = double(lNPV) / double(lNPV + 0.5 *
fNCount[iAlgo]);
167 fMedian[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust, 1.) *
fRMS[iAlgo]);
168 fRMS[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust, 1.) *
fRMS[iAlgo]);
175 for (
unsigned int j0 = 0; j0 <
fEtaMin.size(); j0++) {
189 for (
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
192 if (
fCombId[i0] == 1 && i0 > 0) {
193 double pPVal = ROOT::Math::chisquared_cdf(lVal, lNDOF);
198 double pVal = iVals[i0];
200 if (
fAlgoId[i0] == 0 && iVals[i0] == 0)
202 if (
fAlgoId[i0] == 3 && iVals[i0] == 0)
204 if (
fAlgoId[i0] == 5 && iVals[i0] == 0)
208 if (i0 == 0 && iChi2 != 0)
210 if (i0 == 0 && iChi2 != 0)
214 lPVal *= ROOT::Math::chisquared_cdf(lVal, lNDOF);
220 puppialgos.
add<
int>(
"algoId", 5);
221 puppialgos.
add<
bool>(
"useCharged",
false);
222 puppialgos.
add<
bool>(
"applyLowPUCorr",
false);
223 puppialgos.
add<
int>(
"combOpt", 5);
224 puppialgos.
add<
double>(
"cone", .4);
225 puppialgos.
add<
double>(
"rmsPtMin", .1);
226 puppialgos.
add<
double>(
"rmsScaleFactor", 1.0);
227 std::vector<edm::ParameterSet> VPSetPuppiAlgos;
236 VPSetPuppiAlgos.push_back(puppiset);
239 algos.addVPSet(
"puppiAlgos", puppialgos, VPSetPuppiAlgos);
240 std::vector<edm::ParameterSet> VPSetAlgos;
242 algos.add<std::vector<double>>(
"etaMin", {0.});
243 algos.add<std::vector<double>>(
"etaMax", {2.5});
244 algos.add<std::vector<double>>(
"ptMin", {0.});
245 algos.add<std::vector<double>>(
"MinNeutralPt", {0.2});
246 algos.add<std::vector<double>>(
"MinNeutralPtSlope", {0.015});
247 algos.add<std::vector<double>>(
"RMSEtaSF", {1.0});
248 algos.add<std::vector<double>>(
"MedEtaSF", {1.0});
249 algos.add<
double>(
"EtaMaxExtrap", 2.0);
250 algosset.
addParameter<std::vector<double>>(
"etaMin", {0.});
251 algosset.
addParameter<std::vector<double>>(
"etaMax", {2.5});
252 algosset.
addParameter<std::vector<double>>(
"ptMin", {0.});
253 algosset.
addParameter<std::vector<double>>(
"MinNeutralPt", {0.2});
254 algosset.
addParameter<std::vector<double>>(
"MinNeutralPtSlope", {0.015});
255 algosset.
addParameter<std::vector<double>>(
"RMSEtaSF", {1.0});
256 algosset.
addParameter<std::vector<double>>(
"MedEtaSF", {1.0});
258 algosset.
addParameter<std::vector<edm::ParameterSet>>(
"puppiAlgos", VPSetPuppiAlgos);
259 VPSetAlgos.push_back(algosset);
260 desc.addVPSet(
"algos",
algos, VPSetAlgos);
void add(const PuppiCandidate &iParticle, const double &iVal, const unsigned int iAlgo)
T getParameter(std::string const &) const
void computeMedRMS(const unsigned int &iAlgo)
std::vector< double > fEtaMin
static void fillDescriptionsPuppiAlgo(edm::ParameterSetDescription &desc)
std::vector< bool > fAdjust
PuppiAlgo(edm::ParameterSet &iConfig)
double cur_NeutralPtSlope
std::vector< double > fConeSize
std::vector< std::vector< double > > fMedian_perEta
double compute(std::vector< double > const &iVals, double iChi2) const
std::vector< double > fRMS
void addParameter(std::string const &name, T const &value)
std::vector< double > fNeutralPtMin
Abs< T >::type abs(const T &t)
std::vector< float > fPupsPV
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< float > fPups
std::vector< double > fMean
std::vector< int > fAlgoId
std::vector< double > fRMSPtMin
std::vector< int > fCombId
std::vector< double > fRMSScaleFactor
std::vector< double > fPtMin
std::vector< double > fRMSEtaSF
std::vector< double > fNeutralPtSlope
std::vector< double > fMedEtaSF
std::vector< double > fEtaMax
void fixAlgoEtaBin(int i_eta)
std::vector< bool > fCharged
std::vector< std::vector< double > > fRMS_perEta
std::vector< int > fNCount
std::vector< double > fMedian