CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 75 of file EmbeddingVertexCorrector.cc.

References edm::ParameterSet::getParameter(), HLT_FULL_cff::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:303
EmbeddingVertexCorrector::~EmbeddingVertexCorrector ( )
override

Definition at line 84 of file EmbeddingVertexCorrector.cc.

84 {}

Member Function Documentation

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

Definition at line 112 of file EmbeddingVertexCorrector.cc.

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

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)
void EmbeddingVertexCorrector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 91 of file EmbeddingVertexCorrector.cc.

References edm::Event::getByLabel(), eostools::move(), edm::Event::put(), 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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
def move
Definition: eostools.py:511
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500

Member Data Documentation

edm::InputTag EmbeddingVertexCorrector::sourceLabel
private

Definition at line 68 of file EmbeddingVertexCorrector.cc.

Referenced by EmbeddingVertexCorrector(), and produce().

edm::InputTag EmbeddingVertexCorrector::vertexPositionLabel
private

Definition at line 69 of file EmbeddingVertexCorrector.cc.

Referenced by EmbeddingVertexCorrector(), and produce().