| 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 | //
|
|---|
| 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 |
|
|---|
| 33 | #include "G4HadronicInteraction.hh"
|
|---|
| 34 |
|
|---|
| 35 | G4double
|
|---|
| 36 | G4HadronicInteraction::GetMinEnergy(
|
|---|
| 37 | const G4Material *aMaterial, const G4Element *anElement ) const
|
|---|
| 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;
|
|---|
| 45 | }
|
|---|
| 46 | for( i=0; i<theMinEnergyList.size(); ++i )
|
|---|
| 47 | {
|
|---|
| 48 | if( aMaterial == theMinEnergyList[i].second )return theMinEnergyList[i].first;
|
|---|
| 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;
|
|---|
| 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
|
|---|
| 65 | << " The model is not active for the Element "
|
|---|
| 66 | << anElement->GetName() << "." << G4endl;
|
|---|
| 67 |
|
|---|
| 68 | for( size_t i=0; i<theMinEnergyListElements.size(); ++i )
|
|---|
| 69 | {
|
|---|
| 70 | if( anElement == theMinEnergyListElements[i].second )
|
|---|
| 71 | {
|
|---|
| 72 | theMinEnergyListElements[i].first = anEnergy;
|
|---|
| 73 | return;
|
|---|
| 74 | }
|
|---|
| 75 | }
|
|---|
| 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
|
|---|
| 86 | << " The model is not active for the Material "
|
|---|
| 87 | << aMaterial->GetName() << "." << G4endl;
|
|---|
| 88 |
|
|---|
| 89 | for( size_t i=0; i<theMinEnergyList.size(); ++i )
|
|---|
| 90 | {
|
|---|
| 91 | if( aMaterial == theMinEnergyList[i].second )
|
|---|
| 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;
|
|---|
| 110 | }
|
|---|
| 111 | for( i=0; i<theMaxEnergyList.size(); ++i )
|
|---|
| 112 | {
|
|---|
| 113 | if( aMaterial == theMaxEnergyList[i].second )return theMaxEnergyList[i].first;
|
|---|
| 114 | }
|
|---|
| 115 | if(IsBlocked()) return 0.*GeV;
|
|---|
| 116 | if( verboseLevel > 0 )
|
|---|
| 117 | G4cout << "*** Warning from HadronicInteraction::GetMaxEnergy" << G4endl
|
|---|
| 118 | << " material " << aMaterial->GetName()
|
|---|
| 119 | << " not found in min energy List" << G4endl;
|
|---|
| 120 |
|
|---|
| 121 | return theMaxEnergy;
|
|---|
| 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
|
|---|
| 131 | << "Warning: The model is not active for the Element "
|
|---|
| 132 | << anElement->GetName() << "." << G4endl;
|
|---|
| 133 |
|
|---|
| 134 | for( size_t i=0; i<theMaxEnergyListElements.size(); ++i )
|
|---|
| 135 | {
|
|---|
| 136 | if( anElement == theMaxEnergyListElements[i].second )
|
|---|
| 137 | {
|
|---|
| 138 | theMaxEnergyListElements[i].first = anEnergy;
|
|---|
| 139 | return;
|
|---|
| 140 | }
|
|---|
| 141 | }
|
|---|
| 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
|
|---|
| 152 | << "Warning: The model is not active for the Material "
|
|---|
| 153 | << aMaterial->GetName() << "." << G4endl;
|
|---|
| 154 |
|
|---|
| 155 | for( size_t i=0; i<theMaxEnergyList.size(); ++i )
|
|---|
| 156 | {
|
|---|
| 157 | if( aMaterial == theMaxEnergyList[i].second )
|
|---|
| 158 | {
|
|---|
| 159 | theMaxEnergyList[i].first = anEnergy;
|
|---|
| 160 | return;
|
|---|
| 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 )
|
|---|
| 182 | {
|
|---|
| 183 | if( aMaterial == theBlockedList[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 )
|
|---|
| 195 | {
|
|---|
| 196 | if( anElement == theBlockedListElements[i] )
|
|---|
| 197 | {
|
|---|
| 198 | return true;
|
|---|
| 199 | }
|
|---|
| 200 | }
|
|---|
| 201 | return false;
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | /* end of file */
|
|---|
| 205 |
|
|---|