Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-06 06:06:59

0001 #!/usr/bin/env cmsRun
0002 
0003 # cmsRun trackingMaterialProducer.py nEvents=1000 fromDB=False
0004 
0005 import FWCore.ParameterSet.Config as cms
0006 from FWCore.ParameterSet.VarParsing import VarParsing
0007 
0008 ###################################################################
0009 # Set default phase-2 settings
0010 ###################################################################
0011 import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
0012 _PH2_GLOBAL_TAG, _PH2_ERA = _settings.get_era_and_conditions(_settings.DEFAULT_VERSION)
0013 
0014 process = cms.Process("Geometry",_PH2_ERA)
0015 
0016 process.load('FWCore.MessageService.MessageLogger_cfi')
0017 process.MessageLogger.files.debugTrackingMaterialProducer = dict()
0018 process.MessageLogger.TrackingMaterialProducer=dict()
0019 
0020 process.load('Configuration.EventContent.EventContent_cff')
0021 
0022 ## MC Related stuff
0023 process.load('Configuration.StandardSequences.Generator_cff')
0024 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0025 
0026 ### Loading 10GeV neutrino gun generator
0027 process.load("SimTracker.TrackerMaterialAnalysis.single10GeVNeutrino_cfi")
0028 
0029 ### Load vertex generator w/o smearing
0030 from Configuration.StandardSequences.VtxSmeared import VtxSmeared
0031 process.load(VtxSmeared['NoSmear'])
0032 
0033 # detector simulation (Geant4-based) with tracking material accounting 
0034 process.load("SimTracker.TrackerMaterialAnalysis.trackingMaterialProducer_cff")
0035 #For some reason now neutrino are no longer tracked, so we need to force it.
0036 process.trackingMaterialProducer.StackingAction.TrackNeutrino = True
0037 
0038 options = VarParsing('analysis')
0039 
0040 options.register('nEvents',
0041                  200000,
0042                  VarParsing.multiplicity.singleton,
0043                  VarParsing.varType.int,
0044                  "Maximum number of events"
0045 )
0046 
0047 options.register('fromDB',
0048                  False,
0049                  VarParsing.multiplicity.singleton,
0050                  VarParsing.varType.bool,
0051                  "Read from Geometry DB?",
0052 )
0053 
0054 options.parseArguments()
0055 
0056 if options.fromDB :
0057    process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0058    from Configuration.AlCa.GlobalTag import GlobalTag
0059    process.GlobalTag = GlobalTag(process.GlobalTag, _PH2_GLOBAL_TAG, '')
0060 else:
0061    process.load('Configuration.Geometry.GeometryExtendedRun4DefaultReco_cff')
0062 
0063 process.maxEvents = cms.untracked.PSet(
0064     input = cms.untracked.int32(options.nEvents)
0065 )
0066 
0067 # Input source
0068 process.source = cms.Source("EmptySource")
0069 
0070 process.out = cms.OutputModule("PoolOutputModule",
0071     outputCommands = cms.untracked.vstring(
0072         'drop *',                                                       # drop all objects
0073         'keep MaterialAccountingTracks_trackingMaterialProducer_*_*'),  # but the material accounting information
0074     fileName = cms.untracked.string('file:material.root')
0075 )
0076 
0077 process.path = cms.Path(process.generator
0078                         * process.VtxSmeared
0079                         * process.generatorSmeared
0080                         * process.trackingMaterialProducer)
0081 process.outpath = cms.EndPath(process.out)
0082