Belle II Software development
BParticle.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <TObject.h>
12#include <TClonesArray.h>
13
14enum SIMPLEPID {PHOTON, ELECTRON, PION, MUON, KAON, PROTON, JPSI, D, DSTAR, B, PHI, LAMBDA0, DEUTERON, ALL };
15
18class BParticle : public TObject {
19
20private:
21 float m_px;
22 float m_py;
23 float m_pz;
24 float m_e;
25 float m_charge;
26 SIMPLEPID m_pid;
27 float m_logL_e;
28 float m_logL_mu;
29 float m_logL_pi;
30 float m_logL_k;
31 float m_logL_p;
32 float m_logL_d;
34public:
38 BParticle(const BParticle&) = default;
41
57 BParticle(float px, float py, float pz, float energy, float charge, SIMPLEPID pid,
58 float logL_e = 0, float logL_mu = 0, float logL_pi = 0, float logL_k = 0, float logL_p = 0, float logL_d = 0);
59
62
63
67 float px() const { return m_px; };
71 float py() const { return m_py; };
75 float pz() const { return m_pz; };
79 float e() const { return m_e; };
84 float GetMomentum() const { return sqrt(m_px * m_px + m_py * m_py + m_pz * m_pz); };
89 float GetTransverseMomentum() const { return sqrt(m_px * m_px + m_py * m_py); };
94 float charge() const { return m_charge; };
95
101 SIMPLEPID pid() const { return m_pid; };
106 float logL_e() const { return m_logL_e; };
111 float logL_mu() const { return m_logL_mu; };
116 float logL_pi() const { return m_logL_pi; };
121 float logL_k() const { return m_logL_k; };
126 float logL_p() const { return m_logL_p; };
131 float logL_d() const { return m_logL_d; };
137 float GetLogL(SIMPLEPID pid);
143 float GetPID(SIMPLEPID pid);
150 float GetBinPID(SIMPLEPID pid1, SIMPLEPID pid2);
151
158 float GetMass(SIMPLEPID pid);
164 float GetMass();
165
171 void SetEnergyFromMass(float mass);
175 void SetEnergyFromPid();
181 void SetPid(SIMPLEPID pid) { m_pid = pid; };
182
189 int InMassRange(float mlower, float mupper) { float m = GetMass(); if (m >= mlower && m <= mupper) return 1; else return 0; };
190
193 {
194 m_px = p.px();
195 m_py = p.py();
196 m_pz = p.pz();
197 m_e = p.e();
198 m_charge = p.charge();
199 m_pid = p.pid();
200 m_logL_e = p.logL_e();
201 m_logL_mu = p.logL_mu();
202 m_logL_pi = p.logL_pi();
203 m_logL_k = p.logL_k();
204 m_logL_p = p.logL_p();
205 m_logL_d = p.logL_d();
206 return *this;
207 };
208
209 ClassDef(BParticle, 2) // Simple particle class
210};
211
212int SelectParticles(TClonesArray* pin, int charge, SIMPLEPID type, TClonesArray* pout);
213
214int CombineParticles(TClonesArray* plist1, TClonesArray* plist2, int same, float masslow, float massup, SIMPLEPID pid,
215 TClonesArray* pout);
The Class for Masterclass particle information This class provides the data structure of the particle...
Definition: BParticle.h:18
float m_logL_pi
log likelihood of the pion hypothesis
Definition: BParticle.h:29
void SetEnergyFromMass(float mass)
Recalculate energy from particle mass and momentum.
Definition: BParticle.cc:106
SIMPLEPID pid() const
Get the particle identity.
Definition: BParticle.h:101
void SetPid(SIMPLEPID pid)
Set particle identity.
Definition: BParticle.h:181
float m_logL_p
log likelihood of the proton hypothesis
Definition: BParticle.h:31
float GetLogL(SIMPLEPID pid)
Get the log likelihood for a particle hypothesis.
Definition: BParticle.cc:48
float logL_pi() const
Get the log likelihood for pion hypothesis.
Definition: BParticle.h:116
float GetPID(SIMPLEPID pid)
Get the log likelihood ratio for a particle hypothesis with respect to all other hypotheses.
Definition: BParticle.cc:61
float GetMomentum() const
Get the momentum of the particle.
Definition: BParticle.h:84
float m_e
energy of the particle
Definition: BParticle.h:24
SIMPLEPID m_pid
particle identity
Definition: BParticle.h:26
float GetTransverseMomentum() const
Get the transverse momentum of the particle.
Definition: BParticle.h:89
float m_logL_mu
log likelihood of the muon hypothesis
Definition: BParticle.h:28
float m_py
y component of the particle momentum
Definition: BParticle.h:22
float m_charge
charge of the particle
Definition: BParticle.h:25
float px() const
Definition: BParticle.h:67
void SetEnergyFromPid()
Recalculate energy from particle identity and momentum.
Definition: BParticle.cc:113
BParticle & operator=(const BParticle &p)
Assign a particle.
Definition: BParticle.h:192
float m_logL_e
log likelihood of the electron hypothesis
Definition: BParticle.h:27
~BParticle()
Default destructor.
Definition: BParticle.h:61
BParticle(const BParticle &)=default
Constructor using the particle.
BParticle & operator+=(const BParticle &)
Operator to add particle.
Definition: BParticle.cc:31
float charge() const
Get the particle charge.
Definition: BParticle.h:94
float GetBinPID(SIMPLEPID pid1, SIMPLEPID pid2)
Get the binary log likelihood ratio for a particle hypothesis with respect to a second hypothesis.
Definition: BParticle.cc:71
float logL_p() const
Get the log likelihood for proton hypothesis.
Definition: BParticle.h:126
float m_pz
z component of the particle momentum
Definition: BParticle.h:23
float logL_e() const
Get the log likelihood for electron hypothesis.
Definition: BParticle.h:106
float e() const
Definition: BParticle.h:79
float logL_mu() const
Get the log likelihood for muon hypothesis.
Definition: BParticle.h:111
float m_px
x component of the particle momentum
Definition: BParticle.h:21
float logL_k() const
Get the log likelihood for kaon hypothesis.
Definition: BParticle.h:121
BParticle()
Default constructor.
Definition: BParticle.h:36
int InMassRange(float mlower, float mupper)
Test if the mass is in range.
Definition: BParticle.h:189
float py() const
Definition: BParticle.h:71
float m_logL_k
log likelihood of the kaon hypothesis
Definition: BParticle.h:30
float GetMass()
Get the mass of the particle.
Definition: BParticle.cc:99
float m_logL_d
log likelihood of the deuteron hypothesis
Definition: BParticle.h:32
float logL_d() const
Get the log likelihood for deuteron hypothesis.
Definition: BParticle.h:131
float pz() const
z
Definition: BParticle.h:75