CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
EmbeddingVertexCorrector Class Reference

#include <TauAnalysis/EmbeddingProducer/plugins/EmbeddingVertexCorrector.cc>

Inheritance diagram for EmbeddingVertexCorrector:
edm::stream::EDProducer<>

Public Member Functions

 EmbeddingVertexCorrector (const edm::ParameterSet &)
 
 ~EmbeddingVertexCorrector () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &iEventSetup) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::InputTag sourceLabel
 
edm::InputTag vertexPositionLabel
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 58 of file EmbeddingVertexCorrector.cc.

Constructor & Destructor Documentation

◆ EmbeddingVertexCorrector()

EmbeddingVertexCorrector::EmbeddingVertexCorrector ( const edm::ParameterSet iConfig)
explicit

Definition at line 77 of file EmbeddingVertexCorrector.cc.

77  {
78  produces<edm::HepMCProduct>();
79 
80  sourceLabel = iConfig.getParameter<edm::InputTag>("src");
81  consumes<edm::HepMCProduct>(sourceLabel);
82  vertexPositionLabel = edm::InputTag("externalLHEProducer", "vertexPosition");
83  consumes<math::XYZTLorentzVectorD>(vertexPositionLabel);
84 }

References edm::ParameterSet::getParameter(), HLT_2018_cff::InputTag, sourceLabel, and vertexPositionLabel.

◆ ~EmbeddingVertexCorrector()

EmbeddingVertexCorrector::~EmbeddingVertexCorrector ( )
override

Definition at line 86 of file EmbeddingVertexCorrector.cc.

86 {}

Member Function Documentation

◆ beginRun()

void EmbeddingVertexCorrector::beginRun ( const edm::Run ,
const edm::EventSetup iEventSetup 
)
overrideprivate

Definition at line 92 of file EmbeddingVertexCorrector.cc.

92  {
93  // edm::ESHandle< SimBeamSpotObjects > beamhandle;
94  // iEventSetup.get<SimBeamSpotObjectsRcd>().get(beamhandle);
95 
97  iEventSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
98 
99  edm::LogInfo("TauEmbedding") << "beam handle\n" << (*beamhandle);
100 }

References edm::EventSetup::get(), and get.

◆ fillDescriptions()

void EmbeddingVertexCorrector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 123 of file EmbeddingVertexCorrector.cc.

123  {
124  //The following says we do not know what parameters are allowed so do no validation
125  // Please change this to state exactly what you do use, even if it is no parameters
127  desc.setUnknown();
128  descriptions.addDefault(desc);
129 }

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

◆ produce()

void EmbeddingVertexCorrector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 102 of file EmbeddingVertexCorrector.cc.

102  {
103  using namespace edm;
104 
105  // Retrieving generated Z to TauTau Event
106  Handle<edm::HepMCProduct> InputGenEvent;
107  iEvent.getByLabel(sourceLabel, InputGenEvent);
108  HepMC::GenEvent* genevent = new HepMC::GenEvent(*InputGenEvent->GetEvent());
109  std::unique_ptr<edm::HepMCProduct> CorrectedGenEvent(new edm::HepMCProduct(genevent));
110 
111  //Retrieving vertex position from input and creating vertex shift
112  Handle<math::XYZTLorentzVectorD> vertex_position;
113  iEvent.getByLabel(vertexPositionLabel, vertex_position);
114  HepMC::FourVector vertex_shift(
115  vertex_position.product()->x() * cm, vertex_position.product()->y() * cm, vertex_position.product()->z() * cm);
116 
117  // Apply vertex shift to all production vertices of the event
118  CorrectedGenEvent->applyVtxGen(&vertex_shift);
119  iEvent.put(std::move(CorrectedGenEvent));
120 }

References edm::HepMCProduct::GetEvent(), iEvent, eostools::move(), edm::Handle< T >::product(), sourceLabel, and vertexPositionLabel.

Member Data Documentation

◆ sourceLabel

edm::InputTag EmbeddingVertexCorrector::sourceLabel
private

Definition at line 70 of file EmbeddingVertexCorrector.cc.

Referenced by EmbeddingVertexCorrector(), and produce().

◆ vertexPositionLabel

edm::InputTag EmbeddingVertexCorrector::vertexPositionLabel
private

Definition at line 71 of file EmbeddingVertexCorrector.cc.

Referenced by EmbeddingVertexCorrector(), and produce().

edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm
HLT enums.
Definition: AlignableModifier.h:19
EmbeddingVertexCorrector::vertexPositionLabel
edm::InputTag vertexPositionLabel
Definition: EmbeddingVertexCorrector.cc:71
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle< edm::HepMCProduct >
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EmbeddingVertexCorrector::sourceLabel
edm::InputTag sourceLabel
Definition: EmbeddingVertexCorrector.cc:70
edm::ESHandle
Definition: DTSurvey.h:22
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
BeamSpotObjectsRcd
Definition: BeamSpotObjectsRcd.h:24
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::HepMCProduct
Definition: HepMCProduct.h:18
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15