CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PythiaHLTSoupFilter.cc
Go to the documentation of this file.
1 
3 
5 #include <iostream>
6 
7 using namespace edm;
8 using namespace std;
9 
10 
12 token_(consumes<edm::HepMCProduct>(edm::InputTag(iConfig.getUntrackedParameter("moduleLabel",std::string("generator")),"unsmeared"))),
13 minptelectron(iConfig.getUntrackedParameter("MinPtElectron", 0.)),
14 minptmuon(iConfig.getUntrackedParameter("MinPtMuon", 0.)),
15 maxetaelectron(iConfig.getUntrackedParameter("MaxEtaElectron", 10.)),
16 maxetamuon(iConfig.getUntrackedParameter("MaxEtaMuon", 10.)),
17 minpttau(iConfig.getUntrackedParameter("MinPtTau", 0.)),
18 maxetatau(iConfig.getUntrackedParameter("MaxEtaTau", 10.))
19 
20 {
21  //now do what ever initialization is needed
22 
23 }
24 
25 
27 {
28 
29  // do anything here that needs to be done at desctruction time
30  // (e.g. close files, deallocate resources etc.)
31 
32 }
33 
34 
35 //
36 // member functions
37 //
38 
39 // ------------ method called to produce the data ------------
41 {
42  using namespace edm;
43  bool accepted = false;
45  iEvent.getByToken(token_, evt);
46 
47  const HepMC::GenEvent * myGenEvent = evt->GetEvent();
48 
49  if(myGenEvent->signal_process_id() == 2) {
50 
51  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
52  p != myGenEvent->particles_end(); ++p ) {
53 
54 
55  if ( abs((*p)->pdg_id()) == 11
56  && (*p)->momentum().perp() > minptelectron
57  && abs((*p)->momentum().eta()) < maxetaelectron
58  && (*p)->status() == 1 ) { accepted = true; }
59 
60 
61 
62  if ( abs((*p)->pdg_id()) == 13
63  && (*p)->momentum().perp() > minptmuon
64  && abs((*p)->momentum().eta()) < maxetamuon
65  && (*p)->status() == 1 ) { accepted = true; }
66 
67 
68  if ( abs((*p)->pdg_id()) == 15
69  && (*p)->momentum().perp() > minpttau
70  && abs((*p)->momentum().eta()) < maxetatau
71  && (*p)->status() == 3 ) { accepted = true; }
72  }
73 
74  } else { accepted = true; }
75 
76  if (accepted){
77  return true; } else {return false;}
78 
79 }
80 
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< edm::HepMCProduct > token_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual bool filter(edm::Event &, const edm::EventSetup &)
PythiaHLTSoupFilter(const edm::ParameterSet &)