Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ConversionUtils Namespace Reference

Functions

template<typename Value >
G4bool Convert (const G4String &myInput, Value &output)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedDouble &output)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedThreeVector &output)
 
template<>
G4bool Convert (const G4String &myInput, G4ThreeVector &output)
 
template<typename Value >
G4bool Convert (const G4String &myInput, Value &value1, Value &value2)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedDouble &min, G4DimensionedDouble &max)
 
template<>
G4bool Convert (const G4String &myInput, G4DimensionedThreeVector &min, G4DimensionedThreeVector &max)
 
template<>
G4bool Convert (const G4String &myInput, G4ThreeVector &min, G4ThreeVector &max)
 

Function Documentation

◆ Convert() [1/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedDouble min,
G4DimensionedDouble max 
)
inline

Definition at line 127 of file G4ConversionUtils.hh.

129 {
130 G4String input(myInput);
131 input = input.strip();
132
133 G4double valueMin, valueMax;
134 G4String unitsMin, unitsMax;
135
136 std::istringstream is(input);
137 char tester;
138
139 if (!(is >> valueMin >> unitsMin >> valueMax >> unitsMax) || is.get(tester)) return false;;
140
141 min = G4DimensionedDouble(valueMin, unitsMin);
142 max = G4DimensionedDouble(valueMax, unitsMax);
143
144 return true;
145 }
G4DimensionedType< G4double > G4DimensionedDouble
double G4double
Definition: G4Types.hh:83

◆ Convert() [2/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedDouble output 
)
inline

Definition at line 58 of file G4ConversionUtils.hh.

59 {
60 G4String input(myInput);
61 input = input.strip();
62
63 G4double value;
64 G4String unit;
65
66 std::istringstream is(input);
67 char tester;
68
69 if (!(is >> value >> unit) || is.get(tester)) return false;
70
71 output = G4DimensionedDouble(value, unit);
72
73 return true;
74 }

◆ Convert() [3/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedThreeVector min,
G4DimensionedThreeVector max 
)
inline

Definition at line 147 of file G4ConversionUtils.hh.

149 {
150 G4String input(myInput);
151 input = input.strip();
152
153 G4double valueMinX, valueMinY, valueMinZ;
154 G4double valueMaxX, valueMaxY, valueMaxZ;
155 G4String unitMin, unitMax;
156
157 std::istringstream is(input);
158 char tester;
159
160 if (!(is >> valueMinX >> valueMinY >> valueMinZ >> unitMin >> valueMaxX >> valueMaxY >> valueMaxZ >> unitMax)
161 || is.get(tester)) return false;
162
163 min = G4DimensionedThreeVector(G4ThreeVector(valueMinX, valueMinY, valueMinZ), unitMin);
164 max = G4DimensionedThreeVector(G4ThreeVector(valueMaxX, valueMaxY, valueMaxZ), unitMax);
165
166 return true;
167 }
G4DimensionedType< G4ThreeVector > G4DimensionedThreeVector
CLHEP::Hep3Vector G4ThreeVector

◆ Convert() [4/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4DimensionedThreeVector output 
)
inline

Definition at line 76 of file G4ConversionUtils.hh.

78 {
79 G4String input(myInput);
80 input = input.strip();
81
82 G4double value1, value2, value3;
83 G4String unit;
84
85 std::istringstream is(input);
86 char tester;
87
88 if (!(is >> value1 >> value2 >> value3 >>unit) || is.get(tester)) return false;
89
90 output = G4DimensionedThreeVector(G4ThreeVector(value1, value2, value3), unit);
91
92 return true;
93 }

◆ Convert() [5/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4ThreeVector min,
G4ThreeVector max 
)
inline

Definition at line 169 of file G4ConversionUtils.hh.

171 {
172 G4String input(myInput);
173 input = input.strip();
174
175 G4double valueMinX, valueMinY, valueMinZ;
176 G4double valueMaxX, valueMaxY, valueMaxZ;
177
178 std::istringstream is(input);
179 char tester;
180
181 if (!(is >> valueMinX >> valueMinY >> valueMinZ >> valueMaxX >> valueMaxY >> valueMaxZ)
182 || is.get(tester)) return false;
183
184 min = G4ThreeVector(valueMinX, valueMinY, valueMinZ);
185 max = G4ThreeVector(valueMaxX, valueMaxY, valueMaxZ);
186
187 return true;
188 }

◆ Convert() [6/8]

template<>
G4bool G4ConversionUtils::Convert ( const G4String myInput,
G4ThreeVector output 
)
inline

Definition at line 95 of file G4ConversionUtils.hh.

96 {
97 G4String input(myInput);
98 input = input.strip();
99
100 G4double value1, value2, value3;
101
102 std::istringstream is(input);
103 char tester;
104
105 if (!(is >> value1 >> value2 >> value3) || is.get(tester)) return false;
106 output = G4ThreeVector(value1, value2, value3);
107
108 return true;
109 }

◆ Convert() [7/8]

template<typename Value >
G4bool G4ConversionUtils::Convert ( const G4String myInput,
Value &  output 
)

Definition at line 45 of file G4ConversionUtils.hh.

46 {
47 G4String input(myInput);
48 input = input.strip();
49
50 std::istringstream is(input);
51 char tester;
52
53 return ((is >> output) && !is.get(tester));
54 }

Referenced by G4AttValueFilterT< T, ConversionErrorPolicy >::Accept(), G4AttValueFilterT< T, ConversionErrorPolicy >::GetValidElement(), G4AttValueFilterT< T, ConversionErrorPolicy >::LoadIntervalElement(), and G4AttValueFilterT< T, ConversionErrorPolicy >::LoadSingleValueElement().

◆ Convert() [8/8]

template<typename Value >
G4bool G4ConversionUtils::Convert ( const G4String myInput,
Value &  value1,
Value &  value2 
)

Definition at line 114 of file G4ConversionUtils.hh.

116 {
117 G4String input(myInput);
118 input = input.strip();
119
120 std::istringstream is(input);
121 char tester;
122
123 return ((is >> value1 >> value2) && (!is.get(tester)));
124 }