6 const double dR2Min = 0.01 * 0.01;
11 : mvaMEtAlgo_(
cfg, consumesCollector()), mvaMEtAlgo_isInitialized_(
false) {
18 for (vInputTag::const_iterator it = srcLeptonsTags.begin(); it != srcLeptonsTags.end(); it++) {
19 srcLeptons_.push_back(consumes<reco::CandidateView>(*it));
29 verbosity_ = (
cfg.exists(
"verbosity")) ?
cfg.getParameter<
int>(
"verbosity") : 0;
31 produces<reco::PFMETCollection>();
48 LogDebug(
"produce") <<
"<PFMETProducerMVA::produce>:" << std::endl
50 <<
", Event: " << evt.
id().
event() << std::endl
52 <<
" --> skipping !!" << std::endl;
55 auto pfMEtCollection = std::make_unique<reco::PFMETCollection>();
56 pfMEtCollection->push_back(pfMEt);
91 bool lHasPhotons =
false;
92 std::vector<reco::PUSubMETCandInfo>
leptonInfo =
112 std::vector<reco::PUSubMETCandInfo> pfCandidateInfo =
computePFCandidateInfo(*pfCandidates_view, hardScatterVertex);
124 <<
", Event: " << evt.
id().
event() << std::endl
125 <<
" PFMET: Pt = " << pfMEtP4_original.pt() <<
", phi = " << pfMEtP4_original.phi() <<
" " 126 <<
"(Px = " << pfMEtP4_original.px() <<
", Py = " << pfMEtP4_original.py() <<
")" << std::endl
127 <<
" MVA MET: Pt = " << pfMEt.
pt() <<
" phi = " << pfMEt.
phi() <<
" (Px = " << pfMEt.
px()
128 <<
", Py = " << pfMEt.
py() <<
")" << std::endl
129 <<
" Cov:" << std::endl
135 auto pfMEtCollection = std::make_unique<reco::PFMETCollection>();
136 pfMEtCollection->push_back(pfMEt);
147 std::vector<reco::PUSubMETCandInfo>
leptonInfo;
162 if (&(*lepton1) == &(*lepton2)) {
168 if (pMatch && !
istau(&(*lepton1)) &&
istau(&(*lepton2))) {
171 if (pMatch && ((
istau(&(*lepton1)) &&
istau(&(*lepton2))) || (!
istau(&(*lepton1)) && !
istau(&(*lepton2)))) &&
172 lepton1->pt() > lepton2->pt()) {
175 if (pMatch && lepton1->pt() == lepton2->pt()) {
177 for (
unsigned int i0 = 0; i0 <
leptonInfo.size(); i0++) {
193 pLeptonInfo.
setP4(lepton1->p4());
196 if (lepton1->isPhoton()) {
214 std::vector<reco::PUSubMETCandInfo>& iLeptons,
215 std::vector<reco::PUSubMETCandInfo>& iCands) {
216 std::vector<reco::PUSubMETCandInfo> retVal;
217 for (reco::PFJetCollection::const_iterator uncorrJet = uncorrJets.begin(); uncorrJet != uncorrJets.end();
221 auto corrJet = corrJets->begin();
222 for (
size_t cjIdx = 0; cjIdx < corrJets->size(); ++cjIdx, ++corrJet) {
226 if (uncorrJet->jetArea() != corrJet->jetArea())
241 jetInfo.
setP4(corrJet->p4());
242 double lType1Corr = 0;
244 double pCorr = iCorrector.
correction(*uncorrJet);
245 lType1Corr =
std::abs(corrJet->pt() - pCorr * uncorrJet->pt());
247 pVec.SetPtEtaPhiM(lType1Corr, 0, corrJet->phi(), 0);
249 pType1Corr.SetCoordinates(pVec.Px(), pVec.Py(), pVec.Pz(), pVec.E());
251 bool pOnLepton =
false;
252 for (
unsigned int i0 = 0; i0 < iLeptons.size(); i0++) {
259 if (corrJet->pt() > 10 && !pOnLepton) {
261 pfCandidateInfo.
setP4(pType1Corr);
262 pfCandidateInfo.
setDZ(-999);
263 iCands.push_back(pfCandidateInfo);
266 lType1Corr = (pCorr * uncorrJet->pt() - uncorrJet->pt());
267 lType1Corr /= corrJet->pt();
275 float chEnF = (uncorrJet->chargedEmEnergy() + uncorrJet->chargedHadronEnergy() + uncorrJet->chargedMuEnergy()) /
280 retVal.push_back(jetInfo);
293 std::vector<reco::PUSubMETCandInfo> retVal;
298 if (hardScatterVertex) {
300 if (pfc !=
nullptr) {
315 pfCandidateInfo.
setP4(pfCandidate->p4());
316 pfCandidateInfo.
setDZ(dZ);
317 retVal.push_back(pfCandidateInfo);
323 std::vector<reco::Vertex::Point> retVal;
329 if (
vertex->position().Rho() > 2.)
331 retVal.push_back(
vertex->position());
348 double lPtCharged = 0;
351 if (lPFTau !=
nullptr) {
352 for (UInt_t i0 = 0; i0 < lPFTau->
signalCands().size(); i0++) {
359 const pat::Tau* lPatPFTau =
nullptr;
360 lPatPFTau =
dynamic_cast<const pat::Tau*
>(iCand);
361 if (lPatPFTau !=
nullptr) {
372 return lPtCharged / lPtTot;
406 double iDR2Max = iDRMax * iDRMax;
410 if (
deltaR2(iCand->
p4(), pfCandidate->p4()) > iDR2Max)
414 if (hardScatterVertex) {
416 if (pfc !=
nullptr) {
428 lVis += pfCandidate->p4();
430 return lVis.pt() / iCand->
pt();
PFMETAlgorithmMVA mvaMEtAlgo_
SpecificPFMETData run(const edm::View< reco::Candidate > &pfCands, edm::ValueMap< float > const *weights=nullptr)
reco::GsfTrackRef gsfTrackRef() const
size_type size() const
Size of the RefVector.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< edm::EDGetTokenT< reco::CandidateView > > srcLeptons_
PFMETProducerMVA(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
float neutralHadronEnergy() const
neutralHadronEnergy
double pt() const final
transverse momentum
int chargedMultiplicity() const
chargedMultiplicity
float chargedEmEnergy() const
chargedEmEnergy
PFSpecificAlgo pfMEtSpecificAlgo_
float neutralEmEnergy() const
neutralEmEnergy
virtual double pt() const =0
transverse momentum
const Point & position() const
position
std::vector< reco::Vertex::Point > computeVertexInfo(const reco::VertexCollection &)
void setSignificanceMatrix(const reco::METCovMatrix &matrix)
const std::vector< reco::CandidatePtr > & signalCands() const
Candidates in signal region.
void setP4(const reco::Candidate::LorentzVector p4)
void setMvaVal(float mva)
bool isNonnull() const
Checks for non-null.
std::vector< Vertex > VertexCollection
collection of Vertex objects
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool mvaMEtAlgo_isInitialized_
double correction(const LorentzVector &fJet) const
get correction using Jet information only
edm::LuminosityBlockNumber_t luminosityBlock() const
Jets made from PFObjects.
double chargedFracInCone(const reco::Candidate *iCand, const reco::CandidateView &pfCandidates, const reco::Vertex *hardScatterVertex, double iDRMax=0.2)
const LorentzVector & p4() const final
four-momentum Lorentz vector
edm::EDGetTokenT< edm::ValueMap< float > > srcJetIds_
virtual bool isPhoton() const =0
double px() const final
x coordinate of momentum vector
bool istau(const reco::Candidate *iCand)
edm::EDGetTokenT< edm::View< reco::Candidate > > srcPFCandidatesView_
bool passPFLooseId(const reco::PFJet *iJet)
edm::EDGetTokenT< reco::PFJetCollection > srcCorrJets_
std::vector< edm::InputTag > vInputTag
virtual int nConstituents() const
of constituents
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)
#define DEFINE_FWK_MODULE(type)
Structure containing data common to all types of MET.
double py() const final
y coordinate of momentum vector
MET made from Particle Flow Candidates.
Analysis-level tau class.
const reco::Candidate::LorentzVector & p4() const
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void setChargedEnFrac(float chEnF)
virtual bool isMuon() const =0
edm::EDGetTokenT< reco::JetCorrector > mJetCorrector_
reco::CandidatePtrVector signalCands() const
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)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
float chargedEnFrac() const
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Particle reconstructed by the particle flow algorithm.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
float chargedHadronEnergy() const
chargedHadronEnergy
~PFMETProducerMVA() override
reco::TrackRef trackRef() const
double chargedEnFrac(const reco::Candidate *iCand, const reco::CandidateView &pfCandidates, const reco::Vertex *hardScatterVertex)
math::XYZPoint Point
point in the space
const_iterator begin() const
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
edm::EDGetTokenT< reco::PFJetCollection > srcUncorrJets_
virtual bool isElectron() const =0
double phi() const final
momentum azimuthal angle
const_iterator end() const
void setP4(const LorentzVector &p4) final
set 4-momentum
EventNumber_t event() const
std::vector< reco::PUSubMETCandInfo > computePFCandidateInfo(const reco::CandidateView &, const reco::Vertex *)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
double energy() const final
energy
double eta() const final
momentum pseudorapidity