4 #include "Math/QuantFuncMathCore.h" 5 #include "Math/SpecFuncMathCore.h" 6 #include "Math/ProbFunc.h" 20 std::vector<edm::ParameterSet> lAlgos = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"puppiAlgos");
23 std::vector<double> tmprms;
24 std::vector<double> tmpmed;
26 for(
unsigned int i0 = 0; i0 < lAlgos.size(); i0++) {
27 int pAlgoId = lAlgos[i0].getParameter<
int > (
"algoId");
28 bool pCharged = lAlgos[i0].getParameter<
bool> (
"useCharged");
29 bool pWeight0 = lAlgos[i0].getParameter<
bool> (
"applyLowPUCorr");
30 int pComb = lAlgos[i0].getParameter<
int> (
"combOpt");
31 double pConeSize = lAlgos[i0].getParameter<
double>(
"cone");
32 double pRMSPtMin = lAlgos[i0].getParameter<
double>(
"rmsPtMin");
33 double pRMSSF = lAlgos[i0].getParameter<
double>(
"rmsScaleFactor");
45 fRMS .push_back(pRMS);
47 fMean .push_back(pMean);
52 for (
unsigned int j0 = 0; j0 <
fEtaMin.size(); j0++){
53 tmprms.push_back(pRMS);
54 tmpmed.push_back(pMed);
73 for(
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
90 if(iParticle.pt() <
fRMSPtMin[iAlgo])
return;
96 if ( puppi_register == std::numeric_limits<int>::lowest() ) {
97 throw cms::Exception(
"PuppiRegisterNotSet") <<
"The puppi register is not set. This must be set before use.\n";
111 fPups.push_back(iVal);
127 if(
fNCount[iAlgo] == 0)
return;
131 for(
unsigned int i0 = 0; i0 < iAlgo; i0++) lNBefore +=
fNCount[i0];
136 for(
int i0 = lNBefore; i0 < lNBefore+
fNCount[iAlgo]; i0++) {
137 if(
fPups[i0] == 0) lNum0 = i0-lNBefore;
141 int lNHalfway = lNBefore + lNum0 +
int(
double( fNCount[iAlgo]-lNum0 )*0.50);
146 for(
int i0 = lNBefore; i0 < lNBefore+fNCount[iAlgo]; i0++) {
148 if(
fPups[i0] == 0)
continue;
154 fMean[iAlgo]/=fNCount[iAlgo];
155 if(lNRMS > 0)
fRMS [iAlgo]/=lNRMS;
167 for(
unsigned int i0 = 0; i0 <
fPupsPV.size(); i0++)
if(
fPupsPV[i0] <= lMed ) lNPV++;
168 double lAdjust = double(lNPV)/double(lNPV+0.5*fNCount[iAlgo]);
170 fMedian[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*
fRMS[iAlgo]);
171 fRMS[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*
fRMS[iAlgo]);
178 for (
unsigned int j0 = 0; j0 <
fEtaMin.size(); j0++){
193 for(
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
194 if(
fNCount[i0] == 0)
return 1.;
195 if(
fCombId[i0] == 1 && i0 > 0) {
196 double pPVal = ROOT::Math::chisquared_cdf(lVal,lNDOF);
201 double pVal = iVals[i0];
208 if(i0 == 0 && iChi2 != 0) lNDOF++;
209 if(i0 == 0 && iChi2 != 0) lVal+=iChi2;
212 lPVal *= ROOT::Math::chisquared_cdf(lVal,lNDOF);
219 puppialgos.
add<
int>(
"algoId", 5);
220 puppialgos.
add<
bool>(
"useCharged",
false);
221 puppialgos.
add<
bool>(
"applyLowPUCorr",
false);
222 puppialgos.
add<
int>(
"combOpt", 5);
223 puppialgos.
add<
double>(
"cone", .4);
224 puppialgos.
add<
double>(
"rmsPtMin", .1);
225 puppialgos.
add<
double>(
"rmsScaleFactor", 1.0);
226 std::vector<edm::ParameterSet> VPSetPuppiAlgos;
235 VPSetPuppiAlgos.push_back(puppiset);
238 algos.
addVPSet(
"puppiAlgos", puppialgos, VPSetPuppiAlgos);
239 std::vector<edm::ParameterSet> VPSetAlgos;
241 algos.
add<std::vector<double>>(
"etaMin", {0.});
242 algos.
add<std::vector<double>>(
"etaMax", {2.5});
243 algos.
add<std::vector<double>>(
"ptMin", {0.});
244 algos.
add<std::vector<double>>(
"MinNeutralPt", {0.2});
245 algos.
add<std::vector<double>>(
"MinNeutralPtSlope", {0.015});
246 algos.
add<std::vector<double>>(
"RMSEtaSF", {1.0});
247 algos.
add<std::vector<double>>(
"MedEtaSF", {1.0});
248 algos.
add<
double>(
"EtaMaxExtrap", 2.0);
249 algosset.
addParameter<std::vector<double>>(
"etaMin", {0.});
250 algosset.
addParameter<std::vector<double>>(
"etaMax", {2.5});
251 algosset.
addParameter<std::vector<double>>(
"ptMin", {0.});
252 algosset.
addParameter<std::vector<double>>(
"MinNeutralPt", {0.2});
253 algosset.
addParameter<std::vector<double>>(
"MinNeutralPtSlope", {0.015});
254 algosset.
addParameter<std::vector<double>>(
"RMSEtaSF", {1.0});
255 algosset.
addParameter<std::vector<double>>(
"MedEtaSF", {1.0});
257 algosset.
addParameter<std::vector<edm::ParameterSet>>(
"puppiAlgos", VPSetPuppiAlgos);
258 VPSetAlgos.push_back(algosset);
259 desc.
addVPSet(
"algos", algos, VPSetAlgos);
void add(const PuppiCandidate &iParticle, const double &iVal, const unsigned int iAlgo)
T getParameter(std::string const &) const
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
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
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
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