Changeset 1007 for trunk/source/processes/hadronic/models/management/src
- Timestamp:
- Apr 20, 2009, 5:54:05 PM (15 years ago)
- Location:
- trunk/source/processes/hadronic/models/management/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/processes/hadronic/models/management/src/G4HadronicInteraction.cc
r962 r1007 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4HadronicInteraction.cc,v 1.4 2009/01/24 11:56:27 vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $28 26 // 29 // Hadronic Interaction base class 30 // original by H.P. Wellisch 31 // modified by J.L. Chuma, TRIUMF, 21-Mar-1997 32 // Last modified: 04-Apr-1997 33 // reimplemented 1.11.2003 JPW. 34 // 23-Jan-2009 V.Ivanchenko move constructor and destructor to the body 35 27 // Hadronic Interaction base class 28 // original by H.P. Wellisch 29 // modified by J.L. Chuma, TRIUMF, 21-Mar-1997 30 // Last modified: 04-Apr-1997 31 // reimplemented 1.11.2003 JPW. 32 36 33 #include "G4HadronicInteraction.hh" 37 #include "G4HadronicInteractionRegistry.hh" 38 #include "G4HadronicException.hh" 39 40 G4HadronicInteraction::G4HadronicInteraction(const G4String& modelName) : 41 verboseLevel(0), theMinEnergy(0.0*GeV), theMaxEnergy(25.0*GeV), 42 isBlocked(false), theModelName(modelName) 43 { 44 G4HadronicInteractionRegistry::Instance()->RegisterMe(this); 45 } 46 47 G4HadronicInteraction::~G4HadronicInteraction() 48 { 49 G4HadronicInteractionRegistry::Instance()->RemoveMe(this); 50 } 51 52 G4double G4HadronicInteraction::GetMinEnergy( 34 35 G4double 36 G4HadronicInteraction::GetMinEnergy( 53 37 const G4Material *aMaterial, const G4Element *anElement ) const 54 { 55 size_t i; 56 if( IsBlocked(aMaterial) )return 0.*GeV; 57 if( IsBlocked(anElement) )return 0.*GeV; 58 for( i=0; i<theMinEnergyListElements.size(); ++i ) 59 { 60 if( anElement == theMinEnergyListElements[i].second ) 61 return theMinEnergyListElements[i].first; 38 { 39 size_t i; 40 if( IsBlocked(aMaterial) )return 0.*GeV; 41 if( IsBlocked(anElement) )return 0.*GeV; 42 for( i=0; i<theMinEnergyListElements.size(); ++i ) 43 { 44 if( anElement == theMinEnergyListElements[i].second )return theMinEnergyListElements[i].first; 62 45 } 63 46 for( i=0; i<theMinEnergyList.size(); ++i ) 64 47 { 65 if( aMaterial == theMinEnergyList[i].second ) 66 return theMinEnergyList[i].first; 48 if( aMaterial == theMinEnergyList[i].second )return theMinEnergyList[i].first; 67 49 } 68 50 if(IsBlocked()) return 0.*GeV; … … 72 54 << " not found in min energy List" << G4endl; 73 55 return theMinEnergy; 74 } 75 76 void G4HadronicInteraction::SetMinEnergy(G4double anEnergy, 77 G4Element *anElement ) 78 { 79 if( IsBlocked(anElement) ) 80 G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl 56 } 57 58 void 59 G4HadronicInteraction::SetMinEnergy( 60 G4double anEnergy, 61 G4Element *anElement ) 62 { 63 if( IsBlocked(anElement) ) 64 G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl 81 65 << " The model is not active for the Element " 82 66 << anElement->GetName() << "." << G4endl; 83 67 84 for( size_t i=0; i<theMinEnergyListElements.size(); ++i )68 for( size_t i=0; i<theMinEnergyListElements.size(); ++i ) 85 69 { 86 70 if( anElement == theMinEnergyListElements[i].second ) … … 90 74 } 91 75 } 92 theMinEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement)); 93 } 94 95 void G4HadronicInteraction::SetMinEnergy(G4double anEnergy, 96 G4Material *aMaterial ) 97 { 98 if( IsBlocked(aMaterial) ) 99 G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl 76 theMinEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement)); 77 } 78 79 void 80 G4HadronicInteraction::SetMinEnergy( 81 G4double anEnergy, 82 G4Material *aMaterial ) 83 { 84 if( IsBlocked(aMaterial) ) 85 G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl 100 86 << " The model is not active for the Material " 101 87 << aMaterial->GetName() << "." << G4endl; 102 88 103 for( size_t i=0; i<theMinEnergyList.size(); ++i )89 for( size_t i=0; i<theMinEnergyList.size(); ++i ) 104 90 { 105 91 if( aMaterial == theMinEnergyList[i].second ) 106 107 108 109 110 } 111 theMinEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial));112 }113 114 G4double G4HadronicInteraction::GetMaxEnergy(const G4Material *aMaterial, 115 const G4Element *anElement ) const 116 { 117 size_t i;118 if( IsBlocked(aMaterial) )return 0.0*GeV;119 if( IsBlocked(anElement) )return 0.0*GeV;120 for( i=0; i<theMaxEnergyListElements.size(); ++i )121 {122 if( anElement == theMaxEnergyListElements[i].second )123 92 { 93 theMinEnergyList[i].first = anEnergy; 94 return; 95 } 96 } 97 theMinEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial)); 98 } 99 100 G4double 101 G4HadronicInteraction::GetMaxEnergy( 102 const G4Material *aMaterial, const G4Element *anElement ) const 103 { 104 size_t i; 105 if( IsBlocked(aMaterial) )return 0.0*GeV; 106 if( IsBlocked(anElement) )return 0.0*GeV; 107 for( i=0; i<theMaxEnergyListElements.size(); ++i ) 108 { 109 if( anElement == theMaxEnergyListElements[i].second )return theMaxEnergyListElements[i].first; 124 110 } 125 111 for( i=0; i<theMaxEnergyList.size(); ++i ) 126 112 { 127 if( aMaterial == theMaxEnergyList[i].second ) 128 return theMaxEnergyList[i].first; 113 if( aMaterial == theMaxEnergyList[i].second )return theMaxEnergyList[i].first; 129 114 } 130 115 if(IsBlocked()) return 0.*GeV; 131 116 if( verboseLevel > 0 ) 132 117 G4cout << "*** Warning from HadronicInteraction::GetMaxEnergy" << G4endl 133 134 118 << " material " << aMaterial->GetName() 119 << " not found in min energy List" << G4endl; 135 120 136 121 return theMaxEnergy; 137 } 138 139 void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy, 140 G4Element *anElement ) 141 { 142 if( IsBlocked(anElement) ) 143 G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl 122 } 123 124 void 125 G4HadronicInteraction::SetMaxEnergy( 126 G4double anEnergy, 127 G4Element *anElement ) 128 { 129 if( IsBlocked(anElement) ) 130 G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl 144 131 << "Warning: The model is not active for the Element " 145 132 << anElement->GetName() << "." << G4endl; 146 133 147 for( size_t i=0; i<theMaxEnergyListElements.size(); ++i )134 for( size_t i=0; i<theMaxEnergyListElements.size(); ++i ) 148 135 { 149 136 if( anElement == theMaxEnergyListElements[i].second ) … … 153 140 } 154 141 } 155 theMaxEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement)); 156 } 157 158 void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy, 159 G4Material *aMaterial ) 160 { 161 if( IsBlocked(aMaterial) ) 162 G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl 142 theMaxEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement)); 143 } 144 145 void 146 G4HadronicInteraction::SetMaxEnergy( 147 G4double anEnergy, 148 G4Material *aMaterial ) 149 { 150 if( IsBlocked(aMaterial) ) 151 G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl 163 152 << "Warning: The model is not active for the Material " 164 153 << aMaterial->GetName() << "." << G4endl; 165 154 166 for( size_t i=0; i<theMaxEnergyList.size(); ++i )155 for( size_t i=0; i<theMaxEnergyList.size(); ++i ) 167 156 { 168 157 if( aMaterial == theMaxEnergyList[i].second ) 169 158 { 170 159 theMaxEnergyList[i].first = anEnergy; 171 160 return; 172 } 173 } 174 theMaxEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial)); 175 } 176 177 void G4HadronicInteraction::DeActivateFor( G4Material *aMaterial ) 178 { 179 theBlockedList.push_back(aMaterial); 180 } 181 182 void G4HadronicInteraction::DeActivateFor( G4Element *anElement ) 183 { 184 theBlockedListElements.push_back(anElement); 185 } 186 187 G4bool G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const 188 { 189 for( size_t i=0; i<theBlockedList.size(); ++i ) 161 } 162 } 163 theMaxEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial)); 164 } 165 166 void 167 G4HadronicInteraction::DeActivateFor( G4Material *aMaterial ) 168 { 169 theBlockedList.push_back(aMaterial); 170 } 171 172 void 173 G4HadronicInteraction::DeActivateFor( G4Element *anElement ) 174 { 175 theBlockedListElements.push_back(anElement); 176 } 177 178 G4bool 179 G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const 180 { 181 for( size_t i=0; i<theBlockedList.size(); ++i ) 190 182 { 191 183 if( aMaterial == theBlockedList[i] ) 192 { 193 return true; 194 } 195 } 196 return false; 197 } 198 199 G4bool G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const 200 { 201 for( size_t i=0; i<theBlockedListElements.size(); ++i ) 184 { 185 return true; 186 } 187 } 188 return false; 189 } 190 191 G4bool 192 G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const 193 { 194 for( size_t i=0; i<theBlockedListElements.size(); ++i ) 202 195 { 203 196 if( anElement == theBlockedListElements[i] ) 204 { 205 return true; 206 } 207 } 208 return false; 209 } 210 211 G4HadronicInteraction::G4HadronicInteraction(const G4HadronicInteraction &right ) 212 { 213 *this = right; 214 } 215 216 const G4HadronicInteraction& 217 G4HadronicInteraction::operator=(const G4HadronicInteraction &right ) 218 { 219 G4String text = "unintended use of G4HadronicInteraction::operator="; 220 throw G4HadronicException(__FILE__, __LINE__, text); 221 return right; 222 } 223 224 /* end of file */ 225 197 { 198 return true; 199 } 200 } 201 return false; 202 } 203 204 /* end of file */ 205 -
trunk/source/processes/hadronic/models/management/src/G4HadronicInteractionRegistry.cc
r962 r1007 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4HadronicInteractionRegistry.cc,v 1.7 2009/02/25 16:30:18 vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $28 //29 // 23-Jan-2009 V.Ivanchenko make the class to be a singleton30 31 26 #include "G4HadronicInteractionRegistry.hh" 32 27 #include "G4HadronicInteraction.hh" 33 28 34 G4HadronicInteractionRegistry* G4HadronicInteractionRegistry::theInstance = 0; 35 36 G4HadronicInteractionRegistry* G4HadronicInteractionRegistry::Instance() 29 G4HadronicInteractionRegistry & G4HadronicInteractionRegistry::theRegistry() 37 30 { 38 if(0 == theInstance) { 39 static G4HadronicInteractionRegistry manager; 40 theInstance = &manager; 41 } 42 return theInstance; 43 } 44 45 G4HadronicInteractionRegistry::G4HadronicInteractionRegistry() 46 { 47 nModels = 0; 48 } 49 50 G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry() 51 { 52 Clean(); 53 } 54 55 void G4HadronicInteractionRegistry::Clean() 56 { 57 //G4cout << "G4HadronicInteractionRegistry::Clean() start " << nModels << G4endl; 58 if(0 < nModels) { 59 for (G4int i=0; i<nModels; i++) { 60 if( allModels[i] ) { 61 //G4cout << "delete " << i << G4endl; 62 //G4cout << allModels[i]->GetModelName() << G4endl; 63 delete allModels[i]; 64 allModels[i] = 0; 65 } 66 } 67 } 68 //G4cout << "G4HadronicInteractionRegistry::Clean() is done " << G4endl; 69 nModels = 0; 31 static G4HadronicInteractionRegistry theRegistryInstance; 32 return theRegistryInstance; 70 33 } 71 34 … … 73 36 RegisterMe(G4HadronicInteraction * aModel) 74 37 { 75 if(nModels > 0) { 76 for (G4int i=0; i<nModels; i++) { 77 if( aModel == allModels[i] ) return; 78 } 79 } 80 //G4cout << "Register model <" << aModel->GetModelName() 81 //<< "> " << nModels << G4endl; 82 allModels.push_back(aModel); 83 nModels++; 38 theRegistry().AddModel(aModel); 84 39 } 85 40 … … 87 42 RemoveMe(G4HadronicInteraction * aModel) 88 43 { 89 if(nModels > 0) { 90 for (G4int i=0; i<nModels; i++) { 91 if( aModel == allModels[i] ) { 92 //G4cout << "DeRegister model <" << aModel->GetModelName() 93 //<< "> " << i << G4endl; 94 allModels[i] = 0; 95 return; 96 } 44 theRegistry().allModels.erase(std::find(theRegistry().allModels.begin(), 45 theRegistry().allModels.end(), aModel)); 46 theRegistry().nModels = theRegistry().allModels.size(); 47 } 48 49 G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry() 50 { 51 /* 52 while(allModels.size()!=0) 53 { 54 delete allModels.front(); 55 } 56 */ 57 } 58 59 void G4HadronicInteractionRegistry:: 60 AddModel(G4HadronicInteraction * aModel) 61 { 62 G4bool alreadyThere = false; 63 for(G4int i=0; i<nModels; i++) 64 { 65 if(allModels[i]==aModel) 66 { 67 alreadyThere = true; 68 break; 97 69 } 98 70 } 71 if(!alreadyThere) 72 { 73 nModels++; 74 allModels.push_back(aModel); 75 } 99 76 } -
trunk/source/processes/hadronic/models/management/src/G4InelasticInteraction.cc
r962 r1007 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4InelasticInteraction.cc,v 1.12 2009/01/24 11:56:27 vnivanch Exp $27 // GEANT4 tag $Name: geant4-09-02-ref-02 $28 26 // 29 // Hadronic Process: Inelastic Interaction30 // original by H.P. Wellisch 31 // modified by J.L. Chuma, TRIUMF, 22-Nov-1996 32 // Last modified: 27-Mar-1997 33 // J.P. Wellisch: 23-Apr-97: throw G4HadronicException(__FILE__, __LINE__, removed 34 // J.P. Wellisch: 24-Apr-97: correction for SetUpPions 35 // Modified by J.L. Chuma, 30-Apr-97: added originalTarget to CalculateMomenta 36 // since TwoBody needed to reset the target particle 37 // J.L. Chuma, 20-Jun-97: Modified CalculateMomenta to correct the decision process 38 // for whether to use GenerateXandPt or TwoCluster 39 // J.L. Chuma, 06-Aug-97: added original incident particle, before Fermi motion and 40 // evaporation effects are included, needed for calculating 41 // self absorption and corrections for single particle spectra 42 // HPW removed misunderstanding of LocalEnergyDeposit, 11.04.98. 43 // 23-Jan-2009 V.Ivanchenko move constructor and destructor to the body 27 // 28 // Hadronic Process: Inelastic Interaction 29 // original by H.P. Wellisch 30 // modified by J.L. Chuma, TRIUMF, 22-Nov-1996 31 // Last modified: 27-Mar-1997 32 // J.P. Wellisch: 23-Apr-97: throw G4HadronicException(__FILE__, __LINE__, removed 33 // J.P. Wellisch: 24-Apr-97: correction for SetUpPions 34 // Modified by J.L. Chuma, 30-Apr-97: added originalTarget to CalculateMomenta 35 // since TwoBody needed to reset the target particle 36 // J.L. Chuma, 20-Jun-97: Modified CalculateMomenta to correct the decision process 37 // for whether to use GenerateXandPt or TwoCluster 38 // J.L. Chuma, 06-Aug-97: added original incident particle, before Fermi motion and 39 // evaporation effects are included, needed for calculating 40 // self absorption and corrections for single particle spectra 41 // HPW removed misunderstanding of LocalEnergyDeposit, 11.04.98. 44 42 45 43 #include "G4InelasticInteraction.hh" 46 44 #include "Randomize.hh" 47 45 #include "G4HadReentrentException.hh" 48 49 G4InelasticInteraction::G4InelasticInteraction(const G4String& modelName) 50 : G4HadronicInteraction(modelName) 51 { cache = 0.0;} 52 53 G4InelasticInteraction::~G4InelasticInteraction() 54 {} 55 56 G4double 46 47 G4double 57 48 G4InelasticInteraction::Pmltpc( // used in Cascade functions 58 49 G4int np, G4int nm, G4int nz, G4int n, G4double b, G4double c ) … … 72 63 } 73 64 74 G4bool65 G4bool 75 66 G4InelasticInteraction::MarkLeadingStrangeParticle( 76 67 const G4ReactionProduct ¤tParticle, … … 101 92 } 102 93 103 void94 void 104 95 G4InelasticInteraction::SetUpPions( 105 96 const G4int np, … … 135 126 } 136 127 137 void128 void 138 129 G4InelasticInteraction::GetNormalizationConstant( 139 130 const G4double energy, // MeV, <0 means annihilation channels … … 179 170 } 180 171 181 void172 void 182 173 G4InelasticInteraction::CalculateMomenta( 183 174 G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec, … … 353 344 354 345 355 void G4InelasticInteraction::346 void G4InelasticInteraction:: 356 347 Rotate(G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec, G4int &vecLen) 357 348 { … … 367 358 } 368 359 369 void360 void 370 361 G4InelasticInteraction::SetUpChange( 371 362 G4FastVector<G4ReactionProduct,GHADLISTSIZE> &vec, -
trunk/source/processes/hadronic/models/management/src/G4V3DNucleus.cc
r962 r1007 26 26 // 27 27 // $Id: G4V3DNucleus.cc,v 1.5 2006/06/29 20:45:59 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-02 -ref-02$28 // GEANT4 tag $Name: geant4-09-02 $ 29 29 // 30 30 #include "G4V3DNucleus.hh" -
trunk/source/processes/hadronic/models/management/src/G4VHighEnergyGenerator.cc
r962 r1007 26 26 // 27 27 // $Id: G4VHighEnergyGenerator.cc,v 1.5 2006/06/29 20:46:03 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-02 -ref-02$28 // GEANT4 tag $Name: geant4-09-02 $ 29 29 // 30 30 // G4VHighEnergyGenerator -
trunk/source/processes/hadronic/models/management/src/G4VIntraNuclearTransportModel.cc
r962 r1007 26 26 // 27 27 // $Id: G4VIntraNuclearTransportModel.cc,v 1.5 2007/01/11 05:28:56 dennis Exp $ 28 // GEANT4 tag $Name: geant4-09-02 -ref-02$28 // GEANT4 tag $Name: geant4-09-02 $ 29 29 // 30 30 // $Id: G4VIntraNuclearTransportModel.cc,v 1.0 1998/06/30 -
trunk/source/processes/hadronic/models/management/src/G4VKineticNucleon.cc
r962 r1007 26 26 // 27 27 // $Id: G4VKineticNucleon.cc,v 1.3 2006/06/29 20:46:07 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-02 -ref-02$28 // GEANT4 tag $Name: geant4-09-02 $ 29 29 // 30 30 #include "G4VKineticNucleon.hh" -
trunk/source/processes/hadronic/models/management/src/G4VNuclearDensity.cc
r962 r1007 26 26 // 27 27 // $Id: G4VNuclearDensity.cc,v 1.3 2006/06/29 20:46:09 gunter Exp $ 28 // GEANT4 tag $Name: geant4-09-02 -ref-02$28 // GEANT4 tag $Name: geant4-09-02 $ 29 29 // 30 30 -
trunk/source/processes/hadronic/models/management/src/G4VPreCompoundModel.cc
r962 r1007 26 26 // 27 27 // $Id: G4VPreCompoundModel.cc,v 1.6 2007/01/11 05:29:10 dennis Exp $ 28 // GEANT4 tag $Name: geant4-09-02 -ref-02$28 // GEANT4 tag $Name: geant4-09-02 $ 29 29 // 30 30
Note: See TracChangeset
for help on using the changeset viewer.