CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
RandomRunSource.RandomRunSource Class Reference
Inheritance diagram for RandomRunSource.RandomRunSource:

Public Member Functions

def insertInto (self, parameterSet, myname)
 
def setRunDistribution (self, runsAndProbs)
 

Public Attributes

 firstRun
 
 setRunNumber
 

Detailed Description

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.

Member Function Documentation

def RandomRunSource.RandomRunSource.insertInto (   self,
  parameterSet,
  myname 
)

Definition at line 14 of file RandomRunSource.py.

References MuonTypeByOrCut.type_, edm::ObjectWithDict.type_, L1TMuonOverlapParams::Node.type_, FWJobMetadataManager::Data.type_, L1TTwinMuxParams::Node.type_, reco::MuonMETCorrectionData.type_, L1TMuonGlobalParams_PUBLIC::Node.type_, FastTimeParametersESModule.type_, CutBasedElectronID.type_, L1TMuonGlobalParams::Node.type_, OpticalAlignMeasurementInfo.type_, L1TMuonBarrelParams::Node.type_, ProcessCallGraph::NodeType.type_, edm::eventsetup::ComponentDescription.type_, HcalSiPMCharacteristics::PrecisionItem.type_, HcalSiPMParameter.type_, l1t::CaloParams::Node.type_, omtf::RpcDataWord64.type_, omtf::RpcDataWord64::.type_, StringObjectFunction< TInputCandidateType >.type_, StringCutObjectSelector< reco::LeafCandidate >.type_, StringCutObjectSelector< l1extra::L1MuonParticle >.type_, StringCutObjectSelector< typename Classifier::Categories >.type_, StringCutObjectSelector< reco::CaloMET, true >.type_, StringObjectFunction< reco::PFTau >.type_, StringCutObjectSelector< reco::MET, true >.type_, StringCutObjectSelector< T >.type_, StringCutObjectSelector< pat::pat::Electron >.type_, StringObjectFunction< T >.type_, StringCutObjectSelector< Object >.type_, StringCutObjectSelector< reco::MET >.type_, StringCutObjectSelector< reco::Photon >.type_, StringObjectFunction< std::vector< TOutputCandidateType > >.type_, StringCutObjectSelector< pat::IsolatedTrack >.type_, StringCutObjectSelector< PFTau >.type_, StringCutObjectSelector< pat::pat::IsolatedTrack >.type_, StringCutObjectSelector< pat::Electron >.type_, StringCutObjectSelector< reco::Vertex >.type_, StringCutObjectSelector< reco::Candidate >.type_, StringCutObjectSelector< pat::Photon >.type_, StringCutObjectSelector< reco::Candidate, true >.type_, StringCutObjectSelector< Jet >.type_, StringCutObjectSelector< pat::pat::Muon >.type_, StringCutObjectSelector< trigger::TriggerObject >.type_, StringCutObjectSelector< reco::utils::ClusterTotals >.type_, StringCutObjectSelector< reco::GsfElectron, true >.type_, StringCutObjectSelector< reco::PFJet, true >.type_, StringCutObjectSelector< reco::PFTau >.type_, StringCutObjectSelector< MuonPointerPair, true >.type_, StringCutObjectSelector< TInputCandidateType >.type_, StringCutObjectSelector< reco::CaloJet >.type_, StringCutObjectSelector< T, DefaultLazyness >.type_, StringCutObjectSelector< T, true >.type_, StringCutObjectSelector< reco::GsfElectron >.type_, StringCutObjectSelector< pat::pat::DiObjectProxy >.type_, StringCutObjectSelector< reco::Muon, true >.type_, StringCutObjectSelector< reco::CaloMET >.type_, StringCutObjectSelector< reco::Photon, true >.type_, StringCutObjectSelector< pat::DiObjectProxy, true >.type_, StringCutObjectSelector< reco::Muon, false >.type_, StringCutObjectSelector< reco::Track, true >.type_, StringCutObjectSelector< reco::PFJet >.type_, StringCutObjectSelector< reco::Muon >.type_, StringCutObjectSelector< reco::CaloMuon, false >.type_, StringCutObjectSelector< reco::CaloJet, true >.type_, StringObjectFunction< pat::TriggerObjectStandAlone >.type_, StringObjectFunction< reco::RecoTauPiZero >.type_, StringObjectFunction< reco::PFRecoTauChargedHadron >.type_, StringObjectFunction< Object >.type_, StringObjectFunction< PFTau >.type_, StringObjectFunction< reco::Candidate >.type_, StringObjectFunction< T, true >.type_, StringCutObjectSelector< pat::Muon >.type_, StringObjectFunction< reco::Candidate, true >.type_, StringObjectFunction< reco::reco::PFTau >.type_, StringObjectFunction< reco::PFJet >.type_, StringCutObjectSelector< reco::Track >.type_, StringCutObjectSelector< T2 > nDau.type_, StringCutObjectSelector< T1 >.type_, vector< TOutputCandidateType >.type_, StringCutObjectSelector< reco::TrackRef, false >.type_, StringCutObjectSelector< TriggerObject >.type_, StringCutObjectSelector< reco::Conversion >.type_, string.type_, StringCutObjectSelector< pat::TriggerObjectStandAlone >.type_, StringCutObjectSelector< reco::Muon > vector< MatchStruct >.type_, StringCutObjectSelector< GenParticle >.type_, StringCutObjectSelector< pat::DiObjectProxy >.type_, StringCutObjectSelector< T2, true >.type_, StringCutObjectSelector< reco::Candidate::LorentzVector, true >.type_, StringCutObjectSelector< reco::Vertex, true >.type_, StringObjectFunction< Object > ss.type_, StringCutObjectSelector< ObjType, true >.type_, StringCutObjectSelector< Object > ss.type_, StringCutObjectSelector< Object > uint.type_, StringObjectFunction< PFRecoTauChargedHadron >.type_, StringCutObjectSelector< reco::JetID >.type_, StringCutObjectSelector< RecoTauPiZero >.type_, StringObjectFunction< RecoTauPiZero >.type_, StringCutObjectSelector< pat::Jet >.type_, StringCutObjectSelector< reco::Jet >.type_, StringCutObjectSelector< reco::CaloTau >.type_, StringObjectFunction< T, DefaultLazyness >.type_, StringCutObjectSelector< reco::PFMET >.type_, StringCutObjectSelector< reco::GenJet >.type_, StringCutObjectSelector< std::vector< TOutputCandidateType > >.type_, StringCutObjectSelector< reco::Candidate::LorentzVector >.type_, StringCutObjectSelector< T2 >.type_, StringCutObjectSelector< pat::pat::Jet >.type_, StringCutObjectSelector< PFRecoTauChargedHadron >.type_, StringCutObjectSelector< pat::Tau >.type_, StringCutObjectSelector< reco::GenParticle >.type_, StringCutObjectSelector< reco::PFCandidate >.type_, StringCutObjectSelector< T1, true >.type_, StringCutObjectSelector< pat::pat::Photon >.type_, StringCutObjectSelector< T, Lazy >.type_, StringCutObjectSelector< reco::Jet, true >.type_, StringCutObjectSelector< reco::reco::Vertex >.type_, StringCutObjectSelector< reco::RecoTauPiZero >.type_, StringCutObjectSelector< reco::PFRecoTauChargedHadron >.type_, StringCutObjectSelector< l1extra::L1EtMissParticle >.type_, StringCutObjectSelector< reco::GenMET >.type_, MuonRefProducer.type_, MuonIDFilterProducerForHLT.type_, omtf::MuonDataWord64.type_, omtf::MuonDataWord64::.type_, TauDQMHistPlotter::cfgEntryProcess.type_, reco::TrackingRecHitInfo.type_, pftools::ParticleFiltrationDecision.type_, pos::PixelTKFECParameters.type_, pat::TriggerFilter.type_, NoProductErrorThrower.type_, l1t::BlockHeader.type_, pat::TriggerCondition.type_, omtf::DtDataWord64.type_, omtf::DtDataWord64::.type_, FastTimeGeometryESProducer.type_, MultShiftMETcorrInputProducer.type_, l1t::CaloSpare.type_, FastTimeTopologyBuilder.type_, GlobalVariablesTableProducer::Variable.type_, edm::ConsumesInfo.type_, edm::ParentContext.type_, pat::helper::AnyNumberAssociationAdaptor.type_, omtf::CscDataWord64::.type_, DQMHcalIsoTrackAlCaReco.type_, omtf::CscDataWord64.type_, DBReader.type_, GsfElectronDataAnalyzer.type_, edm::ParameterWildcardBase.type_, NoBranchErrorThrower.type_, edm::eventsetup::EventSetupRecordKey.type_, SimpleFlatTableProducerBase< T, TProd >::VariableBase.type_, edm::AllowedLabelsDescriptionBase.type_, L1TUtmCondition.type_, reco::PUSubMETCandInfo.type_, fwlite::internal::DataKey.type_, l1t::EtSum.type_, L1TUtmScale.type_, FastTimerSD.type_, BinomialInterval.type_, pftools::CandidateWrapper.type_, ScoutingMuon.type_, edm::eventsetup::DataKey.type_, OpticalAlignInfo.type_, l1extra::L1EmParticle.type_, l1extra::L1JetParticle.type_, Json::Reader::Token.type_, edm::PileUp.type_, PFBlockLink.type_, pat::JetCorrFactorsProducer.type_, L1TUtmObject.type_, Entry.type_, pos::PixelPortCardConfig.type_, edm::ParameterDescriptionBase.type_, FastTimeTopology.type_, edm::Handle< GenericObject >.type_, BeamSpotObjects.type_, L1GctInternHFData.type_, l1extra::L1EtMissParticle.type_, edm::Handle< FWGenericObject >.type_, CandMCMatchTableProducer.type_, funct::RootIntegrator.type_, reco::PFBlockElement.type_, CSCCorrelatedLCTDigi.type_, L1GctInternHtMiss.type_, reco::BeamSpot.type_, L1GctInternEtSum.type_, L1GctInternJetData.type_, TrackerDpgAnalysis.type_, SiStripConfigDb::Run.type_, ConfigurableHisto.type_, reco::Muon.type_, Mixins._TypedParameterizable.type_(), GsfElectronFakeAnalyzer.type_, Json::Value.type_, edm::IndexIntoFile::IndexIntoFileItrImpl.type_, and Config.SubProcess.type_().

14  def insertInto(self, parameterSet, myname):
15  from random import SystemRandom
16  totalProb = 0.
17  for r,p in self.__dict__['runsAndProbs']:
18  totalProb+=p
19  #this is the same random generator used to set the seeds for the RandomNumberGeneratorService
20  random = SystemRandom()
21  runProb = random.uniform(0,totalProb)
22  print runProb
23  sumProb = 0
24  runNumber = 0
25  for r,p in self.__dict__['runsAndProbs']:
26  sumProb+=p
27  if sumProb >= runProb:
28  runNumber = r
29  break
30  if self.type_() == "PoolSource":
31  self.setRunNumber = cms.untracked.uint32(runNumber)
32  else:
33  #sources that inherit from ConfigurableInputSource use 'firstRun'
34  self.firstRun = cms.untracked.uint32(runNumber)
35  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.

7  def setRunDistribution(self,runsAndProbs):
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.
12  """
13  self.__dict__['runsAndProbs']=runsAndProbs
def setRunDistribution(self, runsAndProbs)

Member Data Documentation

RandomRunSource.RandomRunSource.firstRun

Definition at line 34 of file RandomRunSource.py.

RandomRunSource.RandomRunSource.setRunNumber

Definition at line 31 of file RandomRunSource.py.