26 #include "Math/GenVector/PxPyPzM4D.h"
27 #include "Math/GenVector/VectorUtil.h"
28 #include "Math/GenVector/Boost.h"
50 using namespace ROOT::Math::VectorUtil;
61 0.0, 0.0, 15. * 15. ) ),
66 m_jets( iConfig.getParameter<edm::
InputTag>(
"jets" ) ),
68 token_jets( mayConsume<edm::
View<
reco::
Jet> >( iConfig.getParameter<edm::
InputTag>(
"jets" ) ) ),
70 m_leptons( iConfig.getParameter<edm::
InputTag>(
"leptons" ) ),
74 token_muons( mayConsume<
MuonView>( iConfig.getParameter<edm::
InputTag>(
"leptons" ) ) ),
75 token_tracks( mayConsume<edm::
View<
reco::
Track> >( iConfig.getParameter<edm::
InputTag>(
"leptons" ) ) ),
76 m_leptonCands( iConfig.exists(
"leptonCands") ? iConfig.getParameter<edm::
InputTag>(
"leptonCands" ) : edm::
InputTag() ),
77 token_leptonCands( mayConsume<edm::
ValueMap<float> >( iConfig.exists(
"leptonCands") ? iConfig.getParameter<edm::
InputTag>(
"leptonCands" ) : edm::
InputTag() ) ),
78 m_leptonId( iConfig.exists(
"leptonId") ? iConfig.getParameter<edm::
InputTag>(
"leptonId" ) : edm::
InputTag() ),
79 token_leptonId( mayConsume<edm::
ValueMap<float> >( iConfig.exists(
"leptonId") ? iConfig.getParameter<edm::
InputTag>(
"leptonId" ) : edm::
InputTag() ) ),
80 m_transientTrackBuilder( 0 ),
81 m_refineJetAxis( iConfig.getParameter<unsigned int>(
"refineJetAxis" ) ),
82 m_deltaRCut( iConfig.getParameter<double>(
"leptonDeltaRCut" ) ),
83 m_chi2Cut( iConfig.getParameter<double>(
"leptonChi2Cut" ) ),
84 m_muonSelection( (
muon::
SelectionType) iConfig.getParameter<unsigned int>(
"muonSelection" ) )
86 produces<reco::SoftLeptonTagInfoCollection>();
106 std::vector<edm::RefToBase<reco::Jet> >
jets;
107 std::vector<reco::TrackRefVector>
tracks;
113 unsigned int size = h_jtas->size();
116 for (
unsigned int i = 0;
i <
size; ++
i) {
117 jets[
i] = (*h_jtas)[
i].first;
118 tracks[
i] = (*h_jtas)[
i].second;
127 unsigned int size = h_jets->size();
130 for (
unsigned int i = 0;
i < h_jets->size();
i++)
131 jets[
i] = h_jets->refAt(
i);
142 if (h_primaryVertex.
isValid() and not h_primaryVertex->empty())
143 vertex = h_primaryVertex->front();
158 unsigned int leptonId = SoftLeptonProperties::Quality::leptonId;
165 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
168 id[SoftLeptonProperties::Quality::pfElectronId] =
electron->mva();
170 id[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[h_electrons->refAt(
electron - h_electrons->begin())];
180 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
184 id[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[h_electrons->refAt(
electron - h_electrons->begin())];
194 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
195 for (reco::PFCandidateCollection::const_iterator
electron = h_electrons->begin();
electron != h_electrons->end(); ++
electron) {
197 if (
electron->gsfTrackRef().isNonnull())
199 else if (
electron->trackRef().isNonnull())
203 (*id)[SoftLeptonProperties::Quality::pfElectronId] =
electron->mva_e_pi();
205 (*id)[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[
reco::PFCandidateRef(h_electrons,
electron - h_electrons->begin())];
218 if (
muon->globalTrack().isNonnull())
220 else if (
muon->innerTrack().isNonnull())
222 else if (
muon->outerTrack().isNonnull())
228 (*id)[SoftLeptonProperties::Quality::btagMuonCands] = (*h_leptonCands)[h_muons->refAt(
muon - h_muons->begin())];
238 for (
unsigned int i = 0;
i < h_tracks->size();
i++) {
241 id[SoftLeptonProperties::Quality::btagLeptonCands] = (*h_leptonCands)[h_tracks->refAt(
i)];
253 for (Leptons::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton)
254 lepton->second[leptonId] = (*h_leptonId)[lepton->first];
259 for (
unsigned int i = 0;
i < jets.size(); ++
i) {
261 outputCollection->push_back( result );
263 event.put( outputCollection );
276 for(Leptons::const_iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton) {
292 properties.
ptRel = Perp( lepton_momentum, axis );
295 properties.
ratio = lepton_momentum.R() / axis.R();
296 properties.
ratioRel = lepton_momentum.Dot(axis) / axis.Mag2();
298 for(LeptonIds::const_iterator
iter = lepton->second.begin();
iter != lepton->second.end(); ++
iter)
299 properties.
setQuality(static_cast<SoftLeptonProperties::Quality::Generic>(
iter->first),
iter->second);
301 info.
insert( lepton->first, properties );
320 double sum_eta_by_pT = 0.;
321 double sum_phi_by_pT = 0.;
332 eta_rel = (double) track.
eta() - axis.eta();
333 phi_rel = (double) track.
phi() - axis.phi();
334 while (phi_rel < -
M_PI) phi_rel += 2*
M_PI;
335 while (phi_rel >
M_PI) phi_rel -= 2*
M_PI;
338 sum_phi_by_pT += perp * phi_rel;
339 sum_eta_by_pT += perp * eta_rel;
347 eta_rel = (double) track.
eta() - axis.eta();
348 phi_rel = (double) track.
phi() - axis.phi();
349 while (phi_rel < -
M_PI) phi_rel += 2*
M_PI;
350 while (phi_rel >
M_PI) phi_rel -= 2*
M_PI;
353 sum_phi_by_pT -= perp * phi_rel;
354 sum_eta_by_pT -= perp * eta_rel;
358 axis =
math::RhoEtaPhiVector( axis.rho(), axis.eta() + sum_eta_by_pT / sum_pT, axis.phi() + sum_phi_by_pT / sum_pT);
386 double mag = vector.r() * axis.r();
387 double dot = vector.Dot(axis);
388 return -
log((mag - dot)/(mag + dot)) / 2;
393 static const double lepton_mass = 0.00;
394 static const double jet_mass = 5.279;
395 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > lepton(vector.Dot(axis) / axis.r(), Perp(vector, axis), 0., lepton_mass);
396 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> >
jet( axis.r(), 0., 0., jet_mass );
397 ROOT::Math::BoostX boost( -
jet.Beta() );
398 return boost(lepton).x();
const edm::EDGetTokenT< reco::PFCandidateCollection > token_pfElectrons
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::View< reco::Muon > MuonView
const Vector & momentum() const
track momentum vector
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Base class for all types of Jets.
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonCands
virtual Vector momentum() const
spatial momentum vector
reco::TransientTrack build(const reco::Track *p) const
math::Error< dimension >::type Error
covariance error matrix (3x3)
double phi() const
azimuthal angle of momentum vector
std::vector< Vertex > VertexCollection
collection of Vertex objects
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonId
const edm::EDGetTokenT< edm::View< reco::Muon > > token_muons
void setJetRef(const edm::Ref< T > &jetRef)
const_iterator end() const
Termination of iteration.
const edm::EDGetTokenT< edm::View< reco::Electron > > token_electrons
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
const_iterator begin() const
Initialize an iterator over the RefVector.
const edm::EDGetTokenT< edm::View< reco::GsfElectron > > token_gsfElectrons
SelectionType
Selector type.
void setQuality(Quality::Generic qual, float value)
std::vector< SoftLeptonTagInfo > SoftLeptonTagInfoCollection
void insert(const edm::RefToBase< reco::Track > &lepton, const SoftLeptonProperties &properties)
double eta() const
pseudorapidity of momentum vector
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
const edm::InputTag m_leptons
static double relativeEta(const math::XYZVector &vector, const math::XYZVector &axis)
GlobalVector refineJetAxis(const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const edm::RefToBase< reco::Track > &exclude=edm::RefToBase< reco::Track >()) const
double pt() const
track transverse momentum
math::XYZPoint Point
point in the space
const edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
const edm::InputTag m_leptonId
edm::Ref< PFCandidateCollection > PFCandidateRef
persistent reference to a PFCandidate
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const edm::InputTag m_leptonCands
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
unsigned int m_refineJetAxis
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
reco::SoftLeptonTagInfo tag(const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const Leptons &leptons, const reco::Vertex &primaryVertex) const
const edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
XYZVectorD XYZVector
spatial vector with cartesian internal representation
SoftLepton(const edm::ParameterSet &iConfig)
T const * product() const
std::map< unsigned int, float > LeptonIds
edm::View< reco::GsfElectron > GsfElectronView
static const reco::Vertex s_nominalBeamSpot
muon::SelectionType m_muonSelection
T perp() const
Magnitude of transverse component.
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
std::map< edm::RefToBase< reco::Track >, LeptonIds, TrackCompare > Leptons
const edm::InputTag m_jets
const TransientTrackBuilder * m_transientTrackBuilder
const edm::EDGetTokenT< edm::View< reco::Track > > token_tracks
edm::View< reco::Electron > ElectronView
virtual void produce(edm::Event &event, const edm::EventSetup &setup)
bool isNonnull() const
Checks for non-null.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > token_jtas
Global3DVector GlobalVector
static double boostedPPar(const math::XYZVector &vector, const math::XYZVector &axis)