G4VModularPhysicsList Class Reference

#include <G4VModularPhysicsList.hh>

Inheritance diagram for G4VModularPhysicsList:

G4VUserPhysicsList QBBC

Public Member Functions

 G4VModularPhysicsList ()
virtual ~G4VModularPhysicsList ()
virtual void ConstructParticle ()
virtual void ConstructProcess ()
void RegisterPhysics (G4VPhysicsConstructor *)
const G4VPhysicsConstructorGetPhysics (G4int index) const
const G4VPhysicsConstructorGetPhysics (const G4String &name) const
const G4VPhysicsConstructorGetPhysicsWithType (G4int physics_type) const
void ReplacePhysics (G4VPhysicsConstructor *)
void RemovePhysics (G4VPhysicsConstructor *)
void RemovePhysics (G4int type)
void RemovePhysics (const G4String &name)
void SetVerboseLevel (G4int value)
G4int GetVerboseLevel () const

Protected Types

typedef std::vector< G4VPhysicsConstructor * > G4PhysConstVector

Protected Member Functions

 G4VModularPhysicsList (const G4VModularPhysicsList &)
G4VModularPhysicsListoperator= (const G4VModularPhysicsList &)

Protected Attributes

G4PhysConstVectorphysicsVector
G4int verboseLevel

Detailed Description

Definition at line 60 of file G4VModularPhysicsList.hh.


Member Typedef Documentation

typedef std::vector<G4VPhysicsConstructor*> G4VModularPhysicsList::G4PhysConstVector [protected]

Definition at line 114 of file G4VModularPhysicsList.hh.


Constructor & Destructor Documentation

G4VModularPhysicsList::G4VModularPhysicsList (  ) 

Definition at line 40 of file G4VModularPhysicsList.cc.

References physicsVector.

00041   : G4VUserPhysicsList(),
00042     verboseLevel(0)
00043 {
00044    physicsVector = new G4PhysConstVector();
00045 }

G4VModularPhysicsList::~G4VModularPhysicsList (  )  [virtual]

Definition at line 47 of file G4VModularPhysicsList.cc.

References physicsVector.

00048 {
00049   G4PhysConstVector::iterator itr;
00050   for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00051     delete (*itr);
00052   }
00053   physicsVector->clear();
00054   delete physicsVector;
00055 }

G4VModularPhysicsList::G4VModularPhysicsList ( const G4VModularPhysicsList  )  [protected]

Definition at line 57 of file G4VModularPhysicsList.cc.

References physicsVector.

00057                                                                                 : G4VUserPhysicsList(right),
00058     verboseLevel(0)
00059 {
00060    physicsVector = new G4PhysConstVector();
00061 }


Member Function Documentation

void G4VModularPhysicsList::ConstructParticle (  )  [virtual]

Implements G4VUserPhysicsList.

Definition at line 91 of file G4VModularPhysicsList.cc.

References physicsVector.

00092 {
00093   // create particles
00094   G4PhysConstVector::iterator itr;
00095   for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00096     (*itr)->ConstructParticle();;
00097   }
00098 }

void G4VModularPhysicsList::ConstructProcess (  )  [virtual]

Implements G4VUserPhysicsList.

Definition at line 101 of file G4VModularPhysicsList.cc.

References G4VUserPhysicsList::AddTransportation(), and physicsVector.

00102 {
00103   AddTransportation();
00104 
00105   G4PhysConstVector::iterator itr;
00106   for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00107     (*itr)->ConstructProcess();
00108   }
00109 }

const G4VPhysicsConstructor * G4VModularPhysicsList::GetPhysics ( const G4String name  )  const

Definition at line 327 of file G4VModularPhysicsList.cc.

References physicsVector.

00328 {
00329   G4PhysConstVector::iterator itr;
00330   for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00331     if ( name == (*itr)->GetPhysicsName()) break;
00332   }
00333   if (itr!= physicsVector->end()) return (*itr);
00334   else return 0;
00335 }

const G4VPhysicsConstructor * G4VModularPhysicsList::GetPhysics ( G4int  index  )  const

Definition at line 318 of file G4VModularPhysicsList.cc.

References physicsVector.

00319 {
00320   G4int i;
00321   G4PhysConstVector::iterator itr= physicsVector->begin();
00322   for (i=0; i<idx && itr!= physicsVector->end() ; ++i) ++itr;
00323   if (itr!= physicsVector->end()) return (*itr);
00324   else return 0;
00325 }

const G4VPhysicsConstructor * G4VModularPhysicsList::GetPhysicsWithType ( G4int  physics_type  )  const

Definition at line 337 of file G4VModularPhysicsList.cc.

References physicsVector.

00338 {
00339   G4PhysConstVector::iterator itr;
00340   for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00341     if ( pType == (*itr)->GetPhysicsType()) break;
00342   }
00343   if (itr!= physicsVector->end()) return (*itr);
00344   else return 0;
00345 }

G4int G4VModularPhysicsList::GetVerboseLevel (  )  const [inline]

Reimplemented from G4VUserPhysicsList.

Definition at line 122 of file G4VModularPhysicsList.hh.

References verboseLevel.

Referenced by G4PhysListFactory::GetReferencePhysList().

00123 {
00124   return  verboseLevel;
00125 }   

G4VModularPhysicsList & G4VModularPhysicsList::operator= ( const G4VModularPhysicsList  )  [protected]

Definition at line 63 of file G4VModularPhysicsList.cc.

References G4VUserPhysicsList::defaultCutValue, G4VUserPhysicsList::directoryPhysicsTable, G4VUserPhysicsList::fDisableCheckParticleList, G4VUserPhysicsList::fDisplayThreshold, G4VUserPhysicsList::fIsCheckedForRetrievePhysicsTable, G4VUserPhysicsList::fIsPhysicsTableBuilt, G4VUserPhysicsList::fIsRestoredCutValues, G4VUserPhysicsList::fRetrievePhysicsTable, G4VUserPhysicsList::fStoredInAscii, G4VUserPhysicsList::isSetDefaultCutValue, physicsVector, and verboseLevel.

00064 {
00065    if (this != &right) {
00066     defaultCutValue = right.defaultCutValue;
00067     isSetDefaultCutValue = right.isSetDefaultCutValue;
00068     fRetrievePhysicsTable = right.fRetrievePhysicsTable;
00069     fStoredInAscii = right.fStoredInAscii;
00070     fIsCheckedForRetrievePhysicsTable = right.fIsCheckedForRetrievePhysicsTable;
00071     fIsRestoredCutValues = right.fIsRestoredCutValues;
00072     directoryPhysicsTable = right.directoryPhysicsTable;
00073     fDisplayThreshold = right.fDisplayThreshold;
00074     fIsPhysicsTableBuilt = right.fIsPhysicsTableBuilt;
00075     fDisableCheckParticleList = right.fDisableCheckParticleList;
00076     verboseLevel = right.verboseLevel;
00077     
00078     if(physicsVector !=0) {
00079       G4PhysConstVector::iterator itr;
00080       for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00081         delete (*itr);
00082       }
00083       physicsVector->clear();
00084       delete physicsVector;
00085     }
00086     physicsVector = new G4PhysConstVector();
00087   }
00088   return *this;
00089 }

void G4VModularPhysicsList::RegisterPhysics ( G4VPhysicsConstructor  ) 

Definition at line 113 of file G4VModularPhysicsList.cc.

References G4cout, G4endl, G4Exception(), G4State_PreInit, G4StateManager::GetCurrentState(), G4VPhysicsConstructor::GetPhysicsName(), G4VPhysicsConstructor::GetPhysicsType(), G4StateManager::GetStateManager(), JustWarning, physicsVector, and verboseLevel.

Referenced by QBBC::QBBC().

00114 {
00115   G4StateManager*    stateManager = G4StateManager::GetStateManager();
00116   G4ApplicationState currentState = stateManager->GetCurrentState();
00117   if(!(currentState==G4State_PreInit)){
00118     G4Exception("G4VModularPhysicsList::RegisterPhysics",
00119                 "Run0201", JustWarning,
00120                 "Geant4 kernel is not PreInit state : Method ignored.");
00121     return;
00122   }
00123 
00124   G4String pName = fPhysics->GetPhysicsName();  
00125   G4int pType = fPhysics->GetPhysicsType(); 
00126   // If physics_type is equal to 0, 
00127   // following duplication check is omitted 
00128   // This is TEMPORAL treatment.
00129   if (pType == 0) {
00130     physicsVector->push_back(fPhysics);
00131 #ifdef G4VERBOSE
00132     if (verboseLevel >1){
00133       G4cout << "G4VModularPhysicsList::RegisterPhysics: "
00134              <<  pName  << "with type : " << pType 
00135              << "  is added" 
00136              << G4endl;
00137     }
00138 #endif
00139     return;
00140   }
00141    
00142   // Check if physics with the physics_type same as one of given physics 
00143   G4PhysConstVector::iterator itr;
00144   for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00145     if ( pType == (*itr)->GetPhysicsType()) break;
00146   }
00147   if (itr!= physicsVector->end()) {
00148 #ifdef G4VERBOSE
00149     if (verboseLevel >0){
00150       G4cout << "G4VModularPhysicsList::RegisterPhysics: "
00151              << "a physics with given type already exists " 
00152              << G4endl;
00153       G4cout << " Type = " << pType << " : " 
00154              << "  existing physics is " << (*itr)->GetPhysicsName()  
00155              << G4endl;
00156       G4cout << pName << " can not be registered "<<G4endl;
00157     }
00158 #endif
00159     G4String comment ="Duplicate type for ";
00160     comment += pName;
00161     G4Exception("G4VModularPhysicsList::RegisterPhysics",
00162                 "Run0202", JustWarning, comment); 
00163     return;
00164   }
00165 
00166   // register 
00167   physicsVector->push_back(fPhysics);
00168 
00169 }    

void G4VModularPhysicsList::RemovePhysics ( const G4String name  ) 

Definition at line 288 of file G4VModularPhysicsList.cc.

References G4cout, G4endl, G4Exception(), G4State_PreInit, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), JustWarning, physicsVector, and verboseLevel.

00289 {
00290   G4StateManager*    stateManager = G4StateManager::GetStateManager();
00291   G4ApplicationState currentState = stateManager->GetCurrentState();
00292   if(!(currentState==G4State_PreInit)){
00293     G4Exception("G4VModularPhysicsList::RemovePhysics",
00294                 "Run0206", JustWarning,
00295                 "Geant4 kernel is not PreInit state : Method ignored.");
00296     return;
00297   }
00298 
00299   for (G4PhysConstVector::iterator itr = physicsVector->begin(); 
00300                                      itr!= physicsVector->end();) {
00301     G4String pName = (*itr)->GetPhysicsName();  
00302     if ( name == pName) {
00303 #ifdef G4VERBOSE
00304     if (verboseLevel > 0){
00305       G4cout << "G4VModularPhysicsList::RemovePhysics: "
00306              <<  pName  << "  is removed" 
00307              << G4endl;
00308     }
00309 #endif
00310       physicsVector->erase(itr);
00311       break;
00312     } else {
00313       itr++;
00314     }
00315   }
00316 }

void G4VModularPhysicsList::RemovePhysics ( G4int  type  ) 

Definition at line 229 of file G4VModularPhysicsList.cc.

References G4cout, G4endl, G4Exception(), G4State_PreInit, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), JustWarning, physicsVector, and verboseLevel.

00230 {
00231   G4StateManager*    stateManager = G4StateManager::GetStateManager();
00232   G4ApplicationState currentState = stateManager->GetCurrentState();
00233   if(!(currentState==G4State_PreInit)){
00234     G4Exception("G4VModularPhysicsList::RemovePhysics",
00235                 "Run0204", JustWarning,
00236                 "Geant4 kernel is not PreInit state : Method ignored.");
00237     return;
00238   }
00239 
00240   for (G4PhysConstVector::iterator itr = physicsVector->begin(); 
00241                                      itr!= physicsVector->end();) {
00242     if ( pType  == (*itr)->GetPhysicsType()) {
00243       G4String pName = (*itr)->GetPhysicsName();  
00244 #ifdef G4VERBOSE
00245       if (verboseLevel > 0){
00246         G4cout << "G4VModularPhysicsList::RemovePhysics: "
00247                <<  pName  << "  is removed" 
00248                << G4endl;
00249       }
00250 #endif
00251       physicsVector->erase(itr);
00252       break;
00253     } else {
00254       itr++;
00255     }
00256   }
00257 }

void G4VModularPhysicsList::RemovePhysics ( G4VPhysicsConstructor  ) 

Definition at line 259 of file G4VModularPhysicsList.cc.

References G4cout, G4endl, G4Exception(), G4State_PreInit, G4StateManager::GetCurrentState(), G4StateManager::GetStateManager(), JustWarning, physicsVector, and verboseLevel.

00260 {
00261   G4StateManager*    stateManager = G4StateManager::GetStateManager();
00262   G4ApplicationState currentState = stateManager->GetCurrentState();
00263   if(!(currentState==G4State_PreInit)){
00264     G4Exception("G4VModularPhysicsList::RemovePhysics",
00265                 "Run0205", JustWarning,
00266                 "Geant4 kernel is not PreInit state : Method ignored.");
00267     return;
00268   }
00269 
00270   for (G4PhysConstVector::iterator itr = physicsVector->begin(); 
00271                                      itr!= physicsVector->end();) {
00272     if ( fPhysics == (*itr)) {
00273       G4String pName = (*itr)->GetPhysicsName();  
00274 #ifdef G4VERBOSE
00275     if (verboseLevel > 0 ){
00276       G4cout << "G4VModularPhysicsList::RemovePhysics: "
00277              <<  pName  << "  is removed" 
00278              << G4endl;
00279     }
00280 #endif
00281       physicsVector->erase(itr);
00282       break;
00283     } else {
00284       itr++;
00285     }
00286   }
00287 }

void G4VModularPhysicsList::ReplacePhysics ( G4VPhysicsConstructor  ) 

Definition at line 171 of file G4VModularPhysicsList.cc.

References G4cout, G4endl, G4Exception(), G4State_PreInit, G4StateManager::GetCurrentState(), G4VPhysicsConstructor::GetPhysicsName(), G4VPhysicsConstructor::GetPhysicsType(), G4StateManager::GetStateManager(), JustWarning, physicsVector, and verboseLevel.

Referenced by G4PhysListFactory::GetReferencePhysList().

00172 {
00173   G4StateManager*    stateManager = G4StateManager::GetStateManager();
00174   G4ApplicationState currentState = stateManager->GetCurrentState();
00175   if(!(currentState==G4State_PreInit)){
00176     G4Exception("G4VModularPhysicsList::ReplacePhysics",
00177                 "Run0203", JustWarning,
00178                 "Geant4 kernel is not PreInit state : Method ignored.");
00179      return;
00180   }
00181 
00182   G4String pName = fPhysics->GetPhysicsName();  
00183   G4int pType = fPhysics->GetPhysicsType(); 
00184   // If physics_type is equal to 0, 
00185   // duplication check is omitted and just added. 
00186   // This is TEMPORAL treatment.
00187   if (pType == 0) {
00188     // register 
00189     physicsVector->push_back(fPhysics);
00190 #ifdef G4VERBOSE
00191     if (verboseLevel >0){
00192       G4cout << "G4VModularPhysicsList::ReplacePhysics: "
00193              <<  pName  << "with type : " << pType 
00194              << "  is added" 
00195              << G4endl;
00196     }
00197 #endif
00198     return;
00199   }
00200 
00201   // Check if physics with the physics_type same as one of given physics 
00202   G4PhysConstVector::iterator itr= physicsVector->begin();
00203   for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00204     if ( pType == (*itr)->GetPhysicsType()) break;
00205   }
00206   if (itr == physicsVector->end()) {
00207     // register 
00208     physicsVector->push_back(fPhysics);
00209   } else {
00210 #ifdef G4VERBOSE
00211     if (verboseLevel >0){
00212       G4cout << "G4VModularPhysicsList::ReplacePhysics: "
00213              << (*itr)->GetPhysicsName()  << "with type : " << pType 
00214              << "  is replaces with " << pName
00215              << G4endl;
00216     }
00217 #endif
00218 
00219     //  delete exsiting one   
00220     delete (*itr);
00221     // replace with given one
00222     (*itr) = fPhysics;
00223 
00224   }
00225 
00226   return;  
00227 }    

void G4VModularPhysicsList::SetVerboseLevel ( G4int  value  ) 

Reimplemented from G4VUserPhysicsList.

Definition at line 348 of file G4VModularPhysicsList.cc.

References physicsVector, and verboseLevel.

Referenced by G4PhysListFactory::GetReferencePhysList(), and QBBC::QBBC().

00349 {
00350   verboseLevel = value;
00351   
00352   // Loop over constructors
00353   G4PhysConstVector::iterator itr;
00354   for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
00355     (*itr)->SetVerboseLevel(verboseLevel);
00356   }
00357 
00358 }


Field Documentation

G4PhysConstVector* G4VModularPhysicsList::physicsVector [protected]

Definition at line 115 of file G4VModularPhysicsList.hh.

Referenced by ConstructParticle(), ConstructProcess(), G4VModularPhysicsList(), GetPhysics(), GetPhysicsWithType(), operator=(), RegisterPhysics(), RemovePhysics(), ReplacePhysics(), SetVerboseLevel(), and ~G4VModularPhysicsList().

G4int G4VModularPhysicsList::verboseLevel [protected]

Reimplemented from G4VUserPhysicsList.

Definition at line 116 of file G4VModularPhysicsList.hh.

Referenced by GetVerboseLevel(), operator=(), RegisterPhysics(), RemovePhysics(), ReplacePhysics(), and SetVerboseLevel().


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:51 2013 for Geant4 by  doxygen 1.4.7