CMS 3D CMS Logo

Public Member Functions | Protected Attributes

edm::BaseFlatGunProducer Class Reference

#include <BaseFlatGunProducer.h>

Inheritance diagram for edm::BaseFlatGunProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper edm::ExpoRandomPtGunProducer edm::FlatRandomEGunProducer edm::FlatRandomOneOverPtGunProducer edm::FlatRandomPtGunProducer edm::MultiParticleInConeGunProducer

List of all members.

Public Member Functions

 BaseFlatGunProducer (const ParameterSet &)
void beginRun (edm::Run &r, const edm::EventSetup &)
void endRun (edm::Run &r, const edm::EventSetup &)
virtual ~BaseFlatGunProducer ()

Protected Attributes

bool fAddAntiParticle
HepMC::GenEvent * fEvt
double fMaxEta
double fMaxPhi
double fMinEta
double fMinPhi
std::vector< int > fPartIDs
ESHandle
< HepPDT::ParticleDataTable
fPDGTable
CLHEP::HepRandomEngine & fRandomEngine
CLHEP::RandFlat * fRandomGenerator
int fVerbosity

Detailed Description

Definition at line 31 of file BaseFlatGunProducer.h.


Constructor & Destructor Documentation

BaseFlatGunProducer::BaseFlatGunProducer ( const ParameterSet pset)

Definition at line 49 of file BaseFlatGunProducer.cc.

References fAddAntiParticle, fMaxEta, fMaxPhi, fMinEta, fMinPhi, fPartIDs, fRandomEngine, fRandomGenerator, fVerbosity, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

                                                                   :
   fEvt(0),
   fRandomEngine(getEngineReference()),
   fRandomGenerator(0)
   // fPDGTable( new DefaultConfig::ParticleDataTable("PDG Table") )
{

   ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters") ;
  
   // although there's the method ParameterSet::empty(),  
   // it looks like it's NOT even necessary to check if it is,
   // before trying to extract parameters - if it is empty,
   // the default values seem to be taken
   fPartIDs    = pgun_params.getParameter< vector<int> >("PartID");  
   fMinEta     = pgun_params.getParameter<double>("MinEta");
   fMaxEta     = pgun_params.getParameter<double>("MaxEta");
   fMinPhi     = pgun_params.getParameter<double>("MinPhi");
   fMaxPhi     = pgun_params.getParameter<double>("MaxPhi");

  //
  //fPDGTablePath = "/afs/cern.ch/sw/lcg/external/clhep/1.9.2.1/slc3_ia32_gcc323/data/HepPDT/" ;
/*
  string HepPDTBase( getenv("HEPPDT_PARAM_PATH") ) ; 
  fPDGTablePath = HepPDTBase + "/data/" ;
  fPDGTableName = "PDG_mass_width_2004.mc"; // should it be 2004 table ?

  string TableFullName = fPDGTablePath + fPDGTableName ;
  ifstream PDFile( TableFullName.c_str() ) ;
  if( !PDFile ) 
  {
      throw cms::Exception("FileNotFound", "BaseFlatGunProducer::BaseFlatGunProducer()")
        << "File " << TableFullName << " cannot be opened.\n";
  }

  HepPDT::TableBuilder tb(*fPDGTable) ;
  if ( !addPDGParticles( PDFile, tb ) ) { cout << " Error reading PDG !" << endl; }
  // the tb dtor fills fPDGTable
*/

  fVerbosity = pset.getUntrackedParameter<int>( "Verbosity",0 ) ;

// The Service has already instantiated an engine.  Use it.
   fRandomGenerator = new CLHEP::RandFlat(fRandomEngine) ;
   fAddAntiParticle = pset.getParameter<bool>("AddAntiParticle") ;

   produces<GenRunInfoProduct, InRun>();
}
BaseFlatGunProducer::~BaseFlatGunProducer ( ) [virtual]

Definition at line 97 of file BaseFlatGunProducer.cc.

{
  
//if ( fRandomGenerator != NULL ) delete fRandomGenerator;
  // do I need to delete the Engine, too ?
  
  // no need to cleanup GenEvent memory - done in HepMCProduct
  // if (fEvt != NULL) delete fEvt ; // double check
  // delete fPDGTable;
  
}

Member Function Documentation

void BaseFlatGunProducer::beginRun ( edm::Run r,
const edm::EventSetup es 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 110 of file BaseFlatGunProducer.cc.

References fPDGTable, and edm::EventSetup::getData().

{
   es.getData( fPDGTable ) ;
   return ;

}
void BaseFlatGunProducer::endRun ( edm::Run r,
const edm::EventSetup es 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 118 of file BaseFlatGunProducer.cc.

References edm::Run::put().

{
   // just create an empty product
   // to keep the EventContent definitions happy
   // later on we might put the info into the run info that this is a PGun
   auto_ptr<GenRunInfoProduct> genRunInfo( new GenRunInfoProduct() );
   run.put( genRunInfo );
}

Member Data Documentation

HepMC::GenEvent* edm::BaseFlatGunProducer::fEvt [protected]
std::vector<int> edm::BaseFlatGunProducer::fPartIDs [protected]
CLHEP::HepRandomEngine& edm::BaseFlatGunProducer::fRandomEngine [protected]
CLHEP::RandFlat* edm::BaseFlatGunProducer::fRandomGenerator [protected]