Skip to content

Commit

Permalink
Merge pull request #46798 from bsunanda/Run3-gex181
Browse files Browse the repository at this point in the history
Run3-gex181 Getting ready for preparing payload of 2025 Geometry
  • Loading branch information
cmsbuild authored Nov 26, 2024
2 parents 3f4d840 + 94781ba commit 0266ec6
Show file tree
Hide file tree
Showing 7 changed files with 431 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/sh
function die { echo $1: status $2 ; exit $2; }

if [ $# -ne 1 ]
then
echo Error: createExtended2025Payloads.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} splitExtended2025Database.sh

# First read in the little XML files and create the
# big XML file for the Extended2025DD4hep scenario.
cmsRun geometryExtended2025DD4hep_xmlwriter.py || die 'failed geometryExtended2025DD4hep_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 geometryExtended2025DD4hep_writer.py --tag=${mytag} || die 'failed geometryExtended2025DD4hep_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 correct sequence of input and output
# files

#sed -i '{s/ExtendedGeometry2025/ExtendedGeometry2025ZeroMaterial/g}' geometryExtended2025DD4hep_xmlwriter.py
#sed -i '{s/\/ge/\/gez/g}' geometryExtended2025DD4hep_xmlwriter.py
cmsRun geometryExtended2025DD4hep_xmlwriter.py --geom=ExtendedGeometry2025ZeroMaterial --out=gez || die 'failed geometryExtended2025DD4hep_xmlwriter.py ExtendedGeometry2025ZeroMaterial' $?

#sed -i '{s/ExtendedGeometry2025ZeroMaterial/ExtendedGeometry2025FlatMinus05Percent/g}' geometryExtended2025DD4hep_xmlwriter.py
#sed -i '{s/\/gez/\/geFM05/g}' geometryExtended2025DD4hep_xmlwriter.py
cmsRun geometryExtended2025DD4hep_xmlwriter.py --geom=ExtendedGeometry2025FlatMinus05Percent --out=geFM05 || die 'failed geometryExtended2025DD4hep_xmlwriter.py ExtendedGeometry2025FlatMinus05Percent' $?

#sed -i '{s/ExtendedGeometry2025FlatMinus05Percent/ExtendedGeometry2025FlatMinus10Percent/g}' geometryExtended2025DD4hep_xmlwriter.py
#sed -i '{s/\/geFM05/\/geFM10/g}' geometryExtended2025DD4hep_xmlwriter.py
cmsRun geometryExtended2025DD4hep_xmlwriter.py --geom=ExtendedGeometry2025FlatMinus10Percent --out=geFM10 || die 'failed geometryExtended2025DD4hep_xmlwriter.py' $?

#sed -i '{s/ExtendedGeometry2025FlatMinus10Percent/ExtendedGeometry2025FlatPlus05Percent/g}' geometryExtended2025DD4hep_xmlwriter.py
#sed -i '{s/\/geFM10/\/geFP05/g}' geometryExtended2025DD4hep_xmlwriter.py
cmsRun geometryExtended2025DD4hep_xmlwriter.py --geom=ExtendedGeometry2025FlatPlus05Percent --out=geFP05 || die 'failed geometryExtended2025DD4hep_xmlwriter.py ExtendedGeometry2025FlatPlus05Percent' $?

#sed -i '{s/ExtendedGeometry2025FlatPlus05Percent/ExtendedGeometry2025FlatPlus10Percent/g}' geometryExtended2025DD4hep_xmlwriter.py
#sed -i '{s/\/geFP05/\/geFP10/g}' geometryExtended2025DD4hep_xmlwriter.py
cmsRun geometryExtended2025DD4hep_xmlwriter.py --geom=ExtendedGeometry2025FlatPlus05Percent --out=geFP10 || die 'failed geometryExtended2025DD4hep_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 correct sequence of input file and output
# tag
# To start:
# Input file Output tag
# gezSingleBigFile.xml XMLFILE_Geometry_${mytag}_Extended2025ZeroMaterial_mc

#sed -i '{s/Extended/Extended2025ZeroMaterial/g}' xmlgeometrywriter.py
#sed -i '{s/\/ge/\/gez/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py --tag=${mytag} --out=Extended2025ZeroMaterial --inPre=gez|| die 'failed xmlgeometrywriter.py Extended2025ZeroMaterial' $?

#sed -i '{s/Extended2025ZeroMaterial/Extended2025FlatMinus05Percent/g}' xmlgeometrywriter.py
#sed -i '{s/\/gez/\/geFM05/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py --tag=${mytag} --out=Extended2025FlatMinus05Percent --inPre=geFM05 || die 'failed xmlgeometrywriter.py Extended2025FlatMinus05Percent' $?

#sed -i '{s/Extended2025FlatMinus05Percent/Extended2025FlatMinus10Percent/g}' xmlgeometrywriter.py
#sed -i '{s/\/geFM05/\/geFM10/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py --tag=${mytag} --out=Extended2025FlatMinus10Percent --inPre=geFM10 || die 'failed xmlgeometrywriter.py Extended2025FlatMinus10Percent' $?

#sed -i '{s/Extended2025FlatMinus10Percent/Extended2025FlatPlus05Percent/g}' xmlgeometrywriter.py
#sed -i '{s/\/geFM10/\/geFP05/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py --tag=${mytag} --out=Extended2025FlatPlus05Percent --inPre=geFP05 || die 'failed xmlgeometrywriter.py Extended2025FlatPlus05Percent' $?

#sed -i '{s/Extended2025FlatPlus05Percent/Extended2025FlatPlus10Percent/g}' xmlgeometrywriter.py
#sed -i '{s/\/geFP05/\/geFP10/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py --tag=${mytag} --out=Extended2025FlatPlus10Percent --inPre=geFP10 || die 'failed xmlgeometrywriter.py Extended2025FlatPlus10Percent' $?

# 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 DB. There is one for each tag
./splitExtended2025Database.sh
93 changes: 93 additions & 0 deletions CondTools/Geometry/test/writehelpers/createExtended2025Payloads.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/sh


if [ $# -ne 1 ]
then
echo Error: createExtended2025Payloads.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} splitExtended2025Database.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
# GeometryExtended2025_cff geSingleBigFile.xml
cmsRun geometryExtended2025_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 geometryExtended2025_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/Extended2025/Extended2025ZeroMaterial/g}' geometryExtended2025_xmlwriter.py
sed -i '{s/\/ge/\/gez/g}' geometryExtended2025_xmlwriter.py
cmsRun geometryExtended2025_xmlwriter.py

sed -i '{s/Extended2025ZeroMaterial/Extended2025FlatMinus05Percent/g}' geometryExtended2025_xmlwriter.py
sed -i '{s/\/gez/\/geFM05/g}' geometryExtended2025_xmlwriter.py
cmsRun geometryExtended2025_xmlwriter.py

sed -i '{s/Extended2025FlatMinus05Percent/Extended2025FlatMinus10Percent/g}' geometryExtended2025_xmlwriter.py
sed -i '{s/\/geFM05/\/geFM10/g}' geometryExtended2025_xmlwriter.py
cmsRun geometryExtended2025_xmlwriter.py

sed -i '{s/Extended2025FlatMinus10Percent/Extended2025FlatPlus05Percent/g}' geometryExtended2025_xmlwriter.py
sed -i '{s/\/geFM10/\/geFP05/g}' geometryExtended2025_xmlwriter.py
cmsRun geometryExtended2025_xmlwriter.py

sed -i '{s/Extended2025FlatPlus05Percent/Extended2025FlatPlus10Percent/g}' geometryExtended2025_xmlwriter.py
sed -i '{s/\/geFP05/\/geFP10/g}' geometryExtended2025_xmlwriter.py
cmsRun geometryExtended2025_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}_Extended2025ZeroMaterial_mc
#
sed -i '{s/Extended/Extended2025ZeroMaterial/g}' xmlgeometrywriter.py
sed -i '{s/\/ge/\/gez/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py

sed -i '{s/Extended2025ZeroMaterial/Extended2025FlatMinus05Percent/g}' xmlgeometrywriter.py
sed -i '{s/\/gez/\/geFM05/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py

sed -i '{s/Extended2025FlatMinus05Percent/Extended2025FlatMinus10Percent/g}' xmlgeometrywriter.py
sed -i '{s/\/geFM05/\/geFM10/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py

sed -i '{s/Extended2025FlatMinus10Percent/Extended2025FlatPlus05Percent/g}' xmlgeometrywriter.py
sed -i '{s/\/geFM10/\/geFP05/g}' xmlgeometrywriter.py
cmsRun xmlgeometrywriter.py

sed -i '{s/Extended2025FlatPlus05Percent/Extended2025FlatPlus10Percent/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
./splitExtended2025Database.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import FWCore.ParameterSet.Config as cms
import argparse
import sys

parser = argparse.ArgumentParser(prog=sys.argv[0], description='Generate XML geometry.')
parser.add_argument("--tag", help="global tag to use", type=str)
args = parser.parse_args()


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.GeometryDD4hepExtended2025_cff')
process.load('Geometry.CaloEventSetup.CaloGeometryDBWriter_cfi')
process.load('CondTools.Geometry.HcalParametersWriter_cff')
process.load("Geometry.MuonNumbering.muonGeometryConstants_cff")
process.load("Geometry.ForwardGeometry.ZdcGeometry_cfi")

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_'+args.tag+'_Extended2025_mc')),
cms.PSet(record = cms.string('IdealGeometryRecord'),tag = cms.string('TKRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('PTrackerParametersRcd'),tag = cms.string('TKParameters_Geometry_'+args.tag)),
cms.PSet(record = cms.string('PEcalBarrelRcd'), tag = cms.string('EBRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('PEcalEndcapRcd'), tag = cms.string('EERECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('PEcalPreshowerRcd'),tag = cms.string('EPRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('PHcalRcd'), tag = cms.string('HCALRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('HcalParametersRcd'), tag = cms.string('HCALParameters_Geometry_'+args.tag)),
cms.PSet(record = cms.string('PCaloTowerRcd'), tag = cms.string('CTRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('PZdcRcd'), tag = cms.string('ZDCRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('PCastorRcd'), tag = cms.string('CASTORRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('CSCRecoGeometryRcd'),tag = cms.string('CSCRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('CSCRecoDigiParametersRcd'),tag = cms.string('CSCRECODIGI_Geometry_'+args.tag)),
cms.PSet(record = cms.string('DTRecoGeometryRcd'),tag = cms.string('DTRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('RPCRecoGeometryRcd'),tag = cms.string('RPCRECO_Geometry_'+args.tag)),
cms.PSet(record = cms.string('GEMRecoGeometryRcd'),tag = cms.string('GEMRECO_Geometry_'+args.tag))
)
)

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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import FWCore.ParameterSet.Config as cms

import argparse
import sys

parser = argparse.ArgumentParser(prog=sys.argv[0], description='Generate XML geometry.')
parser.add_argument("--geom", help="Name of parameter", type=str, default='ExtendedGeometry2025')
parser.add_argument("--out", help="Prefix for output file", type=str, default='ge')

args = parser.parse_args()

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/cms'+args.geom+'.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("./"+args.out+"SingleBigFile.xml")
)


process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)

process.p1 = cms.Path(process.BigXMLWriter)

Loading

0 comments on commit 0266ec6

Please sign in to comment.