CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

HepPDTESSource Class Reference

#include <PhysicsTools/HepPDTESSource/interface/HepPDTESSource.h>

Inheritance diagram for HepPDTESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

List of all members.

Public Types

typedef HepPDT::ParticleDataTable PDT
 define the particle data table type
typedef std::auto_ptr< PDTReturnType
 define the return type

Public Member Functions

 HepPDTESSource (const edm::ParameterSet &)
 constructor from parameter set
ReturnType produce (const PDTRecord &)
 return the particle table
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
 set validity interval
 ~HepPDTESSource ()
 destructor

Private Attributes

edm::FileInPath pdtFileName

Detailed Description

Description: HepPDT particle data table ESSource

Implementation: <Notes on="" implementation>="">

Definition at line 32 of file HepPDTESSource.h.


Member Typedef Documentation

define the particle data table type

Definition at line 39 of file HepPDTESSource.h.

typedef std::auto_ptr<PDT> HepPDTESSource::ReturnType

define the return type

Definition at line 41 of file HepPDTESSource.h.


Constructor & Destructor Documentation

HepPDTESSource::HepPDTESSource ( const edm::ParameterSet cfg)

constructor from parameter set

Definition at line 4 of file HepPDTESSource.cc.

References edm::ESProducer::setWhatProduced().

                                                           :
  pdtFileName( cfg.getParameter<edm::FileInPath>( "pdtFileName" ) ) {
  setWhatProduced( this );
  findingRecord<PDTRecord>();
}
HepPDTESSource::~HepPDTESSource ( )

destructor

Definition at line 10 of file HepPDTESSource.cc.

                                {
}

Member Function Documentation

HepPDTESSource::ReturnType HepPDTESSource::produce ( const PDTRecord iRecord)

return the particle table

Definition at line 14 of file HepPDTESSource.cc.

References Exception, edm::FileInPath::fullPath(), and pdtFileName.

                                                   {
  using namespace edm::es;
  std::auto_ptr<PDT> pdt( new PDT( "PDG table" , new HepPDT::HeavyIonUnknownID) ); 
  std::ifstream pdtFile( pdtFileName.fullPath().c_str() );
  if( ! pdtFile ) 
    throw cms::Exception( "FileNotFound", "can't open pdt file" )
      << "cannot open " << pdtFileName.fullPath();
  { // notice: the builder has to be destroyed 
    // in order to fill the table!
    HepPDT::TableBuilder builder( * pdt );
    if( ! addParticleTable( pdtFile, builder ) ) { 
      throw cms::Exception( "ConfigError", "can't read pdt file" )
        << "wrong format of " << pdtFileName.fullPath();
    }
  }  
  return pdt;
}
void HepPDTESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue ,
edm::ValidityInterval oInterval 
) [virtual]

set validity interval

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 32 of file HepPDTESSource.cc.

References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().

                                                                      {
  // the same PDT is valid for any time
  oInterval = edm::ValidityInterval( edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime() );
}

Member Data Documentation

Definition at line 50 of file HepPDTESSource.h.

Referenced by produce().