Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -58,6 +58,8 @@
|
||||
#include "G4TwistedTrap.hh"
|
||||
#include "G4TwistedTrd.hh"
|
||||
#include "G4TwistedTubs.hh"
|
||||
#include "G4MultiUnion.hh"
|
||||
#include "G4ScaledSolid.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
@@ -505,7 +507,7 @@ G4String G4tgbGeometryDumper::DumpMaterial(G4Material* mat)
|
||||
const G4double* fractions = mat->GetFractionVector();
|
||||
for(std::size_t ii = 0; ii < numElements; ++ii)
|
||||
{
|
||||
DumpElement((*elems)[ii]);
|
||||
DumpElement(const_cast<G4Element*>((*elems)[ii]));
|
||||
}
|
||||
|
||||
(*theFile) << ":MIXT " << AddQuotes(mateName) << " " << density << " "
|
||||
@@ -513,7 +515,7 @@ G4String G4tgbGeometryDumper::DumpMaterial(G4Material* mat)
|
||||
// close start element tag and get ready to do composit "parts"
|
||||
for(std::size_t ii = 0; ii < numElements; ++ii)
|
||||
{
|
||||
(*theFile) << " " << AddQuotes(GetObjectName((*elems)[ii], theElements))
|
||||
(*theFile) << " " << AddQuotes(GetObjectName(const_cast<G4Element*>((*elems)[ii]), theElements))
|
||||
<< " " << fractions[ii] << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -637,7 +639,7 @@ G4String G4tgbGeometryDumper::DumpSolid(G4VSolid* solid,
|
||||
|
||||
G4String solidType = solid->GetEntityType();
|
||||
solidType = GetTGSolidType(solidType);
|
||||
|
||||
|
||||
if(solidType == "UNIONSOLID")
|
||||
{
|
||||
DumpBooleanVolume("UNION", solid);
|
||||
@@ -662,11 +664,19 @@ G4String G4tgbGeometryDumper::DumpSolid(G4VSolid* solid,
|
||||
G4VSolid* solidori = solidrefl->GetConstituentMovedSolid();
|
||||
DumpSolid(solidori);
|
||||
}
|
||||
else if(solidType == "MULTIUNION")
|
||||
{
|
||||
DumpMultiUnionVolume(solid);
|
||||
}
|
||||
else if(solidType == "SCALEDSOLID")
|
||||
{
|
||||
DumpScaledVolume(solid);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*theFile) << ":SOLID " << AddQuotes(solidName) << " ";
|
||||
(*theFile) << AddQuotes(solidType) << " ";
|
||||
DumpSolidParams(solid);
|
||||
DumpSolidParams( solid );
|
||||
theSolids[solidName] = solid;
|
||||
}
|
||||
|
||||
@@ -730,6 +740,57 @@ void G4tgbGeometryDumper::DumpBooleanVolume(const G4String& solidType,
|
||||
theSolids[bsoName] = bso;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4tgbGeometryDumper::DumpMultiUnionVolume( G4VSolid* so)
|
||||
{
|
||||
const G4MultiUnion* muun = dynamic_cast<const G4MultiUnion*>(so);
|
||||
if(muun != nullptr)
|
||||
{
|
||||
G4int nSolids = muun->GetNumberOfSolids();
|
||||
std::vector<G4String> rotList;
|
||||
for( G4int iso = 0; iso < nSolids; iso++ ) {
|
||||
G4Transform3D trans = muun->GetTransformation(iso);
|
||||
G4String rotName = DumpRotationMatrix( new G4RotationMatrix(trans.getRotation()));
|
||||
rotList.push_back(rotName);
|
||||
G4VSolid* solN = muun->GetSolid(iso);
|
||||
DumpSolid(solN);
|
||||
}
|
||||
G4String bsoName = GetObjectName(const_cast<G4VSolid*>(so), theSolids);
|
||||
(*theFile) << ":SOLID " << AddQuotes(bsoName) << " MULTIUNION "
|
||||
<< nSolids;
|
||||
|
||||
for( G4int iso = 0; iso < nSolids; iso++ ) {
|
||||
G4VSolid* solN = muun->GetSolid(iso);
|
||||
G4Transform3D trans = muun->GetTransformation(iso);
|
||||
G4ThreeVector pos = trans.getTranslation(); // translation is of mother frame
|
||||
(*theFile) << " " << solN->GetName()
|
||||
<< " " << " " << rotList[iso]
|
||||
<< " " << approxTo0(pos.x())
|
||||
<< " " << approxTo0(pos.y())
|
||||
<< " " << approxTo0(pos.z());
|
||||
}
|
||||
(*theFile) << G4endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4tgbGeometryDumper::DumpScaledVolume( G4VSolid* so)
|
||||
{
|
||||
const G4ScaledSolid* ssol = dynamic_cast<const G4ScaledSolid*>(so);
|
||||
if(ssol != nullptr)
|
||||
{
|
||||
G4VSolid* unscaledSolid = ssol->GetUnscaledSolid();
|
||||
G4Scale3D scaleTransf = ssol->GetScaleTransform();
|
||||
G4String bsoName = GetObjectName(const_cast<G4VSolid*>(so), theSolids);
|
||||
(*theFile) << ":SOLID " << AddQuotes(bsoName) << " SCALED "
|
||||
<< unscaledSolid->GetName() << " "
|
||||
<< scaleTransf.xx() << " "
|
||||
<< scaleTransf.yy() << " "
|
||||
<< scaleTransf.zz() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4tgbGeometryDumper::DumpSolidParams(G4VSolid* so)
|
||||
{
|
||||
@@ -875,9 +936,15 @@ std::vector<G4double> G4tgbGeometryDumper::GetSolidParams(const G4VSolid* so)
|
||||
{
|
||||
angphi -= 360 * deg;
|
||||
}
|
||||
G4int ncor = plc->GetNumRZCorner();
|
||||
G4double endphi = plc->GetEndPhi() / deg;
|
||||
if(endphi > 180 * deg)
|
||||
{
|
||||
endphi -= 360 * deg;
|
||||
}
|
||||
params.push_back(angphi);
|
||||
params.push_back(plc->GetOriginalParameters()->Opening_angle / deg);
|
||||
params.push_back(endphi - angphi);
|
||||
// params.push_back(plc->GetOriginalParameters()->Opening_angle / deg);
|
||||
G4int ncor = plc->GetNumRZCorner();
|
||||
params.push_back(ncor);
|
||||
|
||||
for(G4int ii = 0; ii < ncor; ++ii)
|
||||
@@ -903,9 +970,9 @@ std::vector<G4double> G4tgbGeometryDumper::GetSolidParams(const G4VSolid* so)
|
||||
{
|
||||
endphi -= 360 * deg;
|
||||
}
|
||||
G4int ncor = plc->GetNumRZCorner();
|
||||
params.push_back(angphi);
|
||||
params.push_back(endphi - angphi);
|
||||
G4int ncor = plc->GetNumRZCorner();
|
||||
params.push_back(ncor);
|
||||
|
||||
for(G4int ii = 0; ii < ncor; ++ii)
|
||||
@@ -1043,7 +1110,7 @@ std::vector<G4double> G4tgbGeometryDumper::GetSolidParams(const G4VSolid* so)
|
||||
else
|
||||
{
|
||||
G4String ErrMessage = "Solid type not supported, sorry... " + solidType;
|
||||
G4Exception("G4tgbGeometryDumpe::DumpSolidParams()", "NotImplemented",
|
||||
G4Exception("G4tgbGeometryDumper::DumpSolidParams()", "NotImplemented",
|
||||
FatalException, ErrMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ G4Material* G4tgbMaterialSimple::BuildG4Material()
|
||||
|
||||
G4Material* mate =
|
||||
new G4Material(GetName(), GetZ(), GetA(), theTgrMate->GetDensity(),
|
||||
kStateUndefined, STP_Temperature);
|
||||
kStateUndefined, NTP_Temperature);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if(G4tgrMessenger::GetVerboseLevel() >= 2)
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
#include "G4tgrSolid.hh"
|
||||
#include "G4tgrSolidBoolean.hh"
|
||||
#include "G4tgrSolidMultiUnion.hh"
|
||||
#include "G4tgrSolidScaled.hh"
|
||||
#include "G4tgrVolume.hh"
|
||||
#include "G4tgrVolumeDivision.hh"
|
||||
#include "G4tgrVolumeAssembly.hh"
|
||||
@@ -53,6 +55,8 @@
|
||||
#include "G4UnionSolid.hh"
|
||||
#include "G4SubtractionSolid.hh"
|
||||
#include "G4IntersectionSolid.hh"
|
||||
#include "G4MultiUnion.hh"
|
||||
#include "G4ScaledSolid.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
@@ -355,7 +359,8 @@ G4VSolid* G4tgbVolume::FindOrConstructG4Solid(const G4tgrSolid* sol)
|
||||
solid = new G4Torus(sname, solParam[0], solParam[1], solParam[2],
|
||||
solParam[3], phiDelta);
|
||||
}
|
||||
else if(stype == "POLYCONE")
|
||||
else if(stype == "POLYCONE"
|
||||
|| stype == "GENERICPOLYCONE")
|
||||
{
|
||||
std::size_t nplanes = std::size_t(solParam[2]);
|
||||
G4bool genericPoly = false;
|
||||
@@ -399,7 +404,7 @@ G4VSolid* G4tgbVolume::FindOrConstructG4Solid(const G4tgrSolid* sol)
|
||||
{
|
||||
phiTotal = twopi;
|
||||
}
|
||||
solid = new G4Polycone(sname, solParam[0], phiTotal, // start,delta-phi
|
||||
solid = new G4Polycone(sname, solParam[0], phiTotal*deg, // start,delta-phi
|
||||
nplanes, // sections
|
||||
&((*z_p)[0]), &((*rmin_p)[0]), &((*rmax_p)[0]));
|
||||
}
|
||||
@@ -418,7 +423,7 @@ G4VSolid* G4tgbVolume::FindOrConstructG4Solid(const G4tgrSolid* sol)
|
||||
phiTotal = twopi;
|
||||
}
|
||||
solid =
|
||||
new G4GenericPolycone(sname, solParam[0], phiTotal, // start,delta-phi
|
||||
new G4GenericPolycone(sname, solParam[0], phiTotal*deg, // start,delta-phi
|
||||
nplanes, // sections
|
||||
&((*R_c)[0]), &((*Z_c)[0]));
|
||||
}
|
||||
@@ -540,6 +545,19 @@ G4VSolid* G4tgbVolume::FindOrConstructG4Solid(const G4tgrSolid* sol)
|
||||
CheckNoSolidParams(stype, 6, solParam.size());
|
||||
solid = new G4TwistedTrd(sname, solParam[0], solParam[1], solParam[2],
|
||||
solParam[3], solParam[4], solParam[5]);
|
||||
}
|
||||
else if(stype == "SCALED")
|
||||
{
|
||||
const G4tgrSolidScaled* tgrSol = dynamic_cast<const G4tgrSolidScaled*>(sol);
|
||||
if(tgrSol == nullptr)
|
||||
{
|
||||
G4Exception("G4tgbVolume::FindOrConstructG4Solid()", "InvalidSetup",
|
||||
FatalException, "Invalid Solid pointer");
|
||||
return nullptr;
|
||||
}
|
||||
G4VSolid* sol0 = FindOrConstructG4Solid(tgrSol->GetOrigSolid());
|
||||
G4Scale3D scale = tgrSol->GetScale3d();
|
||||
solid = new G4ScaledSolid(sname, sol0, scale);
|
||||
}
|
||||
else if(stype == "TWISTEDTUBS")
|
||||
{
|
||||
@@ -715,6 +733,30 @@ G4VSolid* G4tgbVolume::FindOrConstructG4Solid(const G4tgrSolid* sol)
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else if(stype == "MULTIUNION")
|
||||
{
|
||||
const G4tgrSolidMultiUnion* tgrSol = dynamic_cast<const G4tgrSolidMultiUnion*>(sol);
|
||||
if(tgrSol == nullptr)
|
||||
{
|
||||
G4Exception("G4tgbVolume::FindOrConstructG4Solid()", "InvalidSetup",
|
||||
FatalException, "Invalid Solid pointer");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
G4int nsol = tgrSol->GetNSolid();
|
||||
G4VSolid* soli;
|
||||
G4Transform3D tri;
|
||||
G4MultiUnion* solidu = new G4MultiUnion(sname);
|
||||
|
||||
for (G4int i=0; i<nsol; ++i)
|
||||
{
|
||||
soli = FindOrConstructG4Solid(tgrSol->GetSolid(i));
|
||||
tri = tgrSol->GetTransformation(i);
|
||||
solidu->AddNode(*soli, tri);
|
||||
}
|
||||
solidu->Voxelize();
|
||||
solid = dynamic_cast<G4VSolid*>(solidu);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4String ErrMessage =
|
||||
|
||||
@@ -57,44 +57,44 @@ void G4tgrEvaluator::print_error(G4int estatus) const
|
||||
}
|
||||
}
|
||||
|
||||
G4double fsin(G4double arg) { return std::sin(arg); }
|
||||
G4double fcos(G4double arg) { return std::cos(arg); }
|
||||
G4double ftan(G4double arg) { return std::tan(arg); }
|
||||
G4double fasin(G4double arg) { return std::asin(arg); }
|
||||
G4double facos(G4double arg) { return std::acos(arg); }
|
||||
G4double fatan(G4double arg) { return std::atan(arg); }
|
||||
G4double fatan2(G4double arg1, G4double arg2) { return std::atan2(arg1, arg2); }
|
||||
G4double fsinh(G4double arg) { return std::sinh(arg); }
|
||||
G4double fcosh(G4double arg) { return std::cosh(arg); }
|
||||
G4double ftanh(G4double arg) { return std::tanh(arg); }
|
||||
// G4double fasinh( G4double arg ){ return std::asinh(arg); }
|
||||
// G4double facosh( G4double arg ){ return std::acosh(arg); }
|
||||
// G4double fatanh( G4double arg ){ return std::atanh(arg); }
|
||||
G4double fsqrt(G4double arg) { return std::sqrt(arg); }
|
||||
G4double fexp(G4double arg) { return std::exp(arg); }
|
||||
G4double flog(G4double arg) { return std::log(arg); }
|
||||
G4double flog10(G4double arg) { return std::log10(arg); }
|
||||
G4double fpow(G4double arg1, G4double arg2) { return std::pow(arg1, arg2); }
|
||||
G4double fltsin(G4double arg) { return std::sin(arg); }
|
||||
G4double fltcos(G4double arg) { return std::cos(arg); }
|
||||
G4double flttan(G4double arg) { return std::tan(arg); }
|
||||
G4double fltasin(G4double arg) { return std::asin(arg); }
|
||||
G4double fltacos(G4double arg) { return std::acos(arg); }
|
||||
G4double fltatan(G4double arg) { return std::atan(arg); }
|
||||
G4double fltatan2(G4double arg1, G4double arg2) { return std::atan2(arg1, arg2); }
|
||||
G4double fltsinh(G4double arg) { return std::sinh(arg); }
|
||||
G4double fltcosh(G4double arg) { return std::cosh(arg); }
|
||||
G4double flttanh(G4double arg) { return std::tanh(arg); }
|
||||
// G4double fltasinh( G4double arg ){ return std::asinh(arg); }
|
||||
// G4double fltacosh( G4double arg ){ return std::acosh(arg); }
|
||||
// G4double fltatanh( G4double arg ){ return std::atanh(arg); }
|
||||
G4double fltsqrt(G4double arg) { return std::sqrt(arg); }
|
||||
G4double fltexp(G4double arg) { return std::exp(arg); }
|
||||
G4double fltlog(G4double arg) { return std::log(arg); }
|
||||
G4double fltlog10(G4double arg) { return std::log10(arg); }
|
||||
G4double fltpow(G4double arg1, G4double arg2) { return std::pow(arg1, arg2); }
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4tgrEvaluator::AddCommonFunctions()
|
||||
{
|
||||
setFunction("sin", (*fsin));
|
||||
setFunction("cos", (*fcos));
|
||||
setFunction("tan", (*ftan));
|
||||
setFunction("asin", (*fasin));
|
||||
setFunction("acos", (*facos));
|
||||
setFunction("atan", (*fatan));
|
||||
setFunction("atan2", (*fatan2));
|
||||
setFunction("sinh", (*fsinh));
|
||||
setFunction("cosh", (*fcosh));
|
||||
setFunction("tanh", (*ftanh));
|
||||
// setFunction("asinh", (*fasinh));
|
||||
// setFunction("acosh", (*facosh));
|
||||
// setFunction("atanh", (*fatanh));
|
||||
setFunction("sqrt", (*fsqrt));
|
||||
setFunction("exp", (*fexp));
|
||||
setFunction("log", (*flog));
|
||||
setFunction("log10", (*flog10));
|
||||
setFunction("pow", (*fpow));
|
||||
setFunction("sin", (*fltsin));
|
||||
setFunction("cos", (*fltcos));
|
||||
setFunction("tan", (*flttan));
|
||||
setFunction("asin", (*fltasin));
|
||||
setFunction("acos", (*fltacos));
|
||||
setFunction("atan", (*fltatan));
|
||||
setFunction("atan2", (*fltatan2));
|
||||
setFunction("sinh", (*fltsinh));
|
||||
setFunction("cosh", (*fltcosh));
|
||||
setFunction("tanh", (*flttanh));
|
||||
// setFunction("asinh", (*fltasinh));
|
||||
// setFunction("acosh", (*fltacosh));
|
||||
// setFunction("atanh", (*fltatanh));
|
||||
setFunction("sqrt", (*fltsqrt));
|
||||
setFunction("exp", (*fltexp));
|
||||
setFunction("log", (*fltlog));
|
||||
setFunction("log10", (*fltlog10));
|
||||
setFunction("pow", (*fltpow));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4tgrMaterial::G4tgrMaterial()
|
||||
: theTemperature(STP_Temperature)
|
||||
: theTemperature(NTP_Temperature)
|
||||
, thePressure(STP_Pressure)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4tgrSolidMultiUnion implementation
|
||||
//
|
||||
// Author: P.Heidary, AEOI - November 2021
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4tgrSolidMultiUnion.hh"
|
||||
#include "G4tgrUtils.hh"
|
||||
#include "G4tgrVolume.hh"
|
||||
#include "G4tgrVolumeMgr.hh"
|
||||
#include "G4tgrMessenger.hh"
|
||||
#include "G4tgbRotationMatrixMgr.hh"
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4tgrSolidMultiUnion::G4tgrSolidMultiUnion(const std::vector<G4String>& wl)
|
||||
{
|
||||
// :SOLID/:VOLU SOL MULTIUNION NSOL SOL1 ROTM1 POSX1 POSY1 POSZ1
|
||||
// SOL2 ROTM2 POSX2 POSY2 POSZ2 ...
|
||||
|
||||
//---------- Set name
|
||||
theName = G4tgrUtils::GetString(wl[1]);
|
||||
nSolid = G4tgrUtils::GetInt(wl[3]);
|
||||
G4tgrVolumeMgr* volmgr = G4tgrVolumeMgr::GetInstance();
|
||||
const G4tgrSolid* sol1;
|
||||
|
||||
if(G4int(wl.size()) != 4 + 5*nSolid)
|
||||
{
|
||||
G4String Err1 = "Solid type MULTIUNION with ";
|
||||
G4String Err2 = std::to_string(nSolid);
|
||||
G4String Err3 = " Solids, should have ";
|
||||
G4String Err4 = std::to_string(4 + 5*nSolid);
|
||||
G4String Err5 = " parameters.";
|
||||
G4String Err6 = " It has "+G4UIcommand::ConvertToString(int(wl.size()));
|
||||
|
||||
G4String ErrMessage = Err1 + Err2 + Err3 + Err4 + Err5 + Err6;
|
||||
|
||||
G4tgrUtils::DumpVS(wl, "G4tgrSolidMultiUnion::G4tgrSolidMultiUnion()");
|
||||
G4Exception("G4tgrSolidMultiUnion::G4tgrSolidMultiUnion()", "InvalidInput",
|
||||
FatalException, ErrMessage);
|
||||
}
|
||||
|
||||
for (G4int i = 4; i< nSolid*5; i+=5)
|
||||
{
|
||||
sol1 = volmgr->FindSolid(G4tgrUtils::GetString(wl[i]));
|
||||
if(sol1 == nullptr)
|
||||
{
|
||||
sol1 = volmgr->FindVolume(G4tgrUtils::GetString(wl[i]), 1)->GetSolid();
|
||||
}
|
||||
theSolids.push_back(sol1);
|
||||
|
||||
//---------- Populate transformation matrix
|
||||
theRotMatName = G4tgrUtils::GetString(wl[i + 1]);
|
||||
theRotMat =
|
||||
G4tgbRotationMatrixMgr::GetInstance()->FindOrBuildG4RotMatrix(theRotMatName);
|
||||
thePosition =
|
||||
G4ThreeVector(G4tgrUtils::GetDouble(wl[i+2]),
|
||||
G4tgrUtils::GetDouble(wl[i+3]),
|
||||
G4tgrUtils::GetDouble(wl[i+4]));
|
||||
tr1 = G4Transform3D(*theRotMat, thePosition);
|
||||
theTransformations.push_back(tr1);
|
||||
}
|
||||
|
||||
// ---------- Set solid type
|
||||
G4String wl2 = wl[2];
|
||||
for(std::size_t ii = 0; ii < wl2.length(); ++ii)
|
||||
{
|
||||
wl2[ii] = toupper(wl2[ii]);
|
||||
}
|
||||
theType = wl2;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if(G4tgrMessenger::GetVerboseLevel() >= 1)
|
||||
{
|
||||
G4cout << " Created " << *this << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4tgrVolumeMgr::GetInstance()->RegisterMe(this);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4tgrSolidMultiUnion::~G4tgrSolidMultiUnion()
|
||||
{
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
std::ostream& operator<<(std::ostream& os, const G4tgrSolidMultiUnion& sol)
|
||||
{
|
||||
os << "G4tgrSolidMultiUnion= " << sol.theName << " of type " << sol.theType
|
||||
<< " PARAMS: ";
|
||||
if(sol.theSolidParams.size() != 0)
|
||||
{
|
||||
std::vector<G4double> solpar = *(sol.theSolidParams[0]);
|
||||
for(std::size_t ii = 0; ii < solpar.size(); ++ii)
|
||||
{
|
||||
os << solpar[ii] << " ";
|
||||
}
|
||||
}
|
||||
os << G4endl;
|
||||
|
||||
return os;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4tgrSolidScaled implementation
|
||||
//
|
||||
// Author: P.Heidary, AEOI - November 2021
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4tgrSolidScaled.hh"
|
||||
#include "G4tgrUtils.hh"
|
||||
#include "G4tgrVolume.hh"
|
||||
#include "G4tgrVolumeMgr.hh"
|
||||
#include "G4tgrMessenger.hh"
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4tgrSolidScaled::G4tgrSolidScaled(const std::vector<G4String>& wl)
|
||||
{
|
||||
// :SOLID/:VOLU SOL1 SCALED SOL0 SCLAEX SCALEY SCALEZ
|
||||
if(wl.size() != 7)
|
||||
{
|
||||
G4tgrUtils::DumpVS(wl, "G4tgrSolidScaled::G4tgrSolidScaled()");
|
||||
G4Exception("G4tgrSolidScaled::G4tgrSolidScaled()", "InvalidInput",
|
||||
FatalException, "Line read with less or more than 7 words.");
|
||||
}
|
||||
|
||||
//---------- Set name
|
||||
theName = G4tgrUtils::GetString(wl[1]);
|
||||
|
||||
G4tgrVolumeMgr* volmgr = G4tgrVolumeMgr::GetInstance();
|
||||
origSolid = volmgr->FindSolid(G4tgrUtils::GetString(wl[3]));
|
||||
if(origSolid == nullptr)
|
||||
{
|
||||
origSolid = volmgr->FindVolume(G4tgrUtils::GetString(wl[3]), 1)->GetSolid();
|
||||
}
|
||||
|
||||
//---------- Set scale vector
|
||||
scale3d = G4Scale3D(G4tgrUtils::GetDouble(wl[4]), G4tgrUtils::GetDouble(wl[5]),
|
||||
G4tgrUtils::GetDouble(wl[6]));
|
||||
|
||||
//---------- Set solid type
|
||||
G4String wl2 = wl[2];
|
||||
for(std::size_t ii = 0; ii < wl2.length(); ++ii)
|
||||
{
|
||||
wl2[ii] = toupper(wl2[ii]);
|
||||
}
|
||||
theType = wl2;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if(G4tgrMessenger::GetVerboseLevel() >= 1)
|
||||
{
|
||||
G4cout << " Created " << *this << G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
G4tgrVolumeMgr::GetInstance()->RegisterMe(this);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4tgrSolidScaled::~G4tgrSolidScaled()
|
||||
{
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
std::ostream& operator<<(std::ostream& os, const G4tgrSolidScaled& sol)
|
||||
{
|
||||
os << "G4tgrSolidScaled= " << sol.theName << " of type " << sol.theType
|
||||
<< " original solid: " << sol.origSolid->GetName() << " Scale x: " <<
|
||||
sol.scale3d.xx() << " Scale y: " << sol.scale3d.yy() <<
|
||||
" Scale z: " << sol.scale3d.zz() << G4endl;
|
||||
|
||||
return os;
|
||||
}
|
||||
@@ -249,7 +249,7 @@ G4double G4tgrUtils::GetDouble(const G4String& str, G4double unitval)
|
||||
// Check if it is not an exponential
|
||||
//
|
||||
if((ii < 2) || ((cstr[ii - 1] != 'E') && (cstr[ii - 1] != 'e')) ||
|
||||
!IsNumber(cstr[ii - 2]))
|
||||
!IsNumber(G4String(1,cstr[ii - 2])))
|
||||
{
|
||||
separators.insert(ii);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "G4tgrMessenger.hh"
|
||||
#include "G4tgrSolid.hh"
|
||||
#include "G4tgrSolidBoolean.hh"
|
||||
#include "G4tgrSolidMultiUnion.hh"
|
||||
#include "G4tgrSolidScaled.hh"
|
||||
|
||||
G4ThreadLocal G4tgrVolumeMgr* G4tgrVolumeMgr::theInstance = nullptr;
|
||||
|
||||
@@ -89,6 +91,16 @@ G4tgrSolid* G4tgrVolumeMgr::CreateSolid(const std::vector<G4String>& wl,
|
||||
//---------- Create G4tgrSolidBoolean and fill the solid params
|
||||
sol = new G4tgrSolidBoolean(wlc);
|
||||
}
|
||||
else if(wl2 == "SCALED")
|
||||
{
|
||||
//---------- Create G4tgrSolidScaled and fill the solid params
|
||||
sol = new G4tgrSolidScaled(wlc);
|
||||
}
|
||||
else if(wl2 == "MULTIUNION")
|
||||
{
|
||||
//---------- Create G4tgrSolidMultiUnion and fill the solid params
|
||||
sol = new G4tgrSolidMultiUnion(wlc);
|
||||
}
|
||||
else
|
||||
{
|
||||
//---------- Create G4tgrSolidSimple and fill the solid params
|
||||
|
||||
Reference in New Issue
Block a user