CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ComphepSingletopFilterPy8 Class Reference

#include <ComphepSingletopFilterPy8.h>

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

Public Member Functions

 ComphepSingletopFilterPy8 (const edm::ParameterSet &)
 
 ~ComphepSingletopFilterPy8 () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

int hardLep
 
int pass22
 
int pass23
 
double ptsep
 
int read22
 
int read23
 
edm::EDGetTokenT< edm::HepMCProducttoken_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 19 of file ComphepSingletopFilterPy8.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file ComphepSingletopFilterPy8.cc.

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

37  :
38  token_(consumes<edm::HepMCProduct>(edm::InputTag(iConfig.getUntrackedParameter("moduleLabel",std::string("generator")),"unsmeared")))
39 {
40  ptsep = iConfig.getParameter<double>("pTSep");
41 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > token_
ComphepSingletopFilterPy8::~ComphepSingletopFilterPy8 ( )
override

Definition at line 43 of file ComphepSingletopFilterPy8.cc.

43 {}

Member Function Documentation

void ComphepSingletopFilterPy8::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 45 of file ComphepSingletopFilterPy8.cc.

References hardLep, pass22, pass23, read22, and read23.

void ComphepSingletopFilterPy8::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 52 of file ComphepSingletopFilterPy8.cc.

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

53 {
54  cout << "Proc: 2-->2 2-->3 Total" << endl;
55  cout << boost::format("Read: %9d %9d %9d") % read22 % read23 % (read22+read23)
56  << endl;
57  cout << boost::format("Pass: %9d %9d %9d") % pass22 % pass23 % (pass22+pass23)
58  << endl;
59 }
format
Some error handling for the usage.
bool ComphepSingletopFilterPy8::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 62 of file ComphepSingletopFilterPy8.cc.

References funct::abs(), MessageLogger_cfi::cerr, class-composition::children, gather_cfg::cout, edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), runTauDisplay::gp, hardLep, parents, pass22, pass23, HiggsValidation_cfi::pdg_id, EnergyCorrector::pt, ptsep, read22, read23, and token_.

63 {
64 
65 
67 //iEvent.getByLabel("generator","unsmeared", evt);
68 iEvent.getByToken(token_, evt);
69 const HepMC::GenEvent * myEvt = evt->GetEvent();
70 
71 int id_bdec=0, id_lJet=0, id_b_from_top=0, id_lep = 0;
72 //vars for lepton top
73 const GenParticle * gp_clep = nullptr;
74 GenVertex * gv_hard = nullptr;
75 
76 const GenParticle * gp_lep_FSR = nullptr;
77 GenVertex * gv_lep = nullptr;
78 vector<const GenParticle *> vgp_lep;
79 
80 //vars for add b from top
81 GenVertex * gv = nullptr;
82 const GenParticle * gp = nullptr;
83 vector<const GenParticle *> vgp_bsec;
84 
85 //vars for light Jet (light q)
86 GenVertex * gv_lJet= nullptr;
87 const GenParticle * gplJet= nullptr;
88 vector<const GenParticle *> vgp_lJet;
89 
90 //vars for b from top
91 GenVertex * gv_b_t= nullptr;
92 const GenParticle * gp_b_t= nullptr;
93 vector<const GenParticle *> vgp_b_t;
94 
95 
96 //Run through all particles in myEvt, if lepton found saves it gp_clep
97  for (GenEvent::particle_const_iterator it = myEvt->particles_begin(); it != myEvt->particles_end(); ++it)
98  {
99  if (abs((*it)->status()) == hardLep)
100  {
101  int abs_id = abs((*it)->pdg_id());//11=e, -11=E, 13=mu, -13=Mu, 15=l(tau), -15=L
102  if (abs_id==11 || abs_id==13 || abs_id==15)
103  {
104  gp_clep = *it;
105  id_lep = (*it)->pdg_id();
106  gv_lep=(*it)->production_vertex();
107  // Lepton FSR
108  while (gv_lep)
109  {
110  gp_lep_FSR = nullptr;
111  for (GenVertex::particle_iterator it = gv_lep->particles_begin(children); it != gv_lep->particles_end(children); ++it)
112  {
113  if ((*it)->pdg_id() == id_lep)
114  {
115  if (!gp_lep_FSR || (*it)->momentum().perp2() > gp_lep_FSR->momentum().perp2())
116  {
117  gp_lep_FSR = *it;
118  }
119  }
120  }
121  if (gp_lep_FSR)
122  {
123  gv_lep = gp_lep_FSR->end_vertex();
124  vgp_lep.push_back(gp_lep_FSR); //vertex of
125  }
126  else
127  {
128  gv_lep = nullptr; //exits the "while" loop
129  }
130  }
131  break;
132  }
133  }
134  }
135 // Goes to lepton production vertex
136  gv_hard = gp_clep->production_vertex();
137 
138  if (! gp_clep)
139  {
140  cout << "ERROR: ComphepSingletopFilterPy8: no charged lepton" << endl;
141  return false;
142  }
143 
144 
145 //Run through lepton production_vertex
146  for (GenVertex::particle_iterator it = gv_hard->particles_begin(children); it != gv_hard->particles_end(children); ++it)
147  {
148  int pdg_id = (*it)->pdg_id(); // KF in Pythia
149  int abs_id = abs(pdg_id);
150 
151 //selection of light quark among particles in primary vertex
152  if(abs_id<5)
153  {
154  id_lJet = (*it)->pdg_id();
155  gv_lJet=(*it)->production_vertex();
156 
157  while (gv_lJet)
158  {
159  gplJet = nullptr;
160  for (GenVertex::particle_iterator it = gv_lJet->particles_begin(children); it != gv_lJet->particles_end(children); ++it)
161  {
162  if ((*it)->pdg_id() == id_lJet)
163  {
164  if (!gplJet || (*it)->momentum().perp2() > gplJet->momentum().perp2())
165  {
166  gplJet = *it;
167  }
168  }
169  }
170 
171  if (gplJet)
172  {
173  gv_lJet = gplJet->end_vertex();
174  vgp_lJet.push_back(gplJet); //vertex of
175  }
176  else
177  {
178  gv_lJet = nullptr; //exits the "while" loop
179  }
180  }
181  }
182 
183  if (abs(pdg_id) == 5) // 5 = b
184  {
185  if (pdg_id * (gp_clep->pdg_id()) < 0)
186  { //b is from top
187  id_bdec = pdg_id;
188 
189  id_b_from_top = (*it)->pdg_id();
190  gv_b_t = (*it)->production_vertex();
191 
192  while (gv_b_t)
193  {
194  gp_b_t = nullptr;
195  for (GenVertex::particle_iterator it = gv_b_t->particles_begin(children); it != gv_b_t->particles_end(children); ++it)
196  {
197  if ((*it)->pdg_id() == id_b_from_top)
198  {
199  if (!gp_b_t || (*it)->momentum().perp2() > gp_b_t->momentum().perp2())
200  {
201  gp_b_t = *it;
202  }
203  }
204  }
205 
206  if (gp_b_t)
207  {
208  gv_b_t = gp_b_t->end_vertex();
209  vgp_b_t.push_back(gp_b_t); //vertex of
210  }
211  else
212  {
213  gv_b_t = nullptr; //exits the "while" loop
214  }
215  }
216  }
217  else
218  {//If process 2-3, then aditional b in the initial state fills
219  vgp_bsec.push_back(*it);
220  }
221  }
222  }
223 
224 
225 bool process22 = (vgp_bsec.empty()); //if there is no aditional b-quark in primary vexrtes, then it is tq-process (2->2)
226 
227  if (process22)
228  {
229  for (GenVertex::particle_iterator it = gv_hard->particles_begin(parents); it != gv_hard->particles_end(parents); ++it) //Among parents of lepton production vertex(primary vertex) we find b-quark.
230  {
231 
232  if ((*it)->pdg_id() == id_bdec)
233  {
234  gv = (*it)->production_vertex();
235  break;
236  }
237  }
238  if (! gv)
239  {
240  cerr << "ERROR: ComphepSingletopFilterPy8: HepMC inconsistency (! gv)" << endl;
241  myEvt->print();
242  return false;
243  }
244  }
245  else
246  {
247  gv = vgp_bsec.back()->end_vertex();
248  }
249 
250 //##Correction for GV vertex, because of additional gluons in ISR
251 bool WeFoundAdditional_b_quark = false;
252 int loopCount = 0, gv_loopCount = 0;
253  while (WeFoundAdditional_b_quark != true)
254  {
256  for (GenVertex::particle_iterator it = gv->particles_begin(children); it != gv->particles_end(children); ++it)
257  {
259  if ((*it)->pdg_id() == -id_bdec)
260  { //we found right vertex of ISR gluon splitting!
261  WeFoundAdditional_b_quark = true;//gv = (*it)->production_vertex();
262  }
263  }
264  if (WeFoundAdditional_b_quark == false)
265  {
267  for (GenVertex::particle_iterator it = gv->particles_begin(parents); it != gv->particles_end(parents); ++it)
268  {
269  if ((*it)->pdg_id() == id_bdec)
270  {
271  gv = (*it)->production_vertex();
272 
273  }
274  }
275  }
276  loopCount++;
277 
278  if (loopCount > 100)//loop protection, nothing more
279  {
280 cerr << "ERROR: ComphepSingletopFilterPy8: HepMC inconsistency (No add b vertex found)" << endl;
281  break;
282  }
283  }
284 
285 
286 
287  while (gv)
288  {
289  gp = nullptr;
290 
291  for (GenVertex::particle_iterator it = gv->particles_begin(children); it != gv->particles_end(children); ++it)
292  {
293  if ((*it)->pdg_id() == -id_bdec)
294  {
295  if (!gp || (*it)->momentum().perp2() > gp->momentum().perp2())
296  {
297  gp = *it;
298 
299  }
300  }
301  }
302  if (gp)
303  {
304  gv = gp->end_vertex();
305  vgp_bsec.push_back(gp); //vertex of
306  }
307  else
308  {
309  gv = nullptr; //exits the "while" loop
310  }
311  gv_loopCount++;
312  }
313 
314 
315  if (vgp_bsec.empty())
316  {
317  cerr << "ERROR: ComphepSingletopFilterPy8: HepMC inconsistency (vgp_bsec.size() == 0)" << endl;
318  return false;
319  }
320 
321  double pt = vgp_bsec.back()->momentum().perp();
322  // double eta = vgp_bsec.back()->momentum().eta();
323  bool pass;
324  if (process22)
325  {
326  read22 += 1;
327  pass = pt < ptsep;
328  if (pass) pass22 += 1;
329  }
330  else
331  {
332  read23 += 1;
333  pass = ptsep <= pt;
334  if (pass) pass23 += 1;
335  }
336  return pass;
337 }
TPRegexp parents
Definition: eve_filter.cc:21
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< edm::HepMCProduct > token_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38

Member Data Documentation

int ComphepSingletopFilterPy8::hardLep
private

Definition at line 31 of file ComphepSingletopFilterPy8.h.

Referenced by beginJob(), and filter().

int ComphepSingletopFilterPy8::pass22
private

Definition at line 31 of file ComphepSingletopFilterPy8.h.

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

int ComphepSingletopFilterPy8::pass23
private

Definition at line 31 of file ComphepSingletopFilterPy8.h.

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

double ComphepSingletopFilterPy8::ptsep
private

Definition at line 30 of file ComphepSingletopFilterPy8.h.

Referenced by ComphepSingletopFilterPy8(), and filter().

int ComphepSingletopFilterPy8::read22
private

Definition at line 31 of file ComphepSingletopFilterPy8.h.

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

int ComphepSingletopFilterPy8::read23
private

Definition at line 31 of file ComphepSingletopFilterPy8.h.

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

edm::EDGetTokenT<edm::HepMCProduct> ComphepSingletopFilterPy8::token_
private

Definition at line 27 of file ComphepSingletopFilterPy8.h.

Referenced by filter().