From 46b140351f3aa22202714456bf84225095ca898a Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 7 Aug 2023 18:26:56 +0200 Subject: [PATCH 1/2] Try to see the impactc of additional SD's of HCAL in the Run3 scenario for dd4hep --- .../data/dd4hep/cmsExtendedGeometry2021.xml | 383 ++++++++++++++++++ .../GeometryDD4hepExtended2021Reco_cff.py | 55 +++ SimG4CMS/Calo/macros/MakeHitStudyPlots.C | 11 +- SimG4CMS/Calo/test/python/SimRun3_cfg.py | 124 ++++++ 4 files changed, 568 insertions(+), 5 deletions(-) create mode 100644 Geometry/HcalCommonData/data/dd4hep/cmsExtendedGeometry2021.xml create mode 100644 Geometry/HcalCommonData/python/GeometryDD4hepExtended2021Reco_cff.py create mode 100644 SimG4CMS/Calo/test/python/SimRun3_cfg.py diff --git a/Geometry/HcalCommonData/data/dd4hep/cmsExtendedGeometry2021.xml b/Geometry/HcalCommonData/data/dd4hep/cmsExtendedGeometry2021.xml new file mode 100644 index 0000000000000..4c1c913e4733c --- /dev/null +++ b/Geometry/HcalCommonData/data/dd4hep/cmsExtendedGeometry2021.xml @@ -0,0 +1,383 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + )/> + + diff --git a/Geometry/HcalCommonData/python/GeometryDD4hepExtended2021Reco_cff.py b/Geometry/HcalCommonData/python/GeometryDD4hepExtended2021Reco_cff.py new file mode 100644 index 0000000000000..54ae632910e60 --- /dev/null +++ b/Geometry/HcalCommonData/python/GeometryDD4hepExtended2021Reco_cff.py @@ -0,0 +1,55 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Geometry.GeometryDD4hep_cff import * +DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("Geometry/HcalCommonData/data/dd4hep/cmsExtendedGeometry2021.xml") + +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff import * +from Geometry.EcalCommonData.ecalSimulationParameters_cff import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cff import * +from Geometry.MuonNumbering.muonGeometryConstants_cff import * +from Geometry.MuonNumbering.muonOffsetESProducer_cff import * + +# tracker +from Geometry.CommonTopologies.globalTrackingGeometry_cfi import * +from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import * +from Geometry.TrackerGeometryBuilder.trackerParameters_cff import * +from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import * +from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import * + +# calo +from Geometry.CaloEventSetup.CaloTopology_cfi import * +from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import * +CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder", + SelectedCalos = cms.vstring("HCAL", + "ZDC", + "EcalBarrel", + "EcalEndcap", + "EcalPreshower", + "TOWER", + ) +) +from Geometry.EcalAlgo.EcalGeometry_cfi import * +from Geometry.HcalEventSetup.HcalGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import * +from Geometry.HcalEventSetup.CaloTowerTopology_cfi import * +from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import * +from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import * +from Geometry.ForwardGeometry.ForwardGeometry_cfi import * +from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import * +from Geometry.EcalMapping.EcalMapping_cfi import * +from Geometry.EcalMapping.EcalMappingRecord_cfi import * + +# muon +from Geometry.MuonNumbering.muonNumberingInitialization_cfi import * +from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import * +from Geometry.GEMGeometryBuilder.gemGeometry_cff import * +from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import * +from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import * + +# forward +from Geometry.ForwardGeometry.ForwardGeometry_cfi import * + +# pps + + + diff --git a/SimG4CMS/Calo/macros/MakeHitStudyPlots.C b/SimG4CMS/Calo/macros/MakeHitStudyPlots.C index dc84deb304b3b..9da92c2392d5c 100644 --- a/SimG4CMS/Calo/macros/MakeHitStudyPlots.C +++ b/SimG4CMS/Calo/macros/MakeHitStudyPlots.C @@ -67,11 +67,12 @@ void makeHitStudyPlots(std::string file1 = "uncorr/analRun3.root", bool save = false, std::string dirnm = "CaloSimHitStudy") { const int plots = 20; - std::string names[plots] = {"Etot", "Hit", "EtotG", "Time", "eta", "phi", "EdepEM", - "EdepHad", "EdepTk", "Edep", "HitHigh", "HitLow", "HitMu", "HitTk", - "TimeAll", "TimeTk", "EneInc", "EtaInc", "PhiInc", "PtInc"}; - int numb[plots] = {9, 9, 9, 9, 9, 9, 9, 9, 16, 9, 1, 1, 1, 16, 9, 16, 1, 1, 1, 1}; - int rebin[plots] = {10, 10, 10, 10, 2, 4, 10, 10, 1, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1}; + std::string names[plots] = {"Etot", "Hit", "EtotG", "Time", "EdepTk", + "Edep", "HitHigh", "HitLow", "HitMu", "HitTk", + "TimeAll", "TimeTk", "eta", "phi", "EdepEM", + "EdepHad", "EneInc", "EtaInc", "PhiInc", "PtInc"}; + int numb[plots] = {9, 9, 9, 9, 16, 9, 1, 1, 1, 16, 9, 16, 9, 9, 9, 9, 1, 1, 1, 1}; + int rebin[plots] = {10, 10, 10, 10, 1, 10, 10, 10, 10, 10, 10, 10, 2, 4, 10, 10, 1, 1, 1, 1}; bool debug(false); gStyle->SetCanvasBorderMode(0); diff --git a/SimG4CMS/Calo/test/python/SimRun3_cfg.py b/SimG4CMS/Calo/test/python/SimRun3_cfg.py new file mode 100644 index 0000000000000..9468c27bd52d3 --- /dev/null +++ b/SimG4CMS/Calo/test/python/SimRun3_cfg.py @@ -0,0 +1,124 @@ +############################################################################### +# Way to use this: +# cmsRun SimRun3_cfg.py geometry=Default type=DDD data=Muon +# +# Options for geometry: Default, Other +# type: DDD, DD4hep +# data: Muon, MinBias +# +############################################################################### +import FWCore.ParameterSet.Config as cms +import os, sys, imp, re, random +import FWCore.ParameterSet.VarParsing as VarParsing + +#################################################################### +### SETUP OPTIONS +options = VarParsing.VarParsing('standard') +options.register('geometry', + "Default", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "type of operations: Default, Other") +options.register('type', + "DDD", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "type of operations: DDD, DD4hep") +options.register('data', + "Muon", + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "data of operations: Muon, MinBias") + +### get and parse the command line arguments +options.parseArguments() + +print(options) + +#################################################################### +# Use the options + +if (options.type == "DDD"): + from Configuration.Eras.Era_Run3_DDD_cff import Run3_DDD + process = cms.Process('SimRun3',Run3_DDD) + if (options.geometry == "Default"): + geomFile = "Configuration.Geometry.GeometryExtended2021Reco_cff" + else: + geomFile = "Geometry.HcalCommonData.GeometryExtended2021Reco_cff" +else: + from Configuration.Eras.Era_Run3_cff import Run3 + process = cms.Process('SimRun3',Run3) + if (options.geometry == "Default"): + geomFile = "Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff" + else: + geomFile = "Geometry.HcalCommonData.GeometryDD4hepExtended2021Reco_cff" + +globalTag = "auto:phase1_2022_realistic" +inFile = "file:step0" + options.data + ".root" +outFile = "file:step1" + "Run3" + options.geometry + options.type + options.data + ".root" +tFile = "file:" + "Run3" + options.geometry + options.type + options.data + ".root" + +print("Geometry file: ", geomFile) +print("Global Tag: ", globalTag) +print("Input file: ", inFile) +print("Output file: ", outFile) +print("Histogram file:", tFile) + +process.load(geomFile) +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load("IOMC.EventVertexGenerators.VtxSmearedGauss_cfi") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("Configuration.EventContent.EventContent_cff") +process.load("Configuration.StandardSequences.SimIdeal_cff") +process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '') + +process.source = cms.Source("PoolSource", + dropDescendantsOfDroppedBranches = cms.untracked.bool(False), + fileNames = cms.untracked.vstring(inFile), + secondaryFileNames = cms.untracked.vstring() +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.G4cerr=dict() + process.MessageLogger.HitStudy=dict() +# process.MessageLogger.SensitiveDetector=dict() + +process.Timing = cms.Service("Timing") + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.generator.initialSeed = 456789 +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 +process.RandomNumberGeneratorService.VtxSmeared.initialSeed = 123456789 +process.rndmStore = cms.EDProducer("RandomEngineStateProducer") + +# Event output +process.output = cms.OutputModule("PoolOutputModule", + process.FEVTSIMEventContent, + fileName = cms.untracked.string(outFile) +) + +process.load("SimG4CMS.Calo.CaloSimHitStudy_cfi") +process.TFileService = cms.Service("TFileService", + fileName = cms.string(tFile) +) + +process.simulation_step = cms.Path(process.psim) +process.out_step = cms.EndPath(process.output) +process.analysis_step = cms.EndPath(process.CaloSimHitStudy) + +process.g4SimHits.Physics.type = 'SimG4Core/Physics/FTFP_BERT_EMM' +process.g4SimHits.LHCTransport = False + +# Schedule definition +process.schedule = cms.Schedule(process.simulation_step, + process.out_step, + process.analysis_step, + ) From 20bac01f2dcf2f1dea24b36a75816ffd71601eaa Mon Sep 17 00:00:00 2001 From: Sunanda Date: Mon, 7 Aug 2023 18:49:02 +0200 Subject: [PATCH 2/2] Code format --- SimG4CMS/Calo/macros/MakeHitStudyPlots.C | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SimG4CMS/Calo/macros/MakeHitStudyPlots.C b/SimG4CMS/Calo/macros/MakeHitStudyPlots.C index 9da92c2392d5c..9b9914fc8a932 100644 --- a/SimG4CMS/Calo/macros/MakeHitStudyPlots.C +++ b/SimG4CMS/Calo/macros/MakeHitStudyPlots.C @@ -67,10 +67,9 @@ void makeHitStudyPlots(std::string file1 = "uncorr/analRun3.root", bool save = false, std::string dirnm = "CaloSimHitStudy") { const int plots = 20; - std::string names[plots] = {"Etot", "Hit", "EtotG", "Time", "EdepTk", - "Edep", "HitHigh", "HitLow", "HitMu", "HitTk", - "TimeAll", "TimeTk", "eta", "phi", "EdepEM", - "EdepHad", "EneInc", "EtaInc", "PhiInc", "PtInc"}; + std::string names[plots] = {"Etot", "Hit", "EtotG", "Time", "EdepTk", "Edep", "HitHigh", + "HitLow", "HitMu", "HitTk", "TimeAll", "TimeTk", "eta", "phi", + "EdepEM", "EdepHad", "EneInc", "EtaInc", "PhiInc", "PtInc"}; int numb[plots] = {9, 9, 9, 9, 16, 9, 1, 1, 1, 16, 9, 16, 9, 9, 9, 9, 1, 1, 1, 1}; int rebin[plots] = {10, 10, 10, 10, 1, 10, 10, 10, 10, 10, 10, 10, 2, 4, 10, 10, 1, 1, 1, 1}; bool debug(false);