Skip to content

Commit

Permalink
Code check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Aug 28, 2020
1 parent ddcf112 commit 8f3bd89
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
28 changes: 19 additions & 9 deletions SimG4Core/Geometry/src/DDG4Builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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());
Expand Down Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions SimG4Core/Geometry/src/DDG4ProductionCuts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
3 changes: 2 additions & 1 deletion SimG4Core/Geometry/src/DDG4SensitiveConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
14 changes: 10 additions & 4 deletions SimG4Core/Geometry/src/DDG4SolidConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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";
Expand Down Expand Up @@ -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),
Expand All @@ -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;

Expand Down

0 comments on commit 8f3bd89

Please sign in to comment.