CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
LowPtElectronModifier Class Reference
Inheritance diagram for LowPtElectronModifier:
ModifyObjectValueBase

Public Member Functions

 LowPtElectronModifier (const edm::ParameterSet &conf, edm::ConsumesCollector &)
 
void modifyObject (pat::Electron &ele) const final
 
void setEvent (const edm::Event &) final
 
void setEventContent (const edm::EventSetup &) final
 
 ~LowPtElectronModifier () override=default
 
- Public Member Functions inherited from ModifyObjectValueBase
virtual void modifyObject (reco::GsfElectron &) const
 
virtual void modifyObject (reco::Photon &) const
 
virtual void modifyObject (reco::Muon &) const
 
virtual void modifyObject (reco::BaseTau &) const
 
virtual void modifyObject (reco::Jet &) const
 
virtual void modifyObject (pat::Photon &) const
 
virtual void modifyObject (pat::Muon &) const
 
virtual void modifyObject (pat::Tau &) const
 
virtual void modifyObject (pat::Jet &) const
 
 ModifyObjectValueBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual ~ModifyObjectValueBase ()
 

Private Attributes

reco::BeamSpot const * beamSpot_ = 0
 
const edm::EDGetTokenT< reco::BeamSpotbeamSpotT_
 
reco::ConversionCollection const * conv_ = 0
 
const edm::EDGetTokenT< reco::ConversionCollectionconvT_
 
bool extra_
 
reco::VertexCollection const * vertices_ = 0
 
const edm::EDGetTokenT< reco::VertexCollectionverticesT_
 

Detailed Description

Definition at line 10 of file LowPtElectronsModifier.cc.

Constructor & Destructor Documentation

LowPtElectronModifier::LowPtElectronModifier ( const edm::ParameterSet conf,
edm::ConsumesCollector cc 
)

Definition at line 32 of file LowPtElectronsModifier.cc.

33  : ModifyObjectValueBase(conf),
35  conv_(),
37  beamSpot_(),
39  vertices_(),
40  extra_(conf.getParameter<bool>("addExtraUserVars")) {
41  ;
42 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
reco::BeamSpot const * beamSpot_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotT_
ModifyObjectValueBase(const edm::ParameterSet &conf)
const edm::EDGetTokenT< reco::VertexCollection > verticesT_
const edm::EDGetTokenT< reco::ConversionCollection > convT_
reco::ConversionCollection const * conv_
reco::VertexCollection const * vertices_
LowPtElectronModifier::~LowPtElectronModifier ( )
overridedefault

Member Function Documentation

void LowPtElectronModifier::modifyObject ( pat::Electron ele) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 58 of file LowPtElectronsModifier.cc.

References LowPtConversion::addExtraUserVars(), LowPtConversion::addUserVars(), beamSpot_, pat::Electron::BS2D, conv, conv_, reco::Vertex::covariance(), DEFINE_EDM_PLUGIN, extra_, pat::Electron::gsfTrack(), LowPtConversion::match(), reco::Vertex::position(), MetAnalyzer::pv(), pat::Electron::PV2D, pat::Electron::PVDZ, pat::Electron::setDB(), vertices_, and reco::Vertex::zError().

58  {
59  // Embed Conversion info
61  conv.match(*beamSpot_, *conv_, ele);
62  conv.addUserVars(ele);
63  if (extra_) {
64  conv.addExtraUserVars(ele);
65  }
66  // Set impact parameters
67  auto const& gsfTrack = *ele.gsfTrack();
68  if (!vertices_->empty()) {
69  const reco::Vertex& pv = vertices_->front();
70  ele.setDB(gsfTrack.dxy(pv.position()),
71  gsfTrack.dxyError(pv.position(), pv.covariance()),
72  pat::Electron::PV2D); // PV2D
73  ele.setDB(gsfTrack.dz(pv.position()), std::hypot(gsfTrack.dzError(), pv.zError()),
74  pat::Electron::PVDZ); // PVDZ
75  }
76  ele.setDB(gsfTrack.dxy(*beamSpot_), gsfTrack.dxyError(*beamSpot_),
77  pat::Electron::BS2D); // BS2D
78 }
static HepMC::IO_HEPEVT conv
double zError() const
error on z
Definition: Vertex.h:123
void addExtraUserVars(pat::Electron &ele) const
void addUserVars(pat::Electron &ele) const
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:130
const Point & position() const
position
Definition: Vertex.h:109
void setDB(double dB, double edB, IPTYPE type)
Set impact parameter of a certain type and its uncertainty.
reco::BeamSpot const * beamSpot_
def pv(vc)
Definition: MetAnalyzer.py:7
bool match(const reco::BeamSpot &beamSpot, const reco::ConversionCollection &conversions, const pat::Electron &ele)
reco::ConversionCollection const * conv_
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster ...
reco::VertexCollection const * vertices_
void LowPtElectronModifier::setEvent ( const edm::Event iEvent)
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 46 of file LowPtElectronsModifier.cc.

References beamSpot_, beamSpotT_, conv_, convT_, edm::Event::get(), vertices_, and verticesT_.

46  {
47  conv_ = &iEvent.get(convT_);
48  beamSpot_ = &iEvent.get(beamSpotT_);
49  vertices_ = &iEvent.get(verticesT_);
50 }
reco::BeamSpot const * beamSpot_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotT_
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:326
const edm::EDGetTokenT< reco::VertexCollection > verticesT_
const edm::EDGetTokenT< reco::ConversionCollection > convT_
reco::ConversionCollection const * conv_
reco::VertexCollection const * vertices_
void LowPtElectronModifier::setEventContent ( const edm::EventSetup iSetup)
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 54 of file LowPtElectronsModifier.cc.

54 {}

Member Data Documentation

reco::BeamSpot const* LowPtElectronModifier::beamSpot_ = 0
private

Definition at line 24 of file LowPtElectronsModifier.cc.

Referenced by modifyObject(), and setEvent().

const edm::EDGetTokenT<reco::BeamSpot> LowPtElectronModifier::beamSpotT_
private

Definition at line 23 of file LowPtElectronsModifier.cc.

Referenced by setEvent().

reco::ConversionCollection const* LowPtElectronModifier::conv_ = 0
private

Definition at line 22 of file LowPtElectronsModifier.cc.

Referenced by modifyObject(), and setEvent().

const edm::EDGetTokenT<reco::ConversionCollection> LowPtElectronModifier::convT_
private

Definition at line 21 of file LowPtElectronsModifier.cc.

Referenced by setEvent().

bool LowPtElectronModifier::extra_
private

Definition at line 27 of file LowPtElectronsModifier.cc.

Referenced by modifyObject().

reco::VertexCollection const* LowPtElectronModifier::vertices_ = 0
private

Definition at line 26 of file LowPtElectronsModifier.cc.

Referenced by modifyObject(), and setEvent().

const edm::EDGetTokenT<reco::VertexCollection> LowPtElectronModifier::verticesT_
private

Definition at line 25 of file LowPtElectronsModifier.cc.

Referenced by setEvent().