Pass a list of tuple pairs, with the first item of the pair a run number
and the second number of the pair a weight. The function will normalize the
weights so you do not have to worry about that. The pairs will be used to randomly choose what Run
should be assigned to the job.
Definition at line 7 of file ThrowAndSetRandomRun.py.
References print().
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)
35 void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def throwAndSetRandomRun(source, runsAndProbs)