CMS 3D CMS Logo

Public Member Functions | Protected Attributes

edm::BaseFlatGunSource Class Reference

#include <BaseFlatGunSource.h>

Inheritance diagram for edm::BaseFlatGunSource:
edm::GeneratedInputSource edm::ConfigurableInputSource edm::InputSource edm::ProductRegistryHelper edm::ExpoRandomPtGunSource edm::FlatRandomEGunSource edm::FlatRandomPtGunSource edm::MultiParticleInConeGunSource

List of all members.

Public Member Functions

 BaseFlatGunSource (const ParameterSet &, const InputSourceDescription &)
void beginRun (edm::Run &r, const edm::EventSetup &)
virtual ~BaseFlatGunSource ()

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 32 of file BaseFlatGunSource.h.


Constructor & Destructor Documentation

BaseFlatGunSource::BaseFlatGunSource ( const ParameterSet pset,
const InputSourceDescription desc 
)

Definition at line 47 of file BaseFlatGunSource.cc.

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

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

   ParameterSet defpset ;
   //ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters") ;
   ParameterSet pgun_params = 
      pset.getUntrackedParameter<ParameterSet>("PGunParameters", defpset ) ;
  
   // 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
   vector<int> defids ;
   defids.push_back(13) ;
   fPartIDs    = pgun_params.getUntrackedParameter< vector<int> >("PartID",defids);  
   fMinEta     = pgun_params.getUntrackedParameter<double>("MinEta",-5.5);
   fMaxEta     = pgun_params.getUntrackedParameter<double>("MaxEta",5.5);
   fMinPhi     = pgun_params.getUntrackedParameter<double>("MinPhi",-3.14159265358979323846);
   fMaxPhi     = pgun_params.getUntrackedParameter<double>("MaxPhi", 3.14159265358979323846);

  //
  //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", "BaseFlatGunSource::BaseFlatGunSource()")
        << "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.getUntrackedParameter<bool>("AddAntiParticle",false);
   
}
BaseFlatGunSource::~BaseFlatGunSource ( ) [virtual]

Definition at line 101 of file BaseFlatGunSource.cc.

References fRandomGenerator, and NULL.

{
  
  if ( fRandomGenerator != NULL ) delete fRandomGenerator;
  
  // no need to cleanup GenEvent memory - done in HepMCProduct
  // if (fEvt != NULL) delete fEvt ; // double check
  // delete fPDGTable;
  
}

Member Function Documentation

void BaseFlatGunSource::beginRun ( edm::Run r,
const edm::EventSetup es 
)

Definition at line 113 of file BaseFlatGunSource.cc.

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

{

   es.getData( fPDGTable ) ;

   return ;

}

Member Data Documentation

HepMC::GenEvent* edm::BaseFlatGunSource::fEvt [protected]
double edm::BaseFlatGunSource::fMaxEta [protected]
double edm::BaseFlatGunSource::fMaxPhi [protected]
double edm::BaseFlatGunSource::fMinEta [protected]
double edm::BaseFlatGunSource::fMinPhi [protected]
std::vector<int> edm::BaseFlatGunSource::fPartIDs [protected]
CLHEP::HepRandomEngine& edm::BaseFlatGunSource::fRandomEngine [protected]
CLHEP::RandFlat* edm::BaseFlatGunSource::fRandomGenerator [protected]