Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-25 23:40:16

0001 from __future__ import print_function
0002 # Auto generated configuration file
0003 # using: 
0004 # Revision: 1.19 
0005 # Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v 
0006 # with command line options: SingleElectronPt10_cfi.py -s GEN,SIM,DIGI,L1 --pileup=NoPileUp --geometry DB --conditions=auto:startup -n 1 --no_exec
0007 #
0008 #  This was adapted from unpackBuffers-CaloStage2.py.
0009 #    -Unpacking of the uGT raw data has been added
0010 #    -uGT Emulation starting with the Demux output and/or the uGT input 
0011 #    -Analysis for uGT objects using L1TGlobalAnalyzer
0012 #
0013 #   Brian Winer, March 16, 2015
0014 #  
0015 import FWCore.ParameterSet.Config as cms
0016 
0017 
0018 # options
0019 import FWCore.ParameterSet.VarParsing as VarParsing
0020 options = VarParsing.VarParsing('analysis')
0021 options.register('skipEvents',
0022                  0,
0023                  VarParsing.VarParsing.multiplicity.singleton,
0024                  VarParsing.VarParsing.varType.int,
0025                  "Number of events to skip")
0026 options.register('streamer',
0027                  False,
0028                  VarParsing.VarParsing.multiplicity.singleton,
0029                  VarParsing.VarParsing.varType.bool,
0030                  "Read input from streamer file")
0031 options.register('debug',
0032                  False,
0033                  VarParsing.VarParsing.multiplicity.singleton,
0034                  VarParsing.VarParsing.varType.bool,
0035                  "Enable debug data")
0036 options.register('dumpRaw',
0037                  False,
0038                  VarParsing.VarParsing.multiplicity.singleton,
0039                  VarParsing.VarParsing.varType.bool,
0040                  "Print RAW data")
0041 options.register('dumpDigis',
0042                  False,
0043                  VarParsing.VarParsing.multiplicity.singleton,
0044                  VarParsing.VarParsing.varType.bool,
0045                  "Print digis")
0046 options.register('histos',
0047                  False,
0048                  VarParsing.VarParsing.multiplicity.singleton,
0049                  VarParsing.VarParsing.varType.bool,
0050                  "Produce standard histograms")
0051 options.register('edm',
0052                  False,
0053                  VarParsing.VarParsing.multiplicity.singleton,
0054                  VarParsing.VarParsing.varType.bool,
0055                  "Produce EDM file")
0056 options.register('valEvents',
0057                  False,
0058                  VarParsing.VarParsing.multiplicity.singleton,
0059                  VarParsing.VarParsing.varType.bool,
0060                  "Filter on validation events")
0061 options.register('process',
0062                  '',
0063                  VarParsing.VarParsing.multiplicity.singleton,
0064                  VarParsing.VarParsing.varType.string,
0065                  "Rename process if used")
0066 options.register('mps',
0067                  '',
0068                  VarParsing.VarParsing.multiplicity.list,
0069                  VarParsing.VarParsing.varType.int,
0070                  "List of MPs to process")
0071 options.register('json',
0072                  '',
0073                  VarParsing.VarParsing.multiplicity.singleton,
0074                  VarParsing.VarParsing.varType.string,
0075                  "JSON file with list of good lumi sections")
0076 options.register('newXML',
0077                  False,
0078                  VarParsing.VarParsing.multiplicity.singleton,
0079                  VarParsing.VarParsing.varType.bool,
0080                  "New XML Grammar")      
0081                  
0082 options.parseArguments()
0083 
0084 pname="Raw2Digi"
0085 if (options.process!=""):
0086     pname=options.process
0087 
0088 process = cms.Process(pname)
0089 
0090 # import of standard configurations
0091 process.load('Configuration.StandardSequences.Services_cff')
0092 process.load('FWCore.MessageService.MessageLogger_cfi')
0093 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0094 process.load('Configuration.Geometry.GeometryDB_cff')
0095 process.load('Configuration.StandardSequences.MagneticField_38T_cff')
0096 process.load('Configuration.StandardSequences.SimL1Emulator_cff')
0097 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0098 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0099 
0100 process.maxEvents = cms.untracked.PSet(
0101     input = cms.untracked.int32(options.maxEvents)
0102 )
0103 
0104 # Input source
0105 if (options.streamer) :
0106     process.source = cms.Source(
0107         "NewEventStreamFileReader",
0108         fileNames = cms.untracked.vstring (options.inputFiles),
0109         skipEvents=cms.untracked.uint32(options.skipEvents)
0110     )
0111 else :
0112     process.source = cms.Source (
0113         "PoolSource",
0114         fileNames = cms.untracked.vstring (options.inputFiles),
0115         skipEvents=cms.untracked.uint32(options.skipEvents)
0116     )
0117 
0118 if (options.json):
0119     import FWCore.PythonUtilities.LumiList as LumiList
0120     process.source.lumisToProcess = LumiList.LumiList(filename = options.json).getVLuminosityBlockRange()
0121 
0122 process.options = cms.untracked.PSet(
0123     SkipEvent = cms.untracked.vstring('ProductNotFound')
0124 )
0125 
0126 
0127 # Additional output definition
0128 # TTree output file
0129 process.load("CommonTools.UtilAlgos.TFileService_cfi")
0130 process.TFileService.fileName = cms.string('l1tCalo_2016_histos.root')
0131 
0132 # enable debug message logging for our modules
0133 process.MessageLogger.L1TCaloEvents=dict()
0134 
0135 process.MessageLogger.suppressInfo = cms.untracked.vstring('Geometry', 'AfterSource')
0136 
0137 if (options.dumpRaw):
0138     process.MessageLogger.files.infos = cms.untracked.PSet(
0139         INFO = cms.untracked.PSet(limit = cms.untracked.int32(0)),
0140         L1TCaloEvents = cms.untracked.PSet(
0141             limit = cms.untracked.int32(10000)
0142         )
0143     )
0144 
0145 if (options.debug):
0146 #    process.MessageLogger.debugModules = cms.untracked.vstring('L1TRawToDigi:caloStage2Digis', 'MP7BufferDumpToRaw:stage2MPRaw', 'MP7BufferDumpToRaw:stage2DemuxRaw')
0147     process.MessageLogger.debugModules = cms.untracked.vstring('*')
0148     process.MessageLogger.cerr.threshold = cms.untracked.string('DEBUG')
0149 
0150 
0151 # Other statements
0152 from Configuration.AlCa.GlobalTag import GlobalTag
0153 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:startup', '')
0154 
0155 # validation event filter
0156 process.load('EventFilter.L1TRawToDigi.validationEventFilter_cfi')
0157 
0158 # MP selectah
0159 process.load('EventFilter.L1TRawToDigi.tmtFilter_cfi')
0160 process.tmtFilter.mpList = cms.untracked.vint32(options.mps)
0161 
0162 # dump raw data
0163 process.dumpRaw = cms.EDAnalyzer( 
0164     "DumpFEDRawDataProduct",
0165     token = cms.untracked.InputTag("rawDataCollector"),
0166     feds = cms.untracked.vint32 ( 1360, 1366, 1404 ),
0167     dumpPayload = cms.untracked.bool ( options.dumpRaw )
0168 )
0169 
0170 # raw to digi
0171 process.load('EventFilter.L1TRawToDigi.caloStage2Digis_cfi')
0172 process.caloStage2Digis.InputLabel = cms.InputTag('rawDataCollector')
0173 if (options.debug):
0174     process.caloStage2Digis.debug = cms.untracked.bool(True)
0175 
0176 process.load('EventFilter.L1TRawToDigi.gtStage2Digis_cfi')
0177 process.gtStage2Digis.InputLabel = cms.InputTag('rawDataCollector')
0178 
0179 
0180 ## Load our L1 menu
0181 process.load('L1Trigger.L1TGlobal.StableParametersConfig_cff')
0182 
0183 process.load('L1Trigger.L1TGlobal.TriggerMenuXml_cfi')
0184 process.TriggerMenuXml.TriggerMenuLuminosity = 'startup'
0185 #process.TriggerMenuXml.DefXmlFile = 'L1_Example_Menu_2013.xml'
0186 #process.TriggerMenuXml.DefXmlFile = 'L1Menu_Reference_2014.xml'
0187 process.TriggerMenuXml.DefXmlFile = 'L1Menu_Collisions2015_25nsStage1_v6_uGT_v2a.xml'
0188 #process.TriggerMenuXml.DefXmlFile = 'L1Menu_Collisions2015_25nsStage1_v6_uGT_v3.xml'
0189 process.TriggerMenuXml.newGrammar = cms.bool(options.newXML)
0190 if(options.newXML):
0191    print("Using new XML Grammar ")
0192    #process.TriggerMenuXml.DefXmlFile = 'L1Menu_CollisionsHeavyIons2015_v4_uGT_v2.xml'
0193    #process.TriggerMenuXml.DefXmlFile = 'MuonTest.xml'
0194    process.TriggerMenuXml.DefXmlFile = 'test_ext.xml'
0195 
0196 
0197 process.load('L1Trigger.L1TGlobal.TriggerMenuConfig_cff')
0198 process.es_prefer_l1GtParameters = cms.ESPrefer('l1t::TriggerMenuXmlProducer','TriggerMenuXml')
0199 
0200 ## Run the Stage 2 uGT emulator
0201 process.load('L1Trigger.L1TGlobal.simGlobalStage2Digis_cff')
0202 process.simGlobalStage2Digis.caloInputTag = cms.InputTag("gtStage2Digis","GT")
0203 process.simGlobalStage2Digis.GmtInputTag = cms.InputTag("gtStage2Digis","GT")
0204 process.simGlobalStage2Digis.extInputTag = cms.InputTag("gtStage2Digis","GT")
0205 process.simGlobalStage2Digis.PrescaleSet = cms.uint32(1)
0206 process.simGlobalStage2Digis.Verbosity = cms.untracked.int32(0)
0207 
0208 
0209 
0210 # gt analyzer
0211 process.l1tGlobalAnalyzer = cms.EDAnalyzer('L1TGlobalAnalyzer',
0212     doText = cms.untracked.bool(False),
0213     dmxEGToken = cms.InputTag("None"),
0214     dmxTauToken = cms.InputTag("None"),
0215     dmxJetToken = cms.InputTag("None"),
0216     dmxEtSumToken = cms.InputTag("None"),
0217     muToken = cms.InputTag("gtStage2Digis","GT"),
0218     egToken = cms.InputTag("gtStage2Digis","GT"),
0219     tauToken = cms.InputTag("gtStage2Digis","GT"),
0220     jetToken = cms.InputTag("gtStage2Digis","GT"),
0221     etSumToken = cms.InputTag("gtStage2Digis","GT"),
0222     gtAlgToken = cms.InputTag("gtStage2Digis","GT"),
0223     emulDxAlgToken = cms.InputTag("None"),
0224     emulGtAlgToken = cms.InputTag("simGlobalStage2Digis")
0225 )
0226 
0227 # Take Digis to RAW
0228 #process.load("EventFilter.L1TRawToDigi.gtStage2Raw_cfi")
0229 #process.gtStage2Raw.InputLabel = cms.InputTag("gtStage2Digis","GT")
0230 
0231 
0232 # dump records
0233 process.dumpGTRecord = cms.EDAnalyzer("l1t::GtRecordDump",
0234         egInputTag    = cms.InputTag("gtStage2Digis","GT"),
0235         muInputTag    = cms.InputTag("gtStage2Digis","GT"),
0236         tauInputTag   = cms.InputTag("gtStage2Digis","GT"),
0237         jetInputTag   = cms.InputTag("gtStage2Digis","GT"),
0238         etsumInputTag = cms.InputTag("gtStage2Digis","GT"),
0239         uGtAlgInputTag = cms.InputTag("simGlobalStage2Digis"),
0240         uGtExtInputTag = cms.InputTag("gtStage2Digis","GT"),
0241         bxOffset       = cms.int32(0),
0242         minBx          = cms.int32(-2),
0243         maxBx          = cms.int32(2),
0244         minBxVec       = cms.int32(0),
0245         maxBxVec       = cms.int32(0),      
0246         dumpGTRecord   = cms.bool(False),
0247                 dumpTrigResults= cms.bool(True),
0248         dumpVectors    = cms.bool(False),
0249         tvFileName     = cms.string( "TestVector_Data.txt" ),
0250                 psFileName     = cms.string( "prescale_L1TGlobal.csv" ),
0251                 psColumn       = cms.int32(1)
0252          )
0253 
0254 
0255 
0256 # Path and EndPath definitions
0257 process.path = cms.Path(
0258     process.validationEventFilter
0259     +process.dumpRaw
0260     +process.caloStage2Digis
0261     +process.gtStage2Digis
0262     +process.simGlobalStage2Digis
0263     +process.l1tGlobalAnalyzer
0264     +process.dumpGTRecord 
0265 #    +process.gtStage2Raw   
0266 )
0267 
0268 # enable validation event filtering
0269 if (not options.valEvents):
0270     process.path.remove(process.validationEventFilter)
0271 
0272 # enable validation event filtering
0273 if (len(options.mps)==0):
0274     process.path.remove(process.tmtFilter)
0275 
0276 # enable RAW printout
0277 if (not options.dumpRaw):
0278     process.path.remove(process.dumpRaw)
0279 
0280 # optional EDM file
0281 if (options.edm):
0282     process.output = cms.OutputModule(
0283         "PoolOutputModule",
0284         outputCommands = cms.untracked.vstring("keep *"),
0285         SelectEvents = cms.untracked.PSet(
0286             SelectEvents = cms.vstring('path')
0287         ),
0288         fileName = cms.untracked.string('l1tCalo_2016_EDM.root')
0289     )
0290 
0291     process.out = cms.EndPath(
0292         process.output
0293     )
0294 
0295 
0296