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

Merge branch 'quiet_gmclash' into 'master'

Add verbosity flag to gmclash - off  by default

See merge request !112
parents 34bdf305 f6d3e3fc
No related branches found
No related tags found
1 merge request!112Add verbosity flag to gmclash - off by default
......@@ -12,6 +12,7 @@
#include <iostream>
#include <iomanip>
G4bool gmclash_verbose =false;
static G4String geometryFileName ;
static G4String reportFileName = "gmclash_report.json";
......@@ -24,10 +25,11 @@ int main(int argc, char** argv) {
GetInputArguments(argc, argv);
G4cout
<< " =================== Running GeoModelClash =================== " << G4endl
<< " =================== Running GeoModelClash =================== " << G4endl
<< " Geometry file name = " << geometryFileName << G4endl
<< " Output clashes report file name = " << reportFileName << G4endl
<< " ============================================================== " << G4endl;
<< " Verbose output = " << gmclash_verbose << G4endl
<< " ============================================================== " << G4endl;
// version banner
G4String vs = G4Version;
......@@ -64,6 +66,7 @@ int main(int argc, char** argv) {
detector->SetRunOverlapCheck(true);
detector->SetGeometryFileName (geometryFileName);
detector->SetReportFileName (reportFileName);
detector->SetGMClashVerbosity(gmclash_verbose);
detector->Construct();
delete detector;
......@@ -73,6 +76,7 @@ int main(int argc, char** argv) {
static struct option options[] = {
{"geometry file name " , required_argument, 0, 'g'},
{"output clashes report file name " , required_argument, 0, 'o'},
{"verbose output " , no_argument , 0, 'v'},
{"help" , no_argument , 0, 'h'},
{0, 0, 0, 0}
};
......@@ -85,6 +89,7 @@ void Help() {
<<" **** Parameters: \n\n"
<<" -g : [MANDATORY] the Geometry file name [.db/.gdml/.dylib/.so] \n"
<<" -o : [OPTIONAL] clashes report file name (default: gmclash_report)\n"
<<" -v : [OPTIONAL] verbose output (default: off)\n"
<< std::endl;
std::cout <<"\nUsage: ./gmclash [OPTIONS]\n" <<std::endl;
for (int i=0; options[i].name!=NULL; i++) {
......@@ -104,7 +109,7 @@ void GetInputArguments(int argc, char** argv) {
}
while (true) {
int c, optidx = 0;
c = getopt_long(argc, argv, "g:o:h", options, &optidx);
c = getopt_long(argc, argv, "g:o:vh", options, &optidx);
if (c == -1)
break;
//
......@@ -118,6 +123,9 @@ void GetInputArguments(int argc, char** argv) {
case 'o':
reportFileName = optarg;
break;
case 'v':
gmclash_verbose = true;
break;
case 'h':
Help();
exit(0);
......
......@@ -50,6 +50,7 @@ public:
void SetPrefixLogicalVolume(const G4String &prefixLV) { fPrefixLogicalVolume = prefixLV; }
void SetMaterial(const G4String &material) { fMaterial = material; }
void SetReportFileName(const G4String &reportFileName) { fReportFileName = reportFileName; }
void SetGMClashVerbosity(const G4bool flag) { fGmclashVerbosity = flag; }
void SetOutputGDMLFileName(const G4String &outputGDMLFileName) { fOutputGDMLFileName = outputGDMLFileName; }
void SetDumpGDML(const bool dumpGDML) {fDumpGDML=dumpGDML;}
/// Common method to construct a driver with a stepper of requested type.
......@@ -121,6 +122,7 @@ private:
G4String fOutputGDMLFileName;
G4double fFieldValue;
G4bool fFieldConstant;
G4bool fGmclashVerbosity;
G4GDMLParser fParser;
G4VPhysicalVolume *fWorld;
MyDetectorMessenger *fDetectorMessenger;
......
......@@ -238,6 +238,7 @@ MyDetectorConstruction::MyDetectorConstruction() : fWorld(nullptr), fDetectorMes
{
fFieldValue = 0.0;
fVerbosityFlag = -1;
fGmclashVerbosity = false;
fFieldConstant = false;
fDetectorMessenger = new MyDetectorMessenger(this);
fRunOverlapCheck = false;
......@@ -671,12 +672,13 @@ void MyDetectorConstruction::RecursivelyCheckOverlap(G4LogicalVolume* envelope,s
RecursivelyCheckOverlap(daughter->GetLogicalVolume(), jlist);
//std::cout<<"Starting Overlaps check on daughter: "<<daughter->GetName()<<std::endl;
//std::cout<<"... "<<sampleNo<<std::endl;
myCheckOverlaps(daughter, jlist);
myCheckOverlaps(daughter, jlist, 1000, 0., fGmclashVerbosity, 1);
}
}
bool MyDetectorConstruction::myCheckOverlaps(G4VPhysicalVolume* volume, std::vector<json>& jlist, G4int res, G4double tol,G4bool verbose, G4int maxErr)
{
std::cout.precision(8);
clashdet::clash singleClash;
json jSingleClash;
......@@ -822,9 +824,6 @@ bool MyDetectorConstruction::myCheckOverlaps(G4VPhysicalVolume* volume, std::vec
// write prettified JSON to another file
jlist.push_back(jSingleClash);
if (trials >= maxErr) { return true; }
break;
}
......
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