Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-gex110 Recover BHM placements in the dd4hep scenario #36648

Merged
merged 2 commits into from Jan 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
59 changes: 59 additions & 0 deletions Geometry/ForwardCommonData/data/dd4hep/testForwardGeometry.xml
@@ -0,0 +1,59 @@
<?xml version="1.0"?>
<DDDefinition>
<debug>
<!--
<debug_rotations/>
<debug_includes/>
<debug_volumes/>
<debug_constants/>
<debug_shapes/>
<debug_includes/>
<debug_materials/>
<debug_namespaces/>
<debug_placements/>
<debug_algorithms/>
<debug_materials/>
<debug_visattr/>
-->
</debug>

<open_geometry/>
<close_geometry/>

<IncludeSection>
<Include ref="Geometry/CMSCommonData/data/materials/2021/v3/materials.xml"/>
<Include ref="Geometry/CMSCommonData/data/rotations.xml"/>
<Include ref="Geometry/CMSCommonData/data/extend/v3/cmsextent.xml"/>
<Include ref="Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml"/>
<Include ref="Geometry/CMSCommonData/data/cms/2021/v3/cms.xml"/>
<Include ref="Geometry/CMSCommonData/data/cmsMother.xml"/>
<Include ref="Geometry/CMSCommonData/data/eta3/etaMax.xml"/>
<Include ref="Geometry/TrackerCommonData/data/pixfwdCommon.xml"/>
<Include ref="Geometry/ForwardCommonData/data/pixfwd.xml"/>
<Include ref="Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml"/>
<Include ref="Geometry/ForwardCommonData/data/forward/2021/v1/forward.xml"/>
<Include ref="Geometry/ForwardCommonData/data/totemt2/2021/v1/totemt2.xml"/>
<Include ref="Geometry/ForwardCommonData/data/forwardshield/2021/v1/forwardshield.xml"/>
<Include ref="Geometry/ForwardCommonData/data/bhm.xml"/>
<Include ref="Geometry/ForwardCommonData/data/pltbcm/2021/v1/pltbcm.xml"/>
<Include ref="Geometry/ForwardCommonData/data/bcm1f/2021/v1/bcm1f.xml"/>
<Include ref="Geometry/ForwardCommonData/data/plt/2021/v1/plt.xml"/>
<Include ref="Geometry/ForwardSimData/data/bcm1fsens.xml"/>
<Include ref="Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml"/>
<Include ref="Geometry/ForwardCommonData/data/lumimaterials.xml"/>
<Include ref="Geometry/ForwardCommonData/data/zdcrotations.xml"/>
<Include ref="Geometry/ForwardCommonData/data/lumirotations.xml"/>
<Include ref="Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml"/>
<Include ref="Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml"/>
<Include ref="Geometry/ForwardCommonData/data/cmszdc.xml"/>
<Include ref="Geometry/ForwardSimData/data/pltsens.xml"/>
<Include ref="Geometry/ForwardSimData/data/bcm1fsens.xml"/>
<Include ref="Geometry/ForwardSimData/data/totemsensT2/2021/totemsensT2.xml"/>
<Include ref="Geometry/ForwardSimData/data/zdcsens.xml"/>
<Include ref="Geometry/ForwardSimData/data/bhmProdCuts/2021/v1/bhmProdCuts.xml"/>
<Include ref="Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml"/>
<Include ref="Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml"/>
<Include ref="Geometry/CMSCommonData/data/FieldParameters.xml"/>
</IncludeSection>

</DDDefinition>
63 changes: 63 additions & 0 deletions Geometry/ForwardCommonData/data/pixfwd.xml
@@ -0,0 +1,63 @@
<?xml version="1.0"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should have a version number in the directory name, maybe Geometry/ForwardCommonData/data/forward/2021/v1/pixfwd.xml?

<DDDefinition>

<ConstantsSection label="pixfwd.xml" eval="true">
<Constant name="CylindersOuterRmin" value="168.00*mm"/>
<Constant name="CylindersOuterRmax" value="174.50*mm"/>
<Constant name="CylindersOuterLength" value="2101.09*mm"/>
<Constant name="CylindersEndFlangeLength" value="41.30*mm"/>
<Constant name="RootRadius" value="[CylindersOuterRmax]"/>
<Constant name="RootHalfLength" value="[CylindersOuterLength]/2. + [CylindersEndFlangeLength]/2."/>
<Constant name="AnchorZ" value="0.*mm"/>
<Constant name="ZPixelForward" value="291.*mm"/>
<Constant name="RootStartZ" value="-4*mm"/>
<Constant name="RootMidZ1" value="[cms:TrackLumiZ1]-[ZPixelForward]"/>
<Constant name="RootMidZ2" value="[cms:TrackLumiZ2]-[ZPixelForward]"/>
<Constant name="RootMidZ3" value="[cms:TrackBeamZ1]-[ZPixelForward]"/>
<Constant name="RootEndZ" value="2*[RootHalfLength]"/>
<Constant name="DiskHalfWidth" value="36.625*mm"/> <!-- 37.5*mm -->
<Constant name="Disk1Z" value="[DiskHalfWidth]"/>
</ConstantsSection>

<SolidSection label="pixfwd.xml">
<Polycone name="PixelForwardZplus" startPhi="0*deg" deltaPhi="360*deg" >
<ZSection z="[RootStartZ]" rMin="[cms:TrackBeamR1]" rMax="[RootRadius]"/>
<ZSection z="[RootMidZ1]" rMin="[cms:TrackBeamR11]" rMax="[RootRadius]"/>
<ZSection z="[RootMidZ2]" rMin="[cms:TrackBeamR11]" rMax="[RootRadius]"/>
<ZSection z="[RootMidZ3]" rMin="[cms:TrackBeamR12]" rMax="[RootRadius]"/>
<ZSection z="[RootEndZ]" rMin="[cms:TrackBeamR2]" rMax="[RootRadius]"/>
</Polycone>
<Polycone name="PixelForwardZminus" startPhi="0*deg" deltaPhi="360*deg" >
<ZSection z="-[RootEndZ]" rMin="[cms:TrackBeamR2]" rMax="[RootRadius]"/>
<ZSection z="-[RootMidZ3]" rMin="[cms:TrackBeamR12]" rMax="[RootRadius]"/>
<ZSection z="-[RootMidZ2]" rMin="[cms:TrackBeamR11]" rMax="[RootRadius]"/>
<ZSection z="-[RootMidZ1]" rMin="[cms:TrackBeamR11]" rMax="[RootRadius]"/>
<ZSection z="-[RootStartZ]" rMin="[cms:TrackBeamR1]" rMax="[RootRadius]"/>
</Polycone>
</SolidSection>

<LogicalPartSection label="pixfwd.xml">
<LogicalPart name="PixelForwardZplus" category="envelope">
<rSolid name="PixelForwardZplus"/>
<rMaterial name="materials:Air"/>
</LogicalPart>
<LogicalPart name="PixelForwardZminus" category="envelope">
<rSolid name="PixelForwardZminus"/>
<rMaterial name="materials:Air"/>
</LogicalPart>
</LogicalPartSection>

<PosPartSection label="pixfwd.xml">
<PosPart copyNumber="1">
<rParent name="cms:CMSE"/>
<rChild name="pixfwd:PixelForwardZplus"/>
<Translation x="0*mm" y="0*mm" z="[ZPixelForward]"/>
</PosPart>
<PosPart copyNumber="2">
<rParent name="cms:CMSE"/>
<rChild name="pixfwd:PixelForwardZminus"/>
<Translation x="0*mm" y="0*mm" z="-[ZPixelForward]"/>
</PosPart>
</PosPartSection>

</DDDefinition>
5 changes: 3 additions & 2 deletions Geometry/ForwardCommonData/plugins/dd4hep/DDBHMAngular.cc
Expand Up @@ -57,11 +57,12 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext
parent.placeVolume(child, jj + 1, dd4hep::Transform3D(rot, tran));
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("ForwardGeom") << "DDBHMAngular test: " << child.name() << " number " << jj + 1
<< " positioned in " << parent.name() << " at " << tran << " with " << rot;
<< " positioned in " << parent.name() << " at " << tran << " with " << rotMat
<< " : " << rot;
#endif
}
return 1;
}

// first argument is the type from the xml file
DECLARE_DDCMS_DETELEMENT(DDCMS_forward_DDBHMAngular, algorithm)
DECLARE_DDCMS_DETELEMENT(DDCMS_bhmalgo_DDBHMAngular, algorithm)
40 changes: 40 additions & 0 deletions Geometry/ForwardCommonData/python/testForwardXML_cfi.py
@@ -0,0 +1,40 @@
import FWCore.ParameterSet.Config as cms

XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
geomXMLFiles = cms.vstring(
'Geometry/CMSCommonData/data/materials/2021/v3/materials.xml',
'Geometry/CMSCommonData/data/rotations.xml',
'Geometry/CMSCommonData/data/extend/v3/cmsextent.xml',
'Geometry/CMSCommonData/data/cavernData/2021/v1/cavernData.xml',
'Geometry/CMSCommonData/data/cms/2021/v3/cms.xml',
'Geometry/CMSCommonData/data/cmsMother.xml',
'Geometry/CMSCommonData/data/eta3/etaMax.xml',
'Geometry/TrackerCommonData/data/pixfwdCommon.xml',
'Geometry/ForwardCommonData/data/pixfwd.xml',
'Geometry/HcalCommonData/data/average/hcalforwardmaterial.xml',
'Geometry/ForwardCommonData/data/forward/2021/v1/forward.xml',
'Geometry/ForwardCommonData/data/totemt2/2021/v1/totemt2.xml',
'Geometry/ForwardCommonData/data/forwardshield/2021/v1/forwardshield.xml',
'Geometry/ForwardCommonData/data/bhm.xml',
'Geometry/ForwardCommonData/data/pltbcm/2021/v1/pltbcm.xml',
'Geometry/ForwardCommonData/data/bcm1f/2021/v1/bcm1f.xml',
'Geometry/ForwardCommonData/data/plt/2021/v1/plt.xml',
'Geometry/ForwardSimData/data/bcm1fsens.xml',
'Geometry/ForwardCommonData/data/zdcmaterials/2021/v1/zdcmaterials.xml',
'Geometry/ForwardCommonData/data/lumimaterials.xml',
'Geometry/ForwardCommonData/data/zdcrotations.xml',
'Geometry/ForwardCommonData/data/lumirotations.xml',
'Geometry/ForwardCommonData/data/zdc/2021/v1/zdc.xml',
'Geometry/ForwardCommonData/data/zdclumi/2021/v2/zdclumi.xml',
'Geometry/ForwardCommonData/data/cmszdc.xml',
'Geometry/ForwardSimData/data/pltsens.xml',
'Geometry/ForwardSimData/data/bcm1fsens.xml',
'Geometry/ForwardSimData/data/totemsensT2/2021/totemsensT2.xml',
'Geometry/ForwardSimData/data/zdcsens.xml',
'Geometry/ForwardSimData/data/bhmProdCuts/2021/v1/bhmProdCuts.xml',
'Geometry/ForwardSimData/data/zdcProdCuts/2021/v2/zdcProdCuts.xml',
'Geometry/ForwardSimData/data/ForwardShieldProdCuts.xml',
'Geometry/CMSCommonData/data/FieldParameters.xml',
),
rootNodeName = cms.string('cms:OCMS')
)
53 changes: 53 additions & 0 deletions Geometry/ForwardCommonData/test/g4OverlapCheckForwardDD4hep_cfg.py
@@ -0,0 +1,53 @@
import FWCore.ParameterSet.Config as cms
from Configuration.ProcessModifiers.dd4hep_cff import dd4hep

process = cms.Process("G4PrintGeometry",dd4hep)

process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer",
confGeomXMLFiles = cms.FileInPath('Geometry/ForwardCommonData/data/dd4hep/testForwardGeometry.xml'),
appendToDataLabel = cms.string('')
)
process.DDSpecParRegistryESProducer = cms.ESProducer("DDSpecParRegistryESProducer",
appendToDataLabel = cms.string('')
)
process.DDVectorRegistryESProducer = cms.ESProducer("DDVectorRegistryESProducer",
appendToDataLabel = cms.string(''))
process.DDCompactViewESProducer = cms.ESProducer("DDCompactViewESProducer",
appendToDataLabel = cms.string('')
)

process.load('FWCore.MessageService.MessageLogger_cfi')

if 'MessageLogger' in process.__dict__:
process.MessageLogger.SimG4CoreApplication=dict()
process.MessageLogger.G4cout=dict()
process.MessageLogger.ForwardGeom=dict()

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

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

# Geant4 geometry check
process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("forward")
process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
process.g4SimHits.G4CheckOverlap.Tolerance = cms.double(0.0)
process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
# tells if NodeName is G4Region or G4PhysicalVolume
process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(False)
# list of names
process.g4SimHits.G4CheckOverlap.NodeNames = cms.vstring('cms:CMSE_1')
# enable dump gdml file
process.g4SimHits.G4CheckOverlap.gdmlFlag = cms.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 = ''
#
process.g4SimHits.OnlySDs = cms.vstring('ZdcSensitiveDetector', 'TotemT2ScintSensitiveDetector', 'TotemSensitiveDetector', 'BCM1FSensitiveDetector', 'BHMSensitiveDetector', 'PLTSensitiveDetector')
40 changes: 40 additions & 0 deletions Geometry/ForwardCommonData/test/g4OverlapCheckForwardDDD_cfg.py
@@ -0,0 +1,40 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("G4PrintGeometry")

process.load("Geometry.ForwardCommonData.testForwardXML_cfi")
process.load('FWCore.MessageService.MessageLogger_cfi')

if 'MessageLogger' in process.__dict__:
process.MessageLogger.SimG4CoreApplication=dict()
process.MessageLogger.G4cout=dict()
process.MessageLogger.ForwardGeom=dict()

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

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

# Geant4 geometry check
process.g4SimHits.G4CheckOverlap.OutputBaseName = cms.string("forward")
process.g4SimHits.G4CheckOverlap.OverlapFlag = cms.bool(True)
process.g4SimHits.G4CheckOverlap.Tolerance = cms.double(0.0)
process.g4SimHits.G4CheckOverlap.Resolution = cms.int32(10000)
# tells if NodeName is G4Region or G4PhysicalVolume
process.g4SimHits.G4CheckOverlap.RegionFlag = cms.bool(False)
# list of names
process.g4SimHits.G4CheckOverlap.NodeNames = cms.vstring('CMSE')
# enable dump gdml file
process.g4SimHits.G4CheckOverlap.gdmlFlag = cms.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 = ''
#
process.g4SimHits.OnlySDs = cms.vstring('ZdcSensitiveDetector', 'TotemT2ScintSensitiveDetector', 'TotemSensitiveDetector', 'BCM1FSensitiveDetector', 'BHMSensitiveDetector', 'PLTSensitiveDetector')