Public Member Functions | |
def | insertInto |
def | setRunDistribution |
Public Attributes | |
firstRun | |
setRunNumber |
The class is a Source whose run is chosen randomly. This initializes identically to a cms.Source and after being initialized the run number distribution is set by calling 'setRunDistribution'.
Definition at line 3 of file RandomRunSource.py.
def RandomRunSource::RandomRunSource::insertInto | ( | self, | |
parameterSet, | |||
myname | |||
) |
Definition at line 14 of file RandomRunSource.py.
00015 : 00016 from random import SystemRandom 00017 totalProb = 0. 00018 for r,p in self.__dict__['runsAndProbs']: 00019 totalProb+=p 00020 #this is the same random generator used to set the seeds for the RandomNumberGeneratorService 00021 random = SystemRandom() 00022 runProb = random.uniform(0,totalProb) 00023 print runProb 00024 sumProb = 0 00025 runNumber = 0 00026 for r,p in self.__dict__['runsAndProbs']: 00027 sumProb+=p 00028 if sumProb >= runProb: 00029 runNumber = r 00030 break 00031 if self.type_() == "PoolSource": 00032 self.setRunNumber = cms.untracked.uint32(runNumber) 00033 else: 00034 #sources that inherit from ConfigurableInputSource use 'firstRun' 00035 self.firstRun = cms.untracked.uint32(runNumber) 00036 super(RandomRunSource,self).insertInto(parameterSet,myname)
def RandomRunSource::RandomRunSource::setRunDistribution | ( | self, | |
runsAndProbs | |||
) |
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 class will normalize the weights so you do not have to. The pairs will be used to randomly choose what Run should be assigned to the job.
Definition at line 7 of file RandomRunSource.py.
00008 : 00009 """Pass a list of tuple pairs, with the first item of the pair a run number 00010 and the second number of the pair a weight. The class will normalize the 00011 weights so you do not have to. The pairs will be used to randomly choose what Run 00012 should be assigned to the job. 00013 """ self.__dict__['runsAndProbs']=runsAndProbs
Definition at line 14 of file RandomRunSource.py.
Definition at line 14 of file RandomRunSource.py.