CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RandomFilter.cc
Go to the documentation of this file.
1 
3 
9 
10 #include "CLHEP/Random/RandomEngine.h"
11 
12 using namespace edm;
13 
15  acceptRate_(ps.getUntrackedParameter<double>("acceptRate")) {
17  if(!rng.isAvailable()) {
18  throw cms::Exception("Configuration")
19  << "RandomFilter requires the RandomNumberGeneratorService,\n"
20  "which is not present in the configuration file. You must add\n"
21  "the service in the configuration file or remove the modules that\n"
22  "require it.\n";
23  }
24 }
25 
27 }
28 
31  CLHEP::HepRandomEngine& engine = rng->getEngine(event.streamID());
32  if (engine.flat() < acceptRate_) return true;
33  return false;
34 }
virtual ~RandomFilter()
Definition: RandomFilter.cc:26
virtual bool filter(edm::Event &e, edm::EventSetup const &c) override
Definition: RandomFilter.cc:29
bool isAvailable() const
Definition: Service.h:46
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
StreamID streamID() const
Definition: Event.h:79
RandomFilter(edm::ParameterSet const &ps)
Definition: RandomFilter.cc:14