1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
8 """Pass a list of tuple pairs, with the first item of the pair a run number 9 and the second number of the pair a weight. The function will normalize the 10 weights so you do not have to worry about that. The pairs will be used to randomly choose what Run 11 should be assigned to the job. 13 from random
import SystemRandom
15 for r,p
in runsAndProbs:
18 random = SystemRandom()
19 runProb = random.uniform(0,totalProb)
22 for r,p
in runsAndProbs:
24 if sumProb >= runProb:
27 print(
'setting runNumber to: ',runNumber)
28 if source.type_() ==
"PoolSource":
29 source.setRunNumber = cms.untracked.uint32(runNumber)
32 source.firstRun = cms.untracked.uint32(runNumber)
S & print(S &os, JobReport::InputFile const &f)
def throwAndSetRandomRun(source, runsAndProbs)