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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper BeamProfileVtxGenerator BetafuncEvtVtxGenerator FlatEvtVtxGenerator GaussEvtVtxGenerator HLLHCEvtVtxGenerator

Public Member Functions

 BaseEvtVtxGenerator (const edm::ParameterSet &)
 
virtual TMatrixD const * GetInvLorentzBoost () const =0
 
virtual HepMC::FourVector newVertex (CLHEP::HepRandomEngine *) const =0
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~BaseEvtVtxGenerator ()
 
- 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)
 

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
 
- 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
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

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:46
BaseEvtVtxGenerator::~BaseEvtVtxGenerator ( )
virtual

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, BeamProfileVtxGenerator, FlatEvtVtxGenerator, and GaussEvtVtxGenerator.

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

Definition at line 49 of file BaseEvtVtxGenerator.cc.

References edm::Event::getByToken(), edm::RandomNumberGenerator::getEngine(), edm::HepMCProduct::GetEvent(), eostools::move(), edm::Event::put(), reco::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:122
virtual TMatrixD const * GetInvLorentzBoost() const =0
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
virtual HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const =0
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
return(e1-e2)*(e1-e2)+dp *dp
StreamID streamID() const
Definition: Event.h:81
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 44 of file BaseEvtVtxGenerator.h.