12 tmvaReader_(
"!Color:!Silent:Error"),
41 bool subtractMuon=
true)
44 if (subtractMuon) jp4-=muP4;
45 float dot = muP4.Vect().Dot( jp4.Vect() );
46 float ptrel = muP4.P2() - dot*dot/jp4.P2();
47 ptrel = ptrel>0 ?
sqrt(ptrel) : 0.0;
58 throw cms::Exception(
"FatalError") <<
"MuonMVA is not initialized";
69 sip_ = edB3D>0?fabs(dB3D/edB3D):0.0;
75 double jecL1L2L3Res = 1.;
83 for (
const auto& tagI: bTags){
85 double dr =
deltaR(*(tagI.first), muon);
86 if(dr > minDr)
continue;
92 if (correctorL1 && correctorL1L2L3Res){
93 jecL1L2L3Res = correctorL1L2L3Res->
correction(*(tagI.first));
94 jecL1 = correctorL1->
correction(*(tagI.first));
100 for (
auto jet: tagI.first->getJetConstituentsQuick()){
102 if (pfcand==
nullptr)
throw cms::Exception(
"ConfigurationError") <<
"Cannot get jet constituents";
103 if (pfcand->
charge()==0)
continue;
105 if (!bestTrackPtr)
continue;
107 if (bestTrackPtr->pt()<1.)
continue;
108 if (bestTrackPtr->hitPattern().numberOfValidHits()<8)
continue;
109 if (bestTrackPtr->hitPattern().numberOfValidPixelHits()<2)
continue;
110 if (bestTrackPtr->normalizedChi2()>=5)
continue;
112 if (std::fabs(bestTrackPtr->dxy(vertex.
position())) > 0.2)
continue;
113 if (std::fabs(bestTrackPtr->dz(vertex.
position())) > 17)
continue;
118 if ((jetP4-muP4).Rho()<0.0001){
123 jetP4 *= jecL1L2L3Res;
double eta() const final
momentum pseudorapidity
double dB(IPTYPE type) const
double pt() const final
transverse momentum
int charge() const final
electric charge
double correction(const LorentzVector &fJet) const
get correction using Jet information only
const Point & position() const
position
float segmentCompatibility_
const PFIsolation & miniPFIsolation() const
double segmentCompatibility(reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration) const
Returns the segment compatibility, using muon::segmentCompatibility (DataFormats/MuonReco/interface/M...
const LorentzVector & p4() const final
four-momentum Lorentz vector
double edB(IPTYPE type) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
void initialize(std::string weightsfile, float dRmax)
float ptRel(const reco::Candidate::LorentzVector &muP4, const reco::Candidate::LorentzVector &jetP4, bool subtractMuon=true)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
void computeMva(const pat::Muon &imuon, const reco::Vertex &vertex, const reco::JetTagCollection &bTags, const reco::JetCorrector *correctorL1=0, const reco::JetCorrector *correctorL1L2L3Res=0)
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
reco::TrackRef muonBestTrack() const override
Track selected to be the best measurement of the muon parameters (including PFlow global information)...
float chargedHadronIso() const
Analysis-level muon class.
const reco::Track * bestTrack() const override
float neutralHadronIso() const