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 std::vector<double> tmprms;
25 std::vector<double> tmpmed;
27 for(
unsigned int i0 = 0; i0 < lAlgos.size(); i0++) {
28 int pAlgoId = lAlgos[i0].getParameter<
int > (
"algoId");
29 bool pCharged = lAlgos[i0].getParameter<
bool> (
"useCharged");
30 bool pWeight0 = lAlgos[i0].getParameter<
bool> (
"applyLowPUCorr");
31 int pComb = lAlgos[i0].getParameter<
int> (
"combOpt");
32 double pConeSize = lAlgos[i0].getParameter<
double>(
"cone");
33 double pRMSPtMin = lAlgos[i0].getParameter<
double>(
"rmsPtMin");
34 double pRMSSF = lAlgos[i0].getParameter<
double>(
"rmsScaleFactor");
46 fRMS .push_back(pRMS);
48 fMean .push_back(pMean);
53 for (
unsigned int j0 = 0; j0 <
fEtaMin.size(); j0++){
54 tmprms.push_back(pRMS);
55 tmpmed.push_back(pMed);
74 for(
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
90 void PuppiAlgo::add(
const fastjet::PseudoJet &iParticle,
const double &iVal,
const unsigned int iAlgo) {
91 if(iParticle.pt() <
fRMSPtMin[iAlgo])
return;
96 int puppi_register = std::numeric_limits<int>::lowest();
97 if ( iParticle.has_user_info() ) {
103 if ( puppi_register == std::numeric_limits<int>::lowest() ) {
104 throw cms::Exception(
"PuppiRegisterNotSet") <<
"The puppi register is not set. This must be set before use.\n";
118 fPups.push_back(iVal);
134 if(
fNCount[iAlgo] == 0)
return;
138 for(
unsigned int i0 = 0; i0 < iAlgo; i0++) lNBefore +=
fNCount[i0];
143 for(
int i0 = lNBefore; i0 < lNBefore+
fNCount[iAlgo]; i0++) {
144 if(
fPups[i0] == 0) lNum0 = i0-lNBefore;
148 int lNHalfway = lNBefore + lNum0 +
int(
double( fNCount[iAlgo]-lNum0 )*0.50);
153 for(
int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) {
155 if(
fPups[i0] == 0)
continue;
161 fMean[iAlgo]/=fNCount[iAlgo];
162 if(lNRMS > 0)
fRMS [iAlgo]/=lNRMS;
174 for(
unsigned int i0 = 0; i0 <
fPupsPV.size(); i0++)
if(
fPupsPV[i0] <= lMed ) lNPV++;
175 double lAdjust = double(lNPV)/double(lNPV+0.5*fNCount[iAlgo]);
177 fMedian[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*
fRMS[iAlgo]);
178 fRMS[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*
fRMS[iAlgo]);
185 for (
unsigned int j0 = 0; j0 <
fEtaMin.size(); j0++){
200 for(
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
201 if(
fNCount[i0] == 0)
return 1.;
202 if(
fCombId[i0] == 1 && i0 > 0) {
203 double pPVal = ROOT::Math::chisquared_cdf(lVal,lNDOF);
208 double pVal = iVals[i0];
215 if(i0 == 0 && iChi2 != 0) lNDOF++;
216 if(i0 == 0 && iChi2 != 0) lVal+=iChi2;
219 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< double > fEtaMin
std::vector< bool > fAdjust
std::vector< std::vector< double > > fMedian_perEta
PuppiAlgo(edm::ParameterSet &iConfig)
double cur_NeutralPtSlope
std::vector< std::vector< double > > fRMS_perEta
std::vector< double > fConeSize
int puppi_register() const
std::vector< double > fRMS
std::vector< double > fNeutralPtMin
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
std::vector< double > fPtMin
std::vector< double > fRMSEtaSF
std::vector< double > fNeutralPtSlope
void computeMedRMS(const unsigned int &iAlgo, const double &iPVFrac)
std::vector< double > fMedEtaSF
std::vector< double > fEtaMax
void fixAlgoEtaBin(int i_eta)
std::vector< bool > fCharged
std::vector< int > fNCount
std::vector< double > fMedian