Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:00:27

0001 import sys
0002 import argparse
0003 import importlib
0004 from pathlib import Path
0005 import FWCore.ParameterSet.Config as cms
0006 
0007 print(f'{sys.argv=}')
0008 # NTOE when running cmsRun, __file__ is not defined
0009 
0010 parser = argparse.ArgumentParser(
0011     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
0012 parser.add_argument('-e', '--era', type=str, default='Phase2C17I13M9', help='era')
0013 parser.add_argument('-t', '--global-tag', type=str, default='auto:phase2_realistic_T21', help='global tag')
0014 parser.add_argument('-g', '--geometry', type=str, default='GeometryExtended2026D88Reco', help='geometry')
0015 parser.add_argument('-m', '--max-events', type=int, default=-1, help='max events')
0016 
0017 default_data_dir = Path('/eos/cms/store/relval/CMSSW_12_6_0_pre2/RelValSingleMuPt1000/GEN-SIM-RECO/125X_mcRun4_realistic_v2_2026D88noPU-v1/')
0018 default_input_files = ['file:' + str(each) for each in default_data_dir.glob('**/*.root')]
0019 parser.add_argument('-i', '--input-files', type=str, nargs='+', default=default_input_files, help='input files')
0020 parser.add_argument('-o', '--output-file', type=str, default='output.root', help='output file')
0021 args = parser.parse_args()
0022 
0023 for key, value in vars(args).items():
0024     print(f'{key}={value}')
0025 
0026 era_module = importlib.import_module(f'Configuration.Eras.Era_{args.era}_cff')
0027 era = getattr(era_module, args.era)
0028 
0029 process = cms.Process('GEMCSC', era)
0030 
0031 process = cms.Process('TestGEMCSCSegment')
0032 process.load('FWCore.MessageService.MessageLogger_cfi')
0033 process.load(f'Configuration.Geometry.{args.geometry}_cff')
0034 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0035 process.load('RecoLocalMuon.GEMCSCSegment.gemcscSegments_cfi')
0036 process.load('RecoLocalMuon.GEMCSCSegment.gemcscCoincidenceRateAnalyzer_cfi')
0037 
0038 from Configuration.AlCa.GlobalTag import GlobalTag
0039 process.GlobalTag = GlobalTag(process.GlobalTag, args.global_tag, '')
0040 
0041 process.maxEvents = cms.untracked.PSet(
0042     input = cms.untracked.int32(args.max_events)
0043 )
0044 
0045 process.source = cms.Source('PoolSource',
0046     fileNames = cms.untracked.vstring(*args.input_files)
0047 )
0048 
0049 process.gemcscSegments.enableME21GE21 = True
0050 
0051 process.gemcscSegmentSeq = cms.Sequence(
0052     process.gemcscSegments *
0053     process.gemcscCoincidenceRateAnalyzer
0054 )
0055 
0056 process.TFileService = cms.Service('TFileService',
0057     fileName = cms.string(args.output_file)
0058 )
0059 
0060 process.p = cms.Path(process.gemcscSegmentSeq)