1 import FWCore.ParameterSet.Config
as cms
4 """The class is a Source whose run is chosen randomly. This initializes identically to a cms.Source 5 and after being initialized the run number distribution is set by calling 'setRunDistribution'. 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 class will normalize the 10 weights so you do not have to. The pairs will be used to randomly choose what Run 11 should be assigned to the job. 13 self.__dict__[
'runsAndProbs']=runsAndProbs
15 from random
import SystemRandom
17 for r,p
in self.__dict__[
'runsAndProbs']:
20 random = SystemRandom()
21 runProb = random.uniform(0,totalProb)
25 for r,p
in self.__dict__[
'runsAndProbs']:
27 if sumProb >= runProb:
30 if self.type_() ==
"PoolSource":
34 self.
firstRun = cms.untracked.uint32(runNumber)
35 super(RandomRunSource,self).
insertInto(parameterSet,myname)
def insertInto(self, parameterSet, myname)
def setRunDistribution(self, runsAndProbs)