4 #include "fastjet/internal/base.hh"
5 #include "Math/QuantFuncMathCore.h"
6 #include "Math/SpecFuncMathCore.h"
7 #include "Math/ProbFunc.h"
21 std::vector<edm::ParameterSet> lAlgos = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"puppiAlgos");
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");
43 fRMS .push_back(pRMS);
45 fMean .push_back(pMean);
56 for(
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
63 void PuppiAlgo::add(
const fastjet::PseudoJet &iParticle,
const double &iVal,
const unsigned int iAlgo) {
64 if(iParticle.pt() <
fRMSPtMin[iAlgo])
return;
69 int puppi_register = std::numeric_limits<int>::lowest();
70 if ( iParticle.has_user_info() ) {
76 if ( puppi_register == std::numeric_limits<int>::lowest() ) {
77 throw cms::Exception(
"PuppiRegisterNotSet") <<
"The puppi register is not set. This must be set before use.\n";
91 fPups.push_back(iVal);
107 if(
fNCount[iAlgo] == 0)
return;
111 for(
unsigned int i0 = 0; i0 < iAlgo; i0++) lNBefore +=
fNCount[i0];
116 for(
int i0 = lNBefore; i0 < lNBefore+
fNCount[iAlgo]; i0++) {
117 if(
fPups[i0] == 0) lNum0 = i0-lNBefore;
121 int lNHalfway = lNBefore + lNum0 + int(
double( fNCount[iAlgo]-lNum0 )*0.50);
126 for(
int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) {
128 if(
fPups[i0] == 0)
continue;
134 fMean[iAlgo]/=fNCount[iAlgo];
135 if(lNRMS > 0)
fRMS [iAlgo]/=lNRMS;
150 for(
unsigned int i0 = 0; i0 <
fPupsPV.size(); i0++)
if(
fPupsPV[i0] <= lMed ) lNPV++;
151 double lAdjust = double(lNPV)/double(
fPupsPV.size()+fNCount[iAlgo]);
152 if(lAdjust > 0)
fMedian[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*
fRMS[iAlgo]);
163 for(
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
164 if(
fNCount[i0] == 0)
return 1.;
165 if(
fCombId[i0] == 1 && i0 > 0) {
166 double pPVal = ROOT::Math::chisquared_cdf(lVal,lNDOF);
171 double pVal = iVals[i0];
178 if(i0 == 0 && iChi2 != 0) lNDOF++;
179 if(i0 == 0 && iChi2 != 0) lVal+=iChi2;
182 lPVal *= ROOT::Math::chisquared_cdf(lVal,lNDOF);
T getParameter(std::string const &) const
void add(const fastjet::PseudoJet &iParticle, const double &iVal, const unsigned int iAlgo)
std::vector< bool > fAdjust
PuppiAlgo(edm::ParameterSet &iConfig)
std::vector< double > fConeSize
int puppi_register() const
std::vector< double > fRMS
Abs< T >::type abs(const T &t)
std::vector< float > fPupsPV
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
void computeMedRMS(const unsigned int &iAlgo, const double &iPVFrac)
std::vector< bool > fCharged
std::vector< int > fNCount
std::vector< double > fMedian