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++) {
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;
166 for(
unsigned int i0 = 0; i0 <
fPupsPV.size(); i0++)
if(
fPupsPV[i0] <= lMed ) lNPV++;
167 double lAdjust = double(lNPV)/double(lNPV+0.5*fNCount[iAlgo]);
169 fMedian[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*
fRMS[iAlgo]);
170 fRMS[iAlgo] -=
sqrt(ROOT::Math::chisquared_quantile(lAdjust,1.)*
fRMS[iAlgo]);
177 for (
unsigned int j0 = 0; j0 <
fEtaMin.size(); j0++){
192 for(
unsigned int i0 = 0; i0 <
fNAlgos; i0++) {
193 if(
fNCount[i0] == 0)
return 1.;
194 if(
fCombId[i0] == 1 && i0 > 0) {
195 double pPVal = ROOT::Math::chisquared_cdf(lVal,lNDOF);
200 double pVal = iVals[i0];
207 if(i0 == 0 && iChi2 != 0) lNDOF++;
208 if(i0 == 0 && iChi2 != 0) lVal+=iChi2;
211 lPVal *= ROOT::Math::chisquared_cdf(lVal,lNDOF);
218 puppialgos.
add<
int>(
"algoId", 5);
219 puppialgos.
add<
bool>(
"useCharged",
false);
220 puppialgos.
add<
bool>(
"applyLowPUCorr",
false);
221 puppialgos.
add<
int>(
"combOpt", 5);
222 puppialgos.
add<
double>(
"cone", .4);
223 puppialgos.
add<
double>(
"rmsPtMin", .1);
224 puppialgos.
add<
double>(
"rmsScaleFactor", 1.0);
225 std::vector<edm::ParameterSet> VPSetPuppiAlgos;
234 VPSetPuppiAlgos.push_back(puppiset);
237 algos.
addVPSet(
"puppiAlgos", puppialgos, VPSetPuppiAlgos);
238 std::vector<edm::ParameterSet> VPSetAlgos;
240 algos.
add<std::vector<double>>(
"etaMin", {0.});
241 algos.
add<std::vector<double>>(
"etaMax", {2.5});
242 algos.
add<std::vector<double>>(
"ptMin", {0.});
243 algos.
add<std::vector<double>>(
"MinNeutralPt", {0.2});
244 algos.
add<std::vector<double>>(
"MinNeutralPtSlope", {0.015});
245 algos.
add<std::vector<double>>(
"RMSEtaSF", {1.0});
246 algos.
add<std::vector<double>>(
"MedEtaSF", {1.0});
247 algos.
add<
double>(
"EtaMaxExtrap", 2.0);
248 algosset.
addParameter<std::vector<double>>(
"etaMin", {0.});
249 algosset.
addParameter<std::vector<double>>(
"etaMax", {2.5});
250 algosset.
addParameter<std::vector<double>>(
"ptMin", {0.});
251 algosset.
addParameter<std::vector<double>>(
"MinNeutralPt", {0.2});
252 algosset.
addParameter<std::vector<double>>(
"MinNeutralPtSlope", {0.015});
253 algosset.
addParameter<std::vector<double>>(
"RMSEtaSF", {1.0});
254 algosset.
addParameter<std::vector<double>>(
"MedEtaSF", {1.0});
256 algosset.
addParameter<std::vector<edm::ParameterSet>>(
"puppiAlgos", VPSetPuppiAlgos);
257 VPSetAlgos.push_back(algosset);
258 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)
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