Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:37

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