Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ProductionCuts.cc
Go to the documentation of this file.
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//
26//
27// $Id$
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30//
31// --------------------------------------------------------------
32// GEANT 4 class implementation file/ History:
33// 18 Sep. 2002, H.Kuirashige : Structure created based on object model
34// --------------------------------------------------------------
35
36#include "G4ProductionCuts.hh"
38#include <iomanip>
39
40const G4ParticleDefinition* G4ProductionCuts::gammaDef = 0;
41const G4ParticleDefinition* G4ProductionCuts::electDef = 0;
42const G4ParticleDefinition* G4ProductionCuts::positDef = 0;
43const G4ParticleDefinition* G4ProductionCuts::protonDef = 0;
44
46 isModified(true)
47{
48 for (G4int i=0; i< NumberOfG4CutIndex; i++) {
49 fRangeCuts.push_back(0.0);
50 }
51}
52
54{
55 *this = right;
56}
57
59{
60 fRangeCuts.clear();
61}
62
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}
73
74
75
77{
78 return (this == &right);
79}
80
81
83{
84 return (this != &right);
85}
86
87
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}
104
105
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}
124
125
126void G4ProductionCuts::SetProductionCuts(std::vector<G4double>& cut)
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
@ NumberOfG4CutIndex
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
const G4String & GetParticleName() const
static G4ProductionCutsTable * GetProductionCutsTable()
G4int operator!=(const G4ProductionCuts &right) const
G4int operator==(const G4ProductionCuts &right) const
G4ProductionCuts & operator=(const G4ProductionCuts &right)
std::vector< G4double > fRangeCuts
static G4int GetIndex(const G4String &name)
virtual ~G4ProductionCuts()
void SetProductionCuts(std::vector< G4double > &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41