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++) {
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++) {
148 fMean[iAlgo] /= fNCount[iAlgo];
150 fRMS[iAlgo] /= lNRMS;
151 if (
fRMS[iAlgo] == 0)
163 for (
unsigned int i0 = 0; i0 <
fPupsPV.size(); i0++)
166 double lAdjust = double(lNPV) / double(lNPV + 0.5 * fNCount[iAlgo]);
168 fMedian[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust, 1.) *
fRMS[iAlgo]);
169 fRMS[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust, 1.) *
fRMS[iAlgo]);
176 for (
unsigned int j0 = 0; j0 <
fEtaMin.size(); j0++) {
190 for (
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
193 if (
fCombId[i0] == 1 && i0 > 0) {
194 double pPVal = ROOT::Math::chisquared_cdf(lVal, lNDOF);
199 double pVal = iVals[i0];
201 if (
fAlgoId[i0] == 0 && iVals[i0] == 0)
203 if (
fAlgoId[i0] == 3 && iVals[i0] == 0)
205 if (
fAlgoId[i0] == 5 && iVals[i0] == 0)
209 if (i0 == 0 && iChi2 != 0)
211 if (i0 == 0 && iChi2 != 0)
215 lPVal *= ROOT::Math::chisquared_cdf(lVal, lNDOF);
221 puppialgos.
add<
int>(
"algoId", 5);
222 puppialgos.
add<
bool>(
"useCharged",
false);
223 puppialgos.
add<
bool>(
"applyLowPUCorr",
false);
224 puppialgos.
add<
int>(
"combOpt", 5);
225 puppialgos.
add<
double>(
"cone", .4);
226 puppialgos.
add<
double>(
"rmsPtMin", .1);
227 puppialgos.
add<
double>(
"rmsScaleFactor", 1.0);
228 std::vector<edm::ParameterSet> VPSetPuppiAlgos;
237 VPSetPuppiAlgos.push_back(puppiset);
240 algos.
addVPSet(
"puppiAlgos", puppialgos, VPSetPuppiAlgos);
241 std::vector<edm::ParameterSet> VPSetAlgos;
243 algos.
add<std::vector<double>>(
"etaMin", {0.});
244 algos.
add<std::vector<double>>(
"etaMax", {2.5});
245 algos.
add<std::vector<double>>(
"ptMin", {0.});
246 algos.
add<std::vector<double>>(
"MinNeutralPt", {0.2});
247 algos.
add<std::vector<double>>(
"MinNeutralPtSlope", {0.015});
248 algos.
add<std::vector<double>>(
"RMSEtaSF", {1.0});
249 algos.
add<std::vector<double>>(
"MedEtaSF", {1.0});
250 algos.
add<
double>(
"EtaMaxExtrap", 2.0);
251 algosset.
addParameter<std::vector<double>>(
"etaMin", {0.});
252 algosset.
addParameter<std::vector<double>>(
"etaMax", {2.5});
253 algosset.
addParameter<std::vector<double>>(
"ptMin", {0.});
254 algosset.
addParameter<std::vector<double>>(
"MinNeutralPt", {0.2});
255 algosset.
addParameter<std::vector<double>>(
"MinNeutralPtSlope", {0.015});
256 algosset.
addParameter<std::vector<double>>(
"RMSEtaSF", {1.0});
257 algosset.
addParameter<std::vector<double>>(
"MedEtaSF", {1.0});
259 algosset.
addParameter<std::vector<edm::ParameterSet>>(
"puppiAlgos", VPSetPuppiAlgos);
260 VPSetAlgos.push_back(algosset);
261 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)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
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
std::vector< double > fRMS
void addParameter(std::string const &name, T const &value)
std::vector< double > fNeutralPtMin
Abs< T >::type abs(const T &t)
int puppi_register() const
std::vector< float > fPupsPV
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double compute(std::vector< double > const &iVals, double iChi2) const
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