CMS 3D CMS Logo

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

#include <BaseEvtVtxGenerator.h>

Inheritance diagram for BaseEvtVtxGenerator:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper BeamProfileVtxGenerator BetafuncEvtVtxGenerator FlatEvtVtxGenerator GaussEvtVtxGenerator HLLHCEvtVtxGenerator

Public Member Functions

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

Protected Attributes

TMatrixD * boost_
 
double fTimeOffset
 
HepMC::FourVector * fVertex
 

Private Attributes

edm::InputTag sourceLabel
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
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 26 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::Service< T >::isAvailable(), and sourceLabel.

31  : fVertex(0), boost_(0), fTimeOffset(0),
33 {
35  if ( ! rng.isAvailable()) {
36  throw cms::Exception("Configuration")
37  << "The BaseEvtVtxGenerator requires the RandomNumberGeneratorService\n"
38  "which is not present in the configuration file. \n"
39  "You must add the service\n"
40  "in the configuration file or remove the modules that require it.";
41  }
42 
43  consumes<edm::HepMCProduct>(sourceLabel);
44  produces<edm::HepMCProduct>();
45 }
T getParameter(std::string const &) const
HepMC::FourVector * fVertex
bool isAvailable() const
Definition: Service.h:46
BaseEvtVtxGenerator::~BaseEvtVtxGenerator ( )
virtual

Definition at line 47 of file BaseEvtVtxGenerator.cc.

References boost_, and fVertex.

48 {
49  delete fVertex ;
50  if (boost_ != nullptr ) delete boost_;
51  // no need since now it's done in HepMCProduct
52  // delete fEvt ;
53 }
HepMC::FourVector * fVertex

Member Function Documentation

virtual TMatrixD* BaseEvtVtxGenerator::GetInvLorentzBoost ( )
pure virtual
virtual HepMC::FourVector* BaseEvtVtxGenerator::lastVertex ( )
inlinevirtual

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.

Definition at line 42 of file BaseEvtVtxGenerator.h.

42 { return fVertex; }
HepMC::FourVector * fVertex
virtual HepMC::FourVector* BaseEvtVtxGenerator::newVertex ( CLHEP::HepRandomEngine *  )
pure virtual
void BaseEvtVtxGenerator::produce ( edm::Event evt,
const edm::EventSetup  
)
overridevirtual

Definition at line 55 of file BaseEvtVtxGenerator.cc.

References edm::Event::getByLabel(), edm::RandomNumberGenerator::getEngine(), edm::HepMCProduct::GetEvent(), GetInvLorentzBoost(), eostools::move(), newVertex(), edm::Event::put(), reco::return(), sourceLabel, and edm::Event::streamID().

56 {
58  CLHEP::HepRandomEngine* engine = &rng->getEngine(evt.streamID());
59 
60  Handle<HepMCProduct> HepUnsmearedMCEvt ;
61 
62  evt.getByLabel( sourceLabel, HepUnsmearedMCEvt ) ;
63 
64  // Copy the HepMC::GenEvent
65  HepMC::GenEvent* genevt = new HepMC::GenEvent(*HepUnsmearedMCEvt->GetEvent());
66  std::unique_ptr<edm::HepMCProduct> HepMCEvt(new edm::HepMCProduct(genevt));
67  // generate new vertex & apply the shift
68  //
69  HepMCEvt->applyVtxGen( newVertex(engine) ) ;
70 
71  //HepMCEvt->LorentzBoost( 0., 142.e-6 );
72  HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" );
73  HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" );
74 
75  evt.put(std::move(HepMCEvt)) ;
76 
77  return ;
78 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
virtual HepMC::FourVector * newVertex(CLHEP::HepRandomEngine *)=0
virtual TMatrixD * GetInvLorentzBoost()=0
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:35
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

TMatrixD* BaseEvtVtxGenerator::boost_
protected
double BaseEvtVtxGenerator::fTimeOffset
protected

Definition at line 51 of file BaseEvtVtxGenerator.h.

HepMC::FourVector* BaseEvtVtxGenerator::fVertex
protected
edm::InputTag BaseEvtVtxGenerator::sourceLabel
private

Definition at line 55 of file BaseEvtVtxGenerator.h.

Referenced by BaseEvtVtxGenerator(), and produce().