|
| 1 | +############################################################################### |
| 2 | +# Way to use this: |
| 3 | +# cmsRun runMaterialBudgetHFNose_cfg.py geometry=D94 type=DD4hep pos=Start |
| 4 | +# |
| 5 | +# Options for geometry D92, D94 |
| 6 | +# Options for type DD4hep, DDD |
| 7 | +# Options for pos Start, End |
| 8 | +# |
| 9 | +############################################################################### |
| 10 | +import FWCore.ParameterSet.Config as cms |
| 11 | +import os, sys, importlib, re |
| 12 | +import FWCore.ParameterSet.VarParsing as VarParsing |
| 13 | + |
| 14 | +#################################################################### |
| 15 | +### SETUP OPTIONS |
| 16 | +options = VarParsing.VarParsing('standard') |
| 17 | +options.register('geometry', |
| 18 | + "D94", |
| 19 | + VarParsing.VarParsing.multiplicity.singleton, |
| 20 | + VarParsing.VarParsing.varType.string, |
| 21 | + "geometry of operations: D92, D94") |
| 22 | +options.register('type', |
| 23 | + "DDD", |
| 24 | + VarParsing.VarParsing.multiplicity.singleton, |
| 25 | + VarParsing.VarParsing.varType.string, |
| 26 | + "type of operations: DDD, DD4hep") |
| 27 | +options.register('pos', |
| 28 | + "Start", |
| 29 | + VarParsing.VarParsing.multiplicity.singleton, |
| 30 | + VarParsing.VarParsing.varType.string, |
| 31 | + "type of operations: Start, End") |
| 32 | +### get and parse the command line arguments |
| 33 | +options.parseArguments() |
| 34 | + |
| 35 | +print(options) |
| 36 | + |
| 37 | +#################################################################### |
| 38 | +# Use the options |
| 39 | + |
| 40 | +if (options.geometry == "D94"): |
| 41 | + nose = 1 |
| 42 | +else: |
| 43 | + nose = 0 |
| 44 | + |
| 45 | +if (options.type == "DD4hep"): |
| 46 | + flag = "DD4hep" |
| 47 | + ddFlag = True |
| 48 | +else: |
| 49 | + flag = "" |
| 50 | + ddFlag = False |
| 51 | + |
| 52 | +if (options.pos == "End"): |
| 53 | + zMax = 10.560 |
| 54 | + tag = "End" |
| 55 | +else: |
| 56 | + zMax = 9.6072 |
| 57 | + tag = "Front" |
| 58 | + |
| 59 | +from Configuration.ProcessModifiers.dd4hep_cff import dd4hep |
| 60 | +if (nose == 1): |
| 61 | + from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9 |
| 62 | + if (ddFlag == True): |
| 63 | + process = cms.Process('MaterialBudgetVolume',Phase2C20I13M9,dd4hep) |
| 64 | + else: |
| 65 | + process = cms.Process('MaterialBudgetVolume',Phase2C20I13M9) |
| 66 | +else: |
| 67 | + from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 |
| 68 | + if (ddFlag == True): |
| 69 | + process = cms.Process('MaterialBudgetVolume',Phase2C17I13M9,dd4hep) |
| 70 | + else: |
| 71 | + process = cms.Process('MaterialBudgetVolume',Phase2C17I13M9) |
| 72 | + |
| 73 | +geomFile = "Configuration.Geometry.Geometry" + flag + "Extended2026" + options.geometry + "Reco_cff" |
| 74 | +fileName = "matbdgHFNose" + flag + options.geometry + tag + ".root" |
| 75 | + |
| 76 | +print("Geometry file Name: ", geomFile) |
| 77 | +print("Root file Name: ", fileName) |
| 78 | +print("nose Flag: ", nose) |
| 79 | +print("ddFlag Flag: ", ddFlag) |
| 80 | +print("zMax (m): ", zMax) |
| 81 | + |
| 82 | +process.load(geomFile) |
| 83 | +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") |
| 84 | +process.load("Configuration.StandardSequences.MagneticField_cff") |
| 85 | +process.load("SimG4Core.Application.g4SimHits_cfi") |
| 86 | + |
| 87 | +process.load("IOMC.RandomEngine.IOMC_cff") |
| 88 | +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 |
| 89 | + |
| 90 | +process.load('FWCore.MessageService.MessageLogger_cfi') |
| 91 | +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000) |
| 92 | +if hasattr(process,'MessageLogger'): |
| 93 | + process.MessageLogger.MaterialBudget=dict() |
| 94 | + |
| 95 | +process.source = cms.Source("PoolSource", |
| 96 | + noEventSort = cms.untracked.bool(True), |
| 97 | + duplicateCheckMode = cms.untracked.string("noDuplicateCheck"), |
| 98 | + fileNames = cms.untracked.vstring('file:single_neutrino_random.root') |
| 99 | +) |
| 100 | + |
| 101 | +process.maxEvents = cms.untracked.PSet( |
| 102 | + input = cms.untracked.int32(-1) |
| 103 | +) |
| 104 | + |
| 105 | +process.TFileService = cms.Service("TFileService", |
| 106 | + fileName = cms.string(fileName) |
| 107 | +) |
| 108 | + |
| 109 | +process.g4SimHits.UseMagneticField = False |
| 110 | +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' |
| 111 | +process.g4SimHits.StackingAction.TrackNeutrino = True |
| 112 | +process.g4SimHits.Physics.DummyEMPhysics = True |
| 113 | +process.g4SimHits.Physics.CutsPerRegion = False |
| 114 | +process.g4SimHits.Watchers = cms.VPSet(cms.PSet( |
| 115 | + MaterialBudgetVolume = cms.PSet( |
| 116 | + lvNames = cms.vstring('BEAM', 'BEAM1', 'BEAM2', 'BEAM3', 'BEAM4', 'Tracker', 'ECAL', 'HCal', 'VCAL', 'MGNT', 'MUON', 'OQUA', 'CALOEC', 'HFNoseVol'), |
| 117 | + lvLevels = cms.vint32(3, 3, 3, 3, 3, 3, 4, 4, 3, 4, 3, 3, 4, 3), |
| 118 | + useDD4hep = cms.bool(ddFlag), |
| 119 | + rMax = cms.double(1.8), |
| 120 | + zMax = cms.double(zMax), |
| 121 | + ), |
| 122 | + type = cms.string('MaterialBudgetVolume'), |
| 123 | +)) |
| 124 | + |
| 125 | +process.load("Validation.Geometry.materialBudgetVolumeAnalysis_cfi") |
| 126 | +process.p1 = cms.Path(process.g4SimHits+process.materialBudgetVolumeAnalysis) |
0 commit comments