CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ComphepSingletopFilter Class Reference

#include <GeneratorInterface/GenFilters/src/ComphepSingletopFilter.cc>

Inheritance diagram for ComphepSingletopFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ComphepSingletopFilter (const edm::ParameterSet &)
 
 ~ComphepSingletopFilter ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag hepMCProductTag_
 
unsigned int pass22
 
unsigned int pass23
 
double ptsep
 
unsigned int read22
 
unsigned int read23
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: a filter to match LO/NLO in comphep-generated singletop

Implementation: <Notes on="" implementation>="">

Definition at line 17 of file ComphepSingletopFilter.h.

Constructor & Destructor Documentation

ComphepSingletopFilter::ComphepSingletopFilter ( const edm::ParameterSet iConfig)
explicit

Definition at line 33 of file ComphepSingletopFilter.cc.

References edm::ParameterSet::getParameter(), and ptsep.

33  :
34  hepMCProductTag_(iConfig.getParameter<edm::InputTag>("hepMCProductTag")) {
35  ptsep = iConfig.getParameter<double>("pTSep");
36 }
T getParameter(std::string const &) const
ComphepSingletopFilter::~ComphepSingletopFilter ( )

Definition at line 39 of file ComphepSingletopFilter.cc.

39 {}

Member Function Documentation

void ComphepSingletopFilter::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 42 of file ComphepSingletopFilter.cc.

References pass22, pass23, read22, and read23.

42  {
43  read22 = read23 = 0;
44  pass22 = pass23 = 0;
45 }
void ComphepSingletopFilter::endJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 48 of file ComphepSingletopFilter.cc.

References gather_cfg::cout, cmsPerfStripChart::format, pass22, pass23, read22, and read23.

48  {
49  using namespace std;
50  cout << "Proc: 2-->2 2-->3 Total" << endl;
51  cout << boost::format("Read: %9d %9d %9d") % read22 % read23 % (read22+read23)
52  << endl;
53  cout << boost::format("Pass: %9d %9d %9d") % pass22 % pass23 % (pass22+pass23)
54  << endl;
55 }
string format
Some error handling for the usage.
tuple cout
Definition: gather_cfg.py:121
bool ComphepSingletopFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 58 of file ComphepSingletopFilter.cc.

References funct::abs(), ecal_dqm_sourceclient-live_cfg::cerr, GenParticle::GenParticle, edm::Event::getByLabel(), hepMCProductTag_, NULL, parents, pass22, pass23, EnergyCorrector::pt, ptsep, read22, and read23.

60  {
61 
62  using namespace std;
63  using namespace HepMC;
64 
66  iEvent.getByLabel(hepMCProductTag_, evt);
67  const HepMC::GenEvent * myEvt = evt->GetEvent();
68 // myEvt->print(); // to print the record
69 
70  const GenParticle * gp_clep = NULL;
71 
72  for (GenEvent::particle_const_iterator it = myEvt->particles_begin();
73  it != myEvt->particles_end(); ++it) {
74  if ((*it)->status() == 3) {
75  int abs_id = abs((*it)->pdg_id());
76  if (abs_id==11 || abs_id==13 || abs_id==15) {
77  gp_clep = *it;
78  break;
79  }
80  }
81  }
82 
83  if (! gp_clep) {
84  cerr << "ERROR: ComphepSingletopFilter: no charged lepton" << endl;
85  return false;
86  }
87 
88  int id_bdec = 0;
89  vector<const GenParticle *> vgp_bsec;
90 
91  GenVertex * gv_hard = gp_clep->production_vertex();
92 
93  for (GenVertex::particle_iterator it = gv_hard->particles_begin(children);
94  it != gv_hard->particles_end(children); ++it) {
95  int pdg_id = (*it)->pdg_id();
96  if (abs(pdg_id) == 5) {
97  if (pdg_id * (gp_clep->pdg_id()) < 0) {
98  id_bdec = pdg_id;
99  } else {
100  vgp_bsec.push_back(*it);
101  }
102  }
103  }
104 
105  bool process22 = (vgp_bsec.size() == 0);
106 
107  GenVertex * gv = NULL;
108  if (process22) {
109  for (GenVertex::particle_iterator it = gv_hard->particles_begin(parents);
110  it != gv_hard->particles_end(parents); ++it) {
111  if ((*it)->pdg_id() == id_bdec) {
112  gv = (*it)->production_vertex();
113  break;
114  }
115  }
116  if (! gv) {
117  cerr << "ERROR: ComphepSingletopFilter: HepMC inconsistency" << endl;
118  myEvt->print();
119  return false;
120  }
121  } else {
122  gv = vgp_bsec.back()->end_vertex();
123  }
124  const GenParticle * gp;
125  while (gv) {
126  gp = NULL;
127  for (GenVertex::particle_iterator it = gv->particles_begin(children);
128  it != gv->particles_end(children); ++it) {
129  if ((*it)->pdg_id() == -id_bdec) {
130  if (!gp || (*it)->momentum().perp2() > gp->momentum().perp2()) {
131  gp = *it;
132  }
133  }
134  }
135  if (gp) {
136  gv = gp->end_vertex();
137  vgp_bsec.push_back(gp);
138  } else {
139  gv = NULL;
140  }
141  }
142 
143  if (vgp_bsec.size() == 0) {
144  cerr << "ERROR: ComphepSingletopFilter: HepMC inconsistency" << endl;
145  return false;
146  }
147 
148  double pt = vgp_bsec.back()->momentum().perp();
149  bool pass;
150  if (process22) {
151  read22 += 1;
152  pass = pt < ptsep;
153  if (pass) pass22 += 1;
154  } else {
155  read23 += 1;
156  pass = ptsep <= pt;
157  if (pass) pass23 += 1;
158  }
159 
160  return pass;
161 }
TPRegexp parents
Definition: eve_filter.cc:21
#define NULL
Definition: scimark2.h:8
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420

Member Data Documentation

edm::InputTag ComphepSingletopFilter::hepMCProductTag_
private

Definition at line 29 of file ComphepSingletopFilter.h.

Referenced by filter().

unsigned int ComphepSingletopFilter::pass22
private

Definition at line 28 of file ComphepSingletopFilter.h.

Referenced by beginJob(), endJob(), and filter().

unsigned int ComphepSingletopFilter::pass23
private

Definition at line 28 of file ComphepSingletopFilter.h.

Referenced by beginJob(), endJob(), and filter().

double ComphepSingletopFilter::ptsep
private

Definition at line 26 of file ComphepSingletopFilter.h.

Referenced by ComphepSingletopFilter(), and filter().

unsigned int ComphepSingletopFilter::read22
private

Definition at line 27 of file ComphepSingletopFilter.h.

Referenced by beginJob(), endJob(), and filter().

unsigned int ComphepSingletopFilter::read23
private

Definition at line 27 of file ComphepSingletopFilter.h.

Referenced by beginJob(), endJob(), and filter().