Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions
G4tgrLineProcessor Class Reference

#include <G4tgrLineProcessor.hh>

Inheritance diagram for G4tgrLineProcessor:
ExTGRCLineProcessor

Public Member Functions

 G4tgrLineProcessor ()
 
virtual ~G4tgrLineProcessor ()
 
virtual G4bool ProcessLine (const std::vector< G4String > &wl)
 

Protected Member Functions

G4tgrVolumeFindVolume (const G4String &volname)
 

Detailed Description

Definition at line 50 of file G4tgrLineProcessor.hh.

Constructor & Destructor Documentation

G4tgrLineProcessor::G4tgrLineProcessor ( )

Definition at line 54 of file G4tgrLineProcessor.cc.

References G4tgrVolumeMgr::GetInstance().

55 {
56  volmgr = G4tgrVolumeMgr::GetInstance();
57 }
static G4tgrVolumeMgr * GetInstance()
G4tgrLineProcessor::~G4tgrLineProcessor ( )
virtual

Definition at line 61 of file G4tgrLineProcessor.cc.

62 {
63 }

Member Function Documentation

G4tgrVolume * G4tgrLineProcessor::FindVolume ( const G4String volname)
protected

Definition at line 320 of file G4tgrLineProcessor.cc.

References FatalException, G4tgrVolumeMgr::FindVolume(), G4Exception(), and G4tgrVolume::GetType().

Referenced by ProcessLine().

321 {
322  G4tgrVolume* vol = volmgr->FindVolume( volname, 1);
323 
324  if( vol->GetType() == "VOLDivision" )
325  {
326  G4Exception("G4tgrLineProcessor::FindVolume()",
327  "InvalidSetup", FatalException,
328  "Using 'PLACE' for a volume created by a division !");
329  }
330 
331  return vol;
332 }
G4tgrVolume * FindVolume(const G4String &volname, G4bool exists=false)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetType() const
Definition: G4tgrVolume.hh:91
G4bool G4tgrLineProcessor::ProcessLine ( const std::vector< G4String > &  wl)
virtual

Reimplemented in ExTGRCLineProcessor.

Definition at line 67 of file G4tgrLineProcessor.cc.

References G4tgrMaterialFactory::AddElementFromIsotopes(), G4tgrMaterialFactory::AddElementSimple(), G4tgrMaterialFactory::AddIsotope(), G4tgrMaterialFactory::AddMaterialMixture(), G4tgrMaterialFactory::AddMaterialSimple(), G4tgrParameterMgr::AddParameterNumber(), G4tgrParameterMgr::AddParameterString(), G4tgrVolume::AddPlace(), G4tgrVolume::AddPlaceParam(), G4tgrVolume::AddPlaceReplica(), G4tgrRotationMatrixFactory::AddRotMatrix(), python.hepunit::atmosphere, G4tgrVolumeMgr::CreateSolid(), G4tgrUtils::DumpVS(), FatalException, G4tgrMaterialFactory::FindMaterial(), FindVolume(), G4tgrVolumeMgr::FindVolumes(), G4Exception(), G4tgrUtils::GetDouble(), G4tgrParameterMgr::GetInstance(), G4tgrRotationMatrixFactory::GetInstance(), G4tgrMaterialFactory::GetInstance(), G4tgrUtils::GetString(), G4tgrMessenger::GetVerboseLevel(), python.hepunit::kelvin, G4tgrVolumeMgr::RegisterMe(), G4tgrMaterial::SetIonisationMeanExcitationEnergy(), G4tgrMaterial::SetPressure(), G4tgrMaterial::SetState(), and G4tgrMaterial::SetTemperature().

Referenced by ExTGRCLineProcessor::ProcessLine(), and G4tgrFileReader::ReadFiles().

68 {
69 #ifdef G4VERBOSE
71  {
72  G4tgrUtils::DumpVS(wl, "@@@ Processing input line");
73  }
74 #endif
75 
76  G4String wl0 = wl[0];
77  for( size_t ii = 0; ii < wl0.length(); ii++ )
78  {
79  wl0[ii] = toupper( wl0[ii] );
80  }
81 
82  //------------------------------- parameter number
83  if( wl0 == ":P" )
84  {
86 
87  //------------------------------- parameter string
88  }
89  else if( wl0 == ":PS" )
90  {
92 
93  //------------------------------- isotope
94  }
95  else if( wl0 == ":ISOT" )
96  {
98  ->AddIsotope( wl );
99  volmgr->RegisterMe( isot );
100 
101  //------------------------------- element
102  }
103  else if( wl0 == ":ELEM" )
104  {
106  ->AddElementSimple( wl );
107  volmgr->RegisterMe( elem );
108 
109  //------------------------------- element from isotopes
110  }
111  else if( wl0 == ":ELEM_FROM_ISOT" )
112  {
113  //:ELEM_FROM_ISOT NAME SYMBOL N_ISOT (ISOT_NAME ISOT_ABUNDANCE)
115  ->AddElementFromIsotopes( wl );
116  volmgr->RegisterMe( elem );
117 
118  //------------------------------- material
119  }
120  else if( wl0 == ":MATE" )
121  {
122 
124  ->AddMaterialSimple( wl );
125  volmgr->RegisterMe( mate );
126 
127  //------------------------------- material mixtures & by weight
128  }
129  else if( (wl0 == ":MIXT") || (wl0 == ":MIXT_BY_WEIGHT") )
130  {
132  ->AddMaterialMixture( wl, "MaterialMixtureByWeight" );
133  volmgr->RegisterMe( mate );
134 
135  //------------------------------- material mixture by number of atoms
136  }
137  else if( wl0 == ":MIXT_BY_NATOMS" )
138  {
140  ->AddMaterialMixture(wl, "MaterialMixtureByNoAtoms");
141  volmgr->RegisterMe( mate );
142 
143  //------------------------------- material mixture by volume
144  }
145  else if( wl0 == ":MIXT_BY_VOLUME" )
146  {
148  ->AddMaterialMixture( wl, "MaterialMixtureByVolume" );
149  volmgr->RegisterMe( mate );
150 
151  //------------------------------- material Mean Excitation Energy of
152  // Ionisation Potential
153  }
154  else if( wl0 == ":MATE_MEE" )
155  {
157  ->FindMaterial( G4tgrUtils::GetString( wl[1] ) );
158  if( mate == 0 )
159  {
160  G4Exception("G4tgrLineProcessor::ProcessLine()", "Material not found",
162  return false;
163  }
165 
166  //------------------------------- material
167  }
168  else if( wl0 == ":MATE_STATE" )
169  {
171  ->FindMaterial( G4tgrUtils::GetString( wl[1] ) );
172  if( mate == 0 )
173  {
174  G4Exception("G4tgrLineProcessor::ProcessLine()", "Material not found",
175  FatalException, wl[1] );
176  }
177  mate->SetState( wl[2] );
178 
179  //------------------------------- material
180  }
181  else if( wl0 == ":MATE_TEMPERATURE" )
182  {
184  ->FindMaterial( G4tgrUtils::GetString( wl[1] ) );
185  if( mate == 0 )
186  {
187  G4Exception("G4tgrLineProcessor::ProcessLine()", "Material not found",
188  FatalException, wl[1] );
189  }
190  mate->SetTemperature( G4tgrUtils::GetDouble( wl[2], kelvin ) );
191 
192  //------------------------------- material
193  }
194  else if( wl0 == ":MATE_PRESSURE" )
195  {
197  ->FindMaterial( G4tgrUtils::GetString( wl[1] ) );
198  if( mate == 0 )
199  {
200  G4Exception("G4tgrLineProcessor::ProcessLine()", "Material not found",
201  FatalException, wl[1] );
202  }
203  mate->SetPressure( G4tgrUtils::GetDouble( wl[2], atmosphere ) );
204 
205  //------------------------------- solid
206  }
207  else if( wl0 == ":SOLID" )
208  { // called from here or from G4tgrVolume::G4tgrVolume
209  volmgr->CreateSolid( wl, 0 );
210 
211  //------------------------------- volume
212  }
213  else if( wl0 == ":VOLU" )
214  {
215  G4tgrVolume* vol = new G4tgrVolume( wl );
216  volmgr->RegisterMe( vol );
217 
218  //--------------------------------- single placement
219  }
220  else if( wl0 == ":PLACE" )
221  {
222  G4tgrVolume* vol = FindVolume( G4tgrUtils::GetString( wl[1] ) );
223  G4tgrPlace* vpl = vol->AddPlace( wl );
224  volmgr->RegisterMe( vpl );
225 
226  //--------------------------------- parameterisation
227  }
228  else if( wl0 == ":PLACE_PARAM" )
229  {
230  G4tgrVolume* vol = FindVolume( G4tgrUtils::GetString( wl[1] ) );
231  G4tgrPlaceParameterisation* vpl = vol->AddPlaceParam( wl );
232  volmgr->RegisterMe( vpl );
233 
234  //--------------------------------- division
235  }
236  else if( (wl0 == ":DIV_NDIV") || (wl0 == ":DIV_WIDTH")
237  || (wl0 == ":DIV_NDIV_WIDTH") )
238  {
239  //---------- Create G4tgrVolumeDivision and fill the volume params
240  G4tgrVolumeDivision* vol = new G4tgrVolumeDivision( wl );
241  volmgr->RegisterMe( vol );
242 
243  //--------------------------------- replica
244  }
245  else if( wl0 == ":REPL" )
246  {
247  G4tgrVolume* vol = FindVolume( G4tgrUtils::GetString( wl[1] ) );
248  G4tgrPlaceDivRep* vpl = vol->AddPlaceReplica( wl );
249  volmgr->RegisterMe( vpl );
250 
251  //----------------------------- assembly volume: definition of components
252  }
253  else if( wl0 == ":VOLU_ASSEMBLY" )
254  {
255  G4tgrVolumeAssembly* vol = new G4tgrVolumeAssembly( wl );
256  volmgr->RegisterMe( vol );
257 
258  //----------------------------- assembly volume: definition of components
259  }
260  else if( wl0 == ":PLACE_ASSEMBLY" )
261  {
262  G4tgrVolume* vol = FindVolume( G4tgrUtils::GetString( wl[1] ) );
263  G4tgrPlace* vpl = vol->AddPlace( wl );
264  volmgr->RegisterMe( vpl );
265 
266  //--------------------------------- rotation matrix
267  }
268  else if( wl0 == ":ROTM" )
269  {
270  //---------- When second word is ':NEXT/:MNXT' it is used for defining a
271  // rotation matrix that will be used for the next placement/s
273  ->AddRotMatrix( wl );
274  volmgr->RegisterMe( rm );
275 
276  //------------------------------- visualisation
277  }
278  else if( wl0 == ":VIS" )
279  {
280  std::vector<G4tgrVolume*> vols =
281  volmgr->FindVolumes( G4tgrUtils::GetString( wl[1] ), 1 );
282  for( size_t ii = 0; ii < vols.size(); ii++ )
283  {
284  vols[ii]->AddVisibility( wl );
285  }
286 
287  //--------------------------------- colour
288  }
289  else if( (wl0 == ":COLOUR") || (wl0 == ":COLOR") )
290  {
291  std::vector<G4tgrVolume*> vols =
292  volmgr->FindVolumes( G4tgrUtils::GetString( wl[1] ), 1 );
293  for( size_t ii = 0; ii < vols.size(); ii++ )
294  {
295  vols[ii]->AddRGBColour( wl );
296  }
297 
298  //--------------------------------- check overlaps
299  }
300  else if( wl0 == ":CHECK_OVERLAPS" )
301  {
302  std::vector<G4tgrVolume*> vols =
303  volmgr->FindVolumes( G4tgrUtils::GetString( wl[1] ), 1 );
304  for( size_t ii = 0; ii < vols.size(); ii++ )
305  {
306  vols[ii]->AddCheckOverlaps( wl );
307  }
308  //--------------------------------- ERROR
309  }
310  else
311  {
312  return 0;
313  }
314 
315  return 1;
316 }
void SetIonisationMeanExcitationEnergy(G4double mee)
G4tgrElementFromIsotopes * AddElementFromIsotopes(const std::vector< G4String > &wl)
G4tgrPlaceDivRep * AddPlaceReplica(const std::vector< G4String > &wl)
Definition: G4tgrVolume.cc:180
int atmosphere
Definition: hepunit.py:151
G4tgrMaterialSimple * AddMaterialSimple(const std::vector< G4String > &wl)
void AddParameterString(const std::vector< G4String > &wl, G4bool mustBeNew=0)
G4tgrRotationMatrix * AddRotMatrix(const std::vector< G4String > &wl)
std::vector< G4tgrVolume * > FindVolumes(const G4String &volname, G4bool exists)
static G4tgrRotationMatrixFactory * GetInstance()
void SetState(G4String val)
static G4int GetVerboseLevel()
G4tgrMaterial * FindMaterial(const G4String &name) const
static G4tgrParameterMgr * GetInstance()
void RegisterMe(G4tgrSolid *vol)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4double GetDouble(const G4String &str, G4double unitval=1.)
Definition: G4tgrUtils.cc:205
static void DumpVS(const std::vector< G4String > &wl, const char *msg)
Definition: G4tgrUtils.cc:158
void SetTemperature(G4double val)
static G4String GetString(const G4String &str)
Definition: G4tgrUtils.cc:180
G4tgrSolid * CreateSolid(const std::vector< G4String > &wl, G4bool bVOLUtag)
void SetPressure(G4double val)
G4tgrMaterialMixture * AddMaterialMixture(const std::vector< G4String > &wl, const G4String &mixtType)
void AddParameterNumber(const std::vector< G4String > &wl, G4bool mustBeNew=0)
static G4tgrMaterialFactory * GetInstance()
G4tgrPlaceParameterisation * AddPlaceParam(const std::vector< G4String > &wl)
Definition: G4tgrVolume.cc:218
G4tgrElementSimple * AddElementSimple(const std::vector< G4String > &wl)
G4tgrVolume * FindVolume(const G4String &volname)
virtual G4tgrPlace * AddPlace(const std::vector< G4String > &wl)
Definition: G4tgrVolume.cc:138
G4tgrIsotope * AddIsotope(const std::vector< G4String > &wl)

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