27 #include "Math/GenVector/PxPyPzM4D.h"
28 #include "Math/GenVector/VectorUtil.h"
29 #include "Math/GenVector/Boost.h"
51 using namespace ROOT::Math::VectorUtil;
62 0.0, 0.0, 15. * 15. ) ),
67 m_jets( iConfig.getParameter<edm::
InputTag>(
"jets" ) ),
69 token_jets( mayConsume<edm::
View<
reco::
Jet> >( iConfig.getParameter<edm::
InputTag>(
"jets" ) ) ),
71 m_leptons( iConfig.getParameter<edm::
InputTag>(
"leptons" ) ),
75 token_muons( mayConsume<
MuonView>( iConfig.getParameter<edm::
InputTag>(
"leptons" ) ) ),
76 token_tracks( mayConsume<edm::
View<
reco::
Track> >( iConfig.getParameter<edm::
InputTag>(
"leptons" ) ) ),
77 m_leptonCands( iConfig.exists(
"leptonCands") ? iConfig.getParameter<edm::
InputTag>(
"leptonCands" ) : edm::
InputTag() ),
78 token_leptonCands( mayConsume<edm::
ValueMap<float> >( iConfig.exists(
"leptonCands") ? iConfig.getParameter<edm::
InputTag>(
"leptonCands" ) : edm::
InputTag() ) ),
79 m_leptonId( iConfig.exists(
"leptonId") ? iConfig.getParameter<edm::
InputTag>(
"leptonId" ) : edm::
InputTag() ),
80 token_leptonId( mayConsume<edm::
ValueMap<float> >( iConfig.exists(
"leptonId") ? iConfig.getParameter<edm::
InputTag>(
"leptonId" ) : edm::
InputTag() ) ),
81 m_transientTrackBuilder( 0 ),
82 m_refineJetAxis( iConfig.getParameter<unsigned int>(
"refineJetAxis" ) ),
83 m_deltaRCut( iConfig.getParameter<double>(
"leptonDeltaRCut" ) ),
84 m_chi2Cut( iConfig.getParameter<double>(
"leptonChi2Cut" ) ),
85 m_muonSelection( (
muon::
SelectionType) iConfig.getParameter<unsigned int>(
"muonSelection" ) )
87 produces<reco::SoftLeptonTagInfoCollection>();
107 std::vector<edm::RefToBase<reco::Jet> >
jets;
108 std::vector<reco::TrackRefVector>
tracks;
114 unsigned int size = h_jtas->size();
117 for (
unsigned int i = 0;
i <
size; ++
i) {
118 jets[
i] = (*h_jtas)[
i].first;
119 tracks[
i] = (*h_jtas)[
i].second;
128 unsigned int size = h_jets->size();
131 for (
unsigned int i = 0;
i < h_jets->size();
i++)
132 jets[
i] = h_jets->refAt(
i);
143 if (h_primaryVertex.
isValid() and not h_primaryVertex->empty())
144 vertex = h_primaryVertex->front();
166 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
169 id[SoftLeptonProperties::Quality::pfElectronId] =
electron->mva_e_pi();
171 id[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[h_electrons->refAt(
electron - h_electrons->begin())];
181 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
185 id[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[h_electrons->refAt(
electron - h_electrons->begin())];
195 leptonId = SoftLeptonProperties::Quality::egammaElectronId;
196 for (reco::PFCandidateCollection::const_iterator
electron = h_electrons->begin();
electron != h_electrons->end(); ++
electron) {
198 if (
electron->gsfTrackRef().isNonnull())
200 else if (
electron->trackRef().isNonnull())
204 (*id)[SoftLeptonProperties::Quality::pfElectronId] =
electron->mva_e_pi();
206 (*id)[SoftLeptonProperties::Quality::btagElectronCands] = (*h_leptonCands)[
reco::PFCandidateRef(h_electrons,
electron - h_electrons->begin())];
219 if (
muon->globalTrack().isNonnull())
221 else if (
muon->innerTrack().isNonnull())
223 else if (
muon->outerTrack().isNonnull())
229 (*id)[SoftLeptonProperties::Quality::btagMuonCands] = (*h_leptonCands)[h_muons->refAt(
muon - h_muons->begin())];
239 for (
unsigned int i = 0;
i < h_tracks->size();
i++) {
242 id[SoftLeptonProperties::Quality::btagLeptonCands] = (*h_leptonCands)[h_tracks->refAt(
i)];
254 for (Leptons::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton)
255 lepton->second[leptonId] = (*h_leptonId)[lepton->first];
260 for (
unsigned int i = 0;
i < jets.size(); ++
i) {
262 outputCollection->push_back( result );
264 event.put( outputCollection );
277 for(Leptons::const_iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton) {
294 properties.
ptRel = Perp( lepton_momentum, axis );
297 properties.
ratio = lepton_momentum.R() / axis.R();
298 properties.
ratioRel = lepton_momentum.Dot(axis) / axis.Mag2();
300 for(LeptonIds::const_iterator iter = lepton->second.begin(); iter != lepton->second.end(); ++iter)
301 properties.
setQuality(static_cast<SoftLeptonProperties::Quality::Generic>(iter->first), iter->second);
303 info.
insert( lepton->first, properties );
322 double sum_eta_by_pT = 0.;
323 double sum_phi_by_pT = 0.;
334 eta_rel = (double) track.
eta() - axis.eta();
335 phi_rel = (double) track.
phi() - axis.phi();
336 while (phi_rel < -
M_PI) phi_rel += 2*
M_PI;
337 while (phi_rel >
M_PI) phi_rel -= 2*
M_PI;
340 sum_phi_by_pT += perp * phi_rel;
341 sum_eta_by_pT += perp * eta_rel;
349 eta_rel = (double) track.
eta() - axis.eta();
350 phi_rel = (double) track.
phi() - axis.phi();
351 while (phi_rel < -
M_PI) phi_rel += 2*
M_PI;
352 while (phi_rel >
M_PI) phi_rel -= 2*
M_PI;
355 sum_phi_by_pT -= perp * phi_rel;
356 sum_eta_by_pT -= perp * eta_rel;
360 axis =
math::RhoEtaPhiVector( axis.rho(), axis.eta() + sum_eta_by_pT / sum_pT, axis.phi() + sum_phi_by_pT / sum_pT);
388 double mag = vector.r() * axis.r();
389 double dot = vector.Dot(axis);
390 return -
log((mag - dot)/(mag + dot)) / 2;
395 static const double lepton_mass = 0.00;
396 static const double jet_mass = 5.279;
397 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > lepton(vector.Dot(axis) / axis.r(), Perp(vector, axis), 0., lepton_mass);
398 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> >
jet( axis.r(), 0., 0., jet_mass );
399 ROOT::Math::BoostX boost( -
jet.Beta() );
400 return boost(lepton).x();
408 desc.
add<
unsigned int>(
"muonSelection",1);
413 desc.
add<
unsigned int>(
"refineJetAxis",0);
415 desc.
add<
double>(
"leptonDeltaRCut",0.4);
416 desc.
add<
double>(
"leptonChi2Cut",9999.0);
const edm::EDGetTokenT< reco::PFCandidateCollection > token_pfElectrons
edm::View< reco::Muon > MuonView
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
bool isNonnull() const
Checks for non-null.
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::vector< SoftLeptonTagInfo > SoftLeptonTagInfoCollection
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
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)
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
double deltaR(double eta1, double eta2, double phi1, double phi2)
unsigned int m_refineJetAxis
void insert(const REF &lepton, const SoftLeptonProperties &properties)
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.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::map< edm::RefToBase< reco::Track >, LeptonIds, TrackCompare > Leptons
const edm::InputTag m_jets
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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)
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)