Skip to content

Commit

Permalink
Merge pull request #31 from maureeungaro/main
Browse files Browse the repository at this point in the history
particle verbosity and GEMCDB_ENV
  • Loading branch information
maureeungaro authored May 1, 2023
2 parents 48e943f + c6897ff commit dd6fad3
Show file tree
Hide file tree
Showing 26 changed files with 654 additions and 553 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/testSciG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ jobs:
fail-fast: false
matrix:
examples:
- examples/basic_materials
- examples/cad_imports
- examples/dosimeter
- examples/simple_flux
- examples/flux_detector
- examples/scintillator_array
- examples/sqlite_db
- examples/variations

steps:
# GitHub Actions do not automatically checkout your projects. If you need the code
# you need to check it out.
Expand Down
4 changes: 4 additions & 0 deletions ci/testC12.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ done
# notice the gemc version is the one in the container, here we are
# recompiling it using the checked out glibrary
./ci/build.sh
if [ $? -ne 0 ]; then
echo glibrary / gemc build failed
exit 1
fi

# using the checked out GLIBRARY
export GLIBRARY=`pwd`
Expand Down
6 changes: 5 additions & 1 deletion ci/testSciG.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ done
# build glibrary / gemc
# notice the gemc version is the one in the container, here we are
# recompiling it using the checked out glibrary
./ci/build.sh
./ci/build.sh # build glibrary / gemc
if [ $? -ne 0 ]; then
echo glibrary / gemc build failed
exit 1
fi

# using the checked out GLIBRARY - notice we need to set these here again
export GLIBRARY=`pwd`
Expand Down
5 changes: 3 additions & 2 deletions eventDispenser/eventDispenserOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ vector<GOption> defineOptions() {

json jsonEDVerbosity = {
{GNAME, "edistv"},
{GDESC, GVERBOSITY_DESCRIPTION},
{GDFLT, 0}
{GDESC, "Verbosity for eventDispenser. " + string(GVERBOSITY_DESCRIPTION)},

{GDFLT, 0}
};
goptions.push_back(GOption(jsonEDVerbosity));

Expand Down
4 changes: 2 additions & 2 deletions g4display/g4displayOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ vector<GOption> defineOptions() {
// g4display verbosity
json jsonMessageVerbosity = {
{GNAME, "g4displayv"},
{GDESC, GVERBOSITY_DESCRIPTION},
{GDFLT, 0}
{GDESC, "Verbosity for g4display. " + string(GVERBOSITY_DESCRIPTION)},
{GDFLT, 0}
};
goptions.push_back(GOption(jsonMessageVerbosity));

Expand Down
144 changes: 72 additions & 72 deletions g4system/g4objectsFactories/g4native/buildSolid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,88 +47,88 @@ G4VSolid* G4NativeSystemFactory::buildSolid(GOptions* gopt, GVolume *s, map<stri
string type = s->getType();

if(type == "G4Box") {
thisG4Volume->setSolid(new G4Box(g4name, ///< name
pars[0], ///< half length in X
pars[1], ///< half length in Y
pars[2] ///< half length in Z
thisG4Volume->setSolid(new G4Box(g4name, // name
pars[0], // half length in X
pars[1], // half length in Y
pars[2] // half length in Z
), verbosity
);

return thisG4Volume->getSolid();

} else if(type == "G4Tubs") {
thisG4Volume->setSolid(new G4Tubs(g4name, ///< name
pars[0], ///< Inner radius
pars[1], ///< Outer radius
pars[2], ///< Half length in z
pars[3], ///< Starting phi angle
pars[4] ///< Delta Phi angle
thisG4Volume->setSolid(new G4Tubs(g4name, // name
pars[0], // Inner radius
pars[1], // Outer radius
pars[2], // Half length in z
pars[3], // Starting phi angle
pars[4] // Delta Phi angle
), verbosity
);

return thisG4Volume->getSolid();

} else if(type == "G4Sphere") {
thisG4Volume->setSolid(new G4Sphere(g4name, ///< name
pars[0], ///< Inner radius
pars[1], ///< Outer radius
pars[2], ///< Starting phi angle
pars[3], ///< Delta Phi angle
pars[4], ///< Starting delta angle
pars[5] ///< Delta delta angle
thisG4Volume->setSolid(new G4Sphere(g4name, // name
pars[0], // Inner radius
pars[1], // Outer radius
pars[2], // Starting phi angle
pars[3], // Delta Phi angle
pars[4], // Starting delta angle
pars[5] // Delta delta angle
), verbosity
);

return thisG4Volume->getSolid();

} else if(type == "G4CutTubs") {
thisG4Volume->setSolid(new G4CutTubs(g4name, ///< name
pars[0], ///< Inner radius
pars[1], ///< Outer radius
pars[2], ///< Half length in z
pars[3], ///< Starting phi angle
pars[4], ///< Delta Phi angle
G4ThreeVector(pars[5], pars[6], pars[7]), ///< Outside Normal at -z
G4ThreeVector(pars[8], pars[9], pars[10]) ///< Outside Normal at +z
thisG4Volume->setSolid(new G4CutTubs(g4name, // name
pars[0], // Inner radius
pars[1], // Outer radius
pars[2], // Half length in z
pars[3], // Starting phi angle
pars[4], // Delta Phi angle
G4ThreeVector(pars[5], pars[6], pars[7]), // Outside Normal at -z
G4ThreeVector(pars[8], pars[9], pars[10]) // Outside Normal at +z
), verbosity
);

return thisG4Volume->getSolid();

} else if(type == "G4Cons") {
thisG4Volume->setSolid(new G4Cons(g4name, ///< name
pars[0], ///< Inside radius at -pDz
pars[1], ///< Outside radius at -pDz
pars[2], ///< Inside radius at +pDz
pars[3], ///< Outside radius at +pDz
pars[4], ///< Half length in z
pars[5], ///< Starting phi angle
pars[6] ///< Delta Phi angle
thisG4Volume->setSolid(new G4Cons(g4name, // name
pars[0], // Inside radius at -pDz
pars[1], // Outside radius at -pDz
pars[2], // Inside radius at +pDz
pars[3], // Outside radius at +pDz
pars[4], // Half length in z
pars[5], // Starting phi angle
pars[6] // Delta Phi angle
), verbosity
);

return thisG4Volume->getSolid();

} else if(type == "G4Para") {
thisG4Volume->setSolid(new G4Para(g4name, ///< name
pars[0], ///< Half length in x
pars[1], ///< Half length in y
pars[2], ///< Half length in z
pars[3], ///< Angle formed by the y axis and by the plane joining the centre of the faces parallel to the z-x plane at -dy and +dy
pars[4], ///< Polar angle of the line joining the centres of the faces at -dz and +dz in z
pars[5] ///< Azimuthal angle of the line joining the centres of the faces at -dz and +dz in z
thisG4Volume->setSolid(new G4Para(g4name, // name
pars[0], // Half length in x
pars[1], // Half length in y
pars[2], // Half length in z
pars[3], // Angle formed by the y axis and by the plane joining the centre of the faces parallel to the z-x plane at -dy and +dy
pars[4], // Polar angle of the line joining the centres of the faces at -dz and +dz in z
pars[5] // Azimuthal angle of the line joining the centres of the faces at -dz and +dz in z
), verbosity
);

return thisG4Volume->getSolid();

} else if(type == "G4Trd") {
thisG4Volume->setSolid(new G4Trd(g4name, ///< name
pars[0], ///< Half-length along x at the surface positioned at -dz
pars[1], ///< Half-length along x at the surface positioned at +dz
pars[2], ///< Half-length along y at the surface positioned at -dz
pars[3], ///< Half-length along y at the surface positioned at +dz
pars[4] ///< Half-length along z axis
thisG4Volume->setSolid(new G4Trd(g4name, // name
pars[0], // Half-length along x at the surface positioned at -dz
pars[1], // Half-length along x at the surface positioned at +dz
pars[2], // Half-length along y at the surface positioned at -dz
pars[3], // Half-length along y at the surface positioned at +dz
pars[4] // Half-length along z axis
), verbosity
);
return thisG4Volume->getSolid();
Expand All @@ -142,27 +142,27 @@ G4VSolid* G4NativeSystemFactory::buildSolid(GOptions* gopt, GVolume *s, map<stri

// Right Angular Wedge (4 parameters)
if ( pars.size() == 4 ) {
thisG4Volume->setSolid(new G4Trap(g4name, ///< name
pars[0], ///< Length along Z
pars[1], ///< Length along Y
pars[2], ///< Length along X wider side
pars[3] ///< Length along X at the narrower side (plTX<=pX)
thisG4Volume->setSolid(new G4Trap(g4name, // name
pars[0], // Length along Z
pars[1], // Length along Y
pars[2], // Length along X wider side
pars[3] // Length along X at the narrower side (plTX<=pX)
), verbosity
);
// general trapezoid (11 parameters)
} else if ( pars.size() == 11) {
thisG4Volume->setSolid(new G4Trap(g4name, ///< name
pars[0], ///< Half Z length - distance from the origin to the bases
pars[1], ///< Polar angle of the line joining the centres of the bases at -/+pDz
pars[2], ///< Azimuthal angle of the line joining the centre of the base at -pDz to the centre of the base at +pDz
pars[3], ///< Half Y length of the base at -pDz
pars[4], ///< Half Y length of the base at +pDz
pars[5], ///< Half X length at smaller Y of the base at -pDz
pars[6], ///< Half X length at bigger Y of the base at -pDz
pars[7], ///< Half X length at smaller Y of the base at +pDz
pars[8], ///< Half X length at bigger y of the base at +pDz
pars[9], ///< Angle between the Y-axis and the centre line of the base at -pDz (lower endcap)
pars[10] ///< Angle between the Y-axis and the centre line of the base at +pDz (upper endcap)
thisG4Volume->setSolid(new G4Trap(g4name, // name
pars[0], // Half Z length - distance from the origin to the bases
pars[1], // Polar angle of the line joining the centres of the bases at -/+pDz
pars[2], // Azimuthal angle of the line joining the centre of the base at -pDz to the centre of the base at +pDz
pars[3], // Half Y length of the base at -pDz
pars[4], // Half Y length of the base at +pDz
pars[5], // Half X length at smaller Y of the base at -pDz
pars[6], // Half X length at bigger Y of the base at -pDz
pars[7], // Half X length at smaller Y of the base at +pDz
pars[8], // Half X length at bigger y of the base at +pDz
pars[9], // Angle between the Y-axis and the centre line of the base at -pDz (lower endcap)
pars[10] // Angle between the Y-axis and the centre line of the base at +pDz (upper endcap)
), verbosity
);

Expand All @@ -179,8 +179,8 @@ G4VSolid* G4NativeSystemFactory::buildSolid(GOptions* gopt, GVolume *s, map<stri
pt[6] = G4ThreeVector(pars[18], pars[19], pars[20]);
pt[7] = G4ThreeVector(pars[21], pars[22], pars[23]);

thisG4Volume->setSolid(new G4Trap(g4name, ///< name
pt ///< Coordinates of the vertices
thisG4Volume->setSolid(new G4Trap(g4name, // name
pt // Coordinates of the vertices
), verbosity
);

Expand All @@ -207,13 +207,13 @@ G4VSolid* G4NativeSystemFactory::buildSolid(GOptions* gopt, GVolume *s, map<stri
rOuter[zpl] = pars[3 + 2*zplanes + zpl] ;
}

thisG4Volume->setSolid(new G4Polycone(g4name, ///< name
phistart, ///< Initial Phi starting angle
phitotal, ///< Total Phi angle
zplanes, ///< Number of z planes
zPlane, ///< z coordinate of corners
rInner, ///< Tangent distance to inner surface
rOuter ///< Tangent distance to outer surface, verbosity
thisG4Volume->setSolid(new G4Polycone(g4name, // name
phistart, // Initial Phi starting angle
phitotal, // Total Phi angle
zplanes, // Number of z planes
zPlane, // z coordinate of corners
rInner, // Tangent distance to inner surface
rOuter // Tangent distance to outer surface, verbosity
), verbosity
);

Expand Down
4 changes: 2 additions & 2 deletions g4system/g4systemOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ vector<GOption> defineOptions() {

json jsonG4WorldVerbosity = {
{GNAME, G4SYSTEMVERBOSITY},
{GDESC, GVERBOSITY_DESCRIPTION},
{GDFLT, 1}
{GDESC, "Verbosity for g4system. " + string(GVERBOSITY_DESCRIPTION)},
{GDFLT, 1}
};
goptions.push_back(GOption(jsonG4WorldVerbosity));

Expand Down
1 change: 0 additions & 1 deletion g4system/g4world.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ using namespace std;

G4World::G4World(GWorld *gworld, GOptions* gopts) {


// instantiating volumes map
g4volumesMap = new map<string, G4Volume*>;
g4materialsMap = new map<string, G4Material*>;
Expand Down
4 changes: 2 additions & 2 deletions gfactory/gdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static void close_lib(dlhandle handle);
struct DynamicLib {

private:
std::string dlFileName; ///< dynamic library file
std::string dlFileName; // dynamic library file
int verbosity = 0;

bool doesFileExists(const std::string& name) {
Expand All @@ -44,7 +44,7 @@ struct DynamicLib {
public:
// default constructor
DynamicLib() = default;
dlhandle handle = nullptr; ///< posix handle of the dynamic library
dlhandle handle = nullptr; // posix handle of the dynamic library

DynamicLib(std::string path, int v = 0) : dlFileName(path), verbosity(v), handle(nullptr) {

Expand Down
12 changes: 6 additions & 6 deletions goptions/goptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ class GOptions
*/
void printSettings(bool withDefaults);

int getInt(string tag); ///< gets the integer value associated with non structured option \"tag\"
float getFloat(string tag); ///< gets the float value associated with non structured option \"tag\"
double getDouble(string tag); ///< gets the double value associated with non structured option \"tag\"
string getString(string tag); ///< gets the string value associated with non structured option \"tag\"
bool getSwitch(string tag); ///< gets the bool value associated with switch \"tag\"
int getInt(string tag); // gets the integer value associated with non structured option \"tag\"
float getFloat(string tag); // gets the float value associated with non structured option \"tag\"
double getDouble(string tag); // gets the double value associated with non structured option \"tag\"
string getString(string tag); // gets the string value associated with non structured option \"tag\"
bool getSwitch(string tag); // gets the bool value associated with switch \"tag\"

string jcardFilename; ///< jcard with path, specified by the command line
string jcardFilename; // jcard with path, specified by the command line

/**
* @brief Get the (structured) option json values corresponding to a tag
Expand Down
Loading

0 comments on commit dd6fad3

Please sign in to comment.