Commit b3a432ac authored by cvs2svn's avatar cvs2svn
Browse files

This commit was manufactured by cvs2svn to create tag

'GAUDI_v19r3-pre'.

git-svn-id: svn+ssh://svn.cern.ch/reps/gaudi/distribution/tags/GAUDI/GAUDI_v19r3-pre@3802 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parent 8e970855
package PartPropSvc
version v2
branches src cmt doc
use GaudiPolicy v*
use GaudiKernel v*
use HepPDT v* LCG_Interfaces
apply_pattern install_more_includes more=PartPropSvc
# build a component library
library PartPropSvc ../src/*.cpp
apply_pattern component_library library=PartPropSvc
# define link options
macro_append HepPDT_linkopts " -lHepPID " \
WIN32 " HepPID.lib "
path_append DATAPATH "${PARTPROPSVCROOT}/share"
#=======================================================
private
# get flags to build shared Component library
# apply_pattern package_Cshlibflags
# macro_remove cppflags "-D_GNU_SOURCE"
# macro_remove pp_cppflags "-D_GNU_SOURCE"
# apply_pattern install_runtime
apply_pattern declare_joboptions files="PartPropSvc.py"
-----------------------------------------------------------------------------
Usage:
-----------------------------------------------------------------------------
JobOptions:
(string) "InputType": type of input format. One of:
"PDG", "Herwig", "Pythia", "IsaJet"
default: "PDG"
(vector<string>) "InputFile": name(s) of input files
-----------------------------------------------------------------------------
Accessors:
-----------------------------------------------------------------------------
HepPDT::ParticleDataTable* PDT(): returns the particle data table
generated from input files read
in.
Package : ParticleProp
Package manager : Charles Leggett
! 20070216 Charles Leggett
Patch #1076
- fix for default PDGTABLE.
================ PartPropSvc v2r4 =========================================
! 20070216 Charles Leggett
Patch #1019
- changed into a component lib
- moved IPartPropSvc to GaudiKernel
- moved PartPropSvc.h to src/
! 20070202 Hubert Degaudenzi
- added missing library (CLHEP-HepPDT) in the CLHEP_linkopts macro
(in the private section for the moment).
- commented out the "apply_pattern install_runtime".
================ PartPropSvc v2r3p1 =========================================
! 20040910 Charles Leggett
- src/PartPropSvc.cpp: uses PathResolver to locate PDT files
return FAILURE if can't find any files to open.
================ PartPropSvc v2r3 ==========================================
! 20040716 Charles Leggett
- changed IID to InterfaceID
================ PartPropSvc v2r2 ==========================================
! 20040507 Charles Leggett
- use standard macros in PartPropSvc_entries.cpp, PartPropSvc_load.cpp
- removed PartPropSvc_dll.cpp
================ PartPropSvc v2r1 ==========================================
! 20040129 Paolo Calafiura
- return an error if no PDT file was read
! 20040126 Charles Leggett
- changed default data file to PDGTable.MeV. Obviously non-backward compatible
================ PartPropSvc v2r0 ==========================================
! 20040115 Paolo Calafiura
- importing package to cvs repository"
! 20030624 Charles Leggett
- removed built in version of HepPDT, uses CLHEP version instead
- PartPropSvc.cpp: reads in Herwig and IsaJet as well
: removed QQ input mode
: added share directory, jobOptions and PDGTABLE file
! 20020703 Paolo Calafiura
- TableBuilderT.icc: addQQParticles added return value (false) to
dummy implementation
This diff is collapsed.
This diff is collapsed.
#--------------------------------------------------------------
# PartPropSvc Service options
#--------------------------------------------------------------
theApp.Dlls += [ "PartPropSvc" ]
theApp.ExtSvc += ["PartPropSvc"]
PartPropSvc = Service( "PartPropSvc" )
PartPropSvc.InputType = "PDG"
PartPropSvc.InputFile = ["PDGTABLE.MeV"]
#--------------------------------------------------------------
//--------------------------------------------------------------
// PartPropSvc Service options
//--------------------------------------------------------------
ApplicationMgr.DLLs += { "PartPropSvc" };
ApplicationMgr.ExtSvc += {"PartPropSvc"};
PartPropSvc.InputType = "PDG";
PartPropSvc.InputFile = {"PDGTABLE.MeV"};
//--------------------------------------------------------------
//Include files
#include "GaudiKernel/SvcFactory.h"
#include "GaudiKernel/ISvcLocator.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/PathResolver.h"
#include "PartPropSvc.h"
#include "HepPDT/TableBuilder.hh"
#include <iostream>
#include <cstdlib>
#include <fstream>
// Instantiation of a static factory class used by clients to create
// instances of this service
DECLARE_SERVICE_FACTORY(PartPropSvc)
//*************************************************************************//
PartPropSvc::PartPropSvc( const std::string& name, ISvcLocator* svc )
: Service( name, svc ), m_pdt(0) {
declareProperty( "InputType", m_inputType="PDG");
declareProperty( "InputFile", m_pdtFiles);
if (m_pdtFiles.empty() ) {
m_pdtFiles.push_back("PDGTABLE.MeV");
}
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
PartPropSvc::~PartPropSvc() {
if (m_pdt != 0) {
delete m_pdt;
m_pdt = 0;
}
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
const InterfaceID& PartPropSvc::type() const {
return IID_IPartPropSvc;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
StatusCode PartPropSvc::initialize() {
MsgStream log( msgSvc(), name() );
std::vector<std::string>::const_iterator itr;
StatusCode status = Service::initialize();
log << MSG::INFO << "PDT file(s): " << endreq;
for (itr=m_pdtFiles.begin(); itr!=m_pdtFiles.end(); ++itr) {
log << MSG::INFO << " " << *itr << endreq;
}
log << MSG::INFO << "Type: " << m_inputType << endreq;
if ( status.isFailure() ) {
log << MSG::ERROR << "Could not initialize main svc" << endreq;
return StatusCode::FAILURE;
}
bool (*pF) (std::istream &,
HepPDT::TableBuilder &);
// Determine type of input
if (m_inputType == "PDG") {
pF = &HepPDT::addPDGParticles;
} else if (m_inputType == "Pythia") {
pF = &HepPDT::addPythiaParticles;
} else if (m_inputType == "EvtGen") {
pF = &HepPDT::addEvtGenParticles;
} else if (m_inputType == "Herwig") {
pF = &HepPDT::addHerwigParticles;
} else if (m_inputType == "IsaJet") {
pF = &HepPDT::addIsajetParticles;
} else if (m_inputType == "QQ") {
pF = &HepPDT::addQQParticles;
} else {
log << MSG::ERROR << "Unknown Particle Data file type: \""
<< m_inputType << "\"" << endreq;
return StatusCode::FAILURE;
}
// Make sure we have at least one file
if (m_pdtFiles.size() == 0) {
log << MSG::ERROR << "Need at least 1 PDT file" << endreq;
log << MSG::ERROR << "Check value of property \"InputFile\"" << endreq;
return StatusCode::FAILURE;
}
m_pdt = new HepPDT::ParticleDataTable;
{
// Construct table builder
HepPDT::TableBuilder tb( *m_pdt );
// read the input
int good(0);
for (itr=m_pdtFiles.begin(); itr!=m_pdtFiles.end(); ++itr) {
std::string rfile = System::PathResolver::find_file(*itr,"DATAPATH");
if (rfile == "") {
log << MSG::ERROR << "Could not find PDT file: \"" << *itr
<< "\" in $DATAPATH" << endreq;
continue;
}
std::ifstream pdfile( rfile.c_str() );
if (!pdfile) {
log << MSG::ERROR << "Could not open PDT file: \"" << rfile
<< "\"" << endreq;
continue;
}
if ( ! pF(pdfile,tb) ) {
log << MSG::ERROR << "Error reading PDT file: \"" << rfile
<< "\"" << endreq;
return StatusCode::FAILURE;
}
++good;
}
if (0 == good) {
log << MSG::ERROR << "Unable to access any PDT file" <<endreq;
return StatusCode::FAILURE;
}
} // the tb destructor fills datacol
return status;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
StatusCode PartPropSvc::finalize() {
MsgStream log( msgSvc(), name() );
StatusCode status = Service::finalize();
if ( status.isSuccess() )
log << MSG::INFO << "Service finalised successfully" << endreq;
return status;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
StatusCode PartPropSvc::queryInterface( const InterfaceID& riid,
void** ppvInterface ) {
StatusCode sc = StatusCode::FAILURE;
if ( ppvInterface ) {
*ppvInterface = 0;
if ( riid == IID_IPartPropSvc ) {
*ppvInterface = static_cast<IPartPropSvc*>(this);
sc = StatusCode::SUCCESS;
addRef();
}
else
sc = Service::queryInterface( riid, ppvInterface );
}
return sc;
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
#ifndef __PARTPROPSVC_H__
#define __PARTPROPSVC_H__
#include "GaudiKernel/Service.h"
#include "GaudiKernel/IPartPropSvc.h"
#include "HepPDT/ParticleDataTable.hh"
#include <vector>
#include <string>
// Forward declarations
template <class TYPE> class SvcFactory;
//------------------------------------------------------------------
//
// ClassName: PartPropSvc
//
// Description: This service provides access to particle properties.
// Uses HepPDT as the underlying layer
//
// Author: Charles Leggett
//
// Date: 3-8-2001
//
//------------------------------------------------------------------
class PartPropSvc: public Service, virtual public IPartPropSvc {
public:
virtual StatusCode initialize();
virtual StatusCode finalize();
// Query the interfaces.
virtual StatusCode queryInterface( const InterfaceID& riid,
void** ppvInterface );
// Service type.
virtual const InterfaceID& type() const;
// The table
HepPDT::ParticleDataTable *PDT() { return m_pdt; };
protected:
PartPropSvc( const std::string& name, ISvcLocator* svc );
// Destructor.
virtual ~PartPropSvc();
private:
// Allow SvcFactory to instantiate the service.
friend class SvcFactory<PartPropSvc>;
std::string m_inputType;
std::vector<std::string> m_pdtFiles;
HepPDT::ParticleDataTable *m_pdt;
};
#endif
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES(PartPropSvc)
#include "GaudiKernel/DeclareFactoryEntries.h"
DECLARE_FACTORY_ENTRIES(PartPropSvc) {
DECLARE_SERVICE( PartPropSvc );
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment