38 #include "Math/GenVector/PxPyPzM4D.h"
39 #include "Math/GenVector/VectorUtil.h"
40 #include "Math/GenVector/Boost.h"
79 using namespace ROOT::Math::VectorUtil;
90 0.0, 0.0, 15. * 15. ) ),
95 m_jets( iConfig.getParameter<edm::
InputTag>(
"jets" ) ),
96 m_primaryVertex( iConfig.getParameter<edm::
InputTag>(
"primaryVertex" ) ),
97 m_leptons( iConfig.getParameter<edm::
InputTag>(
"leptons" ) ),
98 m_leptonCands( iConfig.exists(
"leptonCands") ? iConfig.getParameter<edm::
InputTag>(
"leptonCands" ) : edm::
InputTag() ),
99 m_leptonId( iConfig.exists(
"leptonId") ? iConfig.getParameter<edm::
InputTag>(
"leptonId" ) : edm::
InputTag() ),
100 m_transientTrackBuilder( 0 ),
101 m_refineJetAxis( iConfig.getParameter<unsigned int>(
"refineJetAxis" ) ),
102 m_deltaRCut( iConfig.getParameter<double>(
"leptonDeltaRCut" ) ),
103 m_chi2Cut( iConfig.getParameter<double>(
"leptonChi2Cut" ) ),
104 m_muonSelection( (
muon::
SelectionType) iConfig.getParameter<unsigned int>(
"muonSelection" ) )
106 produces<reco::SoftLeptonTagInfoCollection>();
126 std::vector<edm::RefToBase<reco::Jet> >
jets;
127 std::vector<reco::TrackRefVector>
tracks;
131 event.getByLabel(
m_jets, h_jtas);
133 unsigned int size = h_jtas->size();
136 for (
unsigned int i = 0;
i <
size; ++
i) {
137 jets[
i] = (*h_jtas)[
i].first;
138 tracks[
i] = (*h_jtas)[
i].second;
145 event.getByLabel(
m_jets, h_jets);
147 unsigned int size = h_jets->size();
150 for (
unsigned int i = 0;
i < h_jets->size();
i++)
151 jets[
i] = h_jets->refAt(
i);
162 if (h_primaryVertex.
isValid() and not h_primaryVertex->empty())
163 vertex = h_primaryVertex->front();
178 unsigned int leptonId = SoftLeptonProperties::quality::leptonId;
182 event.getByLabel(
m_leptons, h_electrons);
185 leptonId = SoftLeptonProperties::quality::egammaElectronId;
188 id[SoftLeptonProperties::quality::pfElectronId] =
electron->mva();
190 id[SoftLeptonProperties::quality::btagElectronCands] = (*h_leptonCands)[h_electrons->refAt(
electron - h_electrons->begin())];
198 event.getByLabel(
m_leptons, h_electrons);
200 leptonId = SoftLeptonProperties::quality::egammaElectronId;
204 id[SoftLeptonProperties::quality::btagElectronCands] = (*h_leptonCands)[h_electrons->refAt(
electron - h_electrons->begin())];
212 event.getByLabel(
m_leptons, h_electrons);
214 leptonId = SoftLeptonProperties::quality::egammaElectronId;
215 for (reco::PFCandidateCollection::const_iterator
electron = h_electrons->begin();
electron != h_electrons->end(); ++
electron) {
217 if (
electron->gsfTrackRef().isNonnull())
219 else if (
electron->trackRef().isNonnull())
223 (*id)[SoftLeptonProperties::quality::pfElectronId] =
electron->mva_e_pi();
225 (*id)[SoftLeptonProperties::quality::btagElectronCands] = (*h_leptonCands)[
reco::PFCandidateRef(h_electrons,
electron - h_electrons->begin())];
238 if (
muon->globalTrack().isNonnull())
240 else if (
muon->innerTrack().isNonnull())
242 else if (
muon->outerTrack().isNonnull())
248 (*id)[SoftLeptonProperties::quality::btagMuonCands] = (*h_leptonCands)[h_muons->refAt(
muon - h_muons->begin())];
258 for (
unsigned int i = 0;
i < h_tracks->size();
i++) {
261 id[SoftLeptonProperties::quality::btagLeptonCands] = (*h_leptonCands)[h_tracks->refAt(
i)];
273 for (Leptons::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton)
274 lepton->second[leptonId] = (*h_leptonId)[lepton->first];
279 for (
unsigned int i = 0;
i < jets.size(); ++
i) {
281 outputCollection->push_back( result );
283 event.put( outputCollection );
296 for(Leptons::const_iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton) {
312 properties.
ptRel = Perp( lepton_momentum, axis );
315 properties.
ratio = lepton_momentum.R() / axis.R();
316 properties.
ratioRel = lepton_momentum.Dot(axis) / axis.Mag2();
318 for(LeptonIds::const_iterator iter = lepton->second.begin(); iter != lepton->second.end(); ++iter)
319 properties.
setQuality(static_cast<SoftLeptonProperties::quality::Generic>(iter->first), iter->second);
321 info.
insert( lepton->first, properties );
340 double sum_eta_by_pT = 0.;
341 double sum_phi_by_pT = 0.;
352 eta_rel = (double) track.
eta() - axis.eta();
353 phi_rel = (double) track.
phi() - axis.phi();
354 while (phi_rel < -
M_PI) phi_rel += 2*
M_PI;
355 while (phi_rel >
M_PI) phi_rel -= 2*
M_PI;
358 sum_phi_by_pT += perp * phi_rel;
359 sum_eta_by_pT += perp * eta_rel;
367 eta_rel = (double) track.
eta() - axis.eta();
368 phi_rel = (double) track.
phi() - axis.phi();
369 while (phi_rel < -
M_PI) phi_rel += 2*
M_PI;
370 while (phi_rel >
M_PI) phi_rel -= 2*
M_PI;
373 sum_phi_by_pT -= perp * phi_rel;
374 sum_eta_by_pT -= perp * eta_rel;
378 axis =
math::RhoEtaPhiVector( axis.rho(), axis.eta() + sum_eta_by_pT / sum_pT, axis.phi() + sum_phi_by_pT / sum_pT);
406 double mag = vector.r() * axis.r();
407 double dot = vector.Dot(axis);
408 return -
log((mag - dot)/(mag + dot)) / 2;
413 static const double lepton_mass = 0.00;
414 static const double jet_mass = 5.279;
415 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > lepton(vector.Dot(axis) / axis.r(), Perp(vector, axis), 0., lepton_mass);
416 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> >
jet( axis.r(), 0., 0., jet_mass );
417 ROOT::Math::BoostX boost( -
jet.Beta() );
418 return boost(lepton).x();
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())
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
void setJetRef(const edm::Ref< T > &jetRef)
const_iterator end() const
Termination of iteration.
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
const_iterator begin() const
Initialize an iterator over the RefVector.
SelectionType
Selector type.
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
const edm::InputTag m_primaryVertex
math::XYZPoint Point
point in the space
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
reco::SoftLeptonTagInfo tag(const edm::RefToBase< reco::Jet > &jet, const reco::TrackRefVector &tracks, const Leptons &leptons, const reco::Vertex &primaryVertex) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void setQuality(quality::Generic qual, float value)
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
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.
Global3DVector GlobalVector
static double boostedPPar(const math::XYZVector &vector, const math::XYZVector &axis)