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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EmbeddingVertexCorrector (const edm::ParameterSet &)
 
 ~EmbeddingVertexCorrector ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &iEventSetup) override
 
virtual 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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 ( )

Definition at line 89 of file EmbeddingVertexCorrector.cc.

90 {
91 }

Member Function Documentation

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

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 }
const T & get() const
Definition: EventSetup.h:56
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 
)
overrideprivatevirtual

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:122
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:416
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
T const * product() const
Definition: Handle.h:81
HLT enums.
def move(src, dest)
Definition: eostools.py:510

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.