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 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) > 1 and sys.argv[1].endswith('.py'):
0024     sys.argv.pop(0)
0025 if len(sys.argv) == 2 and ':' in sys.argv[1]:
0026     argv = sys.argv[1].split(':')
0027 else:
0028     argv = sys.argv[1:]
0029 
0030 for arg in argv:
0031     (k, v) = map(str.strip, arg.split('='))
0032     if k not in globals():
0033         raise "Unknown argument '%s'!" % (k,)
0034     if isinstance(globals()[k], bool):
0035         globals()[k] = v.lower() in ('y', 'yes', 'true', 't', '1')
0036     elif isinstance(globals()[k], int):
0037         globals()[k] = int(v)
0038     else:
0039         globals()[k] = v
0040 
0041 neventsPerJob = nevents/njob
0042 skip = job * neventsPerJob
0043 
0044 if skip>4:
0045     skip = skip-4
0046     neventsPerJob = neventsPerJob+4
0047 
0048 import FWCore.ParameterSet.Config as cms
0049 
0050 process = cms.Process('L1')
0051 
0052 # import of standard configurations
0053 process.load('Configuration.StandardSequences.Services_cff')
0054 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0055 process.load('FWCore.MessageService.MessageLogger_cfi')
0056 process.load('Configuration.EventContent.EventContent_cff')
0057 process.load('SimGeneral.MixingModule.mixNoPU_cfi')
0058 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0059 process.load('Configuration.Geometry.GeometryDB_cff')
0060 process.load('Configuration.StandardSequences.MagneticField_38T_cff')
0061 process.load('Configuration.StandardSequences.Generator_cff')
0062 process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic8TeVCollision_cfi')
0063 process.load('GeneratorInterface.Core.genFilterSummary_cff')
0064 process.load('Configuration.StandardSequences.SimIdeal_cff')
0065 process.load('Configuration.StandardSequences.Digi_cff')
0066 process.load('Configuration.StandardSequences.SimL1Emulator_cff')
0067 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0068 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0069 
0070 process.maxEvents = cms.untracked.PSet(
0071     input = cms.untracked.int32(10)
0072 )
0073 
0074 # Input source
0075 process.source = cms.Source("EmptySource")
0076 
0077 process.options = cms.untracked.PSet(
0078 
0079 )
0080 
0081 # Production Info
0082 process.configurationMetadata = cms.untracked.PSet(
0083     version = cms.untracked.string('$Revision: 1.19 $'),
0084     annotation = cms.untracked.string('SingleElectronPt10_cfi.py nevts:1'),
0085     name = cms.untracked.string('Applications')
0086 )
0087 
0088 # Output definition
0089 
0090 process.output = cms.OutputModule("PoolOutputModule",
0091     splitLevel = cms.untracked.int32(0),
0092     eventAutoFlushCompressedSize = cms.untracked.int32(5242880),
0093     outputCommands = cms.untracked.vstring("keep *",
0094                        "drop *_mix_*_*"),
0095     fileName = cms.untracked.string('SingleElectronPt10_cfi_py_GEN_SIM_DIGI_L1.root'),
0096     dataset = cms.untracked.PSet(
0097         filterName = cms.untracked.string(''),
0098         dataTier = cms.untracked.string('')
0099     ),
0100     SelectEvents = cms.untracked.PSet(
0101         SelectEvents = cms.vstring('generation_step')
0102     )
0103 )
0104 
0105 # Additional output definition
0106 
0107 # Other statements
0108 process.genstepfilter.triggerConditions=cms.vstring("generation_step")
0109 from Configuration.AlCa.GlobalTag import GlobalTag
0110 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:startup', '')
0111 
0112 process.generator = cms.EDProducer("FlatRandomPtGunProducer",
0113     PGunParameters = cms.PSet(
0114         MaxPt = cms.double(25.01),
0115         MinPt = cms.double(24.99),
0116         PartID = cms.vint32(11),
0117         MaxEta = cms.double(2.5),
0118         MaxPhi = cms.double(3.14159265359),
0119         MinEta = cms.double(-2.5),
0120         MinPhi = cms.double(-3.14159265359)
0121     ),
0122     Verbosity = cms.untracked.int32(0),
0123     psethack = cms.string('single electron pt 25'),
0124     AddAntiParticle = cms.bool(True),
0125     firstRun = cms.untracked.uint32(1)
0126 )
0127 
0128 # upgrade calo stage 2
0129 process.load('L1Trigger.L1TCalorimeter.caloStage2Params_cfi')
0130 process.load('L1Trigger.L1TCalorimeter.L1TCaloStage2_cff')
0131 process.caloStage2Layer1Digis.ecalToken = cms.InputTag("simEcalTriggerPrimitiveDigis")
0132 process.caloStage2Layer1Digis.hcalToken = cms.InputTag("simHcalTriggerPrimitiveDigis")
0133 process.esTest = cms.EDAnalyzer("EventSetupRecordDataGetter",
0134    toGet = cms.VPSet(cms.PSet(
0135    record = cms.string('L1TCaloParamsRcd'),
0136    data = cms.vstring('l1tCaloParams'))),
0137    verbose = cms.untracked.bool(True)
0138                 )
0139         
0140 
0141 process.load('L1Trigger.L1TCalorimeter.l1tStage2CaloAnalyzer_cfi')
0142 
0143 process.load('L1Trigger.L1TCalorimeter.l1tStage2InputPatternWriter_cfi')
0144 
0145 # enable debug message logging for our modules
0146 process.MessageLogger = cms.Service(
0147     "MessageLogger",
0148     destinations   = cms.untracked.vstring(
0149     'detailedInfo',
0150     'critical'
0151     ),
0152     detailedInfo   = cms.untracked.PSet(
0153     threshold  = cms.untracked.string('DEBUG') 
0154     ),
0155     debugModules = cms.untracked.vstring(
0156     'caloStage2TowerDigis',
0157     'caloStage2Digis'
0158     )
0159 )
0160 
0161 
0162 ## Load our L1 menu
0163 process.load('L1Trigger.L1TGlobal.StableParametersConfig_cff')
0164 process.load('L1Trigger.L1TGlobal.TriggerMenuXml_cfi')
0165 process.TriggerMenuXml.TriggerMenuLuminosity = 'startup'
0166 process.TriggerMenuXml.DefXmlFile = 'L1Menu_Reference_2014.xml'
0167 
0168 process.load('L1Trigger.L1TGlobal.TriggerMenuConfig_cff')
0169 process.es_prefer_l1GtParameters = cms.ESPrefer('l1t::TriggerMenuXmlProducer','TriggerMenuXml')
0170 
0171 
0172 process.simL1uGtDigis = cms.EDProducer("L1TGlobalProducer",
0173     #TechnicalTriggersUnprescaled = cms.bool(False),
0174     ProduceL1GtObjectMapRecord = cms.bool(True),
0175     AlgorithmTriggersUnmasked = cms.bool(False),
0176     EmulateBxInEvent = cms.int32(1),
0177     L1DataBxInEvent = cms.int32(5),
0178     AlgorithmTriggersUnprescaled = cms.bool(False),
0179     ProduceL1GtDaqRecord = cms.bool(True),
0180     GmtInputTag = cms.InputTag(""),
0181     caloInputTag = cms.InputTag("caloStage2Digis"),
0182     AlternativeNrBxBoardDaq = cms.uint32(0),
0183     #WritePsbL1GtDaqRecord = cms.bool(True),
0184     BstLengthBytes = cms.int32(-1),
0185     Verbosity = cms.untracked.int32(0)
0186 )
0187 
0188 process.dumpGTRecord = cms.EDAnalyzer("l1t::GtRecordDump",
0189                 egInputTag    = cms.InputTag("caloStage2Digis"),
0190         muInputTag    = cms.InputTag(""),
0191         tauInputTag   = cms.InputTag("caloStage2Digis"),
0192         jetInputTag   = cms.InputTag("caloStage2Digis"),
0193         etsumInputTag = cms.InputTag("caloStage2Digis"),
0194         uGtRecInputTag = cms.InputTag("simL1uGtDigis"),
0195         uGtAlgInputTag = cms.InputTag("simL1uGtDigis"),
0196         uGtExtInputTag = cms.InputTag("simL1uGtDigis"),
0197         bxOffset       = cms.int32(skip),
0198         minBx          = cms.int32(0),
0199         maxBx          = cms.int32(0),
0200         minBxVec       = cms.int32(0),
0201         maxBxVec       = cms.int32(0),      
0202         dumpGTRecord   = cms.bool(True),
0203         dumpVectors    = cms.bool(True),
0204         tvFileName     = cms.string( ("TestVector_%03d.txt") % job )
0205          )
0206          
0207          
0208 
0209 # TTree output file
0210 process.load("CommonTools.UtilAlgos.TFileService_cfi")
0211 process.TFileService.fileName = cms.string('l1t.root')
0212 
0213 # Path and EndPath definitions
0214 process.generation_step = cms.Path(process.pgen)
0215 process.simulation_step = cms.Path(process.psim)
0216 process.digitisation_step = cms.Path(process.pdigi)
0217 process.L1simulation_step = cms.Path(process.SimL1Emulator
0218                      +process.esTest
0219                      +process.L1TCaloStage2
0220                     # +process.l1tStage2CaloAnalyzer
0221                     # +process.l1tStage2InputPatternWriter
0222                                      +process.simL1uGtDigis
0223                                      +process.dumpGTRecord
0224                      )
0225 process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
0226 process.endjob_step = cms.EndPath(process.endOfProcess)
0227 process.output_step = cms.EndPath(process.output)
0228 
0229 # Schedule definition
0230 process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.digitisation_step,process.L1simulation_step,process.endjob_step,process.output_step)
0231 # filter all path with the production filter sequence
0232 for path in process.paths:
0233     getattr(process,path)._seq = process.generator * getattr(process,path)._seq 
0234