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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 60 of file EmbeddingVertexCorrector.cc.

Constructor & Destructor Documentation

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

Definition at line 79 of file EmbeddingVertexCorrector.cc.

References edm::ParameterSet::getParameter().

80 {
81  produces<edm::HepMCProduct>();
82 
83  sourceLabel = iConfig.getParameter<edm::InputTag>("src");
84  consumes<edm::HepMCProduct>(sourceLabel);
85  vertexPositionLabel = edm::InputTag("externalLHEProducer","vertexPosition");
86  consumes<math::XYZTLorentzVectorD>(vertexPositionLabel);
87 }
T getParameter(std::string const &) const
EmbeddingVertexCorrector::~EmbeddingVertexCorrector ( )
override

Definition at line 89 of file EmbeddingVertexCorrector.cc.

90 {
91 }

Member Function Documentation

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

Definition at line 99 of file EmbeddingVertexCorrector.cc.

References edm::EventSetup::get().

100 {
101  // edm::ESHandle< SimBeamSpotObjects > beamhandle;
102  // iEventSetup.get<SimBeamSpotObjectsRcd>().get(beamhandle);
103 
105  iEventSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
106 
107 
108  edm::LogInfo("TauEmbedding")<<"beam handle\n"<<(*beamhandle);
109 
110 
111 }
T get() const
Definition: EventSetup.h:71
void EmbeddingVertexCorrector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 137 of file EmbeddingVertexCorrector.cc.

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

137  {
138  //The following says we do not know what parameters are allowed so do no validation
139  // Please change this to state exactly what you do use, even if it is no parameters
141  desc.setUnknown();
142  descriptions.addDefault(desc);
143 }
void addDefault(ParameterSetDescription const &psetDescription)
void EmbeddingVertexCorrector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 114 of file EmbeddingVertexCorrector.cc.

References edm::Event::getByLabel(), edm::HepMCProduct::GetEvent(), eostools::move(), edm::Handle< T >::product(), and edm::Event::put().

115 {
116  using namespace edm;
117 
118  // Retrieving generated Z to TauTau Event
119  Handle<edm::HepMCProduct> InputGenEvent;
120  iEvent.getByLabel(sourceLabel, InputGenEvent);
121  HepMC::GenEvent* genevent = new HepMC::GenEvent(*InputGenEvent->GetEvent());
122  std::unique_ptr<edm::HepMCProduct> CorrectedGenEvent(new edm::HepMCProduct(genevent));
123 
124  //Retrieving vertex position from input and creating vertex shift
125  Handle<math::XYZTLorentzVectorD> vertex_position;
126  iEvent.getByLabel(vertexPositionLabel, vertex_position);
127  HepMC::FourVector vertex_shift(vertex_position.product()->x()*cm, vertex_position.product()->y()*cm, vertex_position.product()->z()*cm);
128 
129  // Apply vertex shift to all production vertices of the event
130  CorrectedGenEvent->applyVtxGen(&vertex_shift);
131  iEvent.put(std::move(CorrectedGenEvent));
132 
133 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
T const * product() const
Definition: Handle.h:74
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::InputTag EmbeddingVertexCorrector::sourceLabel
private

Definition at line 72 of file EmbeddingVertexCorrector.cc.

edm::InputTag EmbeddingVertexCorrector::vertexPositionLabel
private

Definition at line 73 of file EmbeddingVertexCorrector.cc.