| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PartPropSvc Class Reference

`#include <PartPropSvc.h>`

Inheritance diagram for PartPropSvc:
[legend]
Collaboration diagram for PartPropSvc:
[legend]

## Public Member Functions
virtual StatusCode | initialize ()
virtual StatusCode | reinitialize ()
virtual StatusCode | finalize ()
HepPDT::ParticleDataTable * | PDT ()
void | setUnknownParticleHandler (HepPDT::ProcessUnknownID *, const std::string &)
| PartPropSvc (const std::string &name, ISvcLocator *svc)
virtual | ~PartPropSvc ()
Public Member Functions inherited from extends1< Service, IPartPropSvc >
| extends1 (A1 a1, A2 a2, A3 a3)
| Templated constructor with 3 arguments.
| extends1 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends1 (A1 a1)
| Templated constructor with 1 argument.
| extends1 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends1 ()
| Virtual destructor.
Public Member Functions inherited from Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
Public Member Functions inherited from extend_interfaces1< IPartPropSvc >
virtual | ~extend_interfaces1 ()
| Virtual destructor.
Public Member Functions inherited from IPartPropSvc
| DeclareInterfaceID (IPartPropSvc, 2, 0)
| InterfaceID.
virtual | ~IPartPropSvc ()
| virtual destructor
Public Member Functions inherited from IService
| DeclareInterfaceID (IService, 3, 0)
| InterfaceID.
virtual StatusCode | sysInitialize ()=0
| Initialize Service.
virtual StatusCode | sysStart ()=0
| Start Service.
virtual StatusCode | sysStop ()=0
| Stop Service.
virtual StatusCode | sysFinalize ()=0
| Finalize Service.
virtual StatusCode | sysReinitialize ()=0
| Re-initialize the Service.
virtual StatusCode | sysRestart ()=0
| Re-start the Service.
virtual StatusCode | configure ()=0
| Configuration (from OFFLINE to CONFIGURED).
virtual StatusCode | start ()=0
| Start (from INITIALIZED to RUNNING).
virtual StatusCode | stop ()=0
| Stop (from RUNNING to INITIALIZED).
virtual StatusCode | terminate ()=0
| Initialization (from CONFIGURED to OFFLINE).
virtual StatusCode | restart ()=0
| Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual Gaudi::StateMachine::State | FSMState () const =0
| Get the current state.
virtual Gaudi::StateMachine::State | targetFSMState () const =0
| When we are in the middle of a transition, get the state where the transition is leading us.
virtual | ~IService ()
| virtual destructor
Public Member Functions inherited from INamedInterface
| DeclareInterfaceID (INamedInterface, 1, 0)
| InterfaceID.
virtual const std::string & | name () const =0
| Retrieve the name of the instance.
virtual | ~INamedInterface ()
| Virtual destructor (always needed for abstract classes).
Public Member Functions inherited from IInterface
virtual unsigned long | addRef ()=0
| Increment the reference count of Interface instance.
virtual unsigned long | release ()=0
| Release Interface instance.
virtual unsigned long | refCount () const =0
| Current reference count.
virtual | ~IInterface ()
| Virtual destructor.

## Private Member Functions
StatusCode | createTable ()

## Private Attributes
std::vector< std::pair < std::string, bool(*)(std::istream &, HepPDT::TableBuilder &)> > | m_inputs
StringProperty | m_pdtFiles
HepPDT::ProcessUnknownID * | m_upid
std::string | m_upid_name
HepPDT::ParticleDataTable * | m_pdt
bool(*)(std::istream &, HepPDT::TableBuilder &) | parseTableType (std::string &)
MsgStream | m_log
bool | m_upid_local

## Additional Inherited Members
Public Types inherited from extends1< Service, IPartPropSvc >
typedef extends1 | base_class
| Typedef to this class.
typedef extend_interfaces1 < IPartPropSvc > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface.
Protected Member Functions inherited from Service
virtual | ~Service ()
| Standard Destructor.
int | outputLevel () const
| get the `Service's` output level
Protected Member Functions inherited from IService
virtual void | setServiceManager (ISvcManager *)=0
Protected Attributes inherited from Service
IntegerProperty | m_outputLevel
| Service output level.
Gaudi::StateMachine::State | m_state
| Service state.
Gaudi::StateMachine::State | m_targetState
| Service state.

## Detailed Description

Definition at line 27 of file PartPropSvc.h.

## Constructor & Destructor Documentation

PartPropSvc::PartPropSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  |

Definition at line 32 of file PartPropSvc.cpp.

: base_class( name, svc ), m_upid(0), m_pdt(0), m_log(msgSvc(), name),
m_upid_local(false) {
declareProperty( "InputFile", m_pdtFiles="PDGTABLE.MeV");
}

PartPropSvc::~PartPropSvc | ( |  | ) |
| virtual

Definition at line 42 of file PartPropSvc.cpp.

{
}

## Member Function Documentation

StatusCode PartPropSvc::createTable | ( |  | ) |
| private

Definition at line 189 of file PartPropSvc.cpp.

{
// use a handler for unknown heavy ions
if ( m_upid == 0 ) {
setUnknownParticleHandler(new HepPDT::HeavyIonUnknownID,
"Default Heavy Ion Handler");
m_upid_local = true;
}
m_pdt = new HepPDT::ParticleDataTable(m_upid_name, m_upid);
HepPDT::TableBuilder tb( *m_pdt );
std::vector< std::pair<std::string,
bool(*) (std::istream&,HepPDT::TableBuilder&)> >::const_iterator itr;
for (itr = m_inputs.begin(); itr != m_inputs.end(); ++itr) {
string f = itr->first;
bool (*pF) (std::istream&,HepPDT::TableBuilder&) = itr->second;
m_log << MSG::DEBUG << "Reading PDT file \"" << f << "\""
<< endmsg;
std::ifstream pdfile( f.c_str() );
// build a table from the file
if ( ! pF(pdfile,tb) ) {
m_log << MSG::ERROR << "Error reading PDT file: \"" << f
<< "\"" << endmsg;
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}

StatusCode PartPropSvc::finalize | ( |  | ) |
| virtual

Reimplemented from Service.

Definition at line 131 of file PartPropSvc.cpp.

{
if (m_pdt != 0) {
delete m_pdt;
m_pdt = 0;
}
if (m_upid_local && m_upid != 0) {
m_upid_local = false;
// This will cause a memory leak, but we can't delete it as the
// destructor of HepPDT::processUnknownID is protected.
// We need this though to call reinitialize successfully.
m_upid = 0;
}
MsgStream m_log( msgSvc(), name() );
StatusCode status = Service::finalize();
if ( status.isSuccess() )
m_log << MSG::DEBUG << "Service finalised successfully" << endmsg;
return status;
}

StatusCode PartPropSvc::initialize | ( |  | ) |
| virtual

Reimplemented from Service.

Definition at line 48 of file PartPropSvc.cpp.

{
StatusCode status = Service::initialize();
m_log.setLevel( m_outputLevel.value() );
if ( status.isFailure() ) {
m_log << MSG::ERROR << "Could not initialize main svc" << endmsg;
return StatusCode::FAILURE;
}
std::string key = m_pdtFiles.value();
Tokenizer tok(true);
tok.analyse( key, " ", "", "", "=", "", "");
for ( Tokenizer::Items::iterator i = tok.items().begin();
i != tok.items().end(); i++) {
const std::string& fname = (*i).tag();
// see if input file exists in $DATAPATH
std::string rfile = System::PathResolver::find_file(fname,"DATAPATH");
if (rfile == "") {
m_log << MSG::ERROR << "Could not find PDT file: \"" << fname
<< "\" in $DATAPATH" << endmsg;
return StatusCode::FAILURE;
}
// is the file readable?
std::ifstream pdfile( rfile.c_str() );
if (!pdfile) {
m_log << MSG::ERROR << "Could not open PDT file: \"" << rfile
<< "\"" << endmsg;
return StatusCode::FAILURE;
}
std::string val,VAL;
val = (*i).value();
VAL = val;
toupper(VAL);
// default: no type specified, assume PDG
if (val == fname) {
m_log << MSG::INFO << "No table format type specified for \"" << fname
<< "\". Assuming PDG" << endmsg;
VAL = "PDG";
}
bool (*pF) (std::istream &,
HepPDT::TableBuilder &);
try {
pF = parseTableType(VAL);
} catch (...) {
m_log << MSG::ERROR
<< "Could not determine Particle Property table type: \""
<< val << "\" for file \"" << fname << "\"" << endmsg;
return StatusCode::FAILURE;
}
m_log << MSG::DEBUG << "Adding PDT file \"" << rfile << "\" type "
<< VAL << endmsg;
m_inputs.push_back( make_pair( rfile, pF ) );
}
return status;
}

HepPDT::ParticleDataTable * PartPropSvc::PDT | ( |  | ) |
| virtual

Implements IPartPropSvc.

Definition at line 228 of file PartPropSvc.cpp.

{
if (m_pdt == 0) {
m_log << MSG::DEBUG << "creating ParticleDataTable" << endmsg;
if (createTable().isFailure()) {
m_log << MSG::FATAL << "Could not create ParticleDataTable" << endmsg;
m_pdt = 0;
}
}
return m_pdt;
}

StatusCode PartPropSvc::reinitialize | ( |  | ) |
| virtual

Reimplemented from Service.

Definition at line 122 of file PartPropSvc.cpp.

{
return StatusCode::SUCCESS;
}

void PartPropSvc::setUnknownParticleHandler | ( | HepPDT::ProcessUnknownID * | puid,
|  | const std::string & | n
| ) |  |
| virtual

Implements IPartPropSvc.

Definition at line 244 of file PartPropSvc.cpp.

{
if (m_pdt != 0) {
m_log << MSG::ERROR << "not setting Unknown Particle Handler \"" << n
<< "\" as ParticleDataTable already instantiated" << endmsg;
return;
}
m_log << MSG::DEBUG << "setting Unknown Particle Handler \"" << n
<< "\" at " << puid << endmsg;
if (m_upid != 0) {
m_log << MSG::WARNING
<< "overriding previously selected Unknown Particle Handler \""
<< m_upid_name << "\" with \"" << n << "\"" << endmsg;
}
m_upid = puid;
m_upid_name = n;
}

## Member Data Documentation

std::vector< std::pair<std::string, bool(*) (std::istream&,HepPDT::TableBuilder&)> > PartPropSvc::m_inputs
| private

Definition at line 50 of file PartPropSvc.h.

MsgStream PartPropSvc::m_log
| mutable private

Definition at line 60 of file PartPropSvc.h.

HepPDT::ParticleDataTable* PartPropSvc::m_pdt
| private

Definition at line 56 of file PartPropSvc.h.

StringProperty PartPropSvc::m_pdtFiles
| private

Definition at line 52 of file PartPropSvc.h.

HepPDT::ProcessUnknownID* PartPropSvc::m_upid
| private

Definition at line 53 of file PartPropSvc.h.

bool PartPropSvc::m_upid_local
| private

Definition at line 62 of file PartPropSvc.h.

std::string PartPropSvc::m_upid_name
| private

Definition at line 54 of file PartPropSvc.h.

bool(*)(std::istream&, HepPDT::TableBuilder&) PartPropSvc::parseTableType(std::string &)
| private

Definition at line 58 of file PartPropSvc.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/PartPropSvc/src/PartPropSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/PartPropSvc/src/PartPropSvc.cpp