|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
This service provides access to particle properties. More...
#include <ParticlePropertySvc.h>


Public Types | |
| typedef ParticleProperty * | mapped_type |
| typedef std::map< int, mapped_type > | MapID |
| typedef std::map< std::string, mapped_type > | MapName |
| typedef std::map< int, mapped_type > | MapStdHepID |
| typedef std::map< int, mapped_type > | MapPythiaID |
| typedef IParticlePropertySvc::VectPP | VectPP |
| typedef IParticlePropertySvc::const_iterator | const_iterator |
| typedef IParticlePropertySvc::iterator | iterator |
| typedef std::set < ParticleProperty * > | Set |
Public Member Functions | |
| virtual StatusCode | initialize () |
| Initialise the service. | |
| virtual StatusCode | finalize () |
| Finalise the service. | |
| virtual StatusCode | push_back (const std::string &particle, int geantId, int jetsetId, double charge, double mass, double tlife, const std::string &evtName, int pythiaId, double maxWidth) |
| Create a new particle property. | |
| virtual StatusCode | push_back (ParticleProperty *pp) |
| Add a new particle property. | |
| virtual const_iterator | begin () const |
| Get a const reference to the begining of the container. | |
| virtual const_iterator | end () const |
| Get a const reference to the end of the container. | |
| virtual int | size () const |
| Get the container size. | |
| virtual ParticleProperty * | find (int geantId) |
| Retrieve a property by geant3 id. | |
| virtual ParticleProperty * | find (const std::string &name) |
| Retrieve a property by particle name. | |
| virtual ParticleProperty * | findByStdHepID (int stdHepId) |
| Retrieve a property by StdHep id. | |
| virtual ParticleProperty * | findByPythiaID (int pythiaID) |
| Retrieve a property by Pythia id. | |
| virtual StatusCode | erase (int geantId) |
| Erase a property by geant3 id. | |
| virtual StatusCode | erase (const std::string &name) |
| Erase a property by particle name. | |
| virtual StatusCode | eraseByStdHepID (int stdHepId) |
| Erase a property by StdHep id ??? | |
| ParticlePropertySvc (const std::string &name, ISvcLocator *svc) | |
| Standard Constructor. | |
| virtual | ~ParticlePropertySvc () |
| Destructor. | |
Protected Member Functions | |
| const ParticleProperty * | anti (const ParticleProperty *pp) const |
| helper (protected) function to find an antiparticle for the given particle ID (StdHepID) | |
| StatusCode | setAntiParticles () |
| helper (protected) function to set the valid particle<-->antiparticle relations | |
| StatusCode | rebuild () |
| rebuild "the linear container" from the map | |
| StatusCode | erase (const ParticleProperty *pp) |
| remove particle property from all maps | |
| StatusCode | parse (const std::string &file) |
| parse the file | |
| StatusCode | parse () |
| Parses the file and fill all the maps. | |
| StatusCode | addParticles () |
| bool | diff (const ParticleProperty *o, const ParticleProperty *n, const MSG::Level l=MSG::DEBUG) const |
Private Types | |
| typedef std::vector< std::string > | Files |
| typedef std::vector< std::string > | Particles |
Private Attributes | |
| std::string | m_filename |
| Filename of the particle properties file. | |
| Files | m_other |
| additional file names | |
| Particles | m_particles |
| VectPP | m_vectpp |
| Vector of all particle properties. | |
| MapID | m_idmap |
| Map for geant IDs. | |
| MapName | m_namemap |
| Map for particle names. | |
| MapStdHepID | m_stdhepidmap |
| Map for StdHep Ids. | |
| MapPythiaID | m_pythiaidmap |
| Map for Pythia Ids. | |
| Set | m_owned |
| std::set< std::string > | m_replaced |
| IFileAccess * | m_fileAccess |
This service provides access to particle properties.
The settable property of this service is the ParticlePropertiesFile, an ASCII file containing the list of properties for the particles. The default file is: "$PARAMFILESROOT/data/ParticleTable.txt" or if $PARAMFILESROOT is not defined "ParticleTable.txt"
// read additional properties ParticlePropertySvc.OtherFiles = { "$SOMELOCATION1/file1.txt" , "$SOMELOCATION2/file2.txt" } ;
2) Add possibility to modify only certain partiles through the new property "Particles" (default is enpty list), Each line is interpreted as a line in particle data table, e.g.
// redefine the properties of H_20 and H_30 particles: ParticlePropertySvc.Particles = { "H_20 88 35 0.0 120.0 9.4e-26 Higgs'0 35 0.0e+00" , "H_30 89 36 0.0 40.0 1.0e-12 A0 36 0.0e+00" } ;
The replaces/modified particles are reported.
Definition at line 75 of file ParticlePropertySvc.h.
Reimplemented from IParticlePropertySvc.
Definition at line 85 of file ParticlePropertySvc.h.
typedef std::vector<std::string> ParticlePropertySvc::Files [private] |
Definition at line 186 of file ParticlePropertySvc.h.
Reimplemented from IParticlePropertySvc.
Definition at line 86 of file ParticlePropertySvc.h.
| typedef std::map< int, mapped_type > ParticlePropertySvc::MapID |
Definition at line 80 of file ParticlePropertySvc.h.
| typedef std::map< std::string, mapped_type > ParticlePropertySvc::MapName |
Definition at line 81 of file ParticlePropertySvc.h.
Definition at line 79 of file ParticlePropertySvc.h.
| typedef std::map< int, mapped_type > ParticlePropertySvc::MapPythiaID |
Definition at line 83 of file ParticlePropertySvc.h.
| typedef std::map< int, mapped_type > ParticlePropertySvc::MapStdHepID |
Definition at line 82 of file ParticlePropertySvc.h.
typedef std::vector<std::string> ParticlePropertySvc::Particles [private] |
Definition at line 187 of file ParticlePropertySvc.h.
| typedef std::set<ParticleProperty*> ParticlePropertySvc::Set |
Definition at line 87 of file ParticlePropertySvc.h.
Reimplemented from IParticlePropertySvc.
Definition at line 84 of file ParticlePropertySvc.h.
| ParticlePropertySvc::ParticlePropertySvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) |
Standard Constructor.
| name | String with service name | |
| svc | Pointer to service locator interface |
Definition at line 47 of file ParticlePropertySvc.cpp.
00049 : base_class( name, svc ) 00050 // the default name of input data file 00051 , m_filename ( "ParticleTable.txt" ) 00052 , m_other () 00053 , m_particles () 00054 // storages : 00055 , m_vectpp () 00056 , m_idmap () 00057 , m_namemap () 00058 , m_stdhepidmap() 00059 , m_pythiaidmap() 00060 // 00061 , m_owned () 00062 , m_replaced () 00063 , m_fileAccess (0) 00064 { 00065 // Redefine the default name: 00066 if( NULL != getenv("PARAMFILESROOT") ) 00067 { 00068 m_filename = getenv( "PARAMFILESROOT" ) ; 00069 m_filename += "/data/ParticleTable.txt" ; 00070 } 00071 // 00072 declareProperty ( "ParticlePropertiesFile" , m_filename ) ; 00073 declareProperty ( "OtherFiles" , m_other ) ; 00074 declareProperty ( "Particles" , m_particles ) ; 00075 }
| ParticlePropertySvc::~ParticlePropertySvc | ( | ) | [virtual] |
Destructor.
destructor
Definition at line 79 of file ParticlePropertySvc.cpp.
00080 { 00081 for ( Set::iterator i = m_owned.begin(); i != m_owned.end() ; ++i ) 00082 { if ( 0 != *i ) { delete *i ; } } 00083 }
| StatusCode ParticlePropertySvc::addParticles | ( | ) | [protected] |
Definition at line 476 of file ParticlePropertySvc.cpp.
00477 { 00478 00479 MsgStream log ( msgSvc() , name() ) ; 00480 // loop over all "explicit" particles 00481 for ( Particles::const_iterator ip = m_particles.begin() ; 00482 m_particles.end() != ip ; ++ip ) 00483 { 00484 const std::string item = *ip ; 00485 std::istringstream input( item ) ; 00486 // get the name 00487 std::string p_name ; 00488 int p_geant ; 00489 int p_jetset ; 00490 double p_charge ; 00491 double p_mass ; 00492 double p_ltime ; 00493 std::string p_evtgen ; 00494 int p_pythia ; 00495 double p_maxwid ; 00496 if ( input 00497 >> p_name 00498 >> p_geant 00499 >> p_jetset 00500 >> p_charge 00501 >> p_mass 00502 >> p_ltime 00503 >> p_evtgen 00504 >> p_pythia 00505 >> p_maxwid ) 00506 { 00507 log << MSG::ALWAYS 00508 << " Add/Modify the particle: " 00509 << " name='" << p_name << "'" 00510 << " geant=" << p_geant 00511 << " jetset=" << p_jetset 00512 << " charge=" << p_charge 00513 << " mass=" << p_mass 00514 << " ltime=" << p_ltime 00515 << " evtgen='" << p_evtgen << "'" 00516 << " pythia=" << p_pythia 00517 << " maxwid=" << p_maxwid << endmsg ; 00518 // 00519 StatusCode sc = push_back 00520 ( p_name , 00521 p_geant , 00522 p_jetset , 00523 p_charge , 00524 p_mass * Gaudi::Units::GeV , 00525 p_ltime * Gaudi::Units::s , 00526 p_evtgen , 00527 p_pythia , 00528 p_maxwid * Gaudi::Units::GeV ) ; 00529 if ( sc.isFailure() ) { return sc ; } // RETURN 00530 } 00531 else 00532 { 00533 log << MSG::ERROR 00534 << " could not parse '" << item << "'" << endmsg ; 00535 return StatusCode::FAILURE ; // RETURN 00536 } 00537 } 00538 // 00539 return StatusCode::SUCCESS ; 00540 }
| const ParticleProperty * ParticlePropertySvc::anti | ( | const ParticleProperty * | pp | ) | const [protected] |
helper (protected) function to find an antiparticle for the given particle ID (StdHepID)
Helper (protected) function to find an antiparticle for the given particle ID (StdHepID).
| pp | pointer to particle property |
Definition at line 412 of file ParticlePropertySvc.cpp.
00413 { 00414 if ( 0 == pp ) { return 0 ; } 00415 const int ID = pp->pdgID() ; 00416 const int antiID = -1 * ID ; 00417 for ( const_iterator it = m_vectpp.begin() ; m_vectpp.end() != it ; ++it ) 00418 { 00419 const ParticleProperty* ap = *it ; 00420 if ( 0 == ap ) { continue ; } // CONTINUE 00421 if ( antiID == ap->pdgID() ) { return ap ; } // RETURN 00422 }; 00423 // 00424 return pp ; // RETURN 00425 }
| virtual const_iterator ParticlePropertySvc::begin | ( | ) | const [inline, virtual] |
Get a const reference to the begining of the container.
Implements IParticlePropertySvc.
Definition at line 123 of file ParticlePropertySvc.h.
| bool ParticlePropertySvc::diff | ( | const ParticleProperty * | o, | |
| const ParticleProperty * | n, | |||
| const MSG::Level | l = MSG::DEBUG | |||
| ) | const [protected] |
Definition at line 549 of file ParticlePropertySvc.cpp.
00552 { 00553 // 00554 if ( o == n ) { return false ; } 00555 // 00556 MsgStream log ( msgSvc() , name() ) ; 00557 log << l ; 00558 if ( 0 == o || 0 == n ) 00559 { 00560 log << MSG::WARNING << " ParticleProperty* point to NULL" << endmsg ; 00561 return true ; // RETURN 00562 } 00563 // 00564 bool result = false ; 00565 if ( o -> particle () != n -> particle () ) 00566 { 00567 result = true ; 00568 log << " Name:'" << o -> particle () << "'/'" << n -> particle () << "'" ; 00569 } 00570 if ( o -> geantID () != n -> geantID () ) 00571 { 00572 result = true ; 00573 log << " G3ID:" << o -> geantID () << "/" << n -> geantID () << "'" ; 00574 } 00575 if ( o -> pdgID () != n -> pdgID () ) 00576 { 00577 result = true ; 00578 log << " PDGID:" << o -> pdgID () << "/" << n -> pdgID () << "'" ; 00579 } 00580 if ( o -> pythiaID () != n -> pythiaID () ) 00581 { 00582 result = true ; 00583 log << " PYID:" << o -> pythiaID () << "/" << n -> pythiaID () << "'" ; 00584 } 00585 if ( o -> charge () != n -> charge () ) 00586 { 00587 result = true ; 00588 log << " Q:" << o -> charge () << "/" << n -> charge () << "'" ; 00589 } 00590 if ( o -> mass () != n -> mass () ) 00591 { 00592 result = true ; 00593 log << " M:" << o -> mass () << "/" << n -> mass () << "'" ; 00594 } 00595 if ( o -> lifetime () != n -> lifetime () ) 00596 { 00597 result = true ; 00598 log << " T:" << o -> lifetime () << "/" << n -> lifetime () << "'" ; 00599 } 00600 if ( o -> evtGenName () != n -> evtGenName () ) 00601 { 00602 result = true ; 00603 log << " EvtGen:" << o -> evtGenName () << "/" << n -> evtGenName () << "'" ; 00604 } 00605 if ( o -> maxWidth () != n -> maxWidth () ) 00606 { 00607 result = true ; 00608 log << " WMAX:" << o -> maxWidth () << "/" << n -> maxWidth () << "'" ; 00609 } 00610 if ( result ) { log << endmsg ; } 00611 // 00612 return result ; 00613 }
| virtual const_iterator ParticlePropertySvc::end | ( | ) | const [inline, virtual] |
Get a const reference to the end of the container.
Implements IParticlePropertySvc.
Definition at line 125 of file ParticlePropertySvc.h.
| StatusCode ParticlePropertySvc::erase | ( | const ParticleProperty * | pp | ) | [protected] |
remove particle property from all maps
Definition at line 288 of file ParticlePropertySvc.cpp.
00289 { 00290 if ( 0 == pp ) { return StatusCode::FAILURE ; } 00291 00292 _remove_ ( m_idmap , pp ) ; 00293 _remove_ ( m_namemap , pp ) ; 00294 _remove_ ( m_stdhepidmap , pp ) ; 00295 _remove_ ( m_pythiaidmap , pp ) ; 00296 // 00297 return rebuild() ; 00298 }
| virtual StatusCode ParticlePropertySvc::erase | ( | const std::string & | name | ) | [inline, virtual] |
Erase a property by particle name.
Implements IParticlePropertySvc.
Definition at line 144 of file ParticlePropertySvc.h.
| virtual StatusCode ParticlePropertySvc::erase | ( | int | geantId | ) | [inline, virtual] |
Erase a property by geant3 id.
Implements IParticlePropertySvc.
Definition at line 141 of file ParticlePropertySvc.h.
| virtual StatusCode ParticlePropertySvc::eraseByStdHepID | ( | int | stdHepId | ) | [inline, virtual] |
Erase a property by StdHep id ???
Implements IParticlePropertySvc.
Definition at line 147 of file ParticlePropertySvc.h.
00148 { return erase( findByStdHepID ( stdHepId ) ) ; }
| StatusCode ParticlePropertySvc::finalize | ( | ) | [virtual] |
Finalise the service.
finalize
finalize the base class
Reimplemented from Service.
Definition at line 153 of file ParticlePropertySvc.cpp.
00154 { 00155 if ( !m_other.empty() ) 00156 { 00157 MsgStream log( msgSvc() , name() ) ; 00158 log << MSG::INFO 00159 << "Additional Properties have been read from files: " 00160 << Gaudi::Utils::toString ( m_other ) 00161 << endmsg ; 00162 } 00163 00164 if ( !m_replaced.empty() ) 00165 { 00166 MsgStream log( msgSvc() , name() ) ; 00167 log << MSG::ALWAYS 00168 << "Properties have been redefined for " 00169 << m_replaced.size() << " particles : " 00170 << Gaudi::Utils::toString( m_replaced ) 00171 << endmsg ; 00172 } 00173 00174 if (m_fileAccess) { 00175 m_fileAccess->release(); 00176 m_fileAccess = 0; 00177 } 00178 00180 return Service::finalize () ; 00181 }
| virtual ParticleProperty* ParticlePropertySvc::find | ( | const std::string & | name | ) | [inline, virtual] |
Retrieve a property by particle name.
Implements IParticlePropertySvc.
Definition at line 132 of file ParticlePropertySvc.h.
| virtual ParticleProperty* ParticlePropertySvc::find | ( | int | geantId | ) | [inline, virtual] |
Retrieve a property by geant3 id.
Implements IParticlePropertySvc.
Definition at line 129 of file ParticlePropertySvc.h.
00130 { return m_idmap[ geantId ] ; }
| virtual ParticleProperty* ParticlePropertySvc::findByPythiaID | ( | int | pythiaID | ) | [inline, virtual] |
Retrieve a property by Pythia id.
Implements IParticlePropertySvc.
Definition at line 138 of file ParticlePropertySvc.h.
00139 { return m_pythiaidmap[ pythiaID ]; }
| virtual ParticleProperty* ParticlePropertySvc::findByStdHepID | ( | int | stdHepId | ) | [inline, virtual] |
Retrieve a property by StdHep id.
Implements IParticlePropertySvc.
Definition at line 135 of file ParticlePropertySvc.h.
00136 { return m_stdhepidmap[ stdHepId ] ; }
| StatusCode ParticlePropertySvc::initialize | ( | ) | [virtual] |
Initialise the service.
initialize the service and setProperties
Reimplemented from Service.
Definition at line 87 of file ParticlePropertySvc.cpp.
00088 { 00089 StatusCode sc = Service::initialize(); 00090 if ( sc.isFailure() ) { return sc ; } 00091 00092 MsgStream log( msgSvc() , name() ) ; 00093 00094 sc = setProperties(); 00095 if ( sc.isFailure() ) 00096 { 00097 log << MSG::ERROR << " Could not set the properties " << endmsg ; 00098 return sc ; 00099 } 00100 00101 00102 sc = service("VFSSvc",m_fileAccess); 00103 if ( sc.isFailure() ) 00104 { 00105 log << MSG::ERROR << " Cannot retrieve the VFS service " << endmsg ; 00106 return sc ; 00107 } 00108 00109 sc = parse(); 00110 if ( sc.isFailure() ) 00111 { 00112 log << MSG::ERROR << " Could not parse the file " << endmsg ; 00113 return sc ; 00114 } 00115 if ( !m_particles.empty() ) 00116 { 00117 sc = addParticles () ; 00118 if ( sc.isFailure() ) 00119 { 00120 log << MSG::ERROR << " Could not treat particles! " << endmsg ; 00121 return sc ; 00122 } 00123 } 00124 log << MSG::DEBUG << "ParticleProperties parsed successfully" << endmsg; 00125 00126 log << MSG::DEBUG << "Access properties" << endmsg; 00127 // For debugging purposes print out the size of the internal maps 00128 // particle name as key: all particles in database are present here 00129 log << MSG::DEBUG << "NameMap size =" << m_namemap.size() << endmsg; 00130 // Geant3 ID as key: all particles in database are present here 00131 log << MSG::DEBUG << "GeantID Map size =" << m_idmap.size() << endmsg; 00132 // StdHep ID as key: some particles have no valid StdHep ID 00133 log << MSG::DEBUG << "StdHepID Map size =" << m_stdhepidmap.size() 00134 << endmsg; 00135 // Pythia ID as key: some particles are not defined in Pythia 00136 log << MSG::DEBUG << "PythiaID Map size =" << m_pythiaidmap.size() 00137 << endmsg; 00138 00139 if ( !m_replaced.empty() ) 00140 { 00141 log << MSG::INFO 00142 << "Properties have been redefined for " 00143 << m_replaced.size() << " particles : " 00144 << Gaudi::Utils::toString( m_replaced ) 00145 << endmsg ; 00146 } 00147 00148 return StatusCode::SUCCESS ; 00149 }
| StatusCode ParticlePropertySvc::parse | ( | ) | [protected] |
Parses the file and fill all the maps.
Definition at line 302 of file ParticlePropertySvc.cpp.
00303 { 00304 00305 // parse "the main" file 00306 StatusCode sc = parse ( m_filename ) ; 00307 if ( sc.isFailure() ) { return sc ; } 00308 00309 // parse "other" files 00310 for ( Files::const_iterator file = m_other.begin() ; 00311 m_other.end() != file ; ++file ) 00312 { 00313 sc = parse ( *file ) ; 00314 if ( sc.isFailure() ) { return sc ; } 00315 } 00316 00317 // Now check that the file format was consistent with what parser 00318 // expected 00319 if ( m_namemap.size() == 0 ) 00320 { 00321 MsgStream log( msgSvc(), name() ); 00322 log << MSG::ERROR 00323 << "Format of input file inconsistent with what expected" 00324 << " - Check you are using ParticleData.txt" << endmsg; 00325 return StatusCode::FAILURE; 00326 } 00327 00328 return sc; 00329 }
| StatusCode ParticlePropertySvc::parse | ( | const std::string & | file | ) | [protected] |
parse the file
Definition at line 331 of file ParticlePropertySvc.cpp.
00332 { 00333 StatusCode sc = StatusCode::FAILURE; 00334 00335 MsgStream log( msgSvc(), name() ); 00336 char line[ 255 ]; 00337 00338 std::auto_ptr<std::istream> infileptr; 00339 if (m_fileAccess) infileptr = m_fileAccess->open(file); 00340 00341 if ( infileptr.get() == 0 ) 00342 { 00343 log << MSG::ERROR << "Unable to open properties file : " << file 00344 << endmsg; 00345 return StatusCode::FAILURE ; 00346 } 00347 00348 std::istream &infile = *infileptr; 00349 sc = StatusCode::SUCCESS; 00350 log << MSG::INFO 00351 << "Opened particle properties file : " << file << endmsg; 00352 00353 while( infile ) 00354 { 00355 // parse each line of the file (comment lines begin with # in the cdf 00356 // file, 00357 infile.getline( line, 255 ); 00358 00359 if ( line[0] == '#' ) continue; 00360 00361 std::string par, gid, jid, chg, mas, lif, evt, pyt, mwi ; 00362 char* token = strtok( line, " " ); 00363 if ( token ) { par = token; token = strtok( NULL, " " );} else continue; 00364 if ( token ) { gid = token; token = strtok( NULL, " " );} else continue; 00365 if ( token ) { jid = token; token = strtok( NULL, " " );} else continue; 00366 if ( token ) { chg = token; token = strtok( NULL, " " );} else continue; 00367 if ( token ) { mas = token; token = strtok( NULL, " " );} else continue; 00368 if ( token ) { lif = token; token = strtok( NULL, " " );} else continue; 00369 if ( token ) { evt = token; token = strtok( NULL, " " );} else continue; 00370 if ( token ) { pyt = token; token = strtok( NULL, " " );} else continue; 00371 if ( token ) { mwi = token; token = strtok( NULL, " " );} else continue; 00372 if ( token != NULL ) continue; 00373 00374 // In SICb cdf file mass and lifetime units are GeV and sec, specify it so 00375 // that they are converted to Gaudi units (MeV and ns) 00376 double mass = atof( mas.c_str() ) * Gaudi::Units::GeV; 00377 double tlife = atof( lif.c_str() ) * Gaudi::Units::s; 00378 long ljid = atoi( jid.c_str() ); 00379 long lgid = atoi( gid.c_str() ); 00380 long lpyt = atoi( pyt.c_str() ) ; 00381 double mW = atof( mwi.c_str() ) * Gaudi::Units::GeV ; 00382 00383 // Change the particles that do not corresopond to a pdg number 00384 if ( ljid == 0 ) { 00385 ljid = 10000000*lgid; 00386 } 00387 00388 // add a particle property 00389 sc = push_back( par, lgid, ljid, 00390 atof( chg.c_str() ), mass, tlife, evt, lpyt, mW ) ; 00391 if ( sc.isFailure() ) 00392 { 00393 log << MSG::ERROR 00394 << "Error from ParticlePropertySvc::push_back for particle='" 00395 << par << "'" << endmsg ; 00396 } 00397 00398 } 00399 00400 //infile.close(); 00401 00402 return StatusCode::SUCCESS ; 00403 }
| StatusCode ParticlePropertySvc::push_back | ( | ParticleProperty * | pp | ) | [virtual] |
Add a new particle property.
Add a particle property.
| pp,a | particle property class. |
Implements IParticlePropertySvc.
Definition at line 208 of file ParticlePropertySvc.cpp.
00209 { 00210 if ( 0 == pp ) { return StatusCode::FAILURE ; } 00211 // 00212 { // try to add into Geant(3)ID map 00213 const int ID = pp->geantID() ; 00214 // is this already in the map? 00215 MapID::const_iterator ifind = m_idmap.find( ID ) ; 00216 if ( m_idmap.end() != ifind && 0 != m_idmap[ ID ]) 00217 { 00218 diff ( ifind->second , pp ) ; 00219 m_replaced.insert( m_idmap[ ID ]->particle() ) ; 00220 } 00221 // put it into the map 00222 m_idmap[ ID ] = pp ; 00223 } 00224 // 00225 { // try to add into Name map 00226 const std::string& particle = pp->particle() ; 00227 // is this already in the map? 00228 MapName::const_iterator ifind = m_namemap.find( particle ) ; 00229 if ( m_namemap.end() != ifind && 0 != m_namemap[ particle ] ) 00230 { 00231 diff ( ifind->second , pp ) ; 00232 m_replaced.insert( m_namemap[ particle ]->particle() ) ; 00233 } 00234 // put it into the map 00235 m_namemap[ particle ] = pp ; 00236 } 00237 // 00238 // add to StdHep map only if StdHep ID different from zero and if 00239 // not Cerenkov (StdHep ID = gamma) 00240 if ( 0 != pp->jetsetID() && "Tcherenkov" != pp->particle() ) 00241 { // try to add into StdHepID map 00242 const int ID = pp->jetsetID() ; 00243 // is this already in the map? 00244 MapStdHepID::const_iterator ifind = m_stdhepidmap.find( ID ) ; 00245 if ( m_stdhepidmap.end() != ifind && 0 != m_stdhepidmap[ ID ]) 00246 { 00247 diff ( ifind->second , pp ) ; 00248 m_replaced.insert( m_stdhepidmap[ ID ]->particle() ) ; 00249 } 00250 // put it into the map 00251 m_stdhepidmap[ ID ] = pp ; 00252 } 00253 // 00254 // add to Pythia map only if Pythia ID is different from 00255 // zero ( StdHep id is always different from zero in this case ) 00256 if ( 0 != pp->pythiaID() && 00257 0 != pp->jetsetID() && 00258 "Tcherenkov" != pp->particle() ) 00259 { // try to add into PythiaID map 00260 const int ID = pp->pythiaID() ; 00261 // is this already in the map? 00262 MapPythiaID::const_iterator ifind = m_pythiaidmap.find( ID ) ; 00263 if ( m_pythiaidmap.end() != ifind && 0 != m_pythiaidmap[ ID ]) 00264 { 00265 diff ( ifind->second , pp ) ; 00266 m_replaced.insert( m_pythiaidmap[ ID ]->particle() ) ; 00267 } 00268 // put it into the map 00269 m_pythiaidmap[ ID ] = pp ; 00270 } 00271 // 00272 return rebuild() ; 00273 }
| StatusCode ParticlePropertySvc::push_back | ( | const std::string & | particle, | |
| int | geantId, | |||
| int | jetsetId, | |||
| double | charge, | |||
| double | mass, | |||
| double | tlife, | |||
| const std::string & | evtName, | |||
| int | pythiaId, | |||
| double | maxWidth | |||
| ) | [virtual] |
Create a new particle property.
Create a particle property and insert it in the maps.
| geantId | Geant3 ID of the particle. | |
| jetsetId | Jetset ID of the particle. | |
| charge | Particle charge (/e). | |
| mass | Particle mass (GeV). | |
| tlife | Particle lifetime (s). | |
| evtName | String name of the particle in EvtGen. | |
| pythiaId | Pythia ID of the particle. |
Implements IParticlePropertySvc.
Definition at line 186 of file ParticlePropertySvc.cpp.
00195 { 00196 ParticleProperty* pp = new ParticleProperty 00197 ( particle , geantId , jetsetId , 00198 charge , mass , tlife , 00199 evtName , pythiaId , maxWidth ) ; 00200 // 00201 m_owned.insert ( pp ) ; 00202 // 00203 return push_back( pp ); 00204 }
| StatusCode ParticlePropertySvc::rebuild | ( | ) | [protected] |
rebuild "the linear container" from the map
Definition at line 458 of file ParticlePropertySvc.cpp.
00459 { 00460 Set local ; 00461 m_vectpp.clear() ; 00462 m_vectpp.reserve ( m_idmap.size() + 100 ) ; 00463 // load information from maps into the set 00464 _load_ ( m_idmap , local ) ; 00465 _load_ ( m_namemap , local ) ; 00466 _load_ ( m_stdhepidmap , local ) ; 00467 _load_ ( m_pythiaidmap , local ) ; 00468 // load information from set to the linear container vector 00469 for ( Set::iterator i = local.begin() ; local.end() != i ; ++i ) 00470 { m_vectpp.push_back ( *i ) ; } 00471 return setAntiParticles() ; 00472 }
| StatusCode ParticlePropertySvc::setAntiParticles | ( | ) | [protected] |
helper (protected) function to set the valid particle<-->antiparticle relations
helper (protected) function to set the valid particle<-->antiparticle relations status code
Definition at line 432 of file ParticlePropertySvc.cpp.
00433 { 00434 // initialize particle<-->antiParticle relations 00435 for ( iterator ip = m_vectpp.begin() ; m_vectpp.end() != ip ; ++ip ) 00436 { 00437 ParticleProperty* pp = *ip ; 00438 if ( 0 == pp ) { continue ; } // CONTINUE 00439 const ParticleProperty* ap = anti ( pp ) ; 00440 if ( 0 != ap ) { pp->setAntiParticle( ap ) ; } 00441 } 00442 return StatusCode::SUCCESS ; 00443 }
| virtual int ParticlePropertySvc::size | ( | ) | const [inline, virtual] |
Get the container size.
Implements IParticlePropertySvc.
Definition at line 127 of file ParticlePropertySvc.h.
IFileAccess* ParticlePropertySvc::m_fileAccess [private] |
Definition at line 204 of file ParticlePropertySvc.h.
std::string ParticlePropertySvc::m_filename [private] |
Filename of the particle properties file.
Definition at line 189 of file ParticlePropertySvc.h.
MapID ParticlePropertySvc::m_idmap [private] |
Map for geant IDs.
Definition at line 195 of file ParticlePropertySvc.h.
MapName ParticlePropertySvc::m_namemap [private] |
Map for particle names.
Definition at line 196 of file ParticlePropertySvc.h.
Files ParticlePropertySvc::m_other [private] |
additional file names
Definition at line 190 of file ParticlePropertySvc.h.
Set ParticlePropertySvc::m_owned [private] |
Definition at line 201 of file ParticlePropertySvc.h.
Particles ParticlePropertySvc::m_particles [private] |
Definition at line 192 of file ParticlePropertySvc.h.
Map for Pythia Ids.
Definition at line 198 of file ParticlePropertySvc.h.
std::set<std::string> ParticlePropertySvc::m_replaced [private] |
Definition at line 202 of file ParticlePropertySvc.h.
Map for StdHep Ids.
Definition at line 197 of file ParticlePropertySvc.h.
VectPP ParticlePropertySvc::m_vectpp [private] |
Vector of all particle properties.
Definition at line 194 of file ParticlePropertySvc.h.