5 const double dR2Min = 0.01 * 0.01;
16 for (vInputTag::const_iterator it = srcLeptonsTags.begin(); it != srcLeptonsTags.end(); it++) {
17 srcLeptons_.push_back(consumes<reco::CandidateView>(*it));
29 produces<reco::PFMETCollection>();
43 numLeptons += leptons->
size();
46 LogDebug(
"produce") <<
"<PFMETProducerMVA::produce>:" << std::endl
48 <<
", Event: " << evt.
id().
event() << std::endl
49 <<
" numLeptons = " << numLeptons <<
", minNumLeptons = " <<
minNumLeptons_ 50 <<
" --> skipping !!" << std::endl;
53 auto pfMEtCollection = std::make_unique<reco::PFMETCollection>();
54 pfMEtCollection->push_back(pfMEt);
84 const reco::Vertex* hardScatterVertex = (!vertices->empty()) ? &(vertices->front()) :
nullptr;
89 bool lHasPhotons =
false;
90 std::vector<reco::PUSubMETCandInfo>
leptonInfo =
110 std::vector<reco::PUSubMETCandInfo> pfCandidateInfo =
computePFCandidateInfo(*pfCandidates_view, hardScatterVertex);
112 *uncorrJets, corrJets, *jetIds, *vertices, hardScatterVertex, *corrector, evt, es, leptonInfo, pfCandidateInfo);
122 <<
", Event: " << evt.
id().
event() << std::endl
123 <<
" PFMET: Pt = " << pfMEtP4_original.pt() <<
", phi = " << pfMEtP4_original.phi() <<
" " 124 <<
"(Px = " << pfMEtP4_original.px() <<
", Py = " << pfMEtP4_original.py() <<
")" << std::endl
125 <<
" MVA MET: Pt = " << pfMEt.
pt() <<
" phi = " << pfMEt.
phi() <<
" (Px = " << pfMEt.
px()
126 <<
", Py = " << pfMEt.
py() <<
")" << std::endl
127 <<
" Cov:" << std::endl
133 auto pfMEtCollection = std::make_unique<reco::PFMETCollection>();
134 pfMEtCollection->push_back(pfMEt);
145 std::vector<reco::PUSubMETCandInfo>
leptonInfo;
160 if (&(*lepton1) == &(*lepton2)) {
166 if (pMatch && !
istau(&(*lepton1)) &&
istau(&(*lepton2))) {
169 if (pMatch && ((
istau(&(*lepton1)) &&
istau(&(*lepton2))) || (!
istau(&(*lepton1)) && !
istau(&(*lepton2)))) &&
170 lepton1->pt() > lepton2->pt()) {
173 if (pMatch && lepton1->pt() == lepton2->pt()) {
175 for (
unsigned int i0 = 0; i0 < leptonInfo.size(); i0++) {
191 pLeptonInfo.
setP4(lepton1->p4());
193 leptonInfo.push_back(pLeptonInfo);
194 if (lepton1->isPhoton()) {
212 std::vector<reco::PUSubMETCandInfo>& iLeptons,
213 std::vector<reco::PUSubMETCandInfo>& iCands) {
214 std::vector<reco::PUSubMETCandInfo> retVal;
215 for (reco::PFJetCollection::const_iterator uncorrJet = uncorrJets.begin(); uncorrJet != uncorrJets.end();
219 auto corrJet = corrJets->begin();
220 for (
size_t cjIdx = 0; cjIdx < corrJets->size(); ++cjIdx, ++corrJet) {
224 if (uncorrJet->jetArea() != corrJet->jetArea())
239 jetInfo.
setP4(corrJet->p4());
240 double lType1Corr = 0;
242 double pCorr = iCorrector.
correction(*uncorrJet);
243 lType1Corr =
std::abs(corrJet->pt() - pCorr * uncorrJet->pt());
245 pVec.SetPtEtaPhiM(lType1Corr, 0, corrJet->phi(), 0);
247 pType1Corr.SetCoordinates(pVec.Px(), pVec.Py(), pVec.Pz(), pVec.E());
249 bool pOnLepton =
false;
250 for (
unsigned int i0 = 0; i0 < iLeptons.size(); i0++) {
257 if (corrJet->pt() > 10 && !pOnLepton) {
259 pfCandidateInfo.
setP4(pType1Corr);
260 pfCandidateInfo.
setDZ(-999);
261 iCands.push_back(pfCandidateInfo);
264 lType1Corr = (pCorr * uncorrJet->pt() - uncorrJet->pt());
265 lType1Corr /= corrJet->pt();
273 float chEnF = (uncorrJet->chargedEmEnergy() + uncorrJet->chargedHadronEnergy() + uncorrJet->chargedMuEnergy()) /
278 retVal.push_back(jetInfo);
284 std::sort(retVal.begin(), retVal.end());
291 std::vector<reco::PUSubMETCandInfo> retVal;
296 if (hardScatterVertex) {
298 if (pfc !=
nullptr) {
313 pfCandidateInfo.
setP4(pfCandidate->p4());
314 pfCandidateInfo.
setDZ(dZ);
315 retVal.push_back(pfCandidateInfo);
321 std::vector<reco::Vertex::Point> retVal;
322 for (reco::VertexCollection::const_iterator
vertex = vertices.begin();
vertex != vertices.end(); ++
vertex) {
327 if (
vertex->position().Rho() > 2.)
329 retVal.push_back(
vertex->position());
346 double lPtCharged = 0;
349 if (lPFTau !=
nullptr) {
350 for (UInt_t i0 = 0; i0 < lPFTau->
signalCands().size(); i0++) {
357 const pat::Tau* lPatPFTau =
nullptr;
358 lPatPFTau =
dynamic_cast<const pat::Tau*
>(iCand);
359 if (lPatPFTau !=
nullptr) {
370 return lPtCharged / lPtTot;
404 double iDR2Max = iDRMax * iDRMax;
408 if (
deltaR2(iCand->
p4(), pfCandidate->p4()) > iDR2Max)
412 if (hardScatterVertex) {
414 if (pfc !=
nullptr) {
426 lVis += pfCandidate->p4();
428 return lVis.pt() / iCand->
pt();
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
PFMETAlgorithmMVA mvaMEtAlgo_
T getParameter(std::string const &) const
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< edm::EDGetTokenT< reco::CandidateView > > srcLeptons_
bool isNonnull() const
Checks for non-null.
size_type size() const
Size of the RefVector.
double eta() const final
momentum pseudorapidity
PFMETProducerMVA(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
float chargedEmEnergy() const
chargedEmEnergy
PFSpecificAlgo pfMEtSpecificAlgo_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual bool isMuon() const =0
std::vector< reco::Vertex::Point > computeVertexInfo(const reco::VertexCollection &)
virtual bool isPhoton() const =0
double px() const final
x coordinate of momentum vector
void setSignificanceMatrix(const reco::METCovMatrix &matrix)
void setP4(const reco::Candidate::LorentzVector p4)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::LuminosityBlockNumber_t luminosityBlock() const
void setMvaVal(float mva)
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
double correction(const LorentzVector &fJet) const
get correction using Jet information only
reco::CandidatePtrVector signalCands() const
bool mvaMEtAlgo_isInitialized_
int chargedMultiplicity() const
chargedMultiplicity
const Point & position() const
position
Jets made from PFObjects.
double chargedFracInCone(const reco::Candidate *iCand, const reco::CandidateView &pfCandidates, const reco::Vertex *hardScatterVertex, double iDRMax=0.2)
float neutralEmEnergy() const
neutralEmEnergy
edm::EDGetTokenT< edm::ValueMap< float > > srcJetIds_
reco::TrackRef trackRef() const
bool istau(const reco::Candidate *iCand)
#define DEFINE_FWK_MODULE(type)
const_iterator begin() const
edm::EDGetTokenT< edm::View< reco::Candidate > > srcPFCandidatesView_
bool passPFLooseId(const reco::PFJet *iJet)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
edm::EDGetTokenT< reco::PFJetCollection > srcCorrJets_
std::vector< edm::InputTag > vInputTag
double energy() const final
energy
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< reco::VertexCollection > srcVertices_
std::vector< reco::PUSubMETCandInfo > computeLeptonInfo(const std::vector< edm::EDGetTokenT< reco::CandidateView > > &srcLeptons_, const reco::CandidateView &pfCandidates, const reco::Vertex *hardScatterVertex, int &lId, bool &lHasPhotons, edm::Event &iEvent)
const LorentzVector & p4() const final
four-momentum Lorentz vector
Structure containing data common to all types of MET.
virtual bool isElectron() const =0
MET made from Particle Flow Candidates.
Analysis-level tau class.
SpecificPFMETData run(const edm::View< reco::Candidate > &pfCands)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void setChargedEnFrac(float chEnF)
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector_
virtual double pt() const =0
transverse momentum
std::vector< reco::PUSubMETCandInfo > computeJetInfo(const reco::PFJetCollection &, const edm::Handle< reco::PFJetCollection > &, const edm::ValueMap< float > &, const reco::VertexCollection &, const reco::Vertex *, const reco::JetCorrector &iCorr, edm::Event &iEvent, const edm::EventSetup &iSetup, std::vector< reco::PUSubMETCandInfo > &iLeptons, std::vector< reco::PUSubMETCandInfo > &iCands)
double py() const final
y coordinate of momentum vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Particle reconstructed by the particle flow algorithm.
virtual int nConstituents() const
of constituents
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
reco::GsfTrackRef gsfTrackRef() const
float chargedEnFrac() const
~PFMETProducerMVA() override
double chargedEnFrac(const reco::Candidate *iCand, const reco::CandidateView &pfCandidates, const reco::Vertex *hardScatterVertex)
float neutralHadronEnergy() const
neutralHadronEnergy
math::XYZPoint Point
point in the space
const_iterator end() const
edm::EDGetTokenT< reco::PFJetCollection > srcUncorrJets_
const std::vector< reco::CandidatePtr > & signalCands() const
Candidates in signal region.
double phi() const final
momentum azimuthal angle
void setP4(const LorentzVector &p4) final
set 4-momentum
float chargedHadronEnergy() const
chargedHadronEnergy
const reco::Candidate::LorentzVector & p4() const
std::vector< reco::PUSubMETCandInfo > computePFCandidateInfo(const reco::CandidateView &, const reco::Vertex *)