GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Protected Member Functions | Protected Attributes
GGSVGeometryConstruction Class Referenceabstract

Abstract class needed to load GGS geometry. More...

#include <GGSVGeometryConstruction.h>

Inheritance diagram for GGSVGeometryConstruction:
Inheritance graph
[legend]
Collaboration diagram for GGSVGeometryConstruction:
Collaboration graph
[legend]

Public Member Functions

 GGSVGeometryConstruction ()
 Constructor.
 
virtual ~GGSVGeometryConstruction ()
 Destructor.
 
virtual G4VPhysicalVolume * Construct ()=0
 Construct the detector - virtual method. More...
 
virtual G4VPhysicalVolume * GetVolume ()=0
 Get the detector VPhysicalVolume - virtual method. More...
 
virtual bool IsInsideAcceptance (const G4ThreeVector &, const G4ThreeVector &) const
 Checks if a particle is inside the instrument's acceptance. More...
 
void SetGeoDataCard (const G4String &dataCard)
 Sets the geometry configuration datacard. More...
 
void SetVerboseLevel (int verboseLevel)
 Sets the verbosity level. More...
 
virtual const std::string GetVersion ()
 Getter method for geometry version. More...
 
virtual bool ExportParameters ()
 Function for exporting the geometry parameters. More...
 
const std::map< std::string,
int > & 
GetIntParameters ()
 Getter method for integer geometry parameters. More...
 
const std::map< std::string,
bool > & 
GetBoolParameters ()
 Getter method for boolean geometry parameters. More...
 
const std::map< std::string,
double > & 
GetRealParameters ()
 Getter method for real geometry parameters. More...
 
const std::map< std::string,
std::string > & 
GetStringParameters ()
 Getter method for string geometry parameters. More...
 
const std::map< std::string,
std::vector< int > > & 
GetVectIntParameters ()
 Getter method for vector-of-integers geometry parameters. More...
 
const std::map< std::string,
std::vector< bool > > & 
GetVectBoolParameters ()
 Getter method for vector-of-booleans geometry parameters. More...
 
const std::map< std::string,
std::vector< double > > & 
GetVectRealParameters ()
 Getter method for vector-of-reals geometry parameters. More...
 
const std::map< std::string,
std::vector< std::string > > & 
GetVectStringParameters ()
 Getter method for vector-of-strings geometry parameters. More...
 

Protected Member Functions

bool ExportIntParameter (std::string name, int value)
 Sets the value of an integer parameter. More...
 
bool ExportBoolParameter (std::string name, bool value)
 Sets the value of a boolean parameter. More...
 
bool ExportRealParameter (std::string name, double value)
 Sets the value of a real parameter. More...
 
bool ExportStringParameter (std::string name, std::string value)
 Sets the value of a string parameter. More...
 
bool ExportVectIntParameter (std::string name, std::vector< int > value)
 Sets the value of a vector-of-integers parameter. More...
 
bool ExportVectBoolParameter (std::string name, std::vector< bool > value)
 Sets the value of a vector-of-booleans parameter. More...
 
bool ExportVectRealParameter (std::string name, std::vector< double > value)
 Sets the value of a vector-of-reals parameter. More...
 
bool ExportVectStringParameter (std::string name, std::vector< std::string > value)
 Sets the value of a vector-of-strings parameter. More...
 

Protected Attributes

G4String _geoDataCard
 The geometry datacard file.
 
int _verboseLevel
 Verbosity level.
 
std::map< std::string, int > _intParams
 
std::map< std::string, bool > _boolParams
 
std::map< std::string, double > _realParams
 
std::map< std::string,
std::string > 
_stringParams
 
std::map< std::string,
std::vector< int > > 
_vectIntParams
 
std::map< std::string,
std::vector< double > > 
_vectRealParams
 
std::map< std::string,
std::vector< std::string > > 
_vectStringParams
 
std::map< std::string,
std::vector< bool > > 
_vectBoolParams
 

Detailed Description

Abstract class needed to load GGS geometry.

Abstract class needed to load run time the GGSGeometryConstruction library without the need for linking to the executable GGSWolowitz

Definition at line 24 of file GGSVGeometryConstruction.h.

Member Function Documentation

virtual G4VPhysicalVolume* GGSVGeometryConstruction::Construct ( )
pure virtual

Construct the detector - virtual method.

Returns
The G4VPhysicalVolume.
bool GGSVGeometryConstruction::ExportBoolParameter ( std::string  name,
bool  value 
)
protected

Sets the value of a boolean parameter.

The parameter values set by this function are NOT used for geometry construction. They are just stored for being subsequently retrieved.

An exception is thrown if an error occurs while exporting a parameter, e.g. when exporting the same parameter twice. The bool return value is kept for backwards compatibility with the old interface.

Parameters
nameThe name of the parameter.
valueThe value of the parameter.
Returns
true if the parameter has been successfully set.

Definition at line 44 of file GGSVGeometryConstruction.cpp.

44  {
45  if (!_boolParams.insert(std::make_pair(name, value)).second)
46  throw std::runtime_error("Cannot export bool parameter \"" + name + "\"");
47  return true;
48 }
bool GGSVGeometryConstruction::ExportIntParameter ( std::string  name,
int  value 
)
protected

Sets the value of an integer parameter.

The parameter values set by this function are NOT used for geometry construction. They are just stored for being subsequently retrieved.

An exception is thrown if an error occurs while exporting a parameter, e.g. when exporting the same parameter twice. The bool return value is kept for backwards compatibility with the old interface.

Parameters
nameThe name of the parameter.
valueThe value of the parameter.
Returns
true if the parameter has been successfully set.

Definition at line 38 of file GGSVGeometryConstruction.cpp.

38  {
39  if (!_intParams.insert(std::make_pair(name, value)).second)
40  throw std::runtime_error("Cannot export int parameter \"" + name + "\"");
41  return true;
42 }
virtual bool GGSVGeometryConstruction::ExportParameters ( )
inlinevirtual

Function for exporting the geometry parameters.

This function is called by the framework AFTER Construct. Users can re-implement it to export the values of the geometry parameters used for geometry construction, which can be later fetched e.g. to be saved in the output file. A typical re-implementation of this method consists of a series of calls to ExportIntParameter, ExportRealParameter, ExportBoolParameter, ExportStringParameter and their counterparts for vectors ExportVectIntParameter, ExportVectRealParameter, ExportVectBoolParameter, ExportVectStringParameter. Exported parameters are internally stored in maps which can be retrieved by calling GetIntParameters, GetRealParameters, GetBoolParameters, GetStringParameters and their counterparts for vectors GetVectIntParameters, GetVectRealParameters, GetVectBoolParameters, GetVectStringParameters.

An exception is thrown if an error occurs while exporting a parameter, e.g. when exporting the same parameter twice. The bool return value is kept for backwards compatibility with the old interface.

Returns
true if all the parameters have been successfully exported.
Exceptions
std::errorif an error occurs while exporting parameters.

Definition at line 102 of file GGSVGeometryConstruction.h.

102 { return true; }
bool GGSVGeometryConstruction::ExportRealParameter ( std::string  name,
double  value 
)
protected

Sets the value of a real parameter.

The parameter values set by this function are NOT used for geometry construction. They are just stored for being subsequently retrieved.

An exception is thrown if an error occurs while exporting a parameter, e.g. when exporting the same parameter twice. The bool return value is kept for backwards compatibility with the old interface.

Parameters
nameThe name of the parameter.
valueThe value of the parameter.
Returns
true if the parameter has been successfully set.

Definition at line 50 of file GGSVGeometryConstruction.cpp.

50  {
51  if (!_realParams.insert(std::make_pair(name, value)).second)
52  throw std::runtime_error("Cannot export real parameter \"" + name + "\"");
53  return true;
54 }
bool GGSVGeometryConstruction::ExportStringParameter ( std::string  name,
std::string  value 
)
protected

Sets the value of a string parameter.

The parameter values set by this function are NOT used for geometry construction. They are just stored for being subsequently retrieved.

An exception is thrown if an error occurs while exporting a parameter, e.g. when exporting the same parameter twice. The bool return value is kept for backwards compatibility with the old interface.

Parameters
nameThe name of the parameter.
valueThe value of the parameter.
Returns
true if the parameter has been successfully set.

Definition at line 55 of file GGSVGeometryConstruction.cpp.

55  {
56  if (!_stringParams.insert(std::make_pair(name, value)).second)
57  throw std::runtime_error("Cannot export string parameter \"" + name + "\"");
58  return true;
59 }
bool GGSVGeometryConstruction::ExportVectBoolParameter ( std::string  name,
std::vector< bool >  value 
)
protected

Sets the value of a vector-of-booleans parameter.

The parameter values set by this function are NOT used for geometry construction. They are just stored for being subsequently retrieved.

An exception is thrown if an error occurs while exporting a parameter, e.g. when exporting the same parameter twice. The bool return value is kept for backwards compatibility with the old interface.

Parameters
nameThe name of the parameter.
valueThe value of the parameter.
Returns
true if the parameter has been successfully set.

Definition at line 67 of file GGSVGeometryConstruction.cpp.

67  {
68  if (!_vectBoolParams.insert(std::make_pair(name, std::move(value))).second)
69  throw std::runtime_error("Cannot export vector-of-bool parameter \"" + name + "\"");
70  return true;
71 }
bool GGSVGeometryConstruction::ExportVectIntParameter ( std::string  name,
std::vector< int >  value 
)
protected

Sets the value of a vector-of-integers parameter.

The parameter values set by this function are NOT used for geometry construction. They are just stored for being subsequently retrieved.

An exception is thrown if an error occurs while exporting a parameter, e.g. when exporting the same parameter twice. The bool return value is kept for backwards compatibility with the old interface.

Parameters
nameThe name of the parameter.
valueThe value of the parameter.
Returns
true if the parameter has been successfully set.

Definition at line 61 of file GGSVGeometryConstruction.cpp.

61  {
62  if (!_vectIntParams.insert(std::make_pair(name, std::move(value))).second)
63  throw std::runtime_error("Cannot export vector-of-int parameter \"" + name + "\"");
64  return true;
65 }
bool GGSVGeometryConstruction::ExportVectRealParameter ( std::string  name,
std::vector< double >  value 
)
protected

Sets the value of a vector-of-reals parameter.

The parameter values set by this function are NOT used for geometry construction. They are just stored for being subsequently retrieved.

Parameters
nameThe name of the parameter.
valueThe value of the parameter.
Returns
true if the parameter has been successfully set.

Definition at line 73 of file GGSVGeometryConstruction.cpp.

73  {
74  if (!_vectRealParams.insert(std::make_pair(name, std::move(value))).second)
75  throw std::runtime_error("Cannot export vector-of-real parameter \"" + name + "\"");
76  return true;
77 }
bool GGSVGeometryConstruction::ExportVectStringParameter ( std::string  name,
std::vector< std::string >  value 
)
protected

Sets the value of a vector-of-strings parameter.

The parameter values set by this function are NOT used for geometry construction. They are just stored for being subsequently retrieved.

An exception is thrown if an error occurs while exporting a parameter, e.g. when exporting the same parameter twice. The bool return value is kept for backwards compatibility with the old interface.

Parameters
nameThe name of the parameter.
valueThe value of the parameter.
Returns
true if the parameter has been successfully set.

Definition at line 78 of file GGSVGeometryConstruction.cpp.

78  {
79  if (!_vectStringParams.insert(std::make_pair(name, std::move(value))).second)
80  throw std::runtime_error("Cannot export vector-of-string parameter \"" + name + "\"");
81  return true;
82 }
const std::map< std::string, bool > & GGSVGeometryConstruction::GetBoolParameters ( )

Getter method for boolean geometry parameters.

This method returns a map of the exported boolean parameters describing the geometry. The parameters and their value can be set by calling ExportBoolParameter in the override of ExportParameters.

Returns
A (name,value) map of the boolean geometry parameters.
See Also
ExportParameters

Definition at line 16 of file GGSVGeometryConstruction.cpp.

16 { return _boolParams; }
const std::map< std::string, int > & GGSVGeometryConstruction::GetIntParameters ( )

Getter method for integer geometry parameters.

This method returns a map of the exported integer parameters describing the geometry. The parameters and their value can be set by calling ExportIntParameter in the override of ExportParameters.

Returns
A (name,value) map of the integer geometry parameters.
See Also
ExportParameters

Definition at line 14 of file GGSVGeometryConstruction.cpp.

14 { return _intParams; }
const std::map< std::string, double > & GGSVGeometryConstruction::GetRealParameters ( )

Getter method for real geometry parameters.

This method returns a map of the exported real parameters describing the geometry. The parameters and their value can be set by calling ExportRealParameter in the override of ExportParameters.

Returns
A (name,value) map of the real geometry parameters.
See Also
ExportParameters

Definition at line 18 of file GGSVGeometryConstruction.cpp.

18 { return _realParams; }
const std::map< std::string, std::string > & GGSVGeometryConstruction::GetStringParameters ( )

Getter method for string geometry parameters.

This method returns a map of the exported string parameters describing the geometry. The parameters and their value can be set by calling ExportStringParameter in the override of ExportParameters.

Returns
A (name,value) map of the string geometry parameters.
See Also
ExportParameters

Definition at line 20 of file GGSVGeometryConstruction.cpp.

20 { return _stringParams; }
const std::map< std::string, std::vector< bool > > & GGSVGeometryConstruction::GetVectBoolParameters ( )

Getter method for vector-of-booleans geometry parameters.

This method returns a map of the exported vector-of-booleans parameters describing the geometry. The parameters and their value can be set by calling ExportVectBoolParameter in the override of ExportParameters.

Returns
A (name,value) map of the vector-of-booleans geometry parameters.
See Also
ExportParameters

Definition at line 26 of file GGSVGeometryConstruction.cpp.

26  {
27  return _vectBoolParams;
28 }
const std::map< std::string, std::vector< int > > & GGSVGeometryConstruction::GetVectIntParameters ( )

Getter method for vector-of-integers geometry parameters.

This method returns a map of the exported vector-of-integers parameters describing the geometry. The parameters and their value can be set by calling ExportVectIntParameter in the override of ExportParameters.

Returns
A (name,value) map of the vector-of-integers geometry parameters.
See Also
ExportParameters

Definition at line 22 of file GGSVGeometryConstruction.cpp.

22  {
23  return _vectIntParams;
24 }
const std::map< std::string, std::vector< double > > & GGSVGeometryConstruction::GetVectRealParameters ( )

Getter method for vector-of-reals geometry parameters.

This method returns a map of the exported vector-of-reals parameters describing the geometry. The parameters and their value can be set by calling ExportVectRealParameter in the override of ExportParameters.

Returns
A (name,value) map of the vector-of-reals geometry parameters.
See Also
ExportParameters

Definition at line 30 of file GGSVGeometryConstruction.cpp.

30  {
31  return _vectRealParams;
32 }
const std::map< std::string, std::vector< std::string > > & GGSVGeometryConstruction::GetVectStringParameters ( )

Getter method for vector-of-strings geometry parameters.

This method returns a map of the exported vector-of-strings parameters describing the geometry. The parameters and their value can be set by calling ExportVectStringParameter in the override of ExportParameters.

Returns
A (name,value) map of the vector-of-strings geometry parameters.
See Also
ExportParameters

Definition at line 34 of file GGSVGeometryConstruction.cpp.

34  {
35  return _vectStringParams;
36 }
virtual const std::string GGSVGeometryConstruction::GetVersion ( )
inlinevirtual

Getter method for geometry version.

Returns
A std::string containing the geometry version.

Definition at line 83 of file GGSVGeometryConstruction.h.

83 { return ""; }
virtual G4VPhysicalVolume* GGSVGeometryConstruction::GetVolume ( )
pure virtual

Get the detector VPhysicalVolume - virtual method.

Returns
The G4VPhysicalVolume.
virtual bool GGSVGeometryConstruction::IsInsideAcceptance ( const G4ThreeVector &  ,
const G4ThreeVector &   
) const
inlinevirtual

Checks if a particle is inside the instrument's acceptance.

This method checks if a particle shot from generationPoint towards direction is inside the acceptance of the instrument. In this abstract class it always returns true; concrete implementations may override this method to perform geometry-specific acceptance checks, otherwise this default implementation will be used and the acceptance check will never fail.

Returns
true (children classes can override this behavior).

Definition at line 53 of file GGSVGeometryConstruction.h.

53 { return true; }
void GGSVGeometryConstruction::SetGeoDataCard ( const G4String &  dataCard)
inline

Sets the geometry configuration datacard.

The concrete implementations of this class must implement a messenger who will interpret the datacard and configure the geometry accordingly.

Parameters
dataCardName of the datacard file..

Definition at line 62 of file GGSVGeometryConstruction.h.

62 { _geoDataCard = dataCard; }
G4String _geoDataCard
The geometry datacard file.
void GGSVGeometryConstruction::SetVerboseLevel ( int  verboseLevel)
inline

Sets the verbosity level.

The meaning of verbosity levels is left to specific geometry implementations. However, a proposed scheme is: verboseLevel = 1: general geometry construction info (materials, sub-detectors placements etc.) verboseLevel = 2: specific sub-detector construction info (defined by each eventual sub-detector, like positions of its elements). verboseLevel = 3: both

Note that this is only a proposed behavior; different behaviors can be implemented if needed. Other levels can be defined by using verboseLevel as a binary mask (eg., define a verbose level associated to 4 and combine it with verbose level 2 by using verboseLevel = 6 = 4+2).

Parameters
verboseLevelThe verbosity level.

Definition at line 77 of file GGSVGeometryConstruction.h.

77 { _verboseLevel = verboseLevel; }
int _verboseLevel
Verbosity level.

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