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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::EDGetTokenT< edm::HepMCProductsourceToken
 

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
 

Detailed Description

Definition at line 24 of file PassThroughEvtVtxGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file PassThroughEvtVtxGenerator.cc.

References Exception, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), and sourceToken.

29  : BaseEvtVtxGenerator(pset) {
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 }
T getParameter(std::string const &) const
BaseEvtVtxGenerator(const edm::ParameterSet &)
bool isAvailable() const
Definition: Service.h:40
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
PassThroughEvtVtxGenerator::~PassThroughEvtVtxGenerator ( )
override

Definition at line 41 of file PassThroughEvtVtxGenerator.cc.

41 {}

Member Function Documentation

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; };
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 }
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:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 34 of file PassThroughEvtVtxGenerator.h.

Referenced by PassThroughEvtVtxGenerator(), and produce().