Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ana2019::fakedata::KeepEvtFunc Class Reference
Inheritance diagram for ana2019::fakedata::KeepEvtFunc:
ana2019::fakedata::EvtHashRNG ana2019::fakedata::KeepMCEventFunc

Public Member Functions

 KeepEvtFunc (double keepProb)
virtual bool Keep (const caf::SRSpillProxy *sr)
virtual bool Keep (const caf::SRProxy *sr)
void SetKeepProb (double prob)
TRandom * RNG ()
void SetSeed (std::size_t seed)

Protected Member Functions

bool Keep (std::size_t hash)

Private Attributes

double fKeepProb
std::size_t fLastHash

Detailed Description

Class for deciding whether to keep an event (either full StandardRecord or just SRSpill) based on a random number generator and a single (changable) probability

Definition at line 61 of file generate_fd_fake_events.C.

Constructor & Destructor Documentation

ana2019::fakedata::KeepEvtFunc::KeepEvtFunc ( double  keepProb)

Definition at line 64 of file generate_fd_fake_events.C.

Member Function Documentation

virtual bool ana2019::fakedata::KeepEvtFunc::Keep ( const caf::SRSpillProxy sr)

Definition at line 68 of file generate_fd_fake_events.C.

References ana::Hash().

69  {
70  return Keep(Hash(sr));
71  }
virtual bool Keep(const caf::SRSpillProxy *sr)
std::size_t Hash(const std::vector< std::size_t > &vals)
Generate a unique hash from a sequence of integers.
Definition: Utilities.cxx:384
virtual bool ana2019::fakedata::KeepEvtFunc::Keep ( const caf::SRProxy sr)

Definition at line 73 of file generate_fd_fake_events.C.

References caf::Proxy< caf::SRHeader >::cycle, samweb_client.utility::hash, ana::Hash(), caf::Proxy< caf::StandardRecord >::hdr, caf::Proxy< caf::StandardRecord >::spill, and caf::Proxy< caf::SRHeader >::subevt.

74  {
75  auto hash = Hash({Hash(&sr->spill), (std::size_t)(sr->hdr.cycle), sr->hdr.subevt});
76  return Keep(hash);
77  }
caf::Proxy< caf::SRSpill > spill
Definition: SRProxy.h:2143
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
virtual bool Keep(const caf::SRSpillProxy *sr)
caf::Proxy< short unsigned int > subevt
Definition: SRProxy.h:250
caf::Proxy< int > cycle
Definition: SRProxy.h:230
std::size_t Hash(const std::vector< std::size_t > &vals)
Generate a unique hash from a sequence of integers.
Definition: Utilities.cxx:384
bool ana2019::fakedata::KeepEvtFunc::Keep ( std::size_t  hash)

Definition at line 86 of file generate_fd_fake_events.C.

References samweb_client.utility::hash.

87  {
88  if (hash != fLastHash)
89  {
90  SetSeed(hash);
91  fLastHash = hash;
92  }
94  return RNG()->Uniform() < fKeepProb;
95  }
TRandom* ana2019::fakedata::EvtHashRNG::RNG ( )

Definition at line 52 of file generate_fd_fake_events.C.

void ana2019::fakedata::KeepEvtFunc::SetKeepProb ( double  prob)

Definition at line 79 of file generate_fd_fake_events.C.

80  {
81  fKeepProb = prob;
82  }
void ana2019::fakedata::EvtHashRNG::SetSeed ( std::size_t  seed)

Definition at line 53 of file generate_fd_fake_events.C.

53 { fRng.SetSeed(seed); }
unsigned int seed
Definition: runWimpSim.h:102

Member Data Documentation

double ana2019::fakedata::KeepEvtFunc::fKeepProb

Definition at line 98 of file generate_fd_fake_events.C.

std::size_t ana2019::fakedata::KeepEvtFunc::fLastHash

Definition at line 99 of file generate_fd_fake_events.C.

The documentation for this class was generated from the following file: