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::ProductRegistryHelper BeamProfileVtxGenerator BetafuncEvtVtxGenerator FlatEvtVtxGenerator GaussEvtVtxGenerator

Public Member Functions

 BaseEvtVtxGenerator (const edm::ParameterSet &)
 
virtual void beginRun (edm::Run &, const edm::EventSetup &)
 
virtual TMatrixD * GetInvLorentzBoost ()=0
 
virtual HepMC::FourVector * lastVertex ()
 
virtual HepMC::FourVector * newVertex ()=0
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~BaseEvtVtxGenerator ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Protected Member Functions

CLHEP::HepRandomEngine & getEngine ()
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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
 
typedef WorkerT< EDProducerWorkerType
 
- 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 28 of file BaseEvtVtxGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file BaseEvtVtxGenerator.cc.

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

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

References boost_, and fVertex.

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

Member Function Documentation

virtual void BaseEvtVtxGenerator::beginRun ( edm::Run ,
const edm::EventSetup  
)
inlinevirtual

Reimplemented from edm::EDProducer.

Reimplemented in BetafuncEvtVtxGenerator.

Definition at line 37 of file BaseEvtVtxGenerator.h.

37 {};
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 45 of file BaseEvtVtxGenerator.h.

References fVertex.

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

Implements edm::EDProducer.

Definition at line 72 of file BaseEvtVtxGenerator.cc.

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

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

Member Data Documentation

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

Definition at line 65 of file BaseEvtVtxGenerator.h.

Referenced by BaseEvtVtxGenerator(), and getEngine().

double BaseEvtVtxGenerator::fTimeOffset
protected

Definition at line 61 of file BaseEvtVtxGenerator.h.

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

Definition at line 66 of file BaseEvtVtxGenerator.h.

Referenced by produce().