Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-27 03:17:55

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