CMS 3D CMS Logo

LowPtElectronsModifier.cc
Go to the documentation of this file.
7 
9 //
11 public:
13  ~LowPtElectronModifier() override = default;
14 
15  void setEvent(const edm::Event&) final;
16  void setEventContent(const edm::EventSetup&) final;
17 
18  void modifyObject(pat::Electron& ele) const final;
19 
20 private:
24  reco::BeamSpot const* beamSpot_ = nullptr;
27  bool extra_;
28 };
29 
31 //
33  : ModifyObjectValueBase(conf),
34  convT_(cc.consumes<reco::ConversionCollection>(conf.getParameter<edm::InputTag>("conversions"))),
35  conv_(),
36  beamSpotT_(cc.consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpot"))),
37  beamSpot_(),
38  verticesT_(cc.consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("vertices"))),
39  vertices_(),
40  extra_(conf.getParameter<bool>("addExtraUserVars")) {
41  ;
42 }
43 
45 //
47  conv_ = &iEvent.get(convT_);
48  beamSpot_ = &iEvent.get(beamSpotT_);
49  vertices_ = &iEvent.get(verticesT_);
50 }
51 
53 //
55 
57 //
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 }
79 
81 //
electrons_cff.bool
bool
Definition: electrons_cff.py:366
LowPtConversion
Definition: LowPtConversion.h:13
pat::Electron::PV2D
Definition: Electron.h:190
align::BeamSpot
Definition: StructureType.h:95
edm::EDGetTokenT< reco::ConversionCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
pat::Electron::gsfTrack
reco::GsfTrackRef gsfTrack() const override
override the reco::GsfElectron::gsfTrack method, to access the internal storage of the supercluster
pat::Electron::BS2D
Definition: Electron.h:190
LowPtElectronModifier::verticesT_
const edm::EDGetTokenT< reco::VertexCollection > verticesT_
Definition: LowPtElectronsModifier.cc:25
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
LowPtElectronModifier::setEvent
void setEvent(const edm::Event &) final
Definition: LowPtElectronsModifier.cc:46
LowPtElectronModifier::LowPtElectronModifier
LowPtElectronModifier(const edm::ParameterSet &conf, edm::ConsumesCollector &)
Definition: LowPtElectronsModifier.cc:32
reco::ConversionCollection
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
pat::Electron::setDB
void setDB(double dB, double edB, IPTYPE type)
Set impact parameter of a certain type and its uncertainty.
BeamSpot.h
ModifyObjectValueBase.h
reco::BeamSpot
Definition: BeamSpot.h:21
LowPtElectronModifier::extra_
bool extra_
Definition: LowPtElectronsModifier.cc:27
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
edm::ParameterSet
Definition: ParameterSet.h:47
ModifyObjectValueBase
Definition: ModifyObjectValueBase.h:18
LowPtConversion.h
LowPtElectronModifier
Definition: LowPtElectronsModifier.cc:10
edmplugin::PluginFactory
Definition: PluginFactory.h:34
LowPtElectronModifier::convT_
const edm::EDGetTokenT< reco::ConversionCollection > convT_
Definition: LowPtElectronsModifier.cc:21
LowPtElectronModifier::conv_
reco::ConversionCollection const * conv_
Definition: LowPtElectronsModifier.cc:22
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
cc
VertexFwd.h
LowPtElectronModifier::modifyObject
void modifyObject(pat::Electron &ele) const final
Definition: LowPtElectronsModifier.cc:58
l1t::VertexCollection
std::vector< Vertex > VertexCollection
Definition: Vertex.h:12
pat::Electron::PVDZ
Definition: Electron.h:190
LowPtElectronModifier::beamSpot_
reco::BeamSpot const * beamSpot_
Definition: LowPtElectronsModifier.cc:24
LowPtElectronModifier::beamSpotT_
const edm::EDGetTokenT< reco::BeamSpot > beamSpotT_
Definition: LowPtElectronsModifier.cc:23
ConsumesCollector.h
LowPtElectronModifier::~LowPtElectronModifier
~LowPtElectronModifier() override=default
pat::Electron
Analysis-level electron class.
Definition: Electron.h:51
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
reco::Vertex
Definition: Vertex.h:35
LowPtElectronModifier::setEventContent
void setEventContent(const edm::EventSetup &) final
Definition: LowPtElectronsModifier.cc:54
LowPtElectronModifier::vertices_
reco::VertexCollection const * vertices_
Definition: LowPtElectronsModifier.cc:26
conv
EPOS::IO_EPOS conv
Definition: ReggeGribovPartonMCHadronizer.cc:42