1 import FWCore.ParameterSet.Config
as cms
7 """Pass a list of tuple pairs, with the first item of the pair a run number
8 and the second number of the pair a weight. The function will normalize the
9 weights so you do not have to worry about that. The pairs will be used to randomly choose what Run
10 should be assigned to the job.
12 from random
import SystemRandom
14 for r,p
in runsAndProbs:
17 random = SystemRandom()
18 runProb = random.uniform(0,totalProb)
21 for r,p
in runsAndProbs:
23 if sumProb >= runProb:
26 print 'setting runNumber to: ',runNumber
27 if source.type_() ==
"PoolSource":
28 source.setRunNumber = cms.untracked.uint32(runNumber)
31 source.firstRun = cms.untracked.uint32(runNumber)