56 if ( jetP4.pt() >= 10. && jetP4.pt() < 20. ) ptBin = 1;
57 if ( jetP4.pt() >= 20. && jetP4.pt() < 30. ) ptBin = 2;
58 if ( jetP4.pt() >= 30. ) ptBin = 3;
61 if (
std::abs(jetP4.eta()) >= 2.5 &&
std::abs(jetP4.eta()) < 2.75) etaBin = 1;
62 if (
std::abs(jetP4.eta()) >= 2.75 &&
std::abs(jetP4.eta()) < 3.0 ) etaBin = 2;
63 if (
std::abs(jetP4.eta()) >= 3.0 &&
std::abs(jetP4.eta()) < 5.0 ) etaBin = 3;
65 return ( mvaJetId >
mvaCut_[2][ptBin][etaBin] );
70 return jetP4(jets, 0);
75 return jetP4(jets, 1);
81 if ( idx < jets.size() ) {
82 std::vector<reco::PUSubMETCandInfo> jets_sorted =
jets;
83 std::sort(jets_sorted.rbegin(), jets_sorted.rend());
84 retVal = jets_sorted[
idx].p4();
91 for ( std::vector<reco::PUSubMETCandInfo>::const_iterator
jet = jets.begin();
92 jet != jets.end(); ++
jet ) {
98 const std::vector<reco::PUSubMETCandInfo>&
leptons,
102 double dR2match = dRmatch*
dRmatch;
103 std::vector<reco::PUSubMETCandInfo> retVal;
104 for ( std::vector<reco::PUSubMETCandInfo>::const_iterator
jet = jets.begin();
105 jet != jets.end(); ++
jet ) {
106 bool isOverlap =
false;
107 for ( std::vector<reco::PUSubMETCandInfo>::const_iterator lepton = leptons.begin();
108 lepton != leptons.end(); ++lepton ) {
109 if (
deltaR2(
jet->p4(), lepton->p4()) < dR2match ) isOverlap =
true;
111 if (
jet->p4().pt() > ptThreshold && !isOverlap ) retVal.push_back(*
jet);
117 const std::vector<reco::PUSubMETCandInfo>&
leptons,
121 double dR2match = dRmatch*
dRmatch;
122 std::vector<reco::PUSubMETCandInfo> retVal;
123 for ( std::vector<reco::PUSubMETCandInfo>::const_iterator pfCandidate = pfCandidates.begin();
124 pfCandidate != pfCandidates.end(); ++pfCandidate ) {
125 bool isOverlap =
false;
126 for ( std::vector<reco::PUSubMETCandInfo>::const_iterator lepton = leptons.begin();
127 lepton != leptons.end(); ++lepton ) {
128 if (
deltaR2(pfCandidate->p4(), lepton->p4()) < dR2match ) isOverlap =
true;
130 if ( (!isOverlap && !invert) || (isOverlap &&
invert) ) retVal.push_back(*pfCandidate);
138 metData.
phi = atan2(metData.
mey, metData.
mex);
143 bool iCharged,
bool mvaPassFlag,
144 const std::vector<reco::PUSubMETCandInfo>&
objects ) {
151 for ( std::vector<reco::PUSubMETCandInfo>::const_iterator
object = objects.begin();
152 object != objects.end(); ++
object ) {
165 if (
object->dZ() < 0. && dZflag != 2 )
continue;
166 if (
object->dZ() > dZmax && dZflag == 0 )
continue;
167 if (
object->dZ() < dZmax && dZflag == 1 )
continue;
172 if(iCharged) pFrac =
object->chargedEnFrac();
179 if ( passesMVAjetId && !mvaPassFlag )
continue;
180 if ( !passesMVAjetId && mvaPassFlag )
continue;
182 pFrac = 1-
object->chargedEnFrac();
185 retVal.
mex +=
object->p4().px()*pFrac;
186 retVal.
mey +=
object->p4().py()*pFrac;
187 retVal.
sumet +=
object->p4().pt()*pFrac;
245 const std::vector<reco::PUSubMETCandInfo>&
leptons,
246 const std::vector<reco::PUSubMETCandInfo>&
pfCandidates ) {
281 const std::vector<reco::PUSubMETCandInfo>&
T getParameter(std::string const &) const
virtual ~MvaMEtUtilities()
CommonMETData leptonsChSum_
const std::vector< reco::PUSubMETCandInfo > & getCleanedJets() const
double getLeptonsChSumMEX() const
double getLeptonsChSumMEY() const
void finalize(CommonMETData &metData)
unsigned numJetsAboveThreshold(const std::vector< reco::PUSubMETCandInfo > &, double)
std::vector< reco::PUSubMETCandInfo > cleanedJets_
CommonMETData neutralJetHSSum_
bool passesMVA(const reco::Candidate::LorentzVector &, double)
CommonMETData leptonsSum_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
CommonMETData neutralJetPUSum_
CommonMETData pfCandChPUSum_
reco::Candidate::LorentzVector subleadJetP4(const std::vector< reco::PUSubMETCandInfo > &)
double getLeptonsSumMEX() const
Abs< T >::type abs(const T &t)
Structure containing data common to all types of MET.
void computeAllSums(const std::vector< reco::PUSubMETCandInfo > &jets, const std::vector< reco::PUSubMETCandInfo > &leptons, const std::vector< reco::PUSubMETCandInfo > &pfCandidates)
MvaMEtUtilities(const edm::ParameterSet &cfg)
reco::Candidate::LorentzVector leadJetP4(const std::vector< reco::PUSubMETCandInfo > &)
std::vector< reco::PUSubMETCandInfo > cleanPFCands(const std::vector< reco::PUSubMETCandInfo > &, const std::vector< reco::PUSubMETCandInfo > &, double, bool)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
double getLeptonsSumMEY() const
CommonMETData computeRecoil(int metType)
CommonMETData computeCandSum(int compKey, double dZmax, int dZflag, bool iCharged, bool mvaPassFlag, const std::vector< reco::PUSubMETCandInfo > &objects)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::vector< reco::PUSubMETCandInfo > cleanJets(const std::vector< reco::PUSubMETCandInfo > &, const std::vector< reco::PUSubMETCandInfo > &, double, double)
reco::Candidate::LorentzVector jetP4(const std::vector< reco::PUSubMETCandInfo > &, unsigned)
CommonMETData pfCandChHSSum_