| [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 | //
|
|---|
| [1196] | 26 | // $Id: G4HadronicInteraction.cc,v 1.6 2009/08/30 16:12:34 vnivanch Exp $
|
|---|
| 27 | // GEANT4 tag $Name: geant4-09-03-cand-01 $
|
|---|
| [819] | 28 | //
|
|---|
| [1055] | 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 |
|
|---|
| [819] | 36 | #include "G4HadronicInteraction.hh"
|
|---|
| [1055] | 37 | #include "G4HadronicInteractionRegistry.hh"
|
|---|
| 38 | #include "G4HadronicException.hh"
|
|---|
| 39 |
|
|---|
| 40 | G4HadronicInteraction::G4HadronicInteraction(const G4String& modelName) :
|
|---|
| [1196] | 41 | verboseLevel(0), theMinEnergy(0.0), theMaxEnergy(25.0*GeV),
|
|---|
| 42 | isBlocked(false), recoilEnergyThreshold(0.0), theModelName(modelName)
|
|---|
| [1055] | 43 | {
|
|---|
| 44 | G4HadronicInteractionRegistry::Instance()->RegisterMe(this);
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | G4HadronicInteraction::~G4HadronicInteraction()
|
|---|
| 48 | {
|
|---|
| 49 | G4HadronicInteractionRegistry::Instance()->RemoveMe(this);
|
|---|
| 50 | }
|
|---|
| [1196] | 51 |
|
|---|
| 52 | G4double
|
|---|
| 53 | G4HadronicInteraction::SampleInvariantT(const G4ParticleDefinition*,
|
|---|
| 54 | G4double, G4int, G4int)
|
|---|
| 55 | {
|
|---|
| 56 | return 0.0;
|
|---|
| 57 | }
|
|---|
| [819] | 58 |
|
|---|
| [1055] | 59 | G4double G4HadronicInteraction::GetMinEnergy(
|
|---|
| [819] | 60 | const G4Material *aMaterial, const G4Element *anElement ) const
|
|---|
| [1055] | 61 | {
|
|---|
| 62 | size_t i;
|
|---|
| 63 | if( IsBlocked(aMaterial) )return 0.*GeV;
|
|---|
| 64 | if( IsBlocked(anElement) )return 0.*GeV;
|
|---|
| 65 | for( i=0; i<theMinEnergyListElements.size(); ++i )
|
|---|
| [819] | 66 | {
|
|---|
| [1055] | 67 | if( anElement == theMinEnergyListElements[i].second )
|
|---|
| 68 | return theMinEnergyListElements[i].first;
|
|---|
| [819] | 69 | }
|
|---|
| 70 | for( i=0; i<theMinEnergyList.size(); ++i )
|
|---|
| 71 | {
|
|---|
| [1055] | 72 | if( aMaterial == theMinEnergyList[i].second )
|
|---|
| 73 | return theMinEnergyList[i].first;
|
|---|
| [819] | 74 | }
|
|---|
| 75 | if(IsBlocked()) return 0.*GeV;
|
|---|
| 76 | if( verboseLevel > 0 )
|
|---|
| 77 | G4cout << "*** Warning from HadronicInteraction::GetMinEnergy" << G4endl
|
|---|
| 78 | << " material " << aMaterial->GetName()
|
|---|
| 79 | << " not found in min energy List" << G4endl;
|
|---|
| 80 | return theMinEnergy;
|
|---|
| [1055] | 81 | }
|
|---|
| [819] | 82 |
|
|---|
| [1055] | 83 | void G4HadronicInteraction::SetMinEnergy(G4double anEnergy,
|
|---|
| [1196] | 84 | const G4Element *anElement )
|
|---|
| [1055] | 85 | {
|
|---|
| 86 | if( IsBlocked(anElement) )
|
|---|
| 87 | G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
|
|---|
| [819] | 88 | << " The model is not active for the Element "
|
|---|
| 89 | << anElement->GetName() << "." << G4endl;
|
|---|
| 90 |
|
|---|
| [1055] | 91 | for( size_t i=0; i<theMinEnergyListElements.size(); ++i )
|
|---|
| [819] | 92 | {
|
|---|
| 93 | if( anElement == theMinEnergyListElements[i].second )
|
|---|
| 94 | {
|
|---|
| 95 | theMinEnergyListElements[i].first = anEnergy;
|
|---|
| 96 | return;
|
|---|
| 97 | }
|
|---|
| 98 | }
|
|---|
| [1196] | 99 | theMinEnergyListElements.push_back(std::pair<G4double, const G4Element *>(anEnergy, anElement));
|
|---|
| [1055] | 100 | }
|
|---|
| [819] | 101 |
|
|---|
| [1055] | 102 | void G4HadronicInteraction::SetMinEnergy(G4double anEnergy,
|
|---|
| [1196] | 103 | const G4Material *aMaterial )
|
|---|
| [1055] | 104 | {
|
|---|
| 105 | if( IsBlocked(aMaterial) )
|
|---|
| 106 | G4cout << "*** Warning from HadronicInteraction::SetMinEnergy" << G4endl
|
|---|
| [819] | 107 | << " The model is not active for the Material "
|
|---|
| 108 | << aMaterial->GetName() << "." << G4endl;
|
|---|
| 109 |
|
|---|
| [1055] | 110 | for( size_t i=0; i<theMinEnergyList.size(); ++i )
|
|---|
| [819] | 111 | {
|
|---|
| 112 | if( aMaterial == theMinEnergyList[i].second )
|
|---|
| [1055] | 113 | {
|
|---|
| 114 | theMinEnergyList[i].first = anEnergy;
|
|---|
| 115 | return;
|
|---|
| 116 | }
|
|---|
| [819] | 117 | }
|
|---|
| [1196] | 118 | theMinEnergyList.push_back(std::pair<G4double, const G4Material *>(anEnergy, aMaterial));
|
|---|
| [1055] | 119 | }
|
|---|
| [819] | 120 |
|
|---|
| [1055] | 121 | G4double G4HadronicInteraction::GetMaxEnergy(const G4Material *aMaterial,
|
|---|
| 122 | const G4Element *anElement ) const
|
|---|
| 123 | {
|
|---|
| 124 | size_t i;
|
|---|
| [1196] | 125 | if( IsBlocked(aMaterial) )return 0.0;
|
|---|
| 126 | if( IsBlocked(anElement) )return 0.0;
|
|---|
| [1055] | 127 | for( i=0; i<theMaxEnergyListElements.size(); ++i )
|
|---|
| [819] | 128 | {
|
|---|
| [1055] | 129 | if( anElement == theMaxEnergyListElements[i].second )
|
|---|
| 130 | return theMaxEnergyListElements[i].first;
|
|---|
| [819] | 131 | }
|
|---|
| [1196] | 132 | for( i=0; i<theMaxEnergyList.size(); ++i )
|
|---|
| [819] | 133 | {
|
|---|
| [1055] | 134 | if( aMaterial == theMaxEnergyList[i].second )
|
|---|
| 135 | return theMaxEnergyList[i].first;
|
|---|
| [819] | 136 | }
|
|---|
| [1196] | 137 | if(IsBlocked()) return 0.*GeV;
|
|---|
| 138 | if( verboseLevel > 0 ) {
|
|---|
| [819] | 139 | G4cout << "*** Warning from HadronicInteraction::GetMaxEnergy" << G4endl
|
|---|
| [1055] | 140 | << " material " << aMaterial->GetName()
|
|---|
| 141 | << " not found in min energy List" << G4endl;
|
|---|
| [1196] | 142 | }
|
|---|
| 143 | return theMaxEnergy;
|
|---|
| [1055] | 144 | }
|
|---|
| [819] | 145 |
|
|---|
| [1055] | 146 | void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy,
|
|---|
| [1196] | 147 | const G4Element *anElement )
|
|---|
| [1055] | 148 | {
|
|---|
| [1196] | 149 | if( IsBlocked(anElement) ) {
|
|---|
| [1055] | 150 | G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
|
|---|
| [819] | 151 | << "Warning: The model is not active for the Element "
|
|---|
| 152 | << anElement->GetName() << "." << G4endl;
|
|---|
| [1196] | 153 | }
|
|---|
| [1055] | 154 | for( size_t i=0; i<theMaxEnergyListElements.size(); ++i )
|
|---|
| [819] | 155 | {
|
|---|
| 156 | if( anElement == theMaxEnergyListElements[i].second )
|
|---|
| 157 | {
|
|---|
| 158 | theMaxEnergyListElements[i].first = anEnergy;
|
|---|
| 159 | return;
|
|---|
| 160 | }
|
|---|
| 161 | }
|
|---|
| [1196] | 162 | theMaxEnergyListElements.push_back(std::pair<G4double, const G4Element *>(anEnergy, anElement));
|
|---|
| [1055] | 163 | }
|
|---|
| [819] | 164 |
|
|---|
| [1055] | 165 | void G4HadronicInteraction::SetMaxEnergy(G4double anEnergy,
|
|---|
| [1196] | 166 | const G4Material *aMaterial )
|
|---|
| [1055] | 167 | {
|
|---|
| [1196] | 168 | if( IsBlocked(aMaterial) ) {
|
|---|
| [1055] | 169 | G4cout << "*** Warning from HadronicInteraction::SetMaxEnergy" << G4endl
|
|---|
| [819] | 170 | << "Warning: The model is not active for the Material "
|
|---|
| 171 | << aMaterial->GetName() << "." << G4endl;
|
|---|
| [1196] | 172 | }
|
|---|
| [1055] | 173 | for( size_t i=0; i<theMaxEnergyList.size(); ++i )
|
|---|
| [819] | 174 | {
|
|---|
| 175 | if( aMaterial == theMaxEnergyList[i].second )
|
|---|
| [1055] | 176 | {
|
|---|
| [1196] | 177 | theMaxEnergyList[i].first = anEnergy;
|
|---|
| 178 | return;
|
|---|
| [1055] | 179 | }
|
|---|
| [819] | 180 | }
|
|---|
| [1196] | 181 | theMaxEnergyList.push_back(std::pair<G4double, const G4Material *>(anEnergy, aMaterial));
|
|---|
| [1055] | 182 | }
|
|---|
| [819] | 183 |
|
|---|
| [1196] | 184 | void G4HadronicInteraction::DeActivateFor( const G4Material *aMaterial )
|
|---|
| [1055] | 185 | {
|
|---|
| 186 | theBlockedList.push_back(aMaterial);
|
|---|
| 187 | }
|
|---|
| [819] | 188 |
|
|---|
| [1196] | 189 | void G4HadronicInteraction::DeActivateFor( const G4Element *anElement )
|
|---|
| [1055] | 190 | {
|
|---|
| 191 | theBlockedListElements.push_back(anElement);
|
|---|
| 192 | }
|
|---|
| [819] | 193 |
|
|---|
| [1055] | 194 | G4bool G4HadronicInteraction::IsBlocked( const G4Material *aMaterial ) const
|
|---|
| 195 | {
|
|---|
| 196 | for( size_t i=0; i<theBlockedList.size(); ++i )
|
|---|
| [819] | 197 | {
|
|---|
| 198 | if( aMaterial == theBlockedList[i] )
|
|---|
| [1055] | 199 | {
|
|---|
| 200 | return true;
|
|---|
| 201 | }
|
|---|
| [819] | 202 | }
|
|---|
| [1055] | 203 | return false;
|
|---|
| 204 | }
|
|---|
| [819] | 205 |
|
|---|
| [1055] | 206 | G4bool G4HadronicInteraction::IsBlocked( const G4Element *anElement ) const
|
|---|
| 207 | {
|
|---|
| 208 | for( size_t i=0; i<theBlockedListElements.size(); ++i )
|
|---|
| [819] | 209 | {
|
|---|
| 210 | if( anElement == theBlockedListElements[i] )
|
|---|
| [1055] | 211 | {
|
|---|
| 212 | return true;
|
|---|
| 213 | }
|
|---|
| [819] | 214 | }
|
|---|
| [1055] | 215 | return false;
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 | G4HadronicInteraction::G4HadronicInteraction(const G4HadronicInteraction &right )
|
|---|
| 219 | {
|
|---|
| 220 | *this = right;
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | const G4HadronicInteraction&
|
|---|
| 224 | G4HadronicInteraction::operator=(const G4HadronicInteraction &right )
|
|---|
| 225 | {
|
|---|
| 226 | G4String text = "unintended use of G4HadronicInteraction::operator=";
|
|---|
| 227 | throw G4HadronicException(__FILE__, __LINE__, text);
|
|---|
| 228 | return right;
|
|---|
| 229 | }
|
|---|
| [819] | 230 |
|
|---|
| [1055] | 231 | /* end of file */
|
|---|
| [819] | 232 |
|
|---|