Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:59

0001 #!/usr/bin/env python
0002 from __future__ import print_function
0003 import sys
0004 
0005 """
0006 The parameters can be changed by adding commandline arguments of the form
0007 ::
0008 
0009     runGlobalFakeInputProducer.py nevents=-1
0010 
0011 The latter can be used to change parameters in crab.
0012 """
0013 
0014 job = 0 #job number
0015 njob = 1 #number of jobs
0016 nevents = 3564 #number of events
0017 rootout = False #whether to produce root file
0018 dump = False #dump python
0019 
0020 # Argument parsing
0021 # vvv
0022 
0023 
0024 if len(sys.argv) > 1 and sys.argv[1].endswith('.py'):
0025     sys.argv.pop(0)
0026 if len(sys.argv) == 2 and ':' in sys.argv[1]:
0027     argv = sys.argv[1].split(':')
0028 else:
0029     argv = sys.argv[1:]
0030 
0031 for arg in argv:
0032     (k, v) = map(str.strip, arg.split('='))
0033     if k not in globals():
0034         raise "Unknown argument '%s'!" % (k,)
0035     if isinstance(globals()[k], bool):
0036         globals()[k] = v.lower() in ('y', 'yes', 'true', 't', '1')
0037     elif isinstance(globals()[k], int):
0038         globals()[k] = int(v)
0039     else:
0040         globals()[k] = v
0041 
0042 neventsPerJob = nevents/njob
0043 skip = job * neventsPerJob
0044 
0045 if skip>4:
0046     skip = skip-4
0047     neventsPerJob = neventsPerJob+4
0048 
0049 import FWCore.ParameterSet.Config as cms
0050 
0051 process = cms.Process('L1')
0052 
0053 # import of standard configurations
0054 process.load('Configuration.StandardSequences.Services_cff')
0055 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0056 process.load('FWCore.MessageService.MessageLogger_cfi')
0057 process.load('Configuration.EventContent.EventContent_cff')
0058 process.load('SimGeneral.MixingModule.mixNoPU_cfi')
0059 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0060 process.load('Configuration.StandardSequences.MagneticField_38T_cff')
0061 process.load('Configuration.StandardSequences.SimL1Emulator_cff')
0062 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0063 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0064 
0065 process.maxEvents = cms.untracked.PSet(
0066     input = cms.untracked.int32(neventsPerJob)
0067 )
0068 
0069 # Input source
0070 process.source = cms.Source("PoolSource",
0071     secondaryFileNames = cms.untracked.vstring(),
0072     fileNames = cms.untracked.vstring(
0073     "/store/relval/CMSSW_7_1_0/RelValTTbar_13/GEN-SIM-DIGI-RAW-HLTDEBUG/PU50ns_POSTLS171_V16-v1/00000/0EF13A80-F2FE-E311-9565-003048FFD7D4.root",
0074     "/store/relval/CMSSW_7_1_0/RelValTTbar_13/GEN-SIM-DIGI-RAW-HLTDEBUG/PU50ns_POSTLS171_V16-v1/00000/389E0C8A-EFFE-E311-86EA-0025905A6088.root",
0075     "/store/relval/CMSSW_7_1_0/RelValTTbar_13/GEN-SIM-DIGI-RAW-HLTDEBUG/PU50ns_POSTLS171_V16-v1/00000/52F1C37C-F1FE-E311-89EA-00261894394D.root",
0076     "/store/relval/CMSSW_7_1_0/RelValTTbar_13/GEN-SIM-DIGI-RAW-HLTDEBUG/PU50ns_POSTLS171_V16-v1/00000/545B93FA-F1FE-E311-8414-0025905A497A.root",
0077     "/store/relval/CMSSW_7_1_0/RelValTTbar_13/GEN-SIM-DIGI-RAW-HLTDEBUG/PU50ns_POSTLS171_V16-v1/00000/5C8B9784-EFFE-E311-A37A-0025905A60B0.root",
0078     "/store/relval/CMSSW_7_1_0/RelValTTbar_13/GEN-SIM-DIGI-RAW-HLTDEBUG/PU50ns_POSTLS171_V16-v1/00000/5E835FAA-F3FE-E311-8D88-0025905B8596.root",
0079     "/store/relval/CMSSW_7_1_0/RelValTTbar_13/GEN-SIM-DIGI-RAW-HLTDEBUG/PU50ns_POSTLS171_V16-v1/00000/6C2B9503-F0FE-E311-858F-0025905A612A.root",
0080     ),
0081     skipEvents = cms.untracked.uint32(skip)
0082 )
0083 
0084 process.options = cms.untracked.PSet(
0085 
0086 )
0087 
0088 # Production Info
0089 process.configurationMetadata = cms.untracked.PSet(
0090     version = cms.untracked.string('$Revision: 1.19 $'),
0091     annotation = cms.untracked.string('l1 nevts:1'),
0092     name = cms.untracked.string('Applications')
0093 )
0094 
0095 # Output definition
0096 
0097 process.RECOSIMoutput = cms.OutputModule("PoolOutputModule",
0098     splitLevel = cms.untracked.int32(0),
0099     eventAutoFlushCompressedSize = cms.untracked.int32(5242880),
0100     outputCommands = cms.untracked.vstring("keep *"),#process.RECOSIMEventContent.outputCommands,
0101     fileName = cms.untracked.string('L1.root'),
0102     dataset = cms.untracked.PSet(
0103         filterName = cms.untracked.string(''),
0104         dataTier = cms.untracked.string('')
0105     )
0106 )
0107 
0108 # Additional output definition
0109 
0110 # Other statements
0111 from Configuration.AlCa.GlobalTag import GlobalTag
0112 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:startup', '')
0113 
0114 # enable debug message logging for our modules
0115 process.MessageLogger = cms.Service(
0116     "MessageLogger",
0117     destinations   = cms.untracked.vstring(
0118     'detailedInfo',
0119     'critical'
0120     ),
0121     detailedInfo   = cms.untracked.PSet(
0122     threshold  = cms.untracked.string('DEBUG') 
0123     ),
0124     debugModules = cms.untracked.vstring(
0125     'l1tCaloStage2Layer1Digis',
0126     'l1tCaloStage2Digis'
0127     )
0128 )
0129 
0130 ## Load our L1 menu
0131 process.load('L1Trigger.L1TGlobal.StableParametersConfig_cff')
0132 process.load('L1Trigger.L1TGlobal.TriggerMenuXml_cfi')
0133 process.TriggerMenuXml.TriggerMenuLuminosity = 'startup'
0134 process.TriggerMenuXml.DefXmlFile = 'L1Menu_Reference_2014.xml'
0135 
0136 process.load('L1Trigger.L1TGlobal.TriggerMenuConfig_cff')
0137 process.es_prefer_l1GtParameters = cms.ESPrefer('l1t::TriggerMenuXmlProducer','TriggerMenuXml')
0138 
0139 
0140 process.dumpGT = cms.EDAnalyzer("l1t::GtInputDump",
0141                 egInputTag    = cms.InputTag("caloStage2Digis"),
0142         muInputTag    = cms.InputTag(""),
0143         tauInputTag   = cms.InputTag("caloStage2Digis"),
0144         jetInputTag   = cms.InputTag("caloStage2Digis"),
0145         etsumInputTag = cms.InputTag("caloStage2Digis"), 
0146         minBx         = cms.int32(0),
0147         maxBx         = cms.int32(0)
0148          )
0149 
0150 process.bxVectorGT = cms.EDProducer("l1t::BXVectorInputProducer",
0151                 egInputTag     = cms.InputTag("caloStage2Digis"),
0152         muInputTag     = cms.InputTag(""),
0153         tauInputTag    = cms.InputTag("caloStage2Digis"),
0154         jetInputTag    = cms.InputTag("caloStage2Digis"),
0155         etsumInputTag  = cms.InputTag("caloStage2Digis"), 
0156         bxFirst        = cms.int32(-2),
0157         bxLast         = cms.int32(2),
0158         maxMuCand      = cms.uint32(8),
0159         maxJetCand     = cms.uint32(12),
0160         maxEGCand      = cms.uint32(12),
0161         maxTauCand     = cms.uint32(8),                                      
0162         jetEtThreshold = cms.double(10),
0163         tauEtThreshold = cms.double(10),
0164         egEtThreshold  = cms.double(10),
0165         muEtThreshold  = cms.double(1),
0166         emptyBxTrailer = cms.int32(5),
0167         emptyBxEvt     = cms.int32(neventsPerJob)
0168          )
0169 
0170 
0171 process.simL1uGtDigis = cms.EDProducer("L1TGlobalProducer",
0172     #TechnicalTriggersUnprescaled = cms.bool(False),
0173     ProduceL1GtObjectMapRecord = cms.bool(True),
0174     AlgorithmTriggersUnmasked = cms.bool(False),
0175     EmulateBxInEvent = cms.int32(1),
0176     L1DataBxInEvent = cms.int32(5),
0177     AlgorithmTriggersUnprescaled = cms.bool(False),
0178     ProduceL1GtDaqRecord = cms.bool(True),
0179     GmtInputTag = cms.InputTag("gtInput"),
0180     caloInputTag = cms.InputTag("bxVectorGT"),
0181     AlternativeNrBxBoardDaq = cms.uint32(0),
0182     #WritePsbL1GtDaqRecord = cms.bool(True),
0183     BstLengthBytes = cms.int32(-1),
0184     Verbosity = cms.untracked.int32(0)
0185 )
0186 
0187 process.dumpGTRecord = cms.EDAnalyzer("l1t::GtRecordDump",
0188                 egInputTag    = cms.InputTag("bxVectorGT"),
0189         muInputTag    = cms.InputTag("gtInput"),
0190         tauInputTag   = cms.InputTag("bxVectorGT"),
0191         jetInputTag   = cms.InputTag("bxVectorGT"),
0192         etsumInputTag = cms.InputTag("bxVectorGT"),
0193         uGtRecInputTag = cms.InputTag("simL1uGtDigis"),
0194         uGtAlgInputTag = cms.InputTag("simL1uGtDigis"),
0195         uGtExtInputTag = cms.InputTag("simL1uGtDigis"),
0196         bxOffset       = cms.int32(skip),
0197         minBx          = cms.int32(-2),
0198         maxBx          = cms.int32(2),
0199         minBxVec       = cms.int32(0),
0200         maxBxVec       = cms.int32(0),      
0201         dumpGTRecord   = cms.bool(True),
0202         dumpVectors    = cms.bool(True),
0203         tvFileName     = cms.string( ("TestVector_%03d.txt") % job )
0204          )
0205          
0206 
0207 
0208 # Raw to digi
0209 process.load('Configuration.StandardSequences.RawToDigi_cff')
0210 
0211 # upgrade calo stage 2
0212 process.load('L1Trigger.L1TCalorimeter.L1TCaloStage2_PPFromRaw_cff')
0213 process.load('L1Trigger.L1TCalorimeter.l1tStage2CaloAnalyzer_cfi')
0214 #process.load('L1Trigger.L1TCalorimeter.l1tCaloAnalyzer_cfi')
0215 
0216 # TTree output file
0217 process.load("CommonTools.UtilAlgos.TFileService_cfi")
0218 process.TFileService.fileName = cms.string('l1t.root')
0219 
0220 # Path and EndPath definitions
0221 process.L1simulation_step = cms.Path(
0222     process.ecalDigis
0223     +process.hcalDigis
0224     +process.L1TCaloStage2_PPFromRaw
0225 #    +process.dumpGT
0226     +process.bxVectorGT
0227     +process.simL1uGtDigis
0228     +process.dumpGTRecord    
0229     )
0230 
0231 process.RECOSIMoutput_step = cms.EndPath(process.RECOSIMoutput)
0232 
0233 # Schedule definition
0234 process.schedule = cms.Schedule(process.L1simulation_step,
0235                                 process.RECOSIMoutput_step)
0236 
0237 if dump:
0238     outfile = open('dump_TTBarRelVal_Stage2uGT_TestVectors_'+repr(job)+'.py','w')
0239     print(process.dumpPython(), file=outfile)
0240     outfile.close()