Geant4 Cross Reference |
1 /* 1 /* 2 # <<BEGIN-copyright>> 2 # <<BEGIN-copyright>> 3 # <<END-copyright>> 3 # <<END-copyright>> 4 */ 4 */ 5 5 6 #include <iostream> 6 #include <iostream> 7 #include <stdlib.h> 7 #include <stdlib.h> 8 8 9 #include "GIDI_settings.hh" 9 #include "GIDI_settings.hh" 10 10 11 /* 11 /* 12 ============================================== 12 ========================================================= 13 */ 13 */ 14 /** 14 /** 15 This is the top settings class used when a 15 This is the top settings class used when a GND file is read. 16 */ 16 */ 17 GIDI_settings::GIDI_settings( ) { 17 GIDI_settings::GIDI_settings( ) { 18 18 19 } 19 } 20 /* 20 /* 21 ============================================== 21 ========================================================= 22 */ 22 */ 23 GIDI_settings::~GIDI_settings( ) { 23 GIDI_settings::~GIDI_settings( ) { 24 24 25 } 25 } 26 /* 26 /* 27 ============================================== 27 ========================================================= 28 */ 28 */ 29 int GIDI_settings::addParticle( GIDI_settings_ 29 int GIDI_settings::addParticle( GIDI_settings_particle const &particle ) { 30 30 31 int PoPId = particle.getPoPId( ); 31 int PoPId = particle.getPoPId( ); 32 32 33 if( mParticles.find( PoPId ) != mParticles 33 if( mParticles.find( PoPId ) != mParticles.end( ) ) return( 1 ); 34 mParticles.insert( std::pair<int, GIDI_set 34 mParticles.insert( std::pair<int, GIDI_settings_particle>( PoPId, GIDI_settings_particle( particle ) ) ); 35 return( 0 ); 35 return( 0 ); 36 } 36 } 37 /* 37 /* 38 ============================================== 38 ========================================================= 39 */ 39 */ 40 GIDI_settings_particle const *GIDI_settings::g 40 GIDI_settings_particle const *GIDI_settings::getParticle( int PoPId ) const { 41 41 42 std::map<int, GIDI_settings_particle>::con 42 std::map<int, GIDI_settings_particle>::const_iterator particle = mParticles.find( PoPId ); 43 43 44 if( particle == mParticles.end( ) ) return 44 if( particle == mParticles.end( ) ) return( NULL ); 45 return( &(particle->second) ); 45 return( &(particle->second) ); 46 } 46 } 47 /* 47 /* 48 ============================================== 48 ========================================================= 49 */ 49 */ 50 int GIDI_settings::eraseParticle( int PoPId ) 50 int GIDI_settings::eraseParticle( int PoPId ) { 51 51 52 std::map<int, GIDI_settings_particle>::ite 52 std::map<int, GIDI_settings_particle>::iterator particle = mParticles.find( PoPId ); 53 53 54 if( particle == mParticles.end( ) ) return 54 if( particle == mParticles.end( ) ) return( 1 ); 55 mParticles.erase( PoPId ); 55 mParticles.erase( PoPId ); 56 return( 0 ); 56 return( 0 ); 57 } 57 } 58 58