Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ProductionCuts Class Reference

#include <G4ProductionCuts.hh>

Public Member Functions

 G4ProductionCuts ()
 
 G4ProductionCuts (const G4ProductionCuts &right)
 
virtual ~G4ProductionCuts ()
 
G4ProductionCutsoperator= (const G4ProductionCuts &right)
 
G4bool operator== (const G4ProductionCuts &right) const
 
G4bool operator!= (const G4ProductionCuts &right) const
 
void SetProductionCut (G4double cut, G4int index)
 
void SetProductionCut (G4double cut, G4ParticleDefinition *ptcl)
 
void SetProductionCut (G4double cut, const G4String &pName)
 
void SetProductionCut (G4double cut)
 
G4double GetProductionCut (G4int index) const
 
G4double GetProductionCut (const G4String &name) const
 
void SetProductionCuts (std::vector< G4double > &)
 
const std::vector< G4double > & GetProductionCuts () const
 
G4bool IsModified () const
 
void PhysicsTableUpdated ()
 

Static Public Member Functions

static G4int GetIndex (const G4String &name)
 
static G4int GetIndex (const G4ParticleDefinition *ptcl)
 

Protected Attributes

std::vector< G4doublefRangeCuts
 
G4bool isModified = true
 

Detailed Description

Definition at line 55 of file G4ProductionCuts.hh.

Constructor & Destructor Documentation

◆ G4ProductionCuts() [1/2]

G4ProductionCuts::G4ProductionCuts ( )

Definition at line 36 of file G4ProductionCuts.cc.

37{
38 for (G4int i=0; i<NumberOfG4CutIndex; ++i)
39 {
40 fRangeCuts.push_back(0.0);
41 }
42}
@ NumberOfG4CutIndex
int G4int
Definition: G4Types.hh:85
std::vector< G4double > fRangeCuts

◆ G4ProductionCuts() [2/2]

G4ProductionCuts::G4ProductionCuts ( const G4ProductionCuts right)

Definition at line 44 of file G4ProductionCuts.cc.

45{
46 for (G4int i=0; i<NumberOfG4CutIndex; ++i)
47 {
48 fRangeCuts.push_back(0.0);
49 }
50 *this = right;
51}

◆ ~G4ProductionCuts()

G4ProductionCuts::~G4ProductionCuts ( )
virtual

Definition at line 53 of file G4ProductionCuts.cc.

54{
55 fRangeCuts.clear();
56}

Member Function Documentation

◆ GetIndex() [1/2]

G4int G4ProductionCuts::GetIndex ( const G4ParticleDefinition ptcl)
static

Definition at line 159 of file G4ProductionCuts.cc.

160{
161 G4int pdg = (nullptr == ptr) ? 0 : ptr->GetPDGEncoding();
162 G4int index = -1;
163 if (pdg == 22) { index = 0; }
164 else if (pdg == 11) { index = 1; }
165 else if (pdg == -11) { index = 2; }
166 else if (pdg == 2212) { index = 3; }
167
168 return index;
169}

◆ GetIndex() [2/2]

G4int G4ProductionCuts::GetIndex ( const G4String name)
static

Definition at line 147 of file G4ProductionCuts.cc.

148{
149 G4int index = -1;
150 if ( name == "gamma" ) { index = 0; }
151 else if ( name == "e-" ) { index = 1; }
152 else if ( name == "e+" ) { index = 2; }
153 else if ( name == "proton" ) { index = 3; }
154
155 return index;
156}

Referenced by G4ITStepProcessor::ApplyProductionCut(), G4ProductionCutsTable::ConvertRangeToEnergy(), GetProductionCut(), and SetProductionCut().

◆ GetProductionCut() [1/2]

G4double G4ProductionCuts::GetProductionCut ( const G4String name) const

Definition at line 126 of file G4ProductionCuts.cc.

127{
128 return GetProductionCut(GetIndex(name));
129}
static G4int GetIndex(const G4String &name)
G4double GetProductionCut(G4int index) const

◆ GetProductionCut() [2/2]

◆ GetProductionCuts()

const std::vector< G4double > & G4ProductionCuts::GetProductionCuts ( ) const

Definition at line 132 of file G4ProductionCuts.cc.

133{
134 return fRangeCuts;
135}

Referenced by G4ProductionCutsTable::UpdateCoupleTable().

◆ IsModified()

G4bool G4ProductionCuts::IsModified ( ) const

Definition at line 137 of file G4ProductionCuts.cc.

138{
139 return isModified;
140}

Referenced by G4MaterialCutsCouple::IsRecalcNeeded().

◆ operator!=()

G4bool G4ProductionCuts::operator!= ( const G4ProductionCuts right) const

Definition at line 75 of file G4ProductionCuts.cc.

76{
77 return (this != &right);
78}

◆ operator=()

G4ProductionCuts & G4ProductionCuts::operator= ( const G4ProductionCuts right)

Definition at line 58 of file G4ProductionCuts.cc.

59{
60 if (&right==this) return *this;
61
62 for (G4int i=0; i<NumberOfG4CutIndex; ++i)
63 {
64 fRangeCuts[i] = right.fRangeCuts[i];
65 }
66 isModified = right.isModified;
67 return *this;
68}

◆ operator==()

G4bool G4ProductionCuts::operator== ( const G4ProductionCuts right) const

Definition at line 70 of file G4ProductionCuts.cc.

71{
72 return (this == &right);
73}

◆ PhysicsTableUpdated()

void G4ProductionCuts::PhysicsTableUpdated ( )

Definition at line 142 of file G4ProductionCuts.cc.

143{
144 isModified = false;
145}

Referenced by G4MaterialCutsCouple::PhysicsTableUpdated().

◆ SetProductionCut() [1/4]

void G4ProductionCuts::SetProductionCut ( G4double  cut)

Definition at line 97 of file G4ProductionCuts.cc.

98{
99 for(G4int i = 0; i < NumberOfG4CutIndex; ++i)
100 {
101 fRangeCuts[i] = cut;
102 }
103 isModified = true;
104}

◆ SetProductionCut() [2/4]

void G4ProductionCuts::SetProductionCut ( G4double  cut,
const G4String pName 
)

Definition at line 111 of file G4ProductionCuts.cc.

112{
113 SetProductionCut(cut, GetIndex(pName));
114}
void SetProductionCut(G4double cut, G4int index)

◆ SetProductionCut() [3/4]

void G4ProductionCuts::SetProductionCut ( G4double  cut,
G4int  index 
)

Definition at line 80 of file G4ProductionCuts.cc.

81{
82 if(index >= 0 && index < NumberOfG4CutIndex)
83 {
84 fRangeCuts[index] = cut;
85 isModified = true;
86 }
87 else
88 {
89 std::ostringstream os;
90 os << "Setting cuts for particles other than photon, e-, e+ or proton has "
91 "no effect.";
92 G4Exception("G4ProductionCuts::SetProductionCut", "ProcCuts110",
93 JustWarning, os.str().c_str());
94 }
95}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59

Referenced by G4VUserPhysicsList::SetParticleCuts(), and SetProductionCut().

◆ SetProductionCut() [4/4]

void G4ProductionCuts::SetProductionCut ( G4double  cut,
G4ParticleDefinition ptcl 
)

Definition at line 106 of file G4ProductionCuts.cc.

107{
108 SetProductionCut(cut, GetIndex(ptr));
109}

◆ SetProductionCuts()

void G4ProductionCuts::SetProductionCuts ( std::vector< G4double > &  cut)

Definition at line 171 of file G4ProductionCuts.cc.

172{
173 G4int vSize = (G4int)cut.size();
174 if (vSize != NumberOfG4CutIndex)
175 {
176#ifdef G4VERBOSE
178 {
179 G4cout << "G4ProductionCuts::SetProductionCuts ";
180 G4cout << " The size of given cut value vector [=" << vSize << "] "
181 << " is not consistent with number of CutIndex [="
183 }
184#endif
185 G4Exception( "G4ProductionCuts::SetProductionCuts ",
186 "ProcCuts108",
187 JustWarning, "Given vector size is inconsistent ");
188 if (NumberOfG4CutIndex<vSize) { vSize = NumberOfG4CutIndex; }
189 }
190 for(G4int i = 0; i<vSize; ++i)
191 {
192 fRangeCuts[i] = cut[i];
193 }
194 isModified = true;
195}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4ProductionCutsTable * GetProductionCutsTable()

Member Data Documentation

◆ fRangeCuts

std::vector<G4double> G4ProductionCuts::fRangeCuts
protected

◆ isModified

G4bool G4ProductionCuts::isModified = true
protected

The documentation for this class was generated from the following files: