Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-20 02:50:23

0001 #################################################################################################
0002 # To run execute do
0003 # cmsRun tmtt_tf_analysis_cfg.py Events=50 inputMC=Samples/Muons/PU0.txt histFile=outputHistFile.root
0004 # where the arguments take default values if you don't specify them. You can change defaults below.
0005 #################################################################################################
0006 
0007 import FWCore.ParameterSet.Config as cms
0008 import FWCore.Utilities.FileUtils as FileUtils
0009 import FWCore.ParameterSet.VarParsing as VarParsing
0010 
0011 process = cms.Process("L1TVertexFinder")
0012 
0013 process.load('Configuration.Geometry.GeometryExtended2023D17Reco_cff')
0014 process.load('Configuration.Geometry.GeometryExtended2023D17_cff')
0015 process.load('Configuration.StandardSequences.MagneticField_cff')
0016 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0017 from Configuration.AlCa.GlobalTag import GlobalTag
0018 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgradePLS3', '')
0019 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0020 
0021 
0022 options = VarParsing.VarParsing ('analysis')
0023 options.register('analysis',False,VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.bool,"Run vertex finding analysis code")
0024 options.register('histFile','Hist.root',VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string,"Name of output histogram file")
0025 options.register('l1Tracks','TMTrackProducer:TML1TracksKF4ParamsComb', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, 'L1 track collection to use')
0026 
0027 options.parseArguments()
0028 
0029 
0030 #--- input and output
0031 inputFiles = []
0032 for filePath in options.inputFiles:
0033     if filePath.endswith(".root"):
0034         inputFiles.append(filePath)
0035     else:
0036         inputFiles += FileUtils.loadListFromFile(filePath)
0037 
0038 if options.l1Tracks.count(':') != 1:
0039     raise RuntimeError("Value for 'l1Tracks' command-line argument (= '{}') should contain one colon".format(options.l1Tracks))
0040 
0041 l1TracksTag = cms.InputTag(options.l1Tracks.split(':')[0], options.l1Tracks.split(':')[1])
0042 print "  INPUT TRACK COLLECTION = {0}  {1}".format(*options.l1Tracks.split(':')) 
0043     
0044 
0045 process.options   = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )
0046 
0047 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) )
0048 
0049 if options.analysis:
0050     process.TFileService = cms.Service("TFileService", fileName = cms.string(options.histFile))
0051 
0052 process.source = cms.Source ("PoolSource",
0053                             fileNames = cms.untracked.vstring(inputFiles),
0054                             secondaryFileNames = cms.untracked.vstring(),
0055                             # skipEvents = cms.untracked.uint32(500)
0056                             )
0057 
0058 
0059 # process.out = cms.OutputModule("PoolOutputModule",
0060 #     fileName = cms.untracked.string(options.outputFile),
0061 #     outputCommands = cms.untracked.vstring(
0062 #       "keep *",
0063 #       "keep *_producer_*_*",
0064 #       "keep *_VertexProducer_*_*"
0065 #       )
0066 # )
0067 
0068 
0069 process.Timing = cms.Service("Timing", summaryOnly = cms.untracked.bool(True))
0070 
0071 
0072 #--- Load config fragment that configures vertex producer
0073 process.load('L1Trigger.VertexFinder.VertexProducer_cff')
0074 process.VertexProducer.l1TracksInputTag = l1TracksTag
0075 
0076 #--- Load config fragment that configures vertex analyzer
0077 process.load('L1Trigger.VertexFinder.VertexAnalyzer_cff')
0078 process.L1TVertexAnalyzer.l1TracksInputTag = l1TracksTag
0079 
0080 if process.L1TVertexAnalyzer.debug == 0:
0081     process.MessageLogger.cerr.FwkReport.reportEvery = 50
0082 
0083 
0084 if (options.analysis):
0085     process.p = cms.Path(process.VertexProducer + process.L1TVertexAnalyzer)
0086 else:
0087     process.p = cms.Path(process.VertexProducer)
0088 
0089 # process.e = cms.EndPath(process.out)