Belle II Software  release-05-01-25
BParticle.h
1 #ifndef BPARTICLE_H
2 #define BPARTICLE_H
3 //+
4 // File : BParticle.h
5 // Description : class to contain particle info.
6 //
7 // Author : Ryosuke Itoh, IPNS, KEK
8 // Date : 28 - Jan - 2004
9 //-
10 
11 #include "TObject.h"
12 #include "TClonesArray.h"
13 
14 enum SIMPLEPID {PHOTON, ELECTRON, PION, MUON, KAON, PROTON, JPSI, D, DSTAR, B, PHI, LAMBDA0, ALL };
15 
16 class BParticle : public TObject {
17 
18 private:
19  float m_px;
20  float m_py;
21  float m_pz;
22  float m_e;
23  float m_charge;
24  SIMPLEPID m_pid;
25 
26 public:
27  BParticle() {};
28  BParticle(float px, float py, float pz, float e, float c, SIMPLEPID pid);
29  ~BParticle() {};
30 
31  float px() const { return m_px; };
32  float py() const { return m_py; };
33  float pz() const { return m_pz; };
34  float e() const { return m_e; };
35  float GetMomentum() const { return sqrt(m_px * m_px + m_py * m_py + m_pz * m_pz); };
36  float GetTransverseMomentum() const { return sqrt(m_px * m_px + m_py * m_py); };
37  float charge() const { return m_charge; };
38  SIMPLEPID pid() const { return m_pid; };
39  float GetMass(SIMPLEPID pid);
40  float GetMass();
41  void SetEnergyFromMass(float mass);
42  void SetEnergyFromPid();
43  void SetPid(SIMPLEPID pid) { m_pid = pid; };
44  int InMassRange(float mlower, float mupper) { float m = GetMass(); if (m >= mlower && m <= mupper) return 1; else return 0; };
45  BParticle operator+(const BParticle& b)
46  {
47 
48  BParticle particle(
49  px() + b.px(),
50  py() + b.py(),
51  pz() + b.pz(),
52  e() + b.e(),
53  charge() + b.charge(),
54  PHOTON // wrong
55  );
56 
57  return particle;
58  };
59 
60  BParticle& operator=(const BParticle& p)
61  {
62  //if ( this != &p){
63  m_px = p.px();
64  m_py = p.py();
65  m_pz = p.pz();
66  m_e = p.e();
67  m_charge = p.charge();
68  m_pid = p.pid();
69  //}
70  return *this;
71  };
72 
73 
74  ClassDef(BParticle, 1) // Simple particle class
75 };
76 
77 int SelectParticles(TClonesArray* pin , int charge, SIMPLEPID type, TClonesArray* pout);
78 int CombineParticles(TClonesArray* plist1 , TClonesArray* plist2 , int same, float masslow, float massup, SIMPLEPID pid,
79  TClonesArray* pout);
80 
81 
82 #endif
BParticle
Definition: BParticle.h:16