1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
5 """The class is a Source whose run is chosen randomly. This initializes identically to a cms.Source 6 and after being initialized the run number distribution is set by calling 'setRunDistribution'. 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 class will normalize the 11 weights so you do not have to. The pairs will be used to randomly choose what Run 12 should be assigned to the job. 14 self.__dict__[
'runsAndProbs']=runsAndProbs
16 from random
import SystemRandom
18 for r,p
in self.__dict__[
'runsAndProbs']:
21 random = SystemRandom()
22 runProb = random.uniform(0,totalProb)
26 for r,p
in self.__dict__[
'runsAndProbs']:
28 if sumProb >= runProb:
31 if self.type_() ==
"PoolSource":
35 self.
firstRun = cms.untracked.uint32(runNumber)
36 super(RandomRunSource,self).
insertInto(parameterSet,myname)
def insertInto(self, parameterSet, myname)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def setRunDistribution(self, runsAndProbs)