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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 57 of file EmbeddingVertexCorrector.cc.

Constructor & Destructor Documentation

◆ EmbeddingVertexCorrector()

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

Definition at line 75 of file EmbeddingVertexCorrector.cc.

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

75  {
76  produces<edm::HepMCProduct>();
77 
78  sourceLabel = iConfig.getParameter<edm::InputTag>("src");
79  consumes<edm::HepMCProduct>(sourceLabel);
80  vertexPositionLabel = edm::InputTag("externalLHEProducer", "vertexPosition");
81  consumes<math::XYZTLorentzVectorD>(vertexPositionLabel);
82 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307

◆ ~EmbeddingVertexCorrector()

EmbeddingVertexCorrector::~EmbeddingVertexCorrector ( )
override

Definition at line 84 of file EmbeddingVertexCorrector.cc.

84 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 112 of file EmbeddingVertexCorrector.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

112  {
113  //The following says we do not know what parameters are allowed so do no validation
114  // Please change this to state exactly what you do use, even if it is no parameters
116  desc.setUnknown();
117  descriptions.addDefault(desc);
118 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 91 of file EmbeddingVertexCorrector.cc.

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

91  {
92  using namespace edm;
93 
94  // Retrieving generated Z to TauTau Event
95  Handle<edm::HepMCProduct> InputGenEvent;
96  iEvent.getByLabel(sourceLabel, InputGenEvent);
97  HepMC::GenEvent* genevent = new HepMC::GenEvent(*InputGenEvent->GetEvent());
98  std::unique_ptr<edm::HepMCProduct> CorrectedGenEvent(new edm::HepMCProduct(genevent));
99 
100  //Retrieving vertex position from input and creating vertex shift
101  Handle<math::XYZTLorentzVectorD> vertex_position;
102  iEvent.getByLabel(vertexPositionLabel, vertex_position);
103  HepMC::FourVector vertex_shift(
104  vertex_position.product()->x() * cm, vertex_position.product()->y() * cm, vertex_position.product()->z() * cm);
105 
106  // Apply vertex shift to all production vertices of the event
107  CorrectedGenEvent->applyVtxGen(&vertex_shift);
108  iEvent.put(std::move(CorrectedGenEvent));
109 }
T const * product() const
Definition: Handle.h:70
int iEvent
Definition: GenABIO.cc:224
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ sourceLabel

edm::InputTag EmbeddingVertexCorrector::sourceLabel
private

Definition at line 68 of file EmbeddingVertexCorrector.cc.

Referenced by EmbeddingVertexCorrector(), and produce().

◆ vertexPositionLabel

edm::InputTag EmbeddingVertexCorrector::vertexPositionLabel
private

Definition at line 69 of file EmbeddingVertexCorrector.cc.

Referenced by EmbeddingVertexCorrector(), and produce().