source: trunk/source/processes/hadronic/models/management/src/G4HadronicInteraction.cc@ 1057

Last change on this file since 1057 was 1055, checked in by garnier, 17 years ago

maj sur la beta de geant 4.9.3

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