PhotosHEPEVTParticle.h
1 #ifndef _PhotosHEPEVTParticle_h_included_
2 #define _PhotosHEPEVTParticle_h_included_
3 
4 /**
5  * @class PhotosHEPEVTParticle
6  *
7  * @brief Single particle of HEPEVT event record
8  *
9  * This class implements the virtual methods of
10  * PhotosParticle. In this way it provides an
11  * interface between the generic PhotosParticle class
12  * and information stored in HEPEVT event record.
13  *
14  * @author Tomasz Przedzinski
15  * @date 24 November 2011
16  */
17 
18 #include <iostream>
19 #include <vector>
20 #include <cmath>
21 #include <cstdio>
22 
23 #include "Photos.h"
24 #include "PhotosParticle.h"
25 #include "PhotosHEPEVTEvent.h"
26 
27 namespace Photospp
28 {
29 
30 class PhotosHEPEVTEvent;
31 
33 
34  public:
35  /** Default destructor */
37 
38  /** Default constructor */
39  PhotosHEPEVTParticle(int pdgid, int status, double px, double py, double pz, double e, double m, int ms, int me, int ds, int de);
40 
41  /** Add a new daughter to this particle */
42  void addDaughter(PhotosParticle* daughter);
43 
44  /** Set the mothers of this particle via a vector of PhotosParticle*/
45  void setMothers(std::vector<PhotosParticle*> mothers);
46 
47  /** Set the daughters of this particle via a vector of PhotosParticle*/
48  void setDaughters(std::vector<PhotosParticle*> daughters);
49 
50  /** Returns the mothers of this particle via a vector of PhotosParticle */
51  std::vector<PhotosParticle*> getMothers();
52 
53  /** Returns the daughters of this particle via a vector of PhotosParticle */
54  std::vector<PhotosParticle*> getDaughters();
55 
56  /** Returns all particles in the decay tree of this particle
57  via a vector of PhotosParticle */
58  std::vector<PhotosParticle*> getAllDecayProducts();
59 
60  /** Check that the 4 momentum in conserved in the decay of this particle */
62 
63  /** Creates a new particle of type PhotosHEPEVTParticle, with the given
64  properties. The new particle bares no relations to this
65  particle, but `this particle' provides only a way of creating an instance of
66  this derived class. eg. createNewParticle() is used inside
67  filhep_() so that a PhotosHEPEVTParticle can be created without
68  the method having explicit knowledge of the PhotosHEPEVTParticle
69  class */
70  PhotosHEPEVTParticle * createNewParticle(int pdg_id, int status, double mass,
71  double px, double py,
72  double pz, double e);
73 
74  /** Creating history entries not implemented in HEPEVT */
75  void createHistoryEntry();
76 
77  /** Create a self-decay vertex for this particle
78  with 'out' being the outgoing particle in new vertex */
80 
81  /** Check if particle 'p' is daughter of this particle */
83 
84  /** Check if particle 'p' is mother of this particle */
86 
87  /** Print information on this particle into standard output */
88  void print();
89 
90  /** Set the PDG ID code of this particle */
91  void setPdgID(int pdg_id);
92 
93  /** Set the status of this particle */
94  void setStatus(int statu);
95 
96  /** Set the mass of this particle */
97  void setMass(double mass);
98 
99  /** Get the PDG ID code of this particle */
100  int getPdgID();
101 
102  /** Get the status of this particle */
103  int getStatus();
104 
105  /** Get the mass stored (i.e. not calculated from four vector) at generation step */
106  double getMass();
107 
108  /** Returns the px component of the four vector*/
109  double getPx();
110 
111  /** Returns the py component of the four vector */
112  double getPy();
113 
114  /** Returns the pz component of the four vector */
115  double getPz();
116 
117  /** Returns the energy component of the four vector */
118  double getE();
119 
120  /** Set the px component of the four vector */
121  void setPx( double px );
122 
123  /** Set the px component of the four vector */
124  void setPy( double py );
125 
126  /** Set the pz component of the four vector */
127  void setPz( double pz );
128 
129  /** Set the energy component of the four vector */
130  void setE( double e );
131 
132  /** Get the barcode (position in list) of this particle */
133  int getBarcode();
134 
135  /** Set barcode (position in list) of this particle */
136  void setBarcode(int barcode);
137 
138  /** Set event of this particle */
139  void setEvent(PhotosHEPEVTEvent *event);
140 
141  /** Get index of first mother */
142  int getFirstMotherIndex();
143 
144  /** Get index of second mother */
145  int getSecondMotherIndex();
146 
147  /** Get index of first daughter */
148  int getDaughterRangeStart();
149 
150  /** Get index of last daughter */
151  int getDaughterRangeEnd();
152 
153 private:
154 
155  /** Set index of first daughter */
157 
158  /** Set index of last daughter */
159  void setDaughterRangeEnd(int i) { m_daughter_end =i; }
160 
161  /** Event from which this particle is taken */
163 
164  /** Position in the event record */
166 
167  /** Indexes of mothers (-1 if do not have mothers) */
168  int m_first_mother, m_second_mother;
169 
170  /** Range of indexes of daughters (-1 if do not have daughters) */
171  int m_daughter_start, m_daughter_end;
172 
173  /** PDG ID */
174  int m_pdgid;
175 
176  /** Status (stable, decayed) */
177  int m_status;
178 
179  /** Momentum */
180  double m_px, m_py, m_pz, m_e;
181 
182  /** Mass saved at generation step */
184 
185  /** List of created particles - if they are not in the event, they
186  will be deleted when no longer needed */
187  vector<PhotosHEPEVTParticle*> cache;
188 };
189 
190 } // namespace Photospp
191 #endif
192 
bool isDaughterOf(PhotosHEPEVTParticle *p)
vector< PhotosHEPEVTParticle * > cache
void addDaughter(PhotosParticle *daughter)
bool isMotherOf(PhotosHEPEVTParticle *p)
PhotosHEPEVTParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)
std::vector< PhotosParticle * > getMothers()
std::vector< PhotosParticle * > getDaughters()
void setEvent(PhotosHEPEVTEvent *event)
std::vector< PhotosParticle * > getAllDecayProducts()
void setDaughters(std::vector< PhotosParticle * > daughters)
void setMothers(std::vector< PhotosParticle * > mothers)
void createSelfDecayVertex(PhotosParticle *out)
PhotosHEPEVTParticle(int pdgid, int status, double px, double py, double pz, double e, double m, int ms, int me, int ds, int de)