54 #include "Math/GenVector/PxPyPzM4D.h"
55 #include "Math/GenVector/VectorUtil.h"
56 #include "Math/GenVector/Boost.h"
73 return t1.
key() < t2.
key();
144 using namespace reco;
145 using namespace ROOT::Math::VectorUtil;
166 : m_jets(iConfig.getParameter<edm::
InputTag>(
"jets")),
168 token_jets(mayConsume<edm::
View<
reco::
Jet> >(m_jets)),
170 m_leptons(iConfig.getParameter<edm::
InputTag>(
"leptons")),
174 token_muons(mayConsume<
MuonView>(m_leptons)),
175 token_tracks(mayConsume<edm::
View<
reco::
Track> >(m_leptons)),
176 m_leptonCands(iConfig.getParameter<edm::
InputTag>(
"leptonCands")),
177 token_leptonCands(mayConsume<edm::
ValueMap<float> >(m_leptonCands)),
178 m_leptonId(iConfig.getParameter<edm::
InputTag>(
"leptonId")),
179 token_leptonId(mayConsume<edm::
ValueMap<float> >(m_leptonId)),
181 token_put(produces()),
182 m_refineJetAxis(iConfig.getParameter<unsigned int>(
"refineJetAxis")),
183 m_deltaRCut(iConfig.getParameter<double>(
"leptonDeltaRCut")),
184 m_chi2Cut(iConfig.getParameter<double>(
"leptonChi2Cut")),
185 m_muonSelection((
muon::
SelectionType)iConfig.getParameter<unsigned int>(
"muonSelection")) {}
196 std::vector<edm::RefToBase<reco::Jet> >
jets;
197 std::vector<reco::TrackRefVector>
tracks;
203 unsigned int size = h_jtas->size();
206 for (
unsigned int i = 0;
i <
size; ++
i) {
207 jets[
i] = (*h_jtas)[
i].first;
208 tracks[
i] = (*h_jtas)[
i].second;
217 unsigned int size = h_jets->size();
220 for (
unsigned int i = 0;
i < h_jets->size();
i++)
221 jets[
i] = h_jets->refAt(
i);
228 <<
" of type among (\"reco::JetTracksAssociationCollection\", \"edm::View<reco::Jet>\") not found";
235 if (h_primaryVertex.
isValid() and not h_primaryVertex->empty())
236 vertex = h_primaryVertex->front();
258 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
262 id[SoftLeptonProperties::Quality::pfElectronId] =
electron->mva_e_pi();
264 id[SoftLeptonProperties::Quality::btagElectronCands] =
265 (*h_leptonCands)[h_electrons->refAt(
electron - h_electrons->begin())];
275 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
279 id[SoftLeptonProperties::Quality::btagElectronCands] =
280 (*h_leptonCands)[h_electrons->refAt(
electron - h_electrons->begin())];
290 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
291 for (reco::PFCandidateCollection::const_iterator
electron = h_electrons->begin();
295 if (
electron->gsfTrackRef().isNonnull())
297 else if (
electron->trackRef().isNonnull())
301 (*id)[SoftLeptonProperties::Quality::pfElectronId] =
electron->mva_e_pi();
303 (*id)[SoftLeptonProperties::Quality::btagElectronCands] =
317 if (
muon->globalTrack().isNonnull())
319 else if (
muon->innerTrack().isNonnull())
321 else if (
muon->outerTrack().isNonnull())
327 (*id)[SoftLeptonProperties::Quality::btagMuonCands] =
328 (*h_leptonCands)[h_muons->refAt(
muon - h_muons->begin())];
338 for (
unsigned int i = 0;
i < h_tracks->size();
i++) {
341 id[SoftLeptonProperties::Quality::btagLeptonCands] = (*h_leptonCands)[h_tracks->refAt(
i)];
348 <<
" of type among (\"edm::View<reco::GsfElectron>\", "
349 "\"edm::View<reco::Muon>\", \"edm::View<reco::Track>\") !found";
356 for (Leptons::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton)
357 lepton->second[leptonId] = h_leptonId[lepton->first];
362 for (
unsigned int i = 0;
i < jets.size(); ++
i) {
364 outputCollection.push_back(result);
378 for (Leptons::const_iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton) {
399 properties.
ptRel = Perp(lepton_momentum, axis);
402 properties.
ratio = lepton_momentum.R() / axis.R();
403 properties.
ratioRel = lepton_momentum.Dot(axis) / axis.Mag2();
405 for (LeptonIds::const_iterator iter = lepton->second.begin(); iter != lepton->second.end(); ++iter)
406 properties.
setQuality(static_cast<SoftLeptonProperties::Quality::Generic>(iter->first), iter->second);
408 info.
insert(lepton->first, properties);
423 double sum_eta_by_pT = 0.;
424 double sum_phi_by_pT = 0.;
435 eta_rel = (double)track.
eta() - axis.eta();
436 phi_rel = (double)track.
phi() - axis.phi();
437 while (phi_rel < -
M_PI)
439 while (phi_rel >
M_PI)
443 sum_phi_by_pT += perp * phi_rel;
444 sum_eta_by_pT += perp * eta_rel;
452 eta_rel = (double)track.
eta() - axis.eta();
453 phi_rel = (double)track.
phi() - axis.phi();
454 while (phi_rel < -
M_PI)
456 while (phi_rel >
M_PI)
460 sum_phi_by_pT -= perp * phi_rel;
461 sum_eta_by_pT -= perp * eta_rel;
466 math::RhoEtaPhiVector(axis.rho(), axis.eta() + sum_eta_by_pT / sum_pT, axis.phi() + sum_phi_by_pT / sum_pT);
493 double mag = vector.r() * axis.r();
494 double dot = vector.Dot(axis);
495 return -
log((mag - dot) / (mag + dot)) / 2;
500 static const double lepton_mass = 0.00;
501 static const double jet_mass = 5.279;
502 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > lepton(
503 vector.Dot(axis) / axis.r(), Perp(vector, axis), 0., lepton_mass);
504 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> >
jet(axis.r(), 0., 0., jet_mass);
505 ROOT::Math::BoostX boost(-
jet.Beta());
506 return boost(lepton).x();
512 desc.
add<
unsigned int>(
"muonSelection", 1);
517 desc.
add<
unsigned int>(
"refineJetAxis", 0);
519 desc.
add<
double>(
"leptonDeltaRCut", 0.4);
520 desc.
add<
double>(
"leptonChi2Cut", 9999.0);
const edm::EDGetTokenT< reco::PFCandidateCollection > token_pfElectrons
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > token_builder
static std::vector< std::string > checklist log
Vector momentum() const final
spatial momentum vector
edm::View< reco::Muon > MuonView
void produce(edm::StreamID, edm::Event &event, const edm::EventSetup &setup) const final
uint16_t *__restrict__ id
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())
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonCands
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
bool isNonnull() const
Checks for non-null.
auto const & tracks
cannot be loose
const edm::EDGetTokenT< edm::View< reco::Muon > > token_muons
void setJetRef(const edm::Ref< T > &jetRef)
const Vector & momentum() const
track momentum vector
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::map< edm::RefToBase< reco::Track >, LeptonIds, TrackCompare > Leptons
bool getData(T &iHolder) const
std::vector< SoftLeptonTagInfo > SoftLeptonTagInfoCollection
std::map< unsigned int, float > LeptonIds
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
bool operator()(const edm::RefToBase< reco::Track > &t1, const edm::RefToBase< reco::Track > &t2) const
const muon::SelectionType m_muonSelection
const unsigned int m_refineJetAxis
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const_reference_type get(ProductID id, size_t idx) const
const edm::InputTag m_leptonCands
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
void insert(const REF &lepton, const SoftLeptonProperties &properties)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
double significance() const
const edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
XYZVectorD XYZVector
spatial vector with cartesian internal representation
SoftLepton(const edm::ParameterSet &iConfig)
edm::View< reco::GsfElectron > GsfElectronView
static const reco::Vertex s_nominalBeamSpot
T perp() const
Magnitude of transverse component.
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
reco::SoftLeptonTagInfo tag(const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const Leptons &leptons, const reco::Vertex &primaryVertex, const TransientTrackBuilder &builder) const
const edm::InputTag m_jets
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< edm::View< reco::Track > > token_tracks
edm::View< reco::Electron > ElectronView
const edm::EDPutTokenT< reco::SoftLeptonTagInfoCollection > token_put
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)