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 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<>
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 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_FULL_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 submitPVResolutionJobs::desc.

◆ 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
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle< edm::HepMCProduct >
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
EmbeddingVertexCorrector::sourceLabel
edm::InputTag sourceLabel
Definition: EmbeddingVertexCorrector.cc:70
edm::ESHandle
Definition: DTSurvey.h:22
iEvent
int iEvent
Definition: GenABIO.cc:224
BeamSpotObjectsRcd
Definition: BeamSpotObjectsRcd.h:24
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
get
#define get
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::HepMCProduct
Definition: HepMCProduct.h:21
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15