00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // $Id$ 00027 // 00028 //--------------------------------------------------------------------------- 00029 // 00030 // ClassName: G4ChargeExchangePhysics 00031 // 00032 // Author: 19 November 2008 V. Ivanchenko 00033 // 00034 // Modified: 00035 // 00036 //---------------------------------------------------------------------------- 00037 // 00038 00039 #include "G4ChargeExchangePhysics.hh" 00040 00041 #include "G4ChargeExchangeProcess.hh" 00042 #include "G4ChargeExchange.hh" 00043 00044 #include "G4ParticleDefinition.hh" 00045 #include "G4ProcessManager.hh" 00046 00047 #include "G4MesonConstructor.hh" 00048 #include "G4BaryonConstructor.hh" 00049 #include "G4Neutron.hh" 00050 00051 // factory 00052 #include "G4PhysicsConstructorFactory.hh" 00053 // 00054 G4_DECLARE_PHYSCONSTR_FACTORY(G4ChargeExchangePhysics); 00055 00056 00057 G4ChargeExchangePhysics::G4ChargeExchangePhysics(G4int ver, G4bool glauber) 00058 : G4VPhysicsConstructor("chargeExchange"), verbose(ver), glFlag(glauber), 00059 wasActivated(false) 00060 { 00061 if(verbose > 1) G4cout << "### ChargeExchangePhysics" << G4endl; 00062 model = 0; 00063 } 00064 00065 G4ChargeExchangePhysics::G4ChargeExchangePhysics(G4int ver) 00066 : G4VPhysicsConstructor("chargeExchange"), verbose(ver), glFlag(false), 00067 wasActivated(false) 00068 { 00069 if(verbose > 1) G4cout << "### ChargeExchangePhysics" << G4endl; 00070 model = 0; 00071 } 00072 00073 G4ChargeExchangePhysics::~G4ChargeExchangePhysics() 00074 { 00075 delete model; 00076 } 00077 00078 void G4ChargeExchangePhysics::ConstructParticle() 00079 { 00080 // G4cout << "G4ChargeExchangePhysics::ConstructParticle" << G4endl; 00081 G4MesonConstructor pMesonConstructor; 00082 pMesonConstructor.ConstructParticle(); 00083 00084 G4BaryonConstructor pBaryonConstructor; 00085 pBaryonConstructor.ConstructParticle(); 00086 } 00087 00088 void G4ChargeExchangePhysics::ConstructProcess() 00089 { 00090 if(wasActivated) return; 00091 wasActivated = true; 00092 00093 model = new G4ChargeExchange(); 00094 00095 if(verbose > 1) { 00096 G4cout << "### ChargeExchangePhysics Construct Processes with the model <" 00097 << model->GetModelName() << ">" << G4endl; 00098 } 00099 00100 theParticleIterator->reset(); 00101 while( (*theParticleIterator)() ) 00102 { 00103 G4ParticleDefinition* particle = theParticleIterator->value(); 00104 G4String pname = particle->GetParticleName(); 00105 if(pname == "neutron" || 00106 pname == "pi-" || 00107 pname == "pi+" || 00108 pname == "proton" 00109 ) { 00110 00111 G4ProcessManager* pmanager = particle->GetProcessManager(); 00112 G4ChargeExchangeProcess* p = new G4ChargeExchangeProcess(); 00113 p->RegisterMe(model); 00114 pmanager->AddDiscreteProcess(p); 00115 00116 if(verbose > 1) 00117 G4cout << "### ChargeExchangePhysics added for " 00118 << particle->GetParticleName() << G4endl; 00119 } 00120 } 00121 } 00122 00123