CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PassThroughEvtVtxGenerator Class Reference

#include <PassThroughEvtVtxGenerator.h>

Inheritance diagram for PassThroughEvtVtxGenerator:
BaseEvtVtxGenerator edm::stream::EDProducer<>

Public Member Functions

TMatrixD const * GetInvLorentzBoost () const override
 
HepMC::FourVector newVertex (CLHEP::HepRandomEngine *) const override
 
 PassThroughEvtVtxGenerator (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PassThroughEvtVtxGenerator () override
 
- Public Member Functions inherited from BaseEvtVtxGenerator
 BaseEvtVtxGenerator (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~BaseEvtVtxGenerator () 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
 

Private Attributes

edm::EDGetTokenT< edm::HepMCProductsourceToken
 

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

Definition at line 24 of file PassThroughEvtVtxGenerator.h.

Constructor & Destructor Documentation

◆ PassThroughEvtVtxGenerator()

PassThroughEvtVtxGenerator::PassThroughEvtVtxGenerator ( const edm::ParameterSet pset)
explicit

Definition at line 29 of file PassThroughEvtVtxGenerator.cc.

References Exception, edm::Service< T >::isAvailable(), muonDTDigis_cfi::pset, and sourceToken.

31  if (!rng.isAvailable()) {
32  throw cms::Exception("Configuration")
33  << "The PassThroughEvtVtxGenerator requires the RandomNumberGeneratorService\n"
34  "which is not present in the configuration file. \n"
35  "You must add the service\n"
36  "in the configuration file or remove the modules that require it.";
37  }
38  sourceToken = consumes<edm::HepMCProduct>(pset.getParameter<edm::InputTag>("src"));
39 }
BaseEvtVtxGenerator(const edm::ParameterSet &)
bool isAvailable() const
Definition: Service.h:40
edm::EDGetTokenT< edm::HepMCProduct > sourceToken

◆ ~PassThroughEvtVtxGenerator()

PassThroughEvtVtxGenerator::~PassThroughEvtVtxGenerator ( )
override

Definition at line 41 of file PassThroughEvtVtxGenerator.cc.

41 {}

Member Function Documentation

◆ GetInvLorentzBoost()

TMatrixD const* PassThroughEvtVtxGenerator::GetInvLorentzBoost ( ) const
inlineoverridevirtual

This method - and the comment - is a left-over from COBRA-OSCAR time : return the last generated event vertex. If no vertex has been generated yet, a NULL pointer is returned.

Implements BaseEvtVtxGenerator.

Definition at line 34 of file PassThroughEvtVtxGenerator.h.

34 { return nullptr; };

◆ newVertex()

HepMC::FourVector PassThroughEvtVtxGenerator::newVertex ( CLHEP::HepRandomEngine *  ) const
overridevirtual

Implements BaseEvtVtxGenerator.

Definition at line 43 of file PassThroughEvtVtxGenerator.cc.

43  {
44  return HepMC::FourVector(0., 0., 0., 0);
45 }

◆ produce()

void PassThroughEvtVtxGenerator::produce ( edm::Event evt,
const edm::EventSetup  
)
override

Definition at line 47 of file PassThroughEvtVtxGenerator.cc.

References edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), eostools::move(), edm::Event::put(), and sourceToken.

47  {
49 
50  Handle<HepMCProduct> HepUnsmearedMCEvt;
51 
52  evt.getByToken(sourceToken, HepUnsmearedMCEvt);
53 
54  // Copy the HepMC::GenEvent
55  HepMC::GenEvent* genevt = new HepMC::GenEvent(*HepUnsmearedMCEvt->GetEvent());
56  std::unique_ptr<edm::HepMCProduct> HepMCEvt(new edm::HepMCProduct(genevt));
57 
58  evt.put(std::move(HepMCEvt));
59 
60  return;
61 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:526
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ sourceToken

edm::EDGetTokenT<edm::HepMCProduct> PassThroughEvtVtxGenerator::sourceToken
private

Definition at line 34 of file PassThroughEvtVtxGenerator.h.

Referenced by PassThroughEvtVtxGenerator(), and produce().