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().
9 """Pass a list of tuple pairs, with the first item of the pair a run number
10 and the second number of the pair a weight. The function will normalize the
11 weights so you do not have to worry about that. The pairs will be used to randomly choose what Run
12 should be assigned to the job.
14 from random
import SystemRandom
16 for r,p
in runsAndProbs:
19 random = SystemRandom()
20 runProb = random.uniform(0,totalProb)
23 for r,p
in runsAndProbs:
25 if sumProb >= runProb:
28 print(
'setting runNumber to: ',runNumber)
29 if source.type_() ==
"PoolSource":
30 source.setRunNumber = cms.untracked.uint32(runNumber)
33 source.firstRun = cms.untracked.uint32(runNumber)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)