Geant4 9.6.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)
 
G4ProductionCutsoperator= (const G4ProductionCuts &right)
 
virtual ~G4ProductionCuts ()
 
G4int operator== (const G4ProductionCuts &right) const
 
G4int 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
 

Detailed Description

Definition at line 62 of file G4ProductionCuts.hh.

Constructor & Destructor Documentation

◆ G4ProductionCuts() [1/2]

G4ProductionCuts::G4ProductionCuts ( )

Definition at line 45 of file G4ProductionCuts.cc.

45 :
46 isModified(true)
47{
48 for (G4int i=0; i< NumberOfG4CutIndex; i++) {
49 fRangeCuts.push_back(0.0);
50 }
51}
@ NumberOfG4CutIndex
int G4int
Definition: G4Types.hh:66
std::vector< G4double > fRangeCuts

◆ G4ProductionCuts() [2/2]

G4ProductionCuts::G4ProductionCuts ( const G4ProductionCuts right)

Definition at line 53 of file G4ProductionCuts.cc.

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 106 of file G4ProductionCuts.cc.

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

◆ GetIndex() [2/2]

G4int G4ProductionCuts::GetIndex ( const G4String name)
static

Definition at line 88 of file G4ProductionCuts.cc.

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

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!=()

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

Definition at line 82 of file G4ProductionCuts.cc.

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

◆ 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 fRangeCuts[i] = right.fRangeCuts[i];
69 }
70 isModified = right.isModified;
71 return *this;
72}

◆ operator==()

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

Definition at line 76 of file G4ProductionCuts.cc.

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

◆ 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 150 of file G4ProductionCuts.hh.

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

◆ SetProductionCut() [2/3]

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

Definition at line 127 of file G4ProductionCuts.hh.

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

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

◆ SetProductionCut() [3/3]

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

Definition at line 142 of file G4ProductionCuts.hh.

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

◆ SetProductionCuts()

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

Definition at line 126 of file G4ProductionCuts.cc.

127{
128 G4int vSize = cut.size();
129 if (vSize != NumberOfG4CutIndex) {
130#ifdef G4VERBOSE
131 if ( G4ProductionCutsTable::GetProductionCutsTable()->GetVerboseLevel()>1) {
132 G4cerr << "G4ProductionCuts::SetProductionCuts ";
133 G4cerr << " The size of given cut value vector [=" << vSize << "] "
134 << " is not consitent with number of CutIndex [="
136 }
137#endif
138 G4Exception( "G4ProductionCuts::SetProductionCuts ",
139 "ProcCuts108",
140 JustWarning, "Given vector size is inconsitent ");
141 if (NumberOfG4CutIndex<vSize) vSize = NumberOfG4CutIndex;
142 }
143 for(G4int i = 0; (i<vSize ); i++) {
144 fRangeCuts[i] = cut[i];
145 }
146 isModified = true;
147}
@ JustWarning
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
static G4ProductionCutsTable * GetProductionCutsTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Member Data Documentation

◆ fRangeCuts

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

◆ isModified

G4bool G4ProductionCuts::isModified
protected

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