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
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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
 
- 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::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)
 

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, edm::ParameterSet::getParameter(), and edm::Service< T >::isAvailable().

30  : fVertex(0), boost_(0), fTimeOffset(0),
32 {
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>(pset.getParameter<edm::InputTag>("src"));
44  produces<bool>();
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_ != 0 ) 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(), newVertex(), edm::Event::put(), reco::return(), sourceLabel, and edm::Event::streamID().

56 {
58  CLHEP::HepRandomEngine* engine = &rng->getEngine(evt.streamID());
59 
60  Handle<HepMCProduct> HepMCEvt ;
61 
62  evt.getByLabel( sourceLabel, HepMCEvt ) ;
63 
64  // generate new vertex & apply the shift
65  //
66  HepMCEvt->applyVtxGen( newVertex(engine) ) ;
67 
68  //HepMCEvt->LorentzBoost( 0., 142.e-6 );
69  HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" );
70  HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" );
71 
72  // OK, create a (pseudo)product and put in into edm::Event
73  //
74  auto_ptr<bool> NewProduct(new bool(true)) ;
75  evt.put( NewProduct ) ;
76 
77  return ;
78 }
virtual HepMC::FourVector * newVertex(CLHEP::HepRandomEngine *)=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
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
return(e1-e2)*(e1-e2)+dp *dp
StreamID streamID() const
Definition: Event.h:75

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