[819] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
[1007] | 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 | |
---|
[819] | 33 | #include "G4HadronicInteraction.hh" |
---|
| 34 | |
---|
[1007] | 35 | G4double |
---|
| 36 | G4HadronicInteraction::GetMinEnergy( |
---|
[819] | 37 | const G4Material *aMaterial, const G4Element *anElement ) const |
---|
[1007] | 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 ) |
---|
[819] | 43 | { |
---|
[1007] | 44 | if( anElement == theMinEnergyListElements[i].second )return theMinEnergyListElements[i].first; |
---|
[819] | 45 | } |
---|
| 46 | for( i=0; i<theMinEnergyList.size(); ++i ) |
---|
| 47 | { |
---|
[1007] | 48 | if( aMaterial == theMinEnergyList[i].second )return theMinEnergyList[i].first; |
---|
[819] | 49 | } |
---|
| 50 | if(IsBlocked()) return 0.*GeV; |
---|
| 51 | if( verboseLevel > 0 ) |
---|
| 52 | G4cout << "*** Warning from HadronicInteraction::GetMinEnergy" << G4endl |
---|
| 53 | << " material " << aMaterial->GetName() |
---|
| 54 | << " not found in min energy List" << G4endl; |
---|
| 55 | return theMinEnergy; |
---|
[1007] | 56 | } |
---|
[819] | 57 | |
---|
[1007] | 58 | void |
---|
| 59 | G4HadronicInteraction::SetMinEnergy( |
---|
| 60 | G4double anEnergy, |
---|
| 61 | G4Element *anElement ) |
---|
| 62 | { |
---|
| 63 | if( IsBlocked(anElement) ) |
---|
| 64 | G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl |
---|
[819] | 65 | << " The model is not active for the Element " |
---|
| 66 | << anElement->GetName() << "." << G4endl; |
---|
| 67 | |
---|
[1007] | 68 | for( size_t i=0; i<theMinEnergyListElements.size(); ++i ) |
---|
[819] | 69 | { |
---|
| 70 | if( anElement == theMinEnergyListElements[i].second ) |
---|
| 71 | { |
---|
| 72 | theMinEnergyListElements[i].first = anEnergy; |
---|
| 73 | return; |
---|
| 74 | } |
---|
| 75 | } |
---|
[1007] | 76 | theMinEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement)); |
---|
| 77 | } |
---|
[819] | 78 | |
---|
[1007] | 79 | void |
---|
| 80 | G4HadronicInteraction::SetMinEnergy( |
---|
| 81 | G4double anEnergy, |
---|
| 82 | G4Material *aMaterial ) |
---|
| 83 | { |
---|
| 84 | if( IsBlocked(aMaterial) ) |
---|
| 85 | G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl |
---|
[819] | 86 | << " The model is not active for the Material " |
---|
| 87 | << aMaterial->GetName() << "." << G4endl; |
---|
| 88 | |
---|
[1007] | 89 | for( size_t i=0; i<theMinEnergyList.size(); ++i ) |
---|
[819] | 90 | { |
---|
| 91 | if( aMaterial == theMinEnergyList[i].second ) |
---|
[1007] | 92 | { |
---|
| 93 | theMinEnergyList[i].first = anEnergy; |
---|
| 94 | return; |
---|
| 95 | } |
---|
[819] | 96 | } |
---|
[1007] | 97 | theMinEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial)); |
---|
| 98 | } |
---|
[819] | 99 | |
---|
[1007] | 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 ) |
---|
[819] | 108 | { |
---|
[1007] | 109 | if( anElement == theMaxEnergyListElements[i].second )return theMaxEnergyListElements[i].first; |
---|
[819] | 110 | } |
---|
| 111 | for( i=0; i<theMaxEnergyList.size(); ++i ) |
---|
| 112 | { |
---|
[1007] | 113 | if( aMaterial == theMaxEnergyList[i].second )return theMaxEnergyList[i].first; |
---|
[819] | 114 | } |
---|
| 115 | if(IsBlocked()) return 0.*GeV; |
---|
| 116 | if( verboseLevel > 0 ) |
---|
| 117 | G4cout << "*** Warning from HadronicInteraction::GetMaxEnergy" << G4endl |
---|
[1007] | 118 | << " material " << aMaterial->GetName() |
---|
| 119 | << " not found in min energy List" << G4endl; |
---|
[819] | 120 | |
---|
| 121 | return theMaxEnergy; |
---|
[1007] | 122 | } |
---|
[819] | 123 | |
---|
[1007] | 124 | void |
---|
| 125 | G4HadronicInteraction::SetMaxEnergy( |
---|
| 126 | G4double anEnergy, |
---|
| 127 | G4Element *anElement ) |
---|
| 128 | { |
---|
| 129 | if( IsBlocked(anElement) ) |
---|
| 130 | G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl |
---|
[819] | 131 | << "Warning: The model is not active for the Element " |
---|
| 132 | << anElement->GetName() << "." << G4endl; |
---|
| 133 | |
---|
[1007] | 134 | for( size_t i=0; i<theMaxEnergyListElements.size(); ++i ) |
---|
[819] | 135 | { |
---|
| 136 | if( anElement == theMaxEnergyListElements[i].second ) |
---|
| 137 | { |
---|
| 138 | theMaxEnergyListElements[i].first = anEnergy; |
---|
| 139 | return; |
---|
| 140 | } |
---|
| 141 | } |
---|
[1007] | 142 | theMaxEnergyListElements.push_back(std::pair<G4double, G4Element *>(anEnergy, anElement)); |
---|
| 143 | } |
---|
[819] | 144 | |
---|
[1007] | 145 | void |
---|
| 146 | G4HadronicInteraction::SetMaxEnergy( |
---|
| 147 | G4double anEnergy, |
---|
| 148 | G4Material *aMaterial ) |
---|
| 149 | { |
---|
| 150 | if( IsBlocked(aMaterial) ) |
---|
| 151 | G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl |
---|
[819] | 152 | << "Warning: The model is not active for the Material " |
---|
| 153 | << aMaterial->GetName() << "." << G4endl; |
---|
| 154 | |
---|
[1007] | 155 | for( size_t i=0; i<theMaxEnergyList.size(); ++i ) |
---|
[819] | 156 | { |
---|
| 157 | if( aMaterial == theMaxEnergyList[i].second ) |
---|
[1007] | 158 | { |
---|
[819] | 159 | theMaxEnergyList[i].first = anEnergy; |
---|
| 160 | return; |
---|
[1007] | 161 | } |
---|
[819] | 162 | } |
---|
[1007] | 163 | theMaxEnergyList.push_back(std::pair<G4double, G4Material *>(anEnergy, aMaterial)); |
---|
| 164 | } |
---|
[819] | 165 | |
---|
[1007] | 166 | void |
---|
| 167 | G4HadronicInteraction::DeActivateFor( G4Material *aMaterial ) |
---|
| 168 | { |
---|
| 169 | theBlockedList.push_back(aMaterial); |
---|
| 170 | } |
---|
[819] | 171 | |
---|
[1007] | 172 | void |
---|
| 173 | G4HadronicInteraction::DeActivateFor( G4Element *anElement ) |
---|
| 174 | { |
---|
| 175 | theBlockedListElements.push_back(anElement); |
---|
| 176 | } |
---|
[819] | 177 | |
---|
[1007] | 178 | G4bool |
---|
| 179 | G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const |
---|
| 180 | { |
---|
| 181 | for( size_t i=0; i<theBlockedList.size(); ++i ) |
---|
[819] | 182 | { |
---|
| 183 | if( aMaterial == theBlockedList[i] ) |
---|
[1007] | 184 | { |
---|
| 185 | return true; |
---|
| 186 | } |
---|
[819] | 187 | } |
---|
[1007] | 188 | return false; |
---|
| 189 | } |
---|
[819] | 190 | |
---|
[1007] | 191 | G4bool |
---|
| 192 | G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const |
---|
| 193 | { |
---|
| 194 | for( size_t i=0; i<theBlockedListElements.size(); ++i ) |
---|
[819] | 195 | { |
---|
| 196 | if( anElement == theBlockedListElements[i] ) |
---|
[1007] | 197 | { |
---|
| 198 | return true; |
---|
| 199 | } |
---|
[819] | 200 | } |
---|
[1007] | 201 | return false; |
---|
| 202 | } |
---|
[819] | 203 | |
---|
[1007] | 204 | /* end of file */ |
---|
[819] | 205 | |
---|