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