CMS 3D CMS Logo

Functions
egamma Namespace Reference

Functions

template<typename T >
uint32_t getRandomSeedFromObj (const edm::Event &iEvent, const T &obj, size_t nrObjs, size_t objNr)
 
uint32_t getRandomSeedFromSC (const edm::Event &iEvent, const reco::SuperClusterRef scRef)
 

Function Documentation

template<typename T >
uint32_t egamma::getRandomSeedFromObj ( const edm::Event iEvent,
const T obj,
size_t  nrObjs,
size_t  objNr 
)

Definition at line 21 of file EgammaRandomSeeds.h.

References edm::EventID::event(), edm::EventBase::id(), createfilelist::int, edm::EventID::luminosityBlock(), M_PI, SiStripPI::max, edm::EventID::run(), and SurveyInfoScenario_cff::seed.

Referenced by CalibratedPhotonProducerT< T >::setSemiDetRandomSeed(), and CalibratedElectronProducerT< T >::setSemiDetRandomSeed().

21  {
22  std::seed_seq seeder = {int(iEvent.id().event()), int(iEvent.id().luminosityBlock()), int(iEvent.id().run()),
23  int(nrObjs),int(std::numeric_limits<int>::max()*obj.phi()/M_PI) & 0xFFF,int(objNr)};
24  uint32_t seed = 0, tries = 10;
25  do {
26  seeder.generate(&seed,&seed+1); tries++;
27  } while (seed == 0 && tries < 10);
28  return seed ? seed : iEvent.id().event() + 10000*objNr;
29  }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
#define M_PI
edm::EventID id() const
Definition: EventBase.h:60
uint32_t egamma::getRandomSeedFromSC ( const edm::Event iEvent,
const reco::SuperClusterRef  scRef 
)

Definition at line 5 of file EgammaRandomSeeds.cc.

References edm::EventID::event(), edm::EventBase::id(), createfilelist::int, edm::Ref< C, T, F >::key(), edm::EventID::luminosityBlock(), PFRecoTauDiscriminationByIsolation_cfi::offset, edm::EventID::run(), and SurveyInfoScenario_cff::seed.

Referenced by CalibratedPhotonProducerT< T >::setSemiDetRandomSeed(), and CalibratedElectronProducerT< T >::setSemiDetRandomSeed().

6 {
7  const int offset=0; //for future expansion
8  std::seed_seq seeder = {int(iEvent.id().event()), int(iEvent.id().luminosityBlock()), int(iEvent.id().run()),
9  int(scRef->seed()->seed().rawId()),int(scRef->seed()->hitsAndFractions().size()),
10  offset};
11  uint32_t seed = 0, tries = 10;
12  do {
13  seeder.generate(&seed,&seed+1); tries++;
14  } while (seed == 0 && tries < 10);
15  return seed ? seed : iEvent.id().event() + 10000*scRef.key();
16 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
key_type key() const
Accessor for product key.
Definition: Ref.h:265
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
edm::EventID id() const
Definition: EventBase.h:60