CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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.

References fVertex.

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

Implements edm::EDProducer.

Definition at line 55 of file BaseEvtVtxGenerator.cc.

References edm::Event::getByLabel(), edm::RandomNumberGenerator::getEngine(), 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 }
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
virtual HepMC::FourVector * newVertex(CLHEP::HepRandomEngine *)=0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
virtual TMatrixD * GetInvLorentzBoost()=0
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
return(e1-e2)*(e1-e2)+dp *dp
StreamID streamID() const
Definition: Event.h:80

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().