Skip to content

Commit

Permalink
Merge pull request #19728 from civanch/geom_test_scripts
Browse files Browse the repository at this point in the history
Geom test scripts
  • Loading branch information
cmsbuild committed Jul 14, 2017
2 parents 2136e02 + 0a17781 commit a077a53
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 9 deletions.
15 changes: 8 additions & 7 deletions SimG4Core/Geometry/src/DDG4Builder.cc
Expand Up @@ -144,10 +144,11 @@ DDGeometryReturnType DDG4Builder::BuildGeometry() {
DD3Vector x, y, z;
rm.GetComponents(x, y, z);
if ((x.Cross(y)).Dot(z)<0)
LogDebug("SimG4CoreGeometry") << ">>Reflection encountered: " << gra.edgeData(cit->second)->rot_ << "\n";
LogDebug("SimG4CoreGeometry") << ">>Placement d=" << gra.nodeData(cit->first).ddname()
<< " m=" << ddLP.ddname() << " cp=" << gra.edgeData(cit->second)->copyno_
<< " r=" << gra.edgeData(cit->second)->rot_.ddname() << "\n" ;
edm::LogInfo("SimG4CoreGeometry") << ">>Reflection encountered: "
<< gra.edgeData(cit->second)->rot_
<< ">>Placement d=" << gra.nodeData(cit->first).ddname()
<< " m=" << ddLP.ddname() << " cp=" << gra.edgeData(cit->second)->copyno_
<< " r=" << gra.edgeData(cit->second)->rot_.ddname();
G4ThreeVector tempTran(gra.edgeData(cit->second)->trans_.X(), gra.edgeData(cit->second)->trans_.Y(), gra.edgeData(cit->second)->trans_.Z());
G4Translate3D transl = tempTran;
CLHEP::HepRep3x3 temp( x.X(), x.Y(), x.Z(), y.X(), y.Y(), y.Z(), z.X(), z.Y(), z.Z() ); //matrix representation
Expand Down Expand Up @@ -176,9 +177,9 @@ DDGeometryReturnType DDG4Builder::BuildGeometry() {
map_.insert(reflLogicalVolume,ddlv);
DDG4Dispatchable * disp = new DDG4Dispatchable(&(ddg4_it->first),reflLogicalVolume);
theVectorOfDDG4Dispatchables_->push_back(disp);
LogDebug("SimG4CoreGeometry") << "DDG4Builder: newEvent: dd="
<< ddlv.ddname() << " g4="
<< reflLogicalVolume->GetName() << "\n";
edm::LogInfo("SimG4CoreGeometry")<< "DDG4Builder: newEvent: dd="
<< ddlv.ddname() << " g4="
<< reflLogicalVolume->GetName();
}
}

Expand Down
10 changes: 8 additions & 2 deletions SimG4Core/Geometry/src/G4CheckOverlap.cc
Expand Up @@ -123,7 +123,9 @@ G4CheckOverlap::G4CheckOverlap(const edm::ParameterSet &p) {
if(PVname == ((*pvs)[i])->GetName()) {
G4cout << " ##### PhysVolume " << PVname << " [" << ((*pvs)[i])->GetCopyNo()
<< "] LV: " << ((*pvs)[i])->GetLogicalVolume()->GetName()
<< " Mother LV: " << ((*pvs)[i])->GetMotherLogical()->GetName() << G4endl;
<< " Mother LV: " << ((*pvs)[i])->GetMotherLogical()->GetName()
<< " Region: " << ((*pvs)[i])->GetLogicalVolume()->GetRegion()->GetName()
<< G4endl;
G4cout << " Translation: " << ((*pvs)[i])->GetObjectTranslation() << G4endl;
G4cout << " Rotation: " << ((*pvs)[i])->GetObjectRotationValue() << G4endl;
if(gdmlFlag) {
Expand All @@ -138,7 +140,10 @@ G4CheckOverlap::G4CheckOverlap(const edm::ParameterSet &p) {
for (unsigned int i=0; i<numLV; ++i) {
if(LVname == ((*lvs)[i])->GetName()) {
G4int np = ((*lvs)[i])->GetNoDaughters();
G4cout << " ##### LogVolume " << LVname << " " << np << " daughters" << G4endl;
G4cout << " ##### LogVolume " << LVname << " " << np << " daughters"
<< " Region: " << ((*lvs)[i])->GetRegion()->GetName()
<< G4endl;
G4cout << *(((*lvs)[i])->GetSolid()) << G4endl;
for (G4int j=0; j<np; ++j) {
G4VPhysicalVolume* pv = ((*lvs)[i])->GetDaughter(j);
if(pv) {
Expand All @@ -148,6 +153,7 @@ G4CheckOverlap::G4CheckOverlap(const edm::ParameterSet &p) {
<< pv->GetLogicalVolume()->GetName() << G4endl;
G4cout << " Translation: " << pv->GetObjectTranslation() << G4endl;
G4cout << " Rotation: " << pv->GetObjectRotationValue() << G4endl;
G4cout << *(pv->GetLogicalVolume()->GetSolid()) << G4endl;
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions SimG4Core/PrintGeomInfo/python/cmsBeamPipe2017XML_cfi.py
@@ -0,0 +1,22 @@
import FWCore.ParameterSet.Config as cms

XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml',
'Geometry/CMSCommonData/data/rotations.xml',
'Geometry/CMSCommonData/data/extend/cmsextent.xml',
'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml',
'Geometry/CMSCommonData/data/cmsMother.xml',
'Geometry/CMSCommonData/data/beampipe/2017/v1/beampipe.xml',
'Geometry/CMSCommonData/data/cmsBeam.xml',
# 'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml',
# 'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml',
# 'Geometry/CSCGeometryBuilder/data/cscSpecs.xml',
# 'Geometry/RPCGeometryBuilder/data/RPCSpecs.xml',
# 'Geometry/GEMGeometryBuilder/data/GEMSpecsFilter17.xml',
# 'Geometry/GEMGeometryBuilder/data/v4/GEMSpecs.xml',
'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml',
'Geometry/CMSCommonData/data/FieldParameters.xml'),
rootNodeName = cms.string('cms:OCMS')
)


61 changes: 61 additions & 0 deletions SimG4Core/PrintGeomInfo/python/cmsMuon2017XML_cfi.py
@@ -0,0 +1,61 @@
import FWCore.ParameterSet.Config as cms

XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml',
'Geometry/CMSCommonData/data/rotations.xml',
'Geometry/CMSCommonData/data/extend/cmsextent.xml',
'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml',
# 'Geometry/CMSCommonData/data/Phase2/cms.xml',
# 'Geometry/CMSCommonData/data/cms.xml',
'Geometry/CMSCommonData/data/cmsMother.xml',
'Geometry/CMSCommonData/data/eta3/etaMax.xml',
# 'Geometry/CMSCommonData/data/cmsTracker.xml',
# 'Geometry/CMSCommonData/data/Run2/caloBase.xml',
# 'Geometry/CMSCommonData/data/cmsCalo.xml',
'Geometry/CMSCommonData/data/muonBase.xml',
'Geometry/CMSCommonData/data/cmsMuon.xml',
'Geometry/CMSCommonData/data/mgnt.xml',
# 'Geometry/CMSCommonData/data/PhaseI/beampipe.xml',
# 'Geometry/CMSCommonData/data/PhaseII/beampipe.xml',
# 'Geometry/CMSCommonData/data/beampipe.xml',
# 'Geometry/CMSCommonData/data/cmsBeam.xml',
'Geometry/CMSCommonData/data/muonMB.xml',
'Geometry/CMSCommonData/data/muonMagnet.xml',
'Geometry/CMSCommonData/data/cavern.xml',
'Geometry/MuonCommonData/data/mbCommon/2017/v2/mbCommon.xml',
'Geometry/MuonCommonData/data/mb1/2015/v1/mb1.xml',
'Geometry/MuonCommonData/data/mb2/2015/v1/mb2.xml',
'Geometry/MuonCommonData/data/mb3/2015/v1/mb3.xml',
'Geometry/MuonCommonData/data/mb4/2015/v1/mb4.xml',
'Geometry/MuonCommonData/data/design/muonYoke.xml',
'Geometry/MuonCommonData/data/mf/2017/v2/mf.xml',
'Geometry/MuonCommonData/data/rpcf/2015/v1/rpcf.xml',
'Geometry/MuonCommonData/data/csc/2015/v1/csc.xml',
'Geometry/MuonCommonData/data/v2/mfshield.xml',
'Geometry/MuonCommonData/data/PhaseII/gemf.xml',
'Geometry/MuonCommonData/data/PhaseII/gem11.xml',
'Geometry/MuonCommonData/data/v6/muonGemNumbering17.xml',
'Geometry/MuonSimData/data/v2/muonSens.xml',
'Geometry/DTGeometryBuilder/data/dtSpecsFilter.xml',
'Geometry/CSCGeometryBuilder/data/cscSpecsFilter.xml',
'Geometry/CSCGeometryBuilder/data/cscSpecs.xml',
'Geometry/RPCGeometryBuilder/data/RPCSpecs.xml',
'Geometry/GEMGeometryBuilder/data/GEMSpecsFilter17.xml',
'Geometry/GEMGeometryBuilder/data/v4/GEMSpecs.xml',
# 'Geometry/ForwardCommonData/data/brmsens.xml',
# 'Geometry/ForwardSimData/data/castorsens.xml',
# 'Geometry/ForwardSimData/data/zdcsens.xml',
# 'Geometry/HcalSimData/data/HcalProdCuts.xml',
# 'Geometry/EcalSimData/data/EcalProdCuts.xml',
# 'Geometry/EcalSimData/data/ESProdCuts.xml',
# 'Geometry/TrackerSimData/data/PhaseI/trackerProdCuts.xml',
# 'Geometry/TrackerSimData/data/trackerProdCutsBEAM.xml',
'Geometry/MuonSimData/data/muonProdCuts.xml',
# 'Geometry/ForwardSimData/data/CastorProdCuts.xml',
# 'Geometry/ForwardSimData/data/zdcProdCuts.xml',
# 'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml',
'Geometry/CMSCommonData/data/FieldParameters.xml'),
rootNodeName = cms.string('cms:OCMS')
)


35 changes: 35 additions & 0 deletions SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckEcal_cfg.py
@@ -0,0 +1,35 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("G4PrintGeometry")

#process.load('Configuration.Geometry.GeometryExtended2015_cff')
process.load('Configuration.Geometry.GeometryExtended2017_cff')
#process.load('Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi')

from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
process = checkOverlap(process)

process.MessageLogger.destinations = cms.untracked.vstring("Ecal2017.overlaps")

# enable Geant4 overlap check
process.g4SimHits.CheckOverlap = True

# Geant4 overlap check conditions
process.g4SimHits.G4CheckOverlap.Tolerance = cms.untracked.double(0.0)
process.g4SimHits.G4CheckOverlap.Resolution = cms.untracked.int32(10000)
# tells if NodeName is G4Region or G4PhysicalVolume
process.g4SimHits.G4CheckOverlap.RegionFlag = cms.untracked.bool(True)
# list of names
process.g4SimHits.G4CheckOverlap.NodeNames = cms.vstring('EcalRegion')
# enable dump gdml file
process.g4SimHits.G4CheckOverlap.gdmlFlag = cms.untracked.bool(False)
# if defined a G4PhysicsVolume info is printed
process.g4SimHits.G4CheckOverlap.PVname = 'EHAWR'
# if defined a list of daughter volumes is printed
process.g4SimHits.G4CheckOverlap.LVname = 'EHAWR'

# extra output files, created if a name is not empty
process.g4SimHits.FileNameField = ''
process.g4SimHits.FileNameGDML = ''
process.g4SimHits.FileNameRegions = ''
#
41 changes: 41 additions & 0 deletions SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckMuon_cfg.py
@@ -0,0 +1,41 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("G4PrintGeometry")

#process.load('Configuration.Geometry.GeometryIdeal_cff')
#process.load('Configuration.Geometry.GeometryExtended_cff')
#process.load('Configuration.Geometry.GeometryExtended2015_cff')
#process.load('Configuration.Geometry.GeometryExtended2017_cff')
#process.load('Configuration.Geometry.GeometryExtended2019_cff')
#process.load('Configuration.Geometry.GeometryExtended2023D17_cff')
#process.load('Configuration.Geometry.GeometryExtended2023D13_cff')
process.load('SimG4Core.PrintGeomInfo.cmsMuon2017XML_cfi')
#process.load('SimG4Core.PrintGeomInfo.cmsBeamPipe2017XML_cfi')

from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
process = checkOverlap(process)

process.MessageLogger.destinations = cms.untracked.vstring("muon2017.overlaps")

# enable Geant4 overlap check
process.g4SimHits.CheckOverlap = True

# Geant4 overlap check conditions
process.g4SimHits.G4CheckOverlap.Tolerance = cms.untracked.double(0.0)
process.g4SimHits.G4CheckOverlap.Resolution = cms.untracked.int32(10000)
# tells if NodeName is G4Region or G4PhysicalVolume
process.g4SimHits.G4CheckOverlap.RegionFlag = cms.untracked.bool(False)
# list of names
process.g4SimHits.G4CheckOverlap.NodeNames = cms.vstring('OCMS')
# enable dump gdml file
process.g4SimHits.G4CheckOverlap.gdmlFlag = cms.untracked.bool(False)
# if defined a G4PhysicsVolume info is printed
process.g4SimHits.G4CheckOverlap.PVname = ''
# if defined a list of daughter volumes is printed
process.g4SimHits.G4CheckOverlap.LVname = ''

# extra output files, created if a name is not empty
process.g4SimHits.FileNameField = ''
process.g4SimHits.FileNameGDML = ''
process.g4SimHits.FileNameRegions = ''
#
35 changes: 35 additions & 0 deletions SimG4Core/PrintGeomInfo/test/python/g4OverlapCheckTracker_cfg.py
@@ -0,0 +1,35 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("G4PrintGeometry")

#process.load('Configuration.Geometry.GeometryExtended2015_cff')
process.load('Configuration.Geometry.GeometryExtended2017_cff')
#process.load('Geometry.CMSCommonData.cmsExtendedGeometry2017XML_cfi')

from SimG4Core.PrintGeomInfo.g4TestGeometry_cfi import *
process = checkOverlap(process)

process.MessageLogger.destinations = cms.untracked.vstring("Tracker2017.overlaps")

# enable Geant4 overlap check
process.g4SimHits.CheckOverlap = True

# Geant4 overlap check conditions
process.g4SimHits.G4CheckOverlap.Tolerance = cms.untracked.double(0.0)
process.g4SimHits.G4CheckOverlap.Resolution = cms.untracked.int32(10000)
# tells if NodeName is G4Region or G4PhysicalVolume
process.g4SimHits.G4CheckOverlap.RegionFlag = cms.untracked.bool(False)
# list of names
process.g4SimHits.G4CheckOverlap.NodeNames = cms.vstring('Tracker')
# enable dump gdml file
process.g4SimHits.G4CheckOverlap.gdmlFlag = cms.untracked.bool(False)
# if defined a G4PhysicsVolume info is printed
process.g4SimHits.G4CheckOverlap.PVname = 'Tracker'
# if defined a list of daughter volumes is printed
process.g4SimHits.G4CheckOverlap.LVname = 'Tracker'

# extra output files, created if a name is not empty
process.g4SimHits.FileNameField = ''
process.g4SimHits.FileNameGDML = ''
process.g4SimHits.FileNameRegions = ''
#

0 comments on commit a077a53

Please sign in to comment.