Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-08 22:26:28

0001 import sys
0002 import FWCore.ParameterSet.Config as cms
0003 from FWCore.ParameterSet.VarParsing import VarParsing
0004 from Configuration.Eras.Era_Run3_cff import Run3
0005 
0006 options = VarParsing('analysis')
0007 options.register ("dataVsEmulation", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool)
0008 options.register ("dataVsEmulationFile", "empty", VarParsing.multiplicity.singleton, VarParsing.varType.string)
0009 """
0010 - For CMS runs, use the actual run number. Set useB904ME11, useB904ME21 or useB904ME234s2 to False
0011 - For B904 runs, set useB904ME11, useB904ME21 or useB904ME234s2 to True and set runNumber >= 341761.
0012   Set B904RunNumber to when the data was taken, e.g. 210519_162820.
0013 """
0014 options.register("runNumber", 0, VarParsing.multiplicity.singleton, VarParsing.varType.int)
0015 options.register("useB904ME11", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool,
0016                  "Set to True when using B904 ME1/1 data.")
0017 options.register("useB904ME21", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool,
0018                  "Set to True when using B904 ME2/1 data (also works for ME3/1 and ME4/1).")
0019 options.register("useB904ME234s2", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool,
0020                  "Set to True when using B904 ME1/1 data (also works for MEX/2 and ME1/3).")
0021 options.register("B904RunNumber", "YYMMDD_HHMMSS", VarParsing.multiplicity.singleton, VarParsing.varType.string)
0022 options.parseArguments()
0023 
0024 B904Setup = options.useB904ME11 or options.useB904ME21 or options.useB904ME234s2
0025 if B904Setup and options.B904RunNumber == "YYMMDD_HHMMSS":
0026     sys.exit("B904 setup was selected. Please provide a valid Run Number")
0027 
0028 if (not B904Setup) and int(options.runNumber) == 0:
0029     sys.exit("Please provide a valid CMS Run Number")
0030 
0031 process = cms.Process("ANALYSIS", Run3)
0032 process.load("FWCore.MessageService.MessageLogger_cfi")
0033 
0034 process.source = cms.Source(
0035       "PoolSource",
0036       fileNames = cms.untracked.vstring(options.inputFiles)
0037 )
0038 
0039 if options.dataVsEmulation:
0040     options.maxEvents = 1
0041     process.source = cms.Source("EmptySource")
0042 
0043 
0044 process.maxEvents = cms.untracked.PSet(
0045       input = cms.untracked.int32(options.maxEvents)
0046 )
0047 
0048 ## customize the data vs emulator module
0049 from DQM.L1TMonitor.L1TdeCSCTPG_cfi import l1tdeCSCTPGCommon
0050 process.cscTriggerPrimitivesAnalyzer = cms.EDAnalyzer(
0051     "CSCTriggerPrimitivesAnalyzer",
0052     l1tdeCSCTPGCommon,
0053     ## file of the form "DQM_V0001_L1TEMU_R000334393"
0054     rootFileName = cms.string(options.dataVsEmulationFile),
0055     ## e.g. 334393
0056     runNumber = cms.uint32(options.runNumber),
0057     dataVsEmulatorPlots = cms.bool(options.dataVsEmulation),
0058     B904RunNumber = cms.string(options.B904RunNumber)
0059 )
0060 
0061 # this needs to be set here, otherwise we duplicate the B904Setup parameter
0062 process.cscTriggerPrimitivesAnalyzer.useB904ME11 = options.useB904ME11
0063 process.cscTriggerPrimitivesAnalyzer.useB904ME21 = options.useB904ME21
0064 process.cscTriggerPrimitivesAnalyzer.useB904ME234s2 = options.useB904ME234s2
0065 
0066 process.p = cms.Path(process.cscTriggerPrimitivesAnalyzer)