How to detect overlaps in Geant4 geometry ?
Geometry in CMSSW can be represented by an acyclic graph (kind of tree). Volumes should be defined in such way that child volumes don't have
intersection with each other and are completely inside their mother volume. Any exception from that rule (overlap) could cause Geant4 to behave in unpredictable way.
There is a
CMSSW library (SimWatcher)
that comes together with Geant4 and makes it possible to check detector geometry for overlaps.
In order to use it one needs to prepare .py configuration file with proper geometry included (XML files). In execution path there should be Geant4, simulation has to be performed only for 1 event, verbosity should be enabled (i.e. by LoggerMax).
Then one has to check what is the name of root node of geometry graph. It is defined in configuration of XMLIdealGeometryESSource, i.e. in Configuration/TotemCommon/python/geometry*_cfi.py files, in
rootNodeName variable.
To configuration file the following section has to be added (name of rootnode could be OTOTEM (typical for RP case) or OCMS (typical for T1/T2 case) and has to read from used geometry definition in included from .py file):
process.g4SimHits.UseMagneticField = False
process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
process.g4SimHits.Physics.DummyEMPhysics = True
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
type = cms.string('CheckOverlap'),
Resolution = cms.untracked.int32(1000), # precision, default 1000
NodeNames = cms.untracked.vstring('OTOTEM')
))
Now we run our configuration file with
cmsRun command. It will take some time to test geometry. After job is done one need to inspect infos.log file (or standard output). In case overlap is found warning similar to following will appear:
Placed PV Trap6R_CSC_for_TotemT1_Plane_1_5_1 Number 1 in mother CSC_for_TotemT1_Plane_1_5 at depth 5 Status 0
Checking overlaps for volume CornaR_CSC_for_TotemT1_Plane_1_5_1 ...
WARNING - G4PVPlacement::CheckOverlaps()
Overlap is detected for volume CornaR_CSC_for_TotemT1_Plane_1_5_1
with Up_CSC_for_TotemT1_Plane_1_5_1 volume's
local point (289.408,0.236948,25.7519), overlapping by at least: 415.484 nm
Placed PV CornaR_CSC_for_TotemT1_Plane_1_5_1 Number 2 in mother CSC_for_TotemT1_Plane_1_5 at depth 5 Status 1
Translation (364.023,655.531,-21.1825) and with rotation
[ ( 0.866025 -0.5 -6.12303e-17)
( 0.5 0.866025 -6.12303e-17)
Dump of Self Logical Volume CornaR_CSC_for_TotemT1_Plane_1_5_1 Solid: CornaR_CSC_for_TotemT1_Plane_1_5_1 Material: Epoxy
-----------------------------------------------------------
*** Dump for solid - CornaR_CSC_for_TotemT1_Plane_1_5_1 ***
===================================================
Solid type: G4Box
Parameters:
half length X: 52.5 mm
half length Y: 60.022 mm
half length Z: 0.3825 mm
-----------------------------------------------------------
Dump of Mother Logical Volume CSC_for_TotemT1_Plane_1_5 Solid: CSC_for_TotemT1_Plane_1_5 Material: Air
-----------------------------------------------------------
*** Dump for solid - CSC_for_TotemT1_Plane_1_5 ***
===================================================
Solid type: G4Tubs
Parameters:
inner radius : 130 mm
outer radius : 834.5 mm
half length Z: 21.6 mm
starting phi : 40 degrees
delta phi : 100 degrees
-----------------------------------------------------------
From this message we could read which volumes overlap.
Presented method cannot be used to prove that geometry does not contain overlaps at all. It is sampling geometry graph with given precision (by default 1000 points per volume (node)). To be more sure one has to perform tests with better precision (10000 or 100000 points).
Be careful - in the situation where wrong root node name was used, SimWatcher will simply say that there is no overlap !!
--
LeszekGrzanka - 24-Aug-2011
How is Geant4 geometry used in the CMSSW framework ?
Geometry is built by
OscarProducer
.
OscarProducer uses
RunManager
to construct a
DDDWorld
structure.
DDWorld uses
DDG4Builder
to process
DDCompactView
.
DDL Geometry files are read here:
cmssw/GeometryReaders/XMLIdealGeometryESSource/src/XMLIdealGeometryESSource.cc
and this is invoked in our
Geometry configuration file
.
Also, someone seems to have done a cheap copy&paste here:
cmssw/GeometryReaders/XMLIdealGeometryESSource/src/XMLIdealGeometryESProducer.cc
The return value is DDCompactView.
The filenames are read from the configuration file and stored in a
GeometryConfiguration
object.
Then, they are parsed by
DDLParser
.
Roman Pot geometry and alignment
Here is a page devoted to
Roman Pot geometry and alignments.
--
DominikMierzejewski - 31-Aug-2010