CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TauSpinnerFilter.cc
Go to the documentation of this file.
2 
8 
10  src_(pset.getParameter<edm::InputTag>("src"))
11  ,fRandomEngine(nullptr)
12  ,ntaus_(0)
13 {
14  if(pset.getParameter<int>("ntaus")==1)ntaus_=1.0;
15  if(pset.getParameter<int>("ntaus")==2)ntaus_=2.0;
16  WTToken_=consumes<double>(src_);
17 }
18 
20  edm::RandomEngineSentry<TauSpinnerFilter> randomEngineSentry(this, e.streamID());
22  e.getByToken(WTToken_,WT);
23  if(*(WT.product())>=0 && *(WT.product())<=4.0){
24  double weight=(*(WT.product()));
25  if(fRandomEngine->flat()*ntaus_*2.0<weight){return true;}
26  }
27  return false;
28 }
29 
T getParameter(std::string const &) const
edm::InputTag src_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
TauSpinnerFilter(const edm::ParameterSet &)
CLHEP::HepRandomEngine * fRandomEngine
#define nullptr
virtual bool filter(edm::Event &e, edm::EventSetup const &es)
edm::EDGetTokenT< double > WTToken_
StreamID streamID() const
Definition: Event.h:79