Subversion Repositories f9daq

Rev

Rev 273 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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