Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-11-14 23:29:33

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun runMaterialBudgetHFNose_cfg.py geometry=D94 type=DD4hep pos=Start
0004 #
0005 #   Options for geometry D92, D94
0006 #   Options for type DD4hep, DDD
0007 #   Options for pos Start, End
0008 #
0009 ###############################################################################
0010 import FWCore.ParameterSet.Config as cms
0011 import os, sys, importlib, re
0012 import FWCore.ParameterSet.VarParsing as VarParsing
0013 
0014 ####################################################################
0015 ### SETUP OPTIONS
0016 options = VarParsing.VarParsing('standard')
0017 options.register('geometry',
0018                  "D94",
0019                   VarParsing.VarParsing.multiplicity.singleton,
0020                   VarParsing.VarParsing.varType.string,
0021                   "geometry of operations: D92, D94")
0022 options.register('type',
0023                  "DDD",
0024                   VarParsing.VarParsing.multiplicity.singleton,
0025                   VarParsing.VarParsing.varType.string,
0026                   "type of operations: DDD, DD4hep")
0027 options.register('pos',
0028                  "Start",
0029                   VarParsing.VarParsing.multiplicity.singleton,
0030                   VarParsing.VarParsing.varType.string,
0031                   "type of operations: Start, End")
0032 ### get and parse the command line arguments
0033 options.parseArguments()
0034 
0035 print(options)
0036 
0037 ####################################################################
0038 # Use the options
0039 
0040 if (options.geometry == "D94"):
0041     nose = 1
0042 else:
0043     nose = 0
0044 
0045 if (options.type == "DD4hep"):
0046     flag = "DD4hep"
0047     ddFlag = True
0048 else:
0049     flag = ""
0050     ddFlag = False
0051 
0052 if (options.pos == "End"):
0053     zMax = 10.560
0054     tag = "End"
0055 else:
0056     zMax = 9.6072
0057     tag = "Front"
0058 
0059 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
0060 if (nose == 1):
0061     from Configuration.Eras.Era_Phase2C20I13M9_cff import Phase2C20I13M9
0062     if (ddFlag == True):
0063         process = cms.Process('MaterialBudgetVolume',Phase2C20I13M9,dd4hep)
0064     else:
0065         process = cms.Process('MaterialBudgetVolume',Phase2C20I13M9)
0066 else:
0067     from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0068     if (ddFlag == True):
0069         process = cms.Process('MaterialBudgetVolume',Phase2C17I13M9,dd4hep)
0070     else:
0071         process = cms.Process('MaterialBudgetVolume',Phase2C17I13M9)
0072 
0073 geomFile = "Configuration.Geometry.Geometry" + flag + "Extended2026" + options.geometry + "Reco_cff"
0074 fileName = "matbdgHFNose" + flag + options.geometry + tag + ".root"
0075 
0076 print("Geometry file Name: ", geomFile)
0077 print("Root file Name:     ", fileName)
0078 print("nose Flag:          ", nose)
0079 print("ddFlag Flag:        ", ddFlag)
0080 print("zMax (m):           ", zMax)
0081 
0082 process.load(geomFile)
0083 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0084 process.load("Configuration.StandardSequences.MagneticField_cff")
0085 process.load("SimG4Core.Application.g4SimHits_cfi")
0086 
0087 process.load("IOMC.RandomEngine.IOMC_cff")
0088 process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876
0089 
0090 process.load('FWCore.MessageService.MessageLogger_cfi')
0091 process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000)
0092 if hasattr(process,'MessageLogger'):
0093     process.MessageLogger.MaterialBudget=dict()
0094 
0095 process.source = cms.Source("PoolSource",
0096     noEventSort = cms.untracked.bool(True),
0097     duplicateCheckMode = cms.untracked.string("noDuplicateCheck"),
0098     fileNames = cms.untracked.vstring('file:single_neutrino_random.root')
0099 )
0100 
0101 process.maxEvents = cms.untracked.PSet(
0102     input = cms.untracked.int32(-1)
0103 )
0104 
0105 process.TFileService = cms.Service("TFileService",
0106     fileName = cms.string(fileName)
0107 )
0108 
0109 process.g4SimHits.UseMagneticField = False
0110 process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics'
0111 process.g4SimHits.StackingAction.TrackNeutrino = True
0112 process.g4SimHits.Physics.DummyEMPhysics = True
0113 process.g4SimHits.Physics.CutsPerRegion = False
0114 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0115     MaterialBudgetVolume = cms.PSet(
0116         lvNames = cms.vstring('BEAM', 'BEAM1', 'BEAM2', 'BEAM3', 'BEAM4', 'Tracker', 'ECAL', 'HCal', 'VCAL', 'MGNT', 'MUON', 'OQUA', 'CALOEC', 'HFNoseVol'),
0117         lvLevels = cms.vint32(3, 3, 3, 3, 3, 3, 4, 4, 3, 4, 3, 3, 4, 3),
0118         useDD4hep = cms.bool(ddFlag),
0119         rMax = cms.double(1.8),
0120         zMax = cms.double(zMax),
0121     ),
0122     type = cms.string('MaterialBudgetVolume'),
0123 ))
0124 
0125 process.load("Validation.Geometry.materialBudgetVolumeAnalysis_cfi")
0126 process.p1 = cms.Path(process.g4SimHits+process.materialBudgetVolumeAnalysis)