From ddcf112893ce4d797a5a271ee1e57464d095559d Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 28 Aug 2020 22:12:21 +0200 Subject: [PATCH 1/2] Change the debug statements --- SimG4Core/Geometry/src/DDG4Builder.cc | 43 ++------ SimG4Core/Geometry/src/DDG4ProductionCuts.cc | 6 +- .../Geometry/src/DDG4SensitiveConverter.cc | 5 +- SimG4Core/Geometry/src/DDG4SolidConverter.cc | 103 +++++++++--------- 4 files changed, 65 insertions(+), 92 deletions(-) diff --git a/SimG4Core/Geometry/src/DDG4Builder.cc b/SimG4Core/Geometry/src/DDG4Builder.cc index 2f8bfe614837e..ab62807c15ea6 100644 --- a/SimG4Core/Geometry/src/DDG4Builder.cc +++ b/SimG4Core/Geometry/src/DDG4Builder.cc @@ -30,7 +30,7 @@ DDG4Builder::DDG4Builder(const DDCompactView *cpv, G4LogicalVolumeToDDLogicalPar DDG4Builder::~DDG4Builder() { delete solidConverter_; } G4LogicalVolume *DDG4Builder::convertLV(const DDLogicalPart &part) { - LogDebug("SimG4CoreGeometry") << "DDG4Builder::convertLV(): DDLogicalPart = " << part << "\n"; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4Builder::convertLV(): DDLogicalPart = " << part; G4LogicalVolume *result = logs_[part]; if (!result) { G4VSolid *g4s = convertSolid(part.solid()); @@ -39,9 +39,7 @@ G4LogicalVolume *DDG4Builder::convertLV(const DDLogicalPart &part) { map_.insert(result, part); DDG4Dispatchable *disp = new DDG4Dispatchable(&part, result); theVectorOfDDG4Dispatchables_->push_back(disp); - LogDebug("SimG4CoreGeometry") << "DDG4Builder::convertLV(): new G4LogicalVolume " << part.name().name() - << "\nDDG4Builder: newEvent: dd=" << part.ddname() << " g4=" << result->GetName() - << "\n"; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4Builder::convertLV(): new G4LogicalVolume " << part.name().name() << "\nDDG4Builder: newEvent: dd=" << part.ddname() << " g4=" << result->GetName(); logs_[part] = result; // DDD -> GEANT4 } return result; @@ -57,40 +55,33 @@ G4VSolid *DDG4Builder::convertSolid(const DDSolid &solid) { } G4Material *DDG4Builder::convertMaterial(const DDMaterial &material) { - LogDebug("SimG4CoreGeometry") << "DDDetConstr::ConvertMaterial: material=" << material << "\n"; + edm::LogVerbatim("SimG4CoreGeometry") << "DDDetConstr::ConvertMaterial: material=" << material; G4Material *result = nullptr; if (material) { // only if it's a valid DDD-material if ((result = mats_[material])) { - LogDebug("SimG4CoreGeometry") << " is already converted" - << "\n"; + edm::LogVerbatim("SimG4CoreGeometry") << " is already converted"; return result; } } else { // only if it's NOT a valid DDD-material - edm::LogError("SimG4CoreGeometry") << "DDG4Builder:: material " << material.toString() - << " is not valid (in the DDD sense!)"; throw cms::Exception("SimG4CoreGeometry", " material is not valid from the Detector Description: " + material.toString()); } int c = 0; if ((c = material.noOfConstituents())) { // it's a composite material - LogDebug("SimG4CoreGeometry") << " creating a G4-composite material. c=" << c - << " d=" << material.density() / g * mole << "\n"; + edm::LogVerbatim("SimG4CoreGeometry") << " creating a G4-composite material. c=" << c << " d=" << material.density() / CLHEP::g * CLHEP::mole; result = new G4Material(material.name().name(), material.density(), c); for (int i = 0; i < c; ++i) { // recursive building of constituents - LogDebug("SimG4CoreGeometry") << " adding the composite=" << material.name() - << " fm=" << material.constituent(i).second << "\n"; + edm::LogVerbatim("SimG4CoreGeometry") << " adding the composite=" << material.name() << " fm=" << material.constituent(i).second; result->AddMaterial(convertMaterial(material.constituent(i).first), material.constituent(i).second); // fractionmass } } else { // it's an elementary material - LogDebug("SimG4CoreGeometry") << " building an elementary material" - << " z=" << material.z() << " a=" << material.a() / g * mole - << " d=" << material.density() / g * cm3 << "\n"; + edm::LogVerbatim("SimG4CoreGeometry") << " building an elementary material" << " z=" << material.z() << " a=" << material.a() / CLHEP::g * CLHEP::mole << " d=" << material.density() / CLHEP::g * CLHEP::cm3; result = new G4Material(material.name().name(), material.z(), material.a(), material.density()); } mats_[material] = result; @@ -111,13 +102,10 @@ G4LogicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) { for (; git != gend; ++git) { const DDLogicalPart &ddLP = gra.nodeData(git); if (!(ddLP.isDefined().second)) { - edm::LogError("SimG4CoreGeometry") << "DDG4Builder::BuildGeometry() has encountered an undefined " - "DDLogicalPart named " - << ddLP.toString(); throw cms::Exception("SimG4CoreGeometry", " DDG4Builder::BuildGeometry() has encountered an " "undefined DDLogicalPart named " + - ddLP.toString()); + ddLP.toString()); } G4LogicalVolume *g4LV = convertLV(ddLP); ++i; @@ -132,7 +120,6 @@ G4LogicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) { std::string err = " DDG4Builder::BuildGeometry() in processing \"children\" has "; err += "encountered an undefined DDLogicalPart named " + ddcurLP.toString() + " is a child of " + ddLP.toString(); - edm::LogError("SimG4CoreGeometry") << err; throw cms::Exception("SimG4CoreGeometry", err); } int offset = getInt("CopyNoOffset", ddcurLP); @@ -141,10 +128,7 @@ G4LogicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) { DD3Vector x, y, z; rm.GetComponents(x, y, z); if ((x.Cross(y)).Dot(z) < 0) - edm::LogVerbatim("SimG4CoreGeometry") - << "DDG4Builder: Reflection: " << gra.edgeData(cit->second)->ddrot() - << ">>Placement d=" << gra.nodeData(cit->first).ddname() << " m=" << ddLP.ddname() - << " cp=" << gra.edgeData(cit->second)->copyno() << " r=" << gra.edgeData(cit->second)->ddrot().ddname(); + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4Builder: Reflection: " << gra.edgeData(cit->second)->ddrot() << ">>Placement d=" << gra.nodeData(cit->first).ddname() << " m=" << ddLP.ddname() << " cp=" << gra.edgeData(cit->second)->copyno() << " r=" << gra.edgeData(cit->second)->ddrot().ddname(); G4ThreeVector tempTran(gra.edgeData(cit->second)->trans().X(), gra.edgeData(cit->second)->trans().Y(), gra.edgeData(cit->second)->trans().Z()); @@ -176,8 +160,7 @@ G4LogicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) { map_.insert(reflLogicalVolume, ddlv); DDG4Dispatchable *disp = new DDG4Dispatchable(&(ddg4_it->first), reflLogicalVolume); theVectorOfDDG4Dispatchables_->push_back(disp); - edm::LogVerbatim("SimG4CoreGeometry") - << "DDG4Builder: dd=" << ddlv.ddname() << " g4=" << reflLogicalVolume->GetName(); + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4Builder: dd=" << ddlv.ddname() << " g4=" << reflLogicalVolume->GetName(); } } @@ -204,11 +187,10 @@ int DDG4Builder::getInt(const std::string &ss, const DDLogicalPart &part) { if (foundIt) { std::vector temp = val.doubles(); if (temp.size() != 1) { - edm::LogError("SimG4CoreGeometry") << " DDG4Builder - ERROR: I need only 1 " << ss; throw cms::Exception("SimG4CoreGeometry", " DDG4Builder::getInt() Problem with Region tags - " "one and only one allowed: " + - ss); + ss); } return int(temp[0]); } else @@ -227,11 +209,10 @@ double DDG4Builder::getDouble(const std::string &ss, const DDLogicalPart &part) if (foundIt) { std::vector temp = val.strings(); if (temp.size() != 1) { - edm::LogError("SimG4CoreGeometry") << " DDG4Builder - ERROR: I need only 1 " << ss; throw cms::Exception("SimG4CoreGeometry", " DDG4Builder::getDouble() Problem with Region tags " "- one and only one allowed: " + - ss); + ss); } double v; std::string unit; diff --git a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc index 6e22a7bfd8cb5..1fd36bb76cd61 100644 --- a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc +++ b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc @@ -139,11 +139,9 @@ void DDG4ProductionCuts::dd4hepInitialize() { } if (verbosity_ > 0) { - LogDebug("Geometry") << " DDG4ProductionCuts (New) : starting\n" - << " DDG4ProductionCuts : Got " << dd4hepVec_.size() << " region roots.\n" - << " DDG4ProductionCuts : List of all roots:"; + edm::LogVerbatim("SimG4CoreGeometry") << " DDG4ProductionCuts (New) : starting\n" << " DDG4ProductionCuts : Got " << dd4hepVec_.size() << " region roots.\n" << " DDG4ProductionCuts : List of all roots:"; for (size_t jj = 0; jj < dd4hepVec_.size(); ++jj) - LogDebug("Geometry") << " DDG4ProductionCuts : root=" << dd4hepVec_[jj].first << " , " << dd4hepVec_[jj].second; + edm::LogVerbatim("SimG4CoreGeometry") << " DDG4ProductionCuts : root=" << dd4hepVec_[jj].first << " , " << dd4hepVec_[jj].second; } } diff --git a/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc b/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc index 5aa05c36d07f6..aad4b8f783d97 100644 --- a/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc +++ b/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc @@ -13,7 +13,7 @@ DDG4SensitiveConverter::DDG4SensitiveConverter() {} DDG4SensitiveConverter::~DDG4SensitiveConverter() {} void DDG4SensitiveConverter::upDate(const DDG4DispContainer &ddg4s, SensitiveDetectorCatalog &catalog) { - LogDebug("SimG4CoreGeometry") << " DDG4SensitiveConverter::upDate() starts"; + edm::LogVerbatim("SimG4CoreGeometry") << " DDG4SensitiveConverter::upDate() starts"; for (auto ddg4 : ddg4s) { const DDLogicalPart *part = (ddg4->getDDLogicalPart()); @@ -23,8 +23,7 @@ void DDG4SensitiveConverter::upDate(const DDG4DispContainer &ddg4s, SensitiveDet std::string sROUName = getString("ReadOutName", part); std::string fff = result->GetName(); if (sClassName != "NotFound") { - LogDebug("SimG4CoreGeometry") << " DDG4SensitiveConverter: Sensitive " << fff << " Class Name " << sClassName - << " ROU Name " << sROUName; + edm::LogVerbatim("SimG4CoreGeometry") << " DDG4SensitiveConverter: Sensitive " << fff << " Class Name " << sClassName << " ROU Name " << sROUName; fff = result->GetName(); catalog.insert(sClassName, sROUName, fff); } diff --git a/SimG4Core/Geometry/src/DDG4SolidConverter.cc b/SimG4Core/Geometry/src/DDG4SolidConverter.cc index bbd1d7fa36424..707dee979be58 100644 --- a/SimG4Core/Geometry/src/DDG4SolidConverter.cc +++ b/SimG4Core/Geometry/src/DDG4SolidConverter.cc @@ -57,13 +57,13 @@ G4VSolid *DDG4SolidConverter::convert(const DDSolid &solid) { #include "G4Box.hh" G4VSolid *DDG4SolidConverter::box(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: box = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: box = " << solid; return new G4Box(solid.name().name(), (*par_)[0], (*par_)[1], (*par_)[2]); } #include "G4Tubs.hh" G4VSolid *DDG4SolidConverter::tubs(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: tubs = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: tubs = " << solid; return new G4Tubs(solid.name().name(), (*par_)[1], // rmin (*par_)[2], // rmax @@ -74,7 +74,7 @@ G4VSolid *DDG4SolidConverter::tubs(const DDSolid &solid) { #include "G4CutTubs.hh" G4VSolid *DDG4SolidConverter::cuttubs(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: tubs = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: tubs = " << solid; return new G4CutTubs(solid.name().name(), (*par_)[1], // rmin (*par_)[2], // rmax @@ -87,7 +87,7 @@ G4VSolid *DDG4SolidConverter::cuttubs(const DDSolid &solid) { #include "G4Trap.hh" G4VSolid *DDG4SolidConverter::trap(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: trap = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: trap = " << solid; return new G4Trap(solid.name().name(), (*par_)[0], // pDz (*par_)[1], // theta @@ -104,7 +104,7 @@ G4VSolid *DDG4SolidConverter::trap(const DDSolid &solid) { #include "G4Cons.hh" G4VSolid *DDG4SolidConverter::cons(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: cons = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: cons = " << solid; return new G4Cons(solid.name().name(), (*par_)[1], // rmin -z (*par_)[2], // rmax -z @@ -117,20 +117,20 @@ G4VSolid *DDG4SolidConverter::cons(const DDSolid &solid) { #include "G4Polycone.hh" G4VSolid *DDG4SolidConverter::polycone_rz(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: pcon_rz = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: pcon_rz = " << solid; std::vector r; std::vector z; std::vector::const_iterator i = (*par_).begin() + 2; int count = 0; for (; i != (*par_).end(); ++i) { - LogDebug("SimG4CoreGeometry") << " z=" << *i / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << " z=" << *i / CLHEP::cm; z.push_back(*i); ++i; - LogDebug("SimG4CoreGeometry") << " r=" << *i / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << " r=" << *i / CLHEP::cm; r.push_back(*i); count++; } - LogDebug("SimG4CoreGeometry") << "sp=" << (*par_)[0] / CLHEP::deg << " ep=" << (*par_)[1] / CLHEP::deg; + edm::LogVerbatim("SimG4CoreGeometry") << "sp=" << (*par_)[0] / CLHEP::deg << " ep=" << (*par_)[1] / CLHEP::deg; /* std::cout << "### Polycone_RZ: " << "sp=" << (*par_)[0]/CLHEP::deg << " ep=" << (*par_)[1]/CLHEP::deg @@ -148,24 +148,24 @@ G4VSolid *DDG4SolidConverter::polycone_rz(const DDSolid &solid) { } G4VSolid *DDG4SolidConverter::polycone_rrz(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: pcon_rrz = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: pcon_rrz = " << solid; std::vector z_p; std::vector rmin_p; std::vector rmax_p; std::vector::const_iterator i = par_->begin() + 2; int count = 0; for (; i != par_->end(); ++i) { - LogDebug("SimG4CoreGeometry") << "z=" << *i / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "z=" << *i / CLHEP::cm; z_p.push_back(*i); ++i; - LogDebug("SimG4CoreGeometry") << "rmin=" << *i / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "rmin=" << *i / CLHEP::cm; rmin_p.push_back(*i); ++i; - LogDebug("SimG4CoreGeometry") << "rmax=" << *i / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "rmax=" << *i / CLHEP::cm; rmax_p.push_back(*i); count++; } - LogDebug("SimG4CoreGeometry") << "sp=" << (*par_)[0] / CLHEP::deg << " ep=" << (*par_)[1] / CLHEP::deg; + edm::LogVerbatim("SimG4CoreGeometry") << "sp=" << (*par_)[0] / CLHEP::deg << " ep=" << (*par_)[1] / CLHEP::deg; /* std::cout << "### Polycone_RRZ: " << "sp=" << (*par_)[0]/CLHEP::deg << " ep=" << (*par_)[1]/CLHEP::deg @@ -186,7 +186,7 @@ G4VSolid *DDG4SolidConverter::polycone_rrz(const DDSolid &solid) { #include "G4Polyhedra.hh" G4VSolid *DDG4SolidConverter::polyhedra_rz(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: phed_rz = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: phed_rz = " << solid; std::vector r; std::vector z; std::vector::const_iterator i = par_->begin() + 3; @@ -209,24 +209,24 @@ G4VSolid *DDG4SolidConverter::polyhedra_rz(const DDSolid &solid) { } G4VSolid *DDG4SolidConverter::polyhedra_rrz(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: phed_rrz = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: phed_rrz = " << solid; std::vector z_p; std::vector rmin_p; std::vector rmax_p; std::vector::const_iterator i = par_->begin() + 3; int count = 0; for (; i != par_->end(); ++i) { - LogDebug("SimG4CoreGeometry") << "z=" << *i / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "z=" << *i / CLHEP::cm; z_p.push_back(*i); ++i; - LogDebug("SimG4CoreGeometry") << "rmin=" << *i / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "rmin=" << *i / CLHEP::cm; rmin_p.push_back(*i); ++i; - LogDebug("SimG4CoreGeometry") << "rmax=" << *i / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "rmax=" << *i / CLHEP::cm; rmax_p.push_back(*i); count++; } - LogDebug("SimG4CoreGeometry") << "sp=" << (*par_)[0] / CLHEP::deg << " ep=" << (*par_)[1] / CLHEP::deg; + edm::LogVerbatim("SimG4CoreGeometry") << "sp=" << (*par_)[0] / CLHEP::deg << " ep=" << (*par_)[1] / CLHEP::deg; return new G4Polyhedra(solid.name().name(), (*par_)[1], (*par_)[2], @@ -239,7 +239,7 @@ G4VSolid *DDG4SolidConverter::polyhedra_rrz(const DDSolid &solid) { #include "G4ExtrudedSolid.hh" G4VSolid *DDG4SolidConverter::extrudedpolygon(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: extr_pgon = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: extr_pgon = " << solid; std::vector x = static_cast(solid).xVec(); std::vector y = static_cast(solid).yVec(); std::vector z = static_cast(solid).zVec(); @@ -258,7 +258,7 @@ G4VSolid *DDG4SolidConverter::extrudedpolygon(const DDSolid &solid) { #include "G4Torus.hh" G4VSolid *DDG4SolidConverter::torus(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: torus = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: torus = " << solid; return new G4Torus(solid.name().name(), (*par_)[0], // rmin (*par_)[1], // rmax @@ -269,16 +269,16 @@ G4VSolid *DDG4SolidConverter::torus(const DDSolid &solid) { #include "G4UnionSolid.hh" G4VSolid *DDG4SolidConverter::unionsolid(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: unionsolid = " << solid.name(); + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: unionsolid = " << solid.name(); G4UnionSolid *us = nullptr; DDBooleanSolid bs(solid); if (bs) { - LogDebug("SimG4CoreGeometry") << "SolidA=" << bs.solidA(); + edm::LogVerbatim("SimG4CoreGeometry") << "SolidA=" << bs.solidA(); G4VSolid *sa = DDG4SolidConverter().convert(bs.solidA()); - LogDebug("SimG4CoreGeometry") << "SolidB=" << bs.solidB(); + edm::LogVerbatim("SimG4CoreGeometry") << "SolidB=" << bs.solidB(); G4VSolid *sb = DDG4SolidConverter().convert(bs.solidB()); - LogDebug("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush; - LogDebug("SimG4CoreGeometry") << " " << bs.rotation().rotation().Inverse() << std::flush; + edm::LogVerbatim("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush; + edm::LogVerbatim("SimG4CoreGeometry") << " " << bs.rotation().rotation().Inverse() << std::flush; std::vector tdbl(9); bs.rotation().rotation().Inverse().GetComponents(tdbl.begin(), tdbl.end()); CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]); @@ -292,14 +292,14 @@ G4VSolid *DDG4SolidConverter::unionsolid(const DDSolid &solid) { #include "G4SubtractionSolid.hh" #include G4VSolid *DDG4SolidConverter::subtraction(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: subtraction = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: subtraction = " << solid; G4SubtractionSolid *us = nullptr; DDBooleanSolid bs(solid); if (bs) { G4VSolid *sa = DDG4SolidConverter().convert(bs.solidA()); G4VSolid *sb = DDG4SolidConverter().convert(bs.solidB()); - LogDebug("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush; - LogDebug("SimG4CoreGeometry") << " " << bs.rotation().rotation().Inverse() << std::flush; + edm::LogVerbatim("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush; + edm::LogVerbatim("SimG4CoreGeometry") << " " << bs.rotation().rotation().Inverse() << std::flush; std::vector tdbl(9); bs.rotation().rotation().Inverse().GetComponents(tdbl.begin(), tdbl.end()); CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]); @@ -311,14 +311,14 @@ G4VSolid *DDG4SolidConverter::subtraction(const DDSolid &solid) { #include "G4IntersectionSolid.hh" G4VSolid *DDG4SolidConverter::intersection(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: intersection = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: intersection = " << solid; G4IntersectionSolid *us = nullptr; DDBooleanSolid bs(solid); if (bs) { G4VSolid *sa = DDG4SolidConverter().convert(bs.solidA()); G4VSolid *sb = DDG4SolidConverter().convert(bs.solidB()); - LogDebug("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush; - LogDebug("SimG4CoreGeometry") << " " << bs.rotation().rotation().Inverse() << std::flush; + edm::LogVerbatim("SimG4CoreGeometry") << " name:" << solid.name() << " t=" << bs.translation() << std::flush; + edm::LogVerbatim("SimG4CoreGeometry") << " " << bs.rotation().rotation().Inverse() << std::flush; std::vector tdbl(9); bs.rotation().rotation().Inverse().GetComponents(tdbl.begin(), tdbl.end()); CLHEP::HepRep3x3 temprep(tdbl[0], tdbl[1], tdbl[2], tdbl[3], tdbl[4], tdbl[5], tdbl[6], tdbl[7], tdbl[8]); @@ -335,7 +335,7 @@ G4VSolid *DDG4SolidConverter::pseudotrap(const DDSolid &solid) { rot->rotateX(90. * deg); } - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: pseudoTrap = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: pseudoTrap = " << solid; G4Trd *trap = nullptr; G4Tubs *tubs = nullptr; G4VSolid *result = nullptr; @@ -383,8 +383,7 @@ G4VSolid *DDG4SolidConverter::pseudotrap(const DDSolid &solid) { } G4ThreeVector displ(0., 0., displacement); // displacement of the tubs w.r.t. trap - LogDebug("SimG4CoreGeometry") << "DDSolidConverter::pseudotrap(): displacement=" << displacement - << " openingAngle=" << openingAngle / deg << " x=" << x << " h=" << h; + edm::LogVerbatim("SimG4CoreGeometry") << "DDSolidConverter::pseudotrap(): displacement=" << displacement << " openingAngle=" << openingAngle / deg << " x=" << x << " h=" << h; // Now create two solids (trd & tubs), and a boolean solid out of them std::string name = pt.name().name(); @@ -409,11 +408,10 @@ G4VSolid *DDG4SolidConverter::trunctubs(const DDSolid &solid) { // truncated tube-section: a boolean subtraction solid: // from a tube-section a box is subtracted according // to the given parameters - LogDebug("SimG4CoreGeometry") << "MantisConverter: solidshape=" << DDSolidShapesName::name(solid.shape()) << " " - << solid; - LogDebug("SimG4CoreGeometry") << "before"; + edm::LogVerbatim("SimG4CoreGeometry") << "MantisConverter: solidshape=" << DDSolidShapesName::name(solid.shape()) << " " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "before"; DDTruncTubs tt(solid); - LogDebug("SimG4CoreGeometry") << "after"; + edm::LogVerbatim("SimG4CoreGeometry") << "after"; double rIn(tt.rIn()), rOut(tt.rOut()), zHalf(tt.zHalf()), startPhi(tt.startPhi()), deltaPhi(tt.deltaPhi()), cutAtStart(tt.cutAtStart()), cutAtDelta(tt.cutAtDelta()); bool cutInside(bool(tt.cutInside())); @@ -438,9 +436,8 @@ G4VSolid *DDG4SolidConverter::trunctubs(const DDSolid &solid) { double r(cutAtStart), R(cutAtDelta); G4VSolid *result(nullptr); G4VSolid *tubs = new G4Tubs(name, rIn, rOut, zHalf, startPhi, deltaPhi); - LogDebug("SimG4CoreGeometry") << "G4Tubs: " << rIn / CLHEP::cm << ' ' << rOut / CLHEP::cm << ' ' << zHalf / CLHEP::cm - << ' ' << startPhi / CLHEP::deg << ' ' << deltaPhi / CLHEP::deg; - LogDebug("SimG4CoreGeometry") << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "G4Tubs: " << rIn / CLHEP::cm << ' ' << rOut / CLHEP::cm << ' ' << zHalf / CLHEP::cm << ' ' << startPhi / CLHEP::deg << ' ' << deltaPhi / CLHEP::deg; + edm::LogVerbatim("SimG4CoreGeometry") << solid; // length & hight of the box double boxX(rOut * std::sqrt(2) * 1.1), boxY(rOut * std::sqrt(2) * 1.1); // exaggerate dimensions - does not matter, it's subtracted! @@ -454,19 +451,17 @@ G4VSolid *DDG4SolidConverter::trunctubs(const DDSolid &solid) { double cos_alpha = cath / hypo; double alpha = -acos(cos_alpha); - LogDebug("SimG4CoreGeometry") << "cath=" << cath / CLHEP::cm; - LogDebug("SimG4CoreGeometry") << "hypo=" << hypo / CLHEP::cm; - LogDebug("SimG4CoreGeometry") << "al=" << acos(cath / hypo) / CLHEP::deg; - LogDebug("SimG4CoreGeometry") << "deltaPhi=" << deltaPhi / CLHEP::deg << "\n" - << "r=" << r / CLHEP::cm << "\n" - << "R=" << R / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "cath=" << cath / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "hypo=" << hypo / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "al=" << acos(cath / hypo) / CLHEP::deg; + edm::LogVerbatim("SimG4CoreGeometry") << "deltaPhi=" << deltaPhi / CLHEP::deg << "\n" << "r=" << r / CLHEP::cm << "\n" << "R=" << R / CLHEP::cm; - LogDebug("SimG4CoreGeometry") << "alpha=" << alpha / CLHEP::deg; + edm::LogVerbatim("SimG4CoreGeometry") << "alpha=" << alpha / CLHEP::deg; // rotationmatrix of box w.r.t. tubs G4RotationMatrix *rot = new G4RotationMatrix; rot->rotateZ(-alpha); - LogDebug("SimG4CoreGeometry") << (*rot); + edm::LogVerbatim("SimG4CoreGeometry") << (*rot); // center point of the box double xBox; @@ -477,7 +472,7 @@ G4VSolid *DDG4SolidConverter::trunctubs(const DDSolid &solid) { } G4ThreeVector trans(xBox, 0., 0.); - LogDebug("SimG4CoreGeometry") << "trans=" << trans; + edm::LogVerbatim("SimG4CoreGeometry") << "trans=" << trans; G4VSolid *box = new G4Box(name, boxX, boxY, boxZ); result = new G4SubtractionSolid(name, tubs, box, rot, trans); @@ -487,7 +482,7 @@ G4VSolid *DDG4SolidConverter::trunctubs(const DDSolid &solid) { #include "G4Sphere.hh" G4VSolid *DDG4SolidConverter::sphere(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: sphere = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: sphere = " << solid; DDSphere sp(solid); return new G4Sphere(solid.name().name(), sp.innerRadius(), @@ -500,7 +495,7 @@ G4VSolid *DDG4SolidConverter::sphere(const DDSolid &solid) { #include "G4EllipticalTube.hh" G4VSolid *DDG4SolidConverter::ellipticaltube(const DDSolid &solid) { - LogDebug("SimG4CoreGeometry") << "DDG4SolidConverter: ellipticaltube = " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "DDG4SolidConverter: ellipticaltube = " << solid; DDEllipticalTube sp(solid); return new G4EllipticalTube(solid.name().name(), sp.xSemiAxis(), sp.ySemiAxis(), sp.zHeight()); } From 8f3bd894c5b2ca0f3354b2adecd9a0235486df6a Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 28 Aug 2020 22:26:30 +0200 Subject: [PATCH 2/2] Code check --- SimG4Core/Geometry/src/DDG4Builder.cc | 28 +++++++++++++------ SimG4Core/Geometry/src/DDG4ProductionCuts.cc | 7 +++-- .../Geometry/src/DDG4SensitiveConverter.cc | 3 +- SimG4Core/Geometry/src/DDG4SolidConverter.cc | 14 +++++++--- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/SimG4Core/Geometry/src/DDG4Builder.cc b/SimG4Core/Geometry/src/DDG4Builder.cc index ab62807c15ea6..cdc15a6b9f4a2 100644 --- a/SimG4Core/Geometry/src/DDG4Builder.cc +++ b/SimG4Core/Geometry/src/DDG4Builder.cc @@ -39,7 +39,9 @@ G4LogicalVolume *DDG4Builder::convertLV(const DDLogicalPart &part) { map_.insert(result, part); DDG4Dispatchable *disp = new DDG4Dispatchable(&part, result); theVectorOfDDG4Dispatchables_->push_back(disp); - edm::LogVerbatim("SimG4CoreGeometry") << "DDG4Builder::convertLV(): new G4LogicalVolume " << part.name().name() << "\nDDG4Builder: newEvent: dd=" << part.ddname() << " g4=" << result->GetName(); + edm::LogVerbatim("SimG4CoreGeometry") + << "DDG4Builder::convertLV(): new G4LogicalVolume " << part.name().name() + << "\nDDG4Builder: newEvent: dd=" << part.ddname() << " g4=" << result->GetName(); logs_[part] = result; // DDD -> GEANT4 } return result; @@ -71,17 +73,21 @@ G4Material *DDG4Builder::convertMaterial(const DDMaterial &material) { int c = 0; if ((c = material.noOfConstituents())) { // it's a composite material - edm::LogVerbatim("SimG4CoreGeometry") << " creating a G4-composite material. c=" << c << " d=" << material.density() / CLHEP::g * CLHEP::mole; + edm::LogVerbatim("SimG4CoreGeometry") + << " creating a G4-composite material. c=" << c << " d=" << material.density() / CLHEP::g * CLHEP::mole; result = new G4Material(material.name().name(), material.density(), c); for (int i = 0; i < c; ++i) { // recursive building of constituents - edm::LogVerbatim("SimG4CoreGeometry") << " adding the composite=" << material.name() << " fm=" << material.constituent(i).second; + edm::LogVerbatim("SimG4CoreGeometry") + << " adding the composite=" << material.name() << " fm=" << material.constituent(i).second; result->AddMaterial(convertMaterial(material.constituent(i).first), material.constituent(i).second); // fractionmass } } else { // it's an elementary material - edm::LogVerbatim("SimG4CoreGeometry") << " building an elementary material" << " z=" << material.z() << " a=" << material.a() / CLHEP::g * CLHEP::mole << " d=" << material.density() / CLHEP::g * CLHEP::cm3; + edm::LogVerbatim("SimG4CoreGeometry") << " building an elementary material" + << " z=" << material.z() << " a=" << material.a() / CLHEP::g * CLHEP::mole + << " d=" << material.density() / CLHEP::g * CLHEP::cm3; result = new G4Material(material.name().name(), material.z(), material.a(), material.density()); } mats_[material] = result; @@ -105,7 +111,7 @@ G4LogicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) { throw cms::Exception("SimG4CoreGeometry", " DDG4Builder::BuildGeometry() has encountered an " "undefined DDLogicalPart named " + - ddLP.toString()); + ddLP.toString()); } G4LogicalVolume *g4LV = convertLV(ddLP); ++i; @@ -128,7 +134,10 @@ G4LogicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) { DD3Vector x, y, z; rm.GetComponents(x, y, z); if ((x.Cross(y)).Dot(z) < 0) - edm::LogVerbatim("SimG4CoreGeometry") << "DDG4Builder: Reflection: " << gra.edgeData(cit->second)->ddrot() << ">>Placement d=" << gra.nodeData(cit->first).ddname() << " m=" << ddLP.ddname() << " cp=" << gra.edgeData(cit->second)->copyno() << " r=" << gra.edgeData(cit->second)->ddrot().ddname(); + edm::LogVerbatim("SimG4CoreGeometry") + << "DDG4Builder: Reflection: " << gra.edgeData(cit->second)->ddrot() + << ">>Placement d=" << gra.nodeData(cit->first).ddname() << " m=" << ddLP.ddname() + << " cp=" << gra.edgeData(cit->second)->copyno() << " r=" << gra.edgeData(cit->second)->ddrot().ddname(); G4ThreeVector tempTran(gra.edgeData(cit->second)->trans().X(), gra.edgeData(cit->second)->trans().Y(), gra.edgeData(cit->second)->trans().Z()); @@ -160,7 +169,8 @@ G4LogicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) { map_.insert(reflLogicalVolume, ddlv); DDG4Dispatchable *disp = new DDG4Dispatchable(&(ddg4_it->first), reflLogicalVolume); theVectorOfDDG4Dispatchables_->push_back(disp); - edm::LogVerbatim("SimG4CoreGeometry") << "DDG4Builder: dd=" << ddlv.ddname() << " g4=" << reflLogicalVolume->GetName(); + edm::LogVerbatim("SimG4CoreGeometry") + << "DDG4Builder: dd=" << ddlv.ddname() << " g4=" << reflLogicalVolume->GetName(); } } @@ -190,7 +200,7 @@ int DDG4Builder::getInt(const std::string &ss, const DDLogicalPart &part) { throw cms::Exception("SimG4CoreGeometry", " DDG4Builder::getInt() Problem with Region tags - " "one and only one allowed: " + - ss); + ss); } return int(temp[0]); } else @@ -212,7 +222,7 @@ double DDG4Builder::getDouble(const std::string &ss, const DDLogicalPart &part) throw cms::Exception("SimG4CoreGeometry", " DDG4Builder::getDouble() Problem with Region tags " "- one and only one allowed: " + - ss); + ss); } double v; std::string unit; diff --git a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc index 1fd36bb76cd61..a50c3530b541a 100644 --- a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc +++ b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc @@ -139,9 +139,12 @@ void DDG4ProductionCuts::dd4hepInitialize() { } if (verbosity_ > 0) { - edm::LogVerbatim("SimG4CoreGeometry") << " DDG4ProductionCuts (New) : starting\n" << " DDG4ProductionCuts : Got " << dd4hepVec_.size() << " region roots.\n" << " DDG4ProductionCuts : List of all roots:"; + edm::LogVerbatim("SimG4CoreGeometry") << " DDG4ProductionCuts (New) : starting\n" + << " DDG4ProductionCuts : Got " << dd4hepVec_.size() << " region roots.\n" + << " DDG4ProductionCuts : List of all roots:"; for (size_t jj = 0; jj < dd4hepVec_.size(); ++jj) - edm::LogVerbatim("SimG4CoreGeometry") << " DDG4ProductionCuts : root=" << dd4hepVec_[jj].first << " , " << dd4hepVec_[jj].second; + edm::LogVerbatim("SimG4CoreGeometry") + << " DDG4ProductionCuts : root=" << dd4hepVec_[jj].first << " , " << dd4hepVec_[jj].second; } } diff --git a/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc b/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc index aad4b8f783d97..cc2f9a3596c92 100644 --- a/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc +++ b/SimG4Core/Geometry/src/DDG4SensitiveConverter.cc @@ -23,7 +23,8 @@ void DDG4SensitiveConverter::upDate(const DDG4DispContainer &ddg4s, SensitiveDet std::string sROUName = getString("ReadOutName", part); std::string fff = result->GetName(); if (sClassName != "NotFound") { - edm::LogVerbatim("SimG4CoreGeometry") << " DDG4SensitiveConverter: Sensitive " << fff << " Class Name " << sClassName << " ROU Name " << sROUName; + edm::LogVerbatim("SimG4CoreGeometry") + << " DDG4SensitiveConverter: Sensitive " << fff << " Class Name " << sClassName << " ROU Name " << sROUName; fff = result->GetName(); catalog.insert(sClassName, sROUName, fff); } diff --git a/SimG4Core/Geometry/src/DDG4SolidConverter.cc b/SimG4Core/Geometry/src/DDG4SolidConverter.cc index 707dee979be58..d2c229269c956 100644 --- a/SimG4Core/Geometry/src/DDG4SolidConverter.cc +++ b/SimG4Core/Geometry/src/DDG4SolidConverter.cc @@ -383,7 +383,8 @@ G4VSolid *DDG4SolidConverter::pseudotrap(const DDSolid &solid) { } G4ThreeVector displ(0., 0., displacement); // displacement of the tubs w.r.t. trap - edm::LogVerbatim("SimG4CoreGeometry") << "DDSolidConverter::pseudotrap(): displacement=" << displacement << " openingAngle=" << openingAngle / deg << " x=" << x << " h=" << h; + edm::LogVerbatim("SimG4CoreGeometry") << "DDSolidConverter::pseudotrap(): displacement=" << displacement + << " openingAngle=" << openingAngle / deg << " x=" << x << " h=" << h; // Now create two solids (trd & tubs), and a boolean solid out of them std::string name = pt.name().name(); @@ -408,7 +409,8 @@ G4VSolid *DDG4SolidConverter::trunctubs(const DDSolid &solid) { // truncated tube-section: a boolean subtraction solid: // from a tube-section a box is subtracted according // to the given parameters - edm::LogVerbatim("SimG4CoreGeometry") << "MantisConverter: solidshape=" << DDSolidShapesName::name(solid.shape()) << " " << solid; + edm::LogVerbatim("SimG4CoreGeometry") << "MantisConverter: solidshape=" << DDSolidShapesName::name(solid.shape()) + << " " << solid; edm::LogVerbatim("SimG4CoreGeometry") << "before"; DDTruncTubs tt(solid); edm::LogVerbatim("SimG4CoreGeometry") << "after"; @@ -436,7 +438,9 @@ G4VSolid *DDG4SolidConverter::trunctubs(const DDSolid &solid) { double r(cutAtStart), R(cutAtDelta); G4VSolid *result(nullptr); G4VSolid *tubs = new G4Tubs(name, rIn, rOut, zHalf, startPhi, deltaPhi); - edm::LogVerbatim("SimG4CoreGeometry") << "G4Tubs: " << rIn / CLHEP::cm << ' ' << rOut / CLHEP::cm << ' ' << zHalf / CLHEP::cm << ' ' << startPhi / CLHEP::deg << ' ' << deltaPhi / CLHEP::deg; + edm::LogVerbatim("SimG4CoreGeometry") << "G4Tubs: " << rIn / CLHEP::cm << ' ' << rOut / CLHEP::cm << ' ' + << zHalf / CLHEP::cm << ' ' << startPhi / CLHEP::deg << ' ' + << deltaPhi / CLHEP::deg; edm::LogVerbatim("SimG4CoreGeometry") << solid; // length & hight of the box double boxX(rOut * std::sqrt(2) * 1.1), @@ -454,7 +458,9 @@ G4VSolid *DDG4SolidConverter::trunctubs(const DDSolid &solid) { edm::LogVerbatim("SimG4CoreGeometry") << "cath=" << cath / CLHEP::cm; edm::LogVerbatim("SimG4CoreGeometry") << "hypo=" << hypo / CLHEP::cm; edm::LogVerbatim("SimG4CoreGeometry") << "al=" << acos(cath / hypo) / CLHEP::deg; - edm::LogVerbatim("SimG4CoreGeometry") << "deltaPhi=" << deltaPhi / CLHEP::deg << "\n" << "r=" << r / CLHEP::cm << "\n" << "R=" << R / CLHEP::cm; + edm::LogVerbatim("SimG4CoreGeometry") << "deltaPhi=" << deltaPhi / CLHEP::deg << "\n" + << "r=" << r / CLHEP::cm << "\n" + << "R=" << R / CLHEP::cm; edm::LogVerbatim("SimG4CoreGeometry") << "alpha=" << alpha / CLHEP::deg;