diff --git a/FullSimLight/geoModelClash.cc b/FullSimLight/geoModelClash.cc index 0ce4f94ec64a7c9d8aabe61c82b0d84fb47ede55..b27996691115b0d124d985c74052c629598dd9ef 100644 --- a/FullSimLight/geoModelClash.cc +++ b/FullSimLight/geoModelClash.cc @@ -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); diff --git a/FullSimLight/include/MyDetectorConstruction.hh b/FullSimLight/include/MyDetectorConstruction.hh index a987db44226199e7f8ceca8953cf20c44901f869..f2c155a3a88ccd7d5535739be940b56d9e7e0800 100644 --- a/FullSimLight/include/MyDetectorConstruction.hh +++ b/FullSimLight/include/MyDetectorConstruction.hh @@ -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; diff --git a/FullSimLight/src/MyDetectorConstruction.cc b/FullSimLight/src/MyDetectorConstruction.cc index e30c29de3060a3c869ba4438973d8d4acb030e29..945da07418ce2cc59b4641eea5ed91d618f44a47 100644 --- a/FullSimLight/src/MyDetectorConstruction.cc +++ b/FullSimLight/src/MyDetectorConstruction.cc @@ -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; }