Skip to content

Commit

Permalink
Merge pull request #31287 from bsunanda/Run3-sim72
Browse files Browse the repository at this point in the history
Run3-sim72 Change the debug statements
  • Loading branch information
cmsbuild authored Aug 29, 2020
2 parents 982e118 + 8f3bd89 commit ee9e9ae
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 83 deletions.
35 changes: 13 additions & 22 deletions SimG4Core/Geometry/src/DDG4Builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -39,9 +39,9 @@ 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;
Expand All @@ -57,40 +57,37 @@ 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;
Expand All @@ -111,9 +108,6 @@ 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 " +
Expand All @@ -132,7 +126,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);
Expand Down Expand Up @@ -204,7 +197,6 @@ int DDG4Builder::getInt(const std::string &ss, const DDLogicalPart &part) {
if (foundIt) {
std::vector<double> 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: " +
Expand All @@ -227,7 +219,6 @@ double DDG4Builder::getDouble(const std::string &ss, const DDLogicalPart &part)
if (foundIt) {
std::vector<std::string> 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: " +
Expand Down
9 changes: 5 additions & 4 deletions SimG4Core/Geometry/src/DDG4ProductionCuts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ 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;
}
}

Expand Down
6 changes: 3 additions & 3 deletions SimG4Core/Geometry/src/DDG4SensitiveConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -23,8 +23,8 @@ 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);
}
Expand Down
Loading

0 comments on commit ee9e9ae

Please sign in to comment.