StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testHepMCIteration.h
1 // testHepMCIteration.h
3 //
4 // garren@fnal.gov, May 2007
5 //
6 // Define methods and classes used by testHepMCIteration
8 
10 bool IsPhoton( const HepMC::GenParticle* p ) {
11  if ( p->pdg_id() == 22
12  && p->momentum().perp() > 10. ) return true;
13  return false;
14 }
15 
17 bool IsWBoson( const HepMC::GenParticle* p ) {
18  if ( abs(p->pdg_id()) == 24 ) return true;
19  return false;
20 }
21 
24 class IsFinalState {
25 public:
27  bool operator()( const HepMC::GenParticle* p ) {
28  if ( !p->end_vertex() && p->status()==1 ) return true;
29  return false;
30  }
31 };
32 
35 class PrintPhoton {
36 public:
37  PrintPhoton( std::ostream & os ) : m_out( os ) {}
38  void operator()( const HepMC::GenParticle* p ) {
39  if ( IsPhoton(p) ) p->print( m_out );
40  }
41 private:
42  std::ostream & m_out;
43 };
44 
48 public:
49  PrintParticle( std::ostream & os ) : m_out( os ) {}
50  void operator()( const HepMC::GenParticle* p ) {
51  m_out << "\t";
52  p->print( m_out );
53  }
54 private:
55  std::ostream & m_out;
56 };
57 
59 
63 public:
64  PrintChildren( std::ostream & os ) : m_out( os ) {}
65  void operator()( HepMC::GenParticle* p ) {
66  // make a copy
67  HepMC::GenParticle* cp = p;
68  // use the copy and the original
69  m_out << "\t\t\t (id,barcode,status) "
70  << cp->pdg_id() << " "
71  << p->barcode() << " "
72  << cp->status() << std::endl;
73  }
74 private:
75  std::ostream & m_out;
76 };
77 
79 
83 public:
84  PrintDescendants( std::ostream & os ) : m_out( os ) {}
85  void operator()( const HepMC::GenParticle* p ) {
86  m_out << "\t\t";
87  p->print( m_out );
88  }
89 private:
90  std::ostream & m_out;
91 };
int pdg_id() const
particle ID
Definition: GenParticle.h:214
int barcode() const
particle barcode
Definition: GenParticle.h:252
bool operator()(const HepMC::GenParticle *p)
returns true if the GenParticle does not decay
int status() const
HEPEVT decay status.
Definition: GenParticle.h:216
double perp() const
Transverse component of the spatial vector (R in cylindrical system).
example class
void print(std::ostream &ostr=std::cout) const
dump this particle&#39;s full info to ostr
Definition: GenParticle.cc:106
const FourVector & momentum() const
standard 4 momentum
Definition: GenParticle.h:211
GenVertex * end_vertex() const
pointer to the decay vertex
Definition: GenParticle.h:221
The GenParticle class contains information about generated particles.
Definition: GenParticle.h:60