19 #include <unordered_set> 22 struct ptr_hash :
public std::unary_function<reco::CandidatePtr, std::size_t> {
38 jetThreshold_ = cfgParams.
getParameter<
double>(
"jetThreshold");
39 jetEtas_ = cfgParams.
getParameter<std::vector<double> >(
"jeta");
40 jetParams_ = cfgParams.
getParameter<std::vector<double> >(
"jpar");
41 pjetParams_ = cfgParams.
getParameter<std::vector<double> >(
"pjpar");
68 std::unordered_set<reco::CandidatePtr,ptr_hash> footprint;
71 for (
const auto& lep_i :
leptons ) {
72 for(
const auto& lep : *lep_i ) {
74 for(
unsigned int n=0;
n < lep.numberOfSourceCandidatePtrs();
n++ ){
75 if( lep.sourceCandidatePtr(
n).isNonnull() and lep.sourceCandidatePtr(
n).isAvailable() ){
76 footprint.insert(lep.sourceCandidatePtr(
n));
83 for(
const auto&
jet : jets) {
86 if(!cleanJet(
jet, leptons) )
continue;
87 for(
unsigned int n=0;
n <
jet.numberOfSourceCandidatePtrs();
n++){
88 if(
jet.sourceCandidatePtr(
n).isNonnull() and
jet.sourceCandidatePtr(
n).isAvailable() ){
90 footprint.insert(
jet.sourceCandidatePtr(
n));
98 for(
size_t i = 0;
i< pfCandidates->
size(); ++
i) {
101 bool cleancand =
true;
102 if(footprint.find( pfCandidates->
ptrAt(
i) )==footprint.end()) {
105 for(
const auto& it : footprint) {
106 if( (it->p4()-(*pfCandidates)[
i].p4()).Et2()<0.000025 ){
113 sumPt += (*pfCandidates)[
i].pt();
119 for(
const auto&
jet : jets) {
122 if(!cleanJet(
jet, leptons) )
continue;
140 if( jpt > jetThreshold_ ){
144 if(feta<jetEtas_[0]) scale = jetParams_[0];
145 else if(feta<jetEtas_[1]) scale = jetParams_[1];
146 else if(feta<jetEtas_[2]) scale = jetParams_[2];
147 else if(feta<jetEtas_[3]) scale = jetParams_[3];
148 else scale = jetParams_[4];
151 double dpt = scale*jpt*sigmapt;
152 double dph = jpt*sigmaphi;
154 cov_xx += dpt*dpt*c*c + dph*dph*s*
s;
155 cov_xy += (dpt*dpt-dph*dph)*c*s;
156 cov_yy += dph*dph*c*c + dpt*dpt*s*
s;
171 cov_xx += pjetParams_[0]*pjetParams_[0] + pjetParams_[1]*pjetParams_[1]*
sumPt;
172 cov_yy += pjetParams_[0]*pjetParams_[0] + pjetParams_[1]*pjetParams_[1]*
sumPt;
187 double det = cov(0,0)*cov(1,1) - cov(0,1)*cov(1,0);
190 double ncov_xx = cov(1,1) / det;
191 double ncov_xy = -cov(0,1) / det;
192 double ncov_yy = cov(0,0) / det;
195 double sig = met.
px()*met.
px()*ncov_xx + 2*met.
px()*met.
py()*ncov_xy + met.
py()*met.
py()*ncov_yy;
204 for (
const auto& lep_i :
leptons ) {
205 for(
const auto& lep : *lep_i ) {
T getParameter(std::string const &) const
bool cleanJet(const reco::Jet &jet, const std::vector< edm::Handle< reco::CandidateView > > &leptons)
float getResolution(const JetParameters ¶meters) const
JetParameters & setJetEta(float eta)
static double getSignificance(const reco::METCovMatrix &cov, const reco::MET &met)
JetParameters & setRho(float rho)
Ptr< value_type > ptrAt(size_type i) const
Base class for all types of Jets.
double px() const final
x coordinate of momentum vector
ProcessIndex productIndex() const
ROOT::Math::SMatrix< double, 2 > METCovMatrix
reco::METCovMatrix getCovariance(const edm::View< reco::Jet > &jets, const std::vector< edm::Handle< reco::CandidateView > > &leptons, const edm::Handle< edm::View< reco::Candidate > > &pfCandidates, double rho, JME::JetResolution &resPtObj, JME::JetResolution &resPhiObj, JME::JetResolutionScaleFactor &resSFObj, bool isRealData)
void const * productPtr() const
RefCore const & refCore() const
Abs< T >::type abs(const T &t)
METSignificance(const edm::ParameterSet &iConfig)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
double py() const final
y coordinate of momentum vector
JetParameters & setJetPt(float pt)
ProcessIndex processIndex() const