Skip to content
Snippets Groups Projects
Commit cc0fb0e1 authored by Marilena Bandieramonte's avatar Marilena Bandieramonte
Browse files

Merge branch 'geomodelg4-fixEtherAndHyperuranium' into 'master'

Change in GeoModelG4 to support Ether and HyperUranium handling in new geometry tags.

Closes #5

See merge request !20
parents f26f0d90 617eb639
No related branches found
No related tags found
1 merge request!20Change in GeoModelG4 to support Ether and HyperUranium handling in new geometry tags.
...@@ -24,6 +24,14 @@ ...@@ -24,6 +24,14 @@
#include "GeoModel2G4/CLHEPtoEigenConverter.h" #include "GeoModel2G4/CLHEPtoEigenConverter.h"
bool hasEnding (std::string const &fullString, std::string const &ending) {
if (fullString.length() >= ending.length()) {
return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending));
} else {
return false;
}
}
ExtParameterisedVolumeBuilder::ExtParameterisedVolumeBuilder(std::string n): ExtParameterisedVolumeBuilder::ExtParameterisedVolumeBuilder(std::string n):
VolumeBuilder(n), VolumeBuilder(n),
m_getMatEther(true), m_getMatEther(true),
...@@ -125,8 +133,7 @@ G4LogicalVolume* ExtParameterisedVolumeBuilder::Build(const PVConstLink theGeoPh ...@@ -125,8 +133,7 @@ G4LogicalVolume* ExtParameterisedVolumeBuilder::Build(const PVConstLink theGeoPh
Query<int> Qint = av.getId(); Query<int> Qint = av.getId();
if(Qint.isValid()) id = Qint; if(Qint.isValid()) id = Qint;
if(m_matEther->getName() == theGeoPhysChild->getLogVol()->getMaterial()->getName() || hasEnding(theGeoPhysChild->getLogVol()->getMaterial()->getName(), "Ether"))
if(m_matEther->getName() == theGeoPhysChild->getLogVol()->getMaterial()->getName() )
{ {
Geo2G4AssemblyVolume* assembly = BuildAssembly(theGeoPhysChild); Geo2G4AssemblyVolume* assembly = BuildAssembly(theGeoPhysChild);
...@@ -174,6 +181,8 @@ G4LogicalVolume* ExtParameterisedVolumeBuilder::Build(const PVConstLink theGeoPh ...@@ -174,6 +181,8 @@ G4LogicalVolume* ExtParameterisedVolumeBuilder::Build(const PVConstLink theGeoPh
return theG4LogVolume; return theG4LogVolume;
} }
Geo2G4AssemblyVolume* ExtParameterisedVolumeBuilder::BuildAssembly(PVConstLink pv) const Geo2G4AssemblyVolume* ExtParameterisedVolumeBuilder::BuildAssembly(PVConstLink pv) const
{ {
PVConstLink theGeoPhysChild; PVConstLink theGeoPhysChild;
...@@ -201,7 +210,9 @@ Geo2G4AssemblyVolume* ExtParameterisedVolumeBuilder::BuildAssembly(PVConstLink p ...@@ -201,7 +210,9 @@ Geo2G4AssemblyVolume* ExtParameterisedVolumeBuilder::BuildAssembly(PVConstLink p
// Check if it is an assembly // Check if it is an assembly
if(m_matEther->getName() == theGeoPhysChild->getLogVol()->getMaterial()->getName() || if(m_matEther->getName() == theGeoPhysChild->getLogVol()->getMaterial()->getName() ||
m_matHypUr->getName() == theGeoPhysChild->getLogVol()->getMaterial()->getName() ) m_matHypUr->getName() == theGeoPhysChild->getLogVol()->getMaterial()->getName() ||
hasEnding(theGeoPhysChild->getLogVol()->getMaterial()->getName(), "Ether")||
hasEnding(theGeoPhysChild->getLogVol()->getMaterial()->getName(), "HyperUranium"))
{ {
// Build the child assembly // Build the child assembly
if(!(theG4AssemblyChild = BuildAssembly(theGeoPhysChild))) return 0; if(!(theG4AssemblyChild = BuildAssembly(theGeoPhysChild))) return 0;
...@@ -254,10 +265,10 @@ void ExtParameterisedVolumeBuilder::getMatEther() const ...@@ -254,10 +265,10 @@ void ExtParameterisedVolumeBuilder::getMatEther() const
{ {
GeoElement* ethElement = new GeoElement("EtherEl","ET",500.0,0.0); GeoElement* ethElement = new GeoElement("EtherEl","ET",500.0,0.0);
ethElement->ref(); ethElement->ref();
GeoMaterial* ether = new GeoMaterial("Ether",0.0); GeoMaterial* ether = new GeoMaterial("special::Ether",0.0);
ether->add(ethElement,1.); ether->add(ethElement,1.);
// "Alternative" assembly material // "Alternative" assembly material
GeoMaterial* hyperUranium = new GeoMaterial("HyperUranium",0.0); GeoMaterial* hyperUranium = new GeoMaterial("special::HyperUranium",0.0);
hyperUranium->add(ethElement,1.); hyperUranium->add(ethElement,1.);
m_matEther = ether; m_matEther = ether;
m_matHypUr = hyperUranium; m_matHypUr = hyperUranium;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment