CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
BaseEvtVtxGenerator Class Referenceabstract

#include <BaseEvtVtxGenerator.h>

Inheritance diagram for BaseEvtVtxGenerator:
edm::stream::EDProducer<> BeamProfileVtxGenerator BetafuncEvtVtxGenerator FlatEvtVtxGenerator GaussEvtVtxGenerator HLLHCEvtVtxGenerator PassThroughEvtVtxGenerator

Public Member Functions

 BaseEvtVtxGenerator (const edm::ParameterSet &)
 
virtual TMatrixD const * GetInvLorentzBoost () const =0
 
virtual HepMC::FourVector newVertex (CLHEP::HepRandomEngine *) const =0
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~BaseEvtVtxGenerator () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 23 of file BaseEvtVtxGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file BaseEvtVtxGenerator.cc.

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

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

Definition at line 45 of file BaseEvtVtxGenerator.cc.

46 {
47 }

Member Function Documentation

virtual TMatrixD const* BaseEvtVtxGenerator::GetInvLorentzBoost ( ) const
pure virtual

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.

Implemented in BetafuncEvtVtxGenerator, HLLHCEvtVtxGenerator, PassThroughEvtVtxGenerator, FlatEvtVtxGenerator, BeamProfileVtxGenerator, and GaussEvtVtxGenerator.

virtual HepMC::FourVector BaseEvtVtxGenerator::newVertex ( CLHEP::HepRandomEngine *  ) const
pure virtual
void BaseEvtVtxGenerator::produce ( edm::Event evt,
const edm::EventSetup  
)
override

Definition at line 49 of file BaseEvtVtxGenerator.cc.

References edm::Event::getByToken(), edm::RandomNumberGenerator::getEngine(), edm::HepMCProduct::GetEvent(), eostools::move(), edm::Event::put(), mathSSE::return(), and edm::Event::streamID().

50 {
52  CLHEP::HepRandomEngine* engine = &rng->getEngine(evt.streamID());
53 
54  Handle<HepMCProduct> HepUnsmearedMCEvt ;
55 
56  evt.getByToken( sourceToken, HepUnsmearedMCEvt ) ;
57 
58  // Copy the HepMC::GenEvent
59  HepMC::GenEvent* genevt = new HepMC::GenEvent(*HepUnsmearedMCEvt->GetEvent());
60  std::unique_ptr<edm::HepMCProduct> HepMCEvt(new edm::HepMCProduct(genevt));
61  // generate new vertex & apply the shift
62  //
63  HepMCEvt->applyVtxGen( newVertex(engine) ) ;
64 
65  //HepMCEvt->LorentzBoost( 0., 142.e-6 );
66  HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" );
67  HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" );
68 
69  evt.put(std::move(HepMCEvt)) ;
70 
71  return ;
72 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
virtual TMatrixD const * GetInvLorentzBoost() const =0
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
virtual HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const =0
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
return((rh^lh)&mask)
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
StreamID streamID() const
Definition: Event.h:95
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 44 of file BaseEvtVtxGenerator.h.