Geant4 10.7.0
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=-1)
 
void SetProductionCut (G4double cut, G4ParticleDefinition *ptcl)
 
void SetProductionCut (G4double cut, const G4String &pName)
 
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 41 of file G4ProductionCuts.cc.

42{
43 for (G4int i=0; i< NumberOfG4CutIndex; ++i)
44 {
45 fRangeCuts.push_back(0.0);
46 }
47}
@ NumberOfG4CutIndex
int G4int
Definition: G4Types.hh:85
std::vector< G4double > fRangeCuts

◆ G4ProductionCuts() [2/2]

G4ProductionCuts::G4ProductionCuts ( const G4ProductionCuts right)

Definition at line 49 of file G4ProductionCuts.cc.

50{
51 for (G4int i=0; i< NumberOfG4CutIndex; ++i)
52 {
53 fRangeCuts.push_back(0.0);
54 }
55 *this = right;
56}

◆ ~G4ProductionCuts()

G4ProductionCuts::~G4ProductionCuts ( )
virtual

Definition at line 58 of file G4ProductionCuts.cc.

59{
60 fRangeCuts.clear();
61}

Member Function Documentation

◆ GetIndex() [1/2]

G4int G4ProductionCuts::GetIndex ( const G4ParticleDefinition ptcl)
static

Definition at line 104 of file G4ProductionCuts.cc.

105{
106 if(!ptcl) return -1;
107
108 // In the first call, pointers are set
109 if(gammaDef==nullptr && ptcl->GetParticleName()=="gamma")
110 { gammaDef = (G4ParticleDefinition*) ptcl; }
111 if(electDef==nullptr && ptcl->GetParticleName()=="e-")
112 { electDef = (G4ParticleDefinition*) ptcl; }
113 if(positDef==nullptr && ptcl->GetParticleName()=="e+")
114 { positDef = (G4ParticleDefinition*) ptcl; }
115 if(protonDef==nullptr && ptcl->GetParticleName()=="proton")
116 { protonDef = (G4ParticleDefinition*) ptcl; }
117
118 G4int index;
119 if(ptcl==(const G4ParticleDefinition*) gammaDef) { index = 0; }
120 else if(ptcl==(const G4ParticleDefinition*) electDef) { index = 1; }
121 else if(ptcl==(const G4ParticleDefinition*) positDef) { index = 2; }
122 else if(ptcl==(const G4ParticleDefinition*) protonDef) { index = 3; }
123 else { index = -1; }
124
125 return index;
126}
const G4String & GetParticleName() const

◆ GetIndex() [2/2]

G4int G4ProductionCuts::GetIndex ( const G4String name)
static

Definition at line 86 of file G4ProductionCuts.cc.

87{
88 static const G4String gamma ("gamma");
89 static const G4String electron("e-");
90 static const G4String positron("e+");
91 static const G4String proton("proton");
92
93 G4int index;
94 if ( name == gamma ) { index = 0; }
95 else if ( name == electron ) { index = 1; }
96 else if ( name == positron ) { index = 2; }
97 else if ( name == proton ) { index = 3; }
98 else { index = -1; }
99
100 return index;
101}

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

◆ GetProductionCut() [1/2]

G4double G4ProductionCuts::GetProductionCut ( const G4String name) const
inline

Definition at line 167 of file G4ProductionCuts.hh.

168{
169 return GetProductionCut(GetIndex(name));
170}
static G4int GetIndex(const G4String &name)
G4double GetProductionCut(G4int index) const

◆ GetProductionCut() [2/2]

◆ GetProductionCuts()

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

Definition at line 174 of file G4ProductionCuts.hh.

175{
176 return fRangeCuts;
177}

Referenced by G4ProductionCutsTable::UpdateCoupleTable().

◆ IsModified()

G4bool G4ProductionCuts::IsModified ( ) const
inline

Definition at line 180 of file G4ProductionCuts.hh.

181{
182 return isModified;
183}

Referenced by G4MaterialCutsCouple::IsRecalcNeeded().

◆ operator!=()

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

Definition at line 81 of file G4ProductionCuts.cc.

82{
83 return (this != &right);
84}

◆ operator=()

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

Definition at line 63 of file G4ProductionCuts.cc.

64{
65 if (&right==this) return *this;
66
67 for (G4int i=0; i< NumberOfG4CutIndex; ++i)
68 {
69 fRangeCuts[i] = right.fRangeCuts[i];
70 }
71 isModified = right.isModified;
72 return *this;
73}

◆ operator==()

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

Definition at line 75 of file G4ProductionCuts.cc.

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

◆ PhysicsTableUpdated()

void G4ProductionCuts::PhysicsTableUpdated ( )
inline

Definition at line 186 of file G4ProductionCuts.hh.

187{
188 isModified = false;
189}

Referenced by G4MaterialCutsCouple::PhysicsTableUpdated().

◆ SetProductionCut() [1/3]

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

Definition at line 149 of file G4ProductionCuts.hh.

150{
151 G4int idx = GetIndex(pName);
152 if(idx>=0) SetProductionCut(cut,idx);
153}
void SetProductionCut(G4double cut, G4int index=-1)

◆ SetProductionCut() [2/3]

void G4ProductionCuts::SetProductionCut ( G4double  cut,
G4int  index = -1 
)
inline

Definition at line 121 of file G4ProductionCuts.hh.

122{
123 if (index<0)
124 {
125 for(G4int i = 0; i < NumberOfG4CutIndex; ++i)
126 {
127 fRangeCuts[i] = cut;
128 }
129 isModified = true;
130
131 }
132 else if (index < NumberOfG4CutIndex)
133 {
134 fRangeCuts[index] = cut;
135 isModified = true;
136 }
137}

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

◆ SetProductionCut() [3/3]

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

Definition at line 140 of file G4ProductionCuts.hh.

142{
143 G4int idx = -1;
144 if(ptcl) idx = GetIndex(ptcl);
145 if(idx>=0) SetProductionCut(cut,idx);
146}

◆ SetProductionCuts()

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

Definition at line 128 of file G4ProductionCuts.cc.

129{
130 G4int vSize = cut.size();
131 if (vSize != NumberOfG4CutIndex)
132 {
133#ifdef G4VERBOSE
134 if ( G4ProductionCutsTable::GetProductionCutsTable()->GetVerboseLevel()>1)
135 {
136 G4cerr << "G4ProductionCuts::SetProductionCuts ";
137 G4cerr << " The size of given cut value vector [=" << vSize << "] "
138 << " is not consistent with number of CutIndex [="
140 }
141#endif
142 G4Exception( "G4ProductionCuts::SetProductionCuts ",
143 "ProcCuts108",
144 JustWarning, "Given vector size is inconsistent ");
145 if (NumberOfG4CutIndex<vSize) { vSize = NumberOfG4CutIndex; }
146 }
147 for(G4int i = 0; (i<vSize ); ++i)
148 {
149 fRangeCuts[i] = cut[i];
150 }
151 isModified = true;
152}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
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: