| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 2010

# PartPropSvc Namespace Reference

## Functions
| PartPropSvc (const std::string &name, ISvcLocator *svc)
| ~PartPropSvc ()
StatusCode | initialize ()
StatusCode | finalize ()

## Function Documentation

StatusCode PartPropSvc::finalize | ( |  | ) |

Definition at line 143 of file PartPropSvc.cpp.

    00143                                  {
    00144
    00145   MsgStream log( msgSvc(), name() );
    00146   StatusCode status = Service::finalize();
    00147
    00148   if ( status.isSuccess() )
    00149     log << MSG::INFO << "Service finalised successfully" << endmsg;
    00150
    00151   return status;
    00152 }

StatusCode PartPropSvc::initialize | ( |  | ) |

Definition at line 50 of file PartPropSvc.cpp.

    00050                                    {
    00051
    00052   MsgStream log( msgSvc(), name() );
    00053   std::vector<std::string>::const_iterator itr;
    00054
    00055   StatusCode status = Service::initialize();
    00056
    00057   log << MSG::INFO << "PDT file(s): " << endmsg;
    00058   for (itr=m_pdtFiles.begin(); itr!=m_pdtFiles.end(); ++itr) {
    00059     log << MSG::INFO << "    " << *itr << endmsg;
    00060   }
    00061   log << MSG::INFO << "Type:     " << m_inputType << endmsg;
    00062
    00063   if ( status.isFailure() ) {
    00064     log << MSG::ERROR << "Could not initialize main svc" << endmsg;
    00065     return StatusCode::FAILURE;
    00066   }
    00067
    00068   bool (*pF)  (std::istream &,
    00069                HepPDT::TableBuilder &);
    00070
    00071
    00072   // Determine type of input
    00073   if (m_inputType == "PDG") {
    00074     pF = &HepPDT::addPDGParticles;
    00075   } else if (m_inputType == "Pythia") {
    00076     pF = &HepPDT::addPythiaParticles;
    00077   } else if (m_inputType == "EvtGen") {
    00078     pF = &HepPDT::addEvtGenParticles;
    00079   } else if (m_inputType == "Herwig") {
    00080     pF = &HepPDT::addHerwigParticles;
    00081   } else if (m_inputType == "IsaJet") {
    00082     pF = &HepPDT::addIsajetParticles;
    00083   } else if (m_inputType == "QQ") {
    00084     pF = &HepPDT::addQQParticles;
    00085   } else {
    00086     log << MSG::ERROR << "Unknown Particle Data file type: \""
    00087         << m_inputType << "\"" << endmsg;
    00088     return StatusCode::FAILURE;
    00089   }
    00090
    00091   // Make sure we have at least one file
    00092   if (m_pdtFiles.size() == 0) {
    00093     log << MSG::ERROR << "Need at least 1 PDT file" << endmsg;
    00094     log << MSG::ERROR << "Check value of property \"InputFile\"" << endmsg;
    00095     return StatusCode::FAILURE;
    00096   }
    00097
    00098   m_pdt = new HepPDT::ParticleDataTable;
    00099
    00100   {
    00101     // Construct table builder
    00102     HepPDT::TableBuilder  tb( *m_pdt );
    00103
    00104     // read the input
    00105     int good(0);
    00106     for (itr=m_pdtFiles.begin(); itr!=m_pdtFiles.end(); ++itr) {
    00107
    00108       std::string rfile = System::PathResolver::find_file(*itr,"DATAPATH");
    00109       if (rfile == "") {
    00110         log << MSG::ERROR << "Could not find PDT file: \"" << *itr
    00111             << "\" in $DATAPATH" << endmsg;
    00112         continue;
    00113       }
    00114
    00115       std::ifstream pdfile( rfile.c_str() );
    00116       if (!pdfile) {
    00117         log << MSG::ERROR << "Could not open PDT file: \"" << rfile
    00118             << "\"" << endmsg;
    00119         continue;
    00120       }
    00121
    00122       if ( ! pF(pdfile,tb) ) {
    00123         log << MSG::ERROR << "Error reading PDT file: \"" << rfile
    00124             << "\"" << endmsg;
    00125         return StatusCode::FAILURE;
    00126       }
    00127       ++good;
    00128     }
    00129     if (0 == good) {
    00130       log << MSG::ERROR << "Unable to access any PDT file" <<endmsg;
    00131       return StatusCode::FAILURE;
    00132     }
    00133
    00134   }   // the tb destructor fills datacol
    00135
    00136
    00137
    00138   return status;
    00139 }

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

Definition at line 27 of file PartPropSvc.cpp.

    00028   : base_class( name, svc ), m_pdt(0) {
    00029
    00030   declareProperty( "InputType", m_inputType="PDG");
    00031   declareProperty( "InputFile", m_pdtFiles);
    00032
    00033   if (m_pdtFiles.empty() ) {
    00034     m_pdtFiles.push_back("PDGTABLE.MeV");
    00035   }
    00036
    00037 }

PartPropSvc::~PartPropSvc | ( |  | ) |

Definition at line 41 of file PartPropSvc.cpp.

    00041                           {
    00042   if (m_pdt != 0) {
    00043     delete m_pdt;
    00044     m_pdt = 0;
    00045   }
    00046 }