-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[DD4hep] Tool for creation of DD4hep geometry DB payloads and for migration validation #34111
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
CondTools/Geometry/test/writehelpers/createExtended2021DD4hepPayloads.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/bin/sh | ||
|
||
|
||
if [ $# -ne 1 ] | ||
then | ||
echo Error: createExtended2021Payloads.sh requires exactly one argument which is the tag | ||
exit 1 | ||
fi | ||
mytag=$1 | ||
echo ${mytag} | ||
|
||
# Set the tag in all the scripts and the metadata text files | ||
sed -i {s/TagXX/${mytag}/g} *.py | ||
compgen -G "*.txt" > /dev/null && sed -i {s/TagXX/${mytag}/g} *.txt | ||
sed -i {s/TagXX/${mytag}/g} splitExtended2021Database.sh | ||
|
||
# First read in the little XML files and create the | ||
# large XML file for the Phase1_R30F12_HCal Ideal scenario. | ||
# Input cff Output file | ||
# GeometryExtended2021_cff geSingleBigFile.xml | ||
cmsRun geometryExtended2021DD4hep_xmlwriter.py | ||
|
||
# Now convert the content of the large XML file into | ||
# a "blob" and write it to the database. | ||
# Also reads in the little XML files again and fills | ||
# the DDCompactView. From the DDCompactView the | ||
# reco parts of the database are also filled. | ||
cmsRun geometryExtended2021DD4hep_writer.py | ||
|
||
# Now put the other scenarios into the database. | ||
# Input the many XML files referenced by the cff file and | ||
# output a single big XML file. | ||
# This is repeated several times below. The sed commands | ||
# serve to give the following sequence of input and output | ||
# files | ||
# | ||
# Input cff Output file | ||
# GeometryIdeal_cff giSingleBigFile.xml | ||
# | ||
# sed -i '{s/Extended2021/Extended2021ZeroMaterial/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# sed -i '{s/\/ge/\/gez/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# cmsRun geometryExtended2021DD4hep_xmlwriter.py | ||
|
||
# sed -i '{s/Extended2021ZeroMaterial/Extended2021FlatMinus05Percent/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# sed -i '{s/\/gez/\/geFM05/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# cmsRun geometryExtended2021DD4hep_xmlwriter.py | ||
|
||
# sed -i '{s/Extended2021FlatMinus05Percent/Extended2021FlatMinus10Percent/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# sed -i '{s/\/geFM05/\/geFM10/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# cmsRun geometryExtended2021DD4hep_xmlwriter.py | ||
|
||
# sed -i '{s/Extended2021FlatMinus10Percent/Extended2021FlatPlus05Percent/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# sed -i '{s/\/geFM10/\/geFP05/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# cmsRun geometryExtended2021DD4hep_xmlwriter.py | ||
|
||
# sed -i '{s/Extended2021FlatPlus05Percent/Extended2021FlatPlus10Percent/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# sed -i '{s/\/geFP05/\/geFP10/g}' geometryExtended2021DD4hep_xmlwriter.py | ||
# cmsRun geometryExtended2021DD4hep_xmlwriter.py | ||
|
||
# Read the one big XML file and output a record to the | ||
# database with the an identifying tag | ||
# This is repeated several times below. The sed commands | ||
# serve to give the following sequence of input file and output | ||
# tag | ||
# | ||
# Input file Output tag | ||
# gezSingleBigFile.xml XMLFILE_Geometry_${mytag}_Extended2021ZeroMaterial_mc | ||
# | ||
# sed -i '{s/Extended/Extended2021ZeroMaterial/g}' xmlgeometrywriter.py | ||
# sed -i '{s/\/ge/\/gez/g}' xmlgeometrywriter.py | ||
# cmsRun xmlgeometrywriter.py | ||
|
||
# sed -i '{s/Extended2021ZeroMaterial/Extended2021FlatMinus05Percent/g}' xmlgeometrywriter.py | ||
# sed -i '{s/\/gez/\/geFM05/g}' xmlgeometrywriter.py | ||
# cmsRun xmlgeometrywriter.py | ||
|
||
# sed -i '{s/Extended2021FlatMinus05Percent/Extended2021FlatMinus10Percent/g}' xmlgeometrywriter.py | ||
# sed -i '{s/\/geFM05/\/geFM10/g}' xmlgeometrywriter.py | ||
# cmsRun xmlgeometrywriter.py | ||
|
||
# sed -i '{s/Extended2021FlatMinus10Percent/Extended2021FlatPlus05Percent/g}' xmlgeometrywriter.py | ||
# sed -i '{s/\/geFM10/\/geFP05/g}' xmlgeometrywriter.py | ||
# cmsRun xmlgeometrywriter.py | ||
|
||
# sed -i '{s/Extended2021FlatPlus05Percent/Extended2021FlatPlus10Percent/g}' xmlgeometrywriter.py | ||
# sed -i '{s/\/geFP05/\/geFP10/g}' xmlgeometrywriter.py | ||
# cmsRun xmlgeometrywriter.py | ||
|
||
# All the database objects were written into one database | ||
# (myfile.db) in the steps above. Extract the different | ||
# pieces into separate database files. These are the payloads | ||
# that get uploaded to the dropbox. There is one for each tag | ||
./splitExtended2021Database.sh |
80 changes: 80 additions & 0 deletions
80
CondTools/Geometry/test/writehelpers/geometryExtended2021DD4hep_writer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep | ||
|
||
process = cms.Process("GeometryWriter", Run3_dd4hep) | ||
|
||
from Configuration.ProcessModifiers.dd4hep_cff import dd4hep | ||
|
||
process.load('CondCore.CondDB.CondDB_cfi') | ||
|
||
process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') | ||
process.load('Geometry.CaloEventSetup.CaloGeometryDBWriter_cfi') | ||
process.load('CondTools.Geometry.HcalParametersWriter_cff') | ||
process.load("Geometry.MuonNumbering.muonGeometryConstants_cff") | ||
|
||
process.CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", | ||
SelectedCalos = cms.vstring( | ||
'HCAL', | ||
'ZDC', | ||
'EcalBarrel', | ||
'EcalEndcap', | ||
'EcalPreshower', | ||
'TOWER' | ||
) | ||
) | ||
|
||
process.source = cms.Source("EmptyIOVSource", | ||
lastValue = cms.uint64(1), | ||
timetype = cms.string('runnumber'), | ||
firstValue = cms.uint64(1), | ||
interval = cms.uint64(1) | ||
) | ||
|
||
# This reads the big XML file and the only way to fill the | ||
# nonreco part of the database is to read this file. | ||
process.XMLGeometryWriter = cms.EDAnalyzer("XMLGeometryBuilder", | ||
XMLFileName = cms.untracked.string("./geSingleBigFile.xml"), | ||
ZIP = cms.untracked.bool(True) | ||
) | ||
|
||
process.TrackerGeometryWriter = cms.EDAnalyzer("PGeometricDetBuilder",fromDD4hep=cms.bool(True)) | ||
process.TrackerParametersWriter = cms.EDAnalyzer("PTrackerParametersDBBuilder",fromDD4hep=cms.bool(True)) | ||
|
||
process.CaloGeometryWriter = cms.EDAnalyzer("PCaloGeometryBuilder",fromDD4Hep = cms.untracked.bool(True)) | ||
|
||
process.CSCGeometryWriter = cms.EDAnalyzer("CSCRecoIdealDBLoader",fromDD4Hep = cms.untracked.bool(True)) | ||
|
||
process.DTGeometryWriter = cms.EDAnalyzer("DTRecoIdealDBLoader",fromDD4Hep = cms.untracked.bool(True)) | ||
|
||
process.RPCGeometryWriter = cms.EDAnalyzer("RPCRecoIdealDBLoader",fromDD4Hep = cms.untracked.bool(True)) | ||
|
||
process.GEMGeometryWriter = cms.EDAnalyzer("GEMRecoIdealDBLoader",fromDD4Hep = cms.untracked.bool(True)) | ||
|
||
process.CondDB.timetype = cms.untracked.string('runnumber') | ||
process.CondDB.connect = cms.string('sqlite_file:myfile.db') | ||
process.PoolDBOutputService = cms.Service("PoolDBOutputService", | ||
process.CondDB, | ||
toPut = cms.VPSet(cms.PSet(record = cms.string('GeometryFileRcd'),tag = cms.string('XMLFILE_Geometry_TagXX_Extended2021_mc')), | ||
cms.PSet(record = cms.string('IdealGeometryRecord'),tag = cms.string('TKRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('PTrackerParametersRcd'),tag = cms.string('TKParameters_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('PEcalBarrelRcd'), tag = cms.string('EBRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('PEcalEndcapRcd'), tag = cms.string('EERECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('PEcalPreshowerRcd'),tag = cms.string('EPRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('PHcalRcd'), tag = cms.string('HCALRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('HcalParametersRcd'), tag = cms.string('HCALParameters_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('PCaloTowerRcd'), tag = cms.string('CTRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('PZdcRcd'), tag = cms.string('ZDCRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('PCastorRcd'), tag = cms.string('CASTORRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('CSCRecoGeometryRcd'),tag = cms.string('CSCRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('CSCRecoDigiParametersRcd'),tag = cms.string('CSCRECODIGI_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('DTRecoGeometryRcd'),tag = cms.string('DTRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('RPCRecoGeometryRcd'),tag = cms.string('RPCRECO_Geometry_TagXX')), | ||
cms.PSet(record = cms.string('GEMRecoGeometryRcd'),tag = cms.string('GEMRECO_Geometry_TagXX')) | ||
) | ||
) | ||
|
||
process.maxEvents = cms.untracked.PSet( | ||
input = cms.untracked.int32(1) | ||
) | ||
|
||
process.p1 = cms.Path(process.XMLGeometryWriter+process.TrackerGeometryWriter+process.TrackerParametersWriter+process.CaloGeometryWriter+process.HcalParametersWriter+process.CSCGeometryWriter+process.DTGeometryWriter+process.RPCGeometryWriter+process.GEMGeometryWriter) |
31 changes: 31 additions & 0 deletions
31
CondTools/Geometry/test/writehelpers/geometryExtended2021DD4hep_xmlwriter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("GeometryXMLWriter") | ||
|
||
process.source = cms.Source("EmptyIOVSource", | ||
lastValue = cms.uint64(1), | ||
timetype = cms.string('runnumber'), | ||
firstValue = cms.uint64(1), | ||
interval = cms.uint64(1) | ||
) | ||
|
||
process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", | ||
confGeomXMLFiles = cms.FileInPath('Geometry/CMSCommonData/data/dd4hep/cmsExtendedGeometry2021.xml'), | ||
appendToDataLabel = cms.string('make-payload') | ||
) | ||
|
||
process.DDCompactViewESProducer = cms.ESProducer("DDCompactViewESProducer", | ||
appendToDataLabel = cms.string('make-payload') | ||
) | ||
|
||
process.BigXMLWriter = cms.EDAnalyzer("OutputDD4hepToDDL", | ||
fileName = cms.untracked.string("./geSingleBigFile.xml") | ||
) | ||
|
||
|
||
process.maxEvents = cms.untracked.PSet( | ||
input = cms.untracked.int32(1) | ||
) | ||
|
||
process.p1 = cms.Path(process.BigXMLWriter) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cvuosalo - please, remove commented out code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the PR description, a forthcoming PR will enable these lines to produce the reduced material scenarios. Right now the lines serve as reminders of what will be implemented soon.