Subversion Repositories f9daq

Rev

Rev 271 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
193 f9daq 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
 
271 f9daq 14
enum SIMPLEPID {PHOTON, ELECTRON, PION, MUON, KAON, PROTON, JPSI, D, DSTAR, B, PHI, ALL };
193 f9daq 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; };
266 f9daq 35
  float GetMomentum() const { return sqrt(m_px*m_px+m_py*m_py+m_pz*m_pz); };
273 f9daq 36
  float GetTransverseMomentum() const { return sqrt(m_px*m_px+m_py*m_py); };
193 f9daq 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
        BParticle particle(
48
         px() + b.px(),
49
             py() + b.py(),
50
         pz() + b.pz(),
51
         e()  + b.e(),
52
             charge() + b.charge(),
53
                 PHOTON // wrong
54
    );
55
 
56
    return particle;
57
};  
58
 
59
 BParticle & operator=(const BParticle  &p)
60
 {
61
    //if ( this != &p){
62
         m_px = p.px();
63
         m_py = p.py();
64
         m_pz = p.pz();
65
         m_e  = p.e();
66
         m_charge  = p.charge();
67
         m_pid  =  p.pid();
68
        //}     
69
    return *this;
70
 };
71
 
72
 
73
  ClassDef ( BParticle, 1 ) // Simple particle class
74
};
75
 
76
int SelectParticles(TClonesArray *pin , int charge, SIMPLEPID type, TClonesArray *pout);
267 f9daq 77
int CombineParticles(TClonesArray *plist1 ,TClonesArray *plist2 , int same, float masslow, float massup, SIMPLEPID pid, TClonesArray *pout);
193 f9daq 78
 
79
 
80
#endif