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;
166 : m_jets(iConfig.getParameter<
edm::
InputTag>(
"jets")),
170 m_leptons(iConfig.getParameter<
edm::
InputTag>(
"leptons")),
174 token_muons(mayConsume<
MuonView>(m_leptons)),
176 m_leptonCands(iConfig.getParameter<
edm::
InputTag>(
"leptonCands")),
178 m_leptonId(iConfig.getParameter<
edm::
InputTag>(
"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")),
196 std::vector<edm::RefToBase<reco::Jet> >
jets;
197 std::vector<reco::TrackRefVector>
tracks;
206 for (
unsigned int i = 0;
i <
size; ++
i) {
207 jets[
i] = (*h_jtas)[
i].first;
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] =
275 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
279 id[SoftLeptonProperties::Quality::btagElectronCands] =
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] =
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);
474 sum +=
track.momentum();
480 sum -=
track.momentum();
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);
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::EDGetTokenT< reco::PFCandidateCollection > token_pfElectrons
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > token_builder
edm::View< reco::Muon > MuonView
RefToBase< value_type > refAt(size_type i) const
void produce(edm::StreamID, edm::Event &event, const edm::EventSetup &setup) const final
bool isNonnull() const
Checks for non-null.
bool operator()(const edm::RefToBase< reco::Track > &t1, const edm::RefToBase< reco::Track > &t2) const
#define DEFINE_FWK_MODULE(type)
const_reference_type get(ProductID id, size_t idx) const
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonCands
math::Error< dimension >::type Error
covariance error matrix (3x3)
std::vector< Vertex > VertexCollection
collection of Vertex objects
const edm::EDGetTokenT< edm::ValueMap< float > > token_leptonId
GlobalVector refineJetAxis(const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const edm::RefToBase< reco::Track > &exclude=edm::RefToBase< reco::Track >()) const
const edm::EDGetTokenT< edm::View< reco::Muon > > token_muons
const edm::EDGetTokenT< edm::View< reco::Electron > > token_electrons
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
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
reco::TransientTrack build(const reco::Track *p) const
std::vector< SoftLeptonTagInfo > SoftLeptonTagInfoCollection
std::map< unsigned int, float > LeptonIds
void addDefault(ParameterSetDescription const &psetDescription)
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)
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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
T perp() const
Magnitude of transverse component.
const edm::InputTag m_leptonCands
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
auto const & tracks
cannot be loose
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
const Vector & momentum() const
track momentum vector
static const reco::Vertex s_nominalBeamSpot
double significance() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
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_iterator begin() const
primaryVertex
hltOfflineBeamSpot for HLTMON
const edm::EDPutTokenT< reco::SoftLeptonTagInfoCollection > token_put
const_iterator end() const
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > token_jtas
Global3DVector GlobalVector
static double boostedPPar(const math::XYZVector &vector, const math::XYZVector &axis)