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 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 ()=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
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

CLHEP::HepRandomEngine & getEngine ()
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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)
 

Protected Attributes

TMatrixD * boost_
 
double fTimeOffset
 
HepMC::FourVector * fVertex
 

Private Attributes

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

Detailed Description

Definition at line 26 of file BaseEvtVtxGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file BaseEvtVtxGenerator.cc.

References edm::hlt::Exception, fEngine, edm::RandomNumberGenerator::getEngine(), and edm::Service< T >::isAvailable().

30  : fVertex(0), boost_(0), fTimeOffset(0), fEngine(0),
32 {
33 
34 /* No longer needed...
35 
36  // 1st of all, check on module_label - must be VtxSmeared !
37  if ( pset.getParameter<string>("@module_label") != "VtxSmeared" )
38  {
39  throw cms::Exception("Configuration")
40  << "Module has an invalid module label. "
41  "The label of this module MUST be VtxSmeared.";
42  }
43 */
44 
46 
47  if ( ! rng.isAvailable()) {
48 
49  throw cms::Exception("Configuration")
50  << "The BaseEvtVtxGenerator requires the RandomNumberGeneratorService\n"
51  "which is not present in the configuration file. You must add the service\n"
52  "in the configuration file or remove the modules that require it.";
53  }
54 
55  CLHEP::HepRandomEngine& engine = rng->getEngine();
56  fEngine = &engine;
57 
58 
59  produces<bool>();
60 }
T getParameter(std::string const &) const
HepMC::FourVector * fVertex
CLHEP::HepRandomEngine * fEngine
bool isAvailable() const
Definition: Service.h:46
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
BaseEvtVtxGenerator::~BaseEvtVtxGenerator ( )
virtual

Definition at line 62 of file BaseEvtVtxGenerator.cc.

References boost_, and fVertex.

63 {
64  delete fVertex ;
65  if (boost_ != 0 ) delete boost_;
66  // no need since now it's done in HepMCProduct
67  // delete fEvt ;
68 }
HepMC::FourVector * fVertex

Member Function Documentation

CLHEP::HepRandomEngine & BaseEvtVtxGenerator::getEngine ( )
protected
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 ( )
pure virtual
void BaseEvtVtxGenerator::produce ( edm::Event evt,
const edm::EventSetup  
)
overridevirtual

Implements edm::EDProducer.

Definition at line 70 of file BaseEvtVtxGenerator.cc.

References edm::Event::getByLabel(), GetInvLorentzBoost(), newVertex(), edm::Event::put(), reco::return(), and sourceLabel.

71 {
72 
73 
74  Handle<HepMCProduct> HepMCEvt ;
75 
76  evt.getByLabel( sourceLabel, HepMCEvt ) ;
77 
78  // generate new vertex & apply the shift
79  //
80  HepMCEvt->applyVtxGen( newVertex() ) ;
81 
82  //HepMCEvt->LorentzBoost( 0., 142.e-6 );
83  HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" );
84  HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" );
85 
86  // OK, create a (pseudo)product and put in into edm::Event
87  //
88  auto_ptr<bool> NewProduct(new bool(true)) ;
89  evt.put( NewProduct ) ;
90 
91  return ;
92 }
virtual HepMC::FourVector * newVertex()=0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual TMatrixD * GetInvLorentzBoost()=0
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
return(e1-e2)*(e1-e2)+dp *dp

Member Data Documentation

TMatrixD* BaseEvtVtxGenerator::boost_
protected
CLHEP::HepRandomEngine* BaseEvtVtxGenerator::fEngine
private

Definition at line 62 of file BaseEvtVtxGenerator.h.

Referenced by BaseEvtVtxGenerator(), and getEngine().

double BaseEvtVtxGenerator::fTimeOffset
protected

Definition at line 58 of file BaseEvtVtxGenerator.h.

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

Definition at line 63 of file BaseEvtVtxGenerator.h.

Referenced by produce().