CMS 3D CMS Logo

Functions
read_particles_from_HepMC.h File Reference
#include "HepMC/GenEvent.h"
#include "HepMC/GenParticle.h"
#include "HepMC/IO_GenEvent.h"
#include "TauSpinner/SimpleParticle.h"
#include <vector>

Go to the source code of this file.

Functions

HepMC::GenParticle * findLastSelf (HepMC::GenParticle *x)
 
std::vector< TauSpinner::SimpleParticle > * getDaughters (HepMC::GenParticle *x)
 
bool isFirst (HepMC::GenParticle *x)
 
int readParticlesFromHepMC (const HepMC::GenEvent *event, TauSpinner::SimpleParticle &X, TauSpinner::SimpleParticle &tau, TauSpinner::SimpleParticle &tau2, std::vector< TauSpinner::SimpleParticle > &tau_daughters, std::vector< TauSpinner::SimpleParticle > &tau2_daughters)
 

Function Documentation

◆ findLastSelf()

HepMC::GenParticle* findLastSelf ( HepMC::GenParticle *  x)
inline

Definition at line 42 of file read_particles_from_HepMC.cc.

44  {
45  if (!x->end_vertex())
46  return x;
47 
48  for (HepMC::GenVertex::particle_iterator p = x->end_vertex()->particles_begin(HepMC::children);
49  p != x->end_vertex()->particles_end(HepMC::children);
50  ++p) {
51  if ((*p)->pdg_id() == x->pdg_id())
52  return findLastSelf(*p);
53  }
54 

References class-composition::children, AlCaHLTBitMon_ParallelJobs::p, and x.

Referenced by readParticlesFromHepMC().

◆ getDaughters()

std::vector<TauSpinner::SimpleParticle>* getDaughters ( HepMC::GenParticle *  x)
inline

Definition at line 7 of file read_particles_from_HepMC.cc.

8  {
9  std::vector<SimpleParticle> *daughters = new std::vector<SimpleParticle>();
10  if (!x->end_vertex())
11  return daughters;
12 
13  // Check decay products of 'x'
14  for (HepMC::GenVertex::particles_out_const_iterator p = x->end_vertex()->particles_out_const_begin();
15  p != x->end_vertex()->particles_out_const_end();
16  ++p) {
18  HepMC::FourVector mm = pp->momentum();
19 
20  // If the daughter of 'x' has its end vertex - recursively read
21  // all of its daughters.
22  if (pp->end_vertex() && pp->pdg_id() != 111) {
23  std::vector<SimpleParticle> *sub_daughters = getDaughters(pp);
24  daughters->insert(daughters->end(), sub_daughters->begin(), sub_daughters->end());
25 
26  delete sub_daughters;
27  }
28  // Otherwise - add this particle to the list of daughters.
29  else if (pp->pdg_id() != x->pdg_id()) {
30  SimpleParticle tp(mm.px(), mm.py(), mm.pz(), mm.e(), pp->pdg_id());
31  daughters->push_back(tp);
32  }
33  }
34 
35  return daughters;

References BPhysicsValidation_cfi::daughters, GenParticle::GenParticle, AlCaHLTBitMon_ParallelJobs::p, createTree::pp, cmsswSequenceInfo::tp, and x.

Referenced by CandMatcherBase< C1, C2 >::initMaps(), and readParticlesFromHepMC().

◆ isFirst()

bool isFirst ( HepMC::GenParticle *  x)
inline

Definition at line 56 of file read_particles_from_HepMC.cc.

58  {
59  for (HepMC::GenVertex::particle_iterator p = x->production_vertex()->particles_begin(HepMC::parents);
60  p != x->production_vertex()->particles_end(HepMC::parents);
61  ++p) {
62  if (x->pdg_id() == (*p)->pdg_id())
63  return false;
64  }

Referenced by readParticlesFromHepMC().

◆ readParticlesFromHepMC()

int readParticlesFromHepMC ( const HepMC::GenEvent event,
TauSpinner::SimpleParticle &  X,
TauSpinner::SimpleParticle &  tau,
TauSpinner::SimpleParticle &  tau2,
std::vector< TauSpinner::SimpleParticle > &  tau_daughters,
std::vector< TauSpinner::SimpleParticle > &  tau2_daughters 
)

Read HepMC::GenEvent.

Read HepMC event from data file and return particles needed for tau spin weight calculation.

This routine is prepared for use with files generated by Pythia8. Fills:

'X' - Heavy particle (W+/-, H+/-, H, Z) 'tau' - first tau

'tau_daughters' - daughters of 'tau' 'tau2_daughters' - daughters of 'tau2' or empty list, if 'tau2' is nu_tau.

Returns: 0 - event processed correctly 1 - empty event or no decay found in the event

Referenced by TauSpinnerCMS::produce().

class-composition.children
children
Definition: class-composition.py:88
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BPhysicsValidation_cfi.daughters
daughters
Definition: BPhysicsValidation_cfi.py:11
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
findLastSelf
HepMC::GenParticle * findLastSelf(HepMC::GenParticle *x)
Definition: read_particles_from_HepMC.cc:42
GenParticle.GenParticle
GenParticle
Definition: GenParticle.py:18
genVertex_cff.x
x
Definition: genVertex_cff.py:12
getDaughters
std::vector< SimpleParticle > * getDaughters(HepMC::GenParticle *x)
Definition: read_particles_from_HepMC.cc:7
createTree.pp
pp
Definition: createTree.py:17
parents
TPRegexp parents
Definition: eve_filter.cc:21