Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:49

0001 # Configuration file for EmptySource
0002 
0003 from builtins import range
0004 import FWCore.ParameterSet.Config as cms
0005 
0006 process = cms.Process("TEST")
0007 
0008 process.load("FWCore.Framework.test.cmsExceptionsFatal_cff")
0009 
0010 process.maxEvents = cms.untracked.PSet(
0011     input = cms.untracked.int32(8*5)
0012 )
0013 
0014 runToLumi = ((2,1),(10,3),(20,7) )
0015 
0016 def findRunForLumi( lumi) :
0017   lastRun = runToLumi[0][0]
0018   for r,l in runToLumi:
0019     if l > lumi:
0020       break
0021     lastRun = r
0022   return lastRun
0023 
0024 process.source = cms.Source("EmptySource",
0025     firstLuminosityBlock = cms.untracked.uint32(1),
0026     firstLuminosityBlockForEachRun = cms.untracked.VLuminosityBlockID(*[cms.LuminosityBlockID(x,y) for x,y in runToLumi]),
0027     numberEventsInLuminosityBlock = cms.untracked.uint32(5),
0028     firstTime = cms.untracked.uint64(1000),
0029     timeBetweenEvents = cms.untracked.uint64(10)
0030 )
0031 
0032 ids = cms.VEventID()
0033 numberOfEventsInLumi = 0
0034 numberOfEventsPerLumi = process.source.numberEventsInLuminosityBlock.value()
0035 lumi = process.source.firstLuminosityBlock.value()
0036 event=0
0037 oldRun = 2
0038 for i in range(process.maxEvents.input.value()):
0039    numberOfEventsInLumi +=1
0040    event += 1
0041    run = findRunForLumi(lumi)
0042    if numberOfEventsInLumi > numberOfEventsPerLumi:
0043       numberOfEventsInLumi=1
0044       lumi += 1
0045       run = findRunForLumi(lumi)
0046       if run != oldRun:
0047         event = 1
0048         oldRun = run
0049    ids.append(cms.EventID(run,lumi,event))
0050 process.check = cms.EDAnalyzer("EventIDChecker", eventSequence = cms.untracked(ids))
0051 process.print1 = cms.OutputModule("AsciiOutputModule")
0052 
0053 process.p = cms.EndPath(process.check+process.print1)