CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

BaseEvtVtxGenerator Class Reference

#include <BaseEvtVtxGenerator.h>

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

List of all members.

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

Protected Member Functions

CLHEP::HepRandomEngine & getEngine ()

Protected Attributes

TMatrixD * boost_
double fTimeOffset
HepMC::FourVector * fVertex

Private Attributes

CLHEP::HepRandomEngine * fEngine
edm::InputTag sourceLabel

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

        : fVertex(0), boost_(0), fTimeOffset(0), fEngine(0),
          sourceLabel(pset.getParameter<edm::InputTag>("src"))
{
   
/* No longer needed...

   // 1st of all, check on module_label - must be VtxSmeared !
   if ( pset.getParameter<string>("@module_label") != "VtxSmeared" )
   {
      throw cms::Exception("Configuration")
        << "Module has an invalid module label. "
           "The label of this module MUST be VtxSmeared.";
   }
*/
      
   Service<RandomNumberGenerator> rng;

   if ( ! rng.isAvailable()) {

     throw cms::Exception("Configuration")
       << "The BaseEvtVtxGenerator requires the RandomNumberGeneratorService\n"
          "which is not present in the configuration file.  You must add the service\n"
          "in the configuration file or remove the modules that require it.";
   }

   CLHEP::HepRandomEngine& engine = rng->getEngine();
   fEngine = &engine;

      
   produces<bool>(); 
}
BaseEvtVtxGenerator::~BaseEvtVtxGenerator ( ) [virtual]

Definition at line 64 of file BaseEvtVtxGenerator.cc.

References boost_, and fVertex.

{
   delete fVertex ;
   if (boost_ != 0 ) delete boost_;
   // no need since now it's done in HepMCProduct
   // delete fEvt ;
}

Member Function Documentation

virtual void BaseEvtVtxGenerator::beginRun ( edm::Run ,
const edm::EventSetup  
) [inline, virtual]

Reimplemented from edm::EDProducer.

Reimplemented in BetafuncEvtVtxGenerator.

Definition at line 37 of file BaseEvtVtxGenerator.h.

{};
CLHEP::HepRandomEngine & BaseEvtVtxGenerator::getEngine ( ) [protected]
virtual TMatrixD* BaseEvtVtxGenerator::GetInvLorentzBoost ( ) [pure virtual]
virtual HepMC::FourVector* BaseEvtVtxGenerator::lastVertex ( ) [inline, virtual]

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.

{ return 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(), and sourceLabel.

{
   
   
   Handle<HepMCProduct> HepMCEvt ;
   
   evt.getByLabel( sourceLabel, HepMCEvt ) ;
   
   // generate new vertex & apply the shift 
   //
   HepMCEvt->applyVtxGen( newVertex() ) ;

   //HepMCEvt->LorentzBoost( 0., 142.e-6 );
   HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" );
   HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" );
   
   // OK, create a (pseudo)product and put in into edm::Event
   //
   auto_ptr<bool> NewProduct(new bool(true)) ;      
   evt.put( NewProduct ) ;
      
   return ;
}

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

HepMC::FourVector* BaseEvtVtxGenerator::fVertex [protected]

Definition at line 66 of file BaseEvtVtxGenerator.h.

Referenced by produce().