Subversion Repositories f9daq

Rev

Rev 266 | Go to most recent revision | Details | 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
 
14
enum SIMPLEPID {PHOTON, ELECTRON, PION, MUON, KAON, PROTON, JPSI, D, DSTAR, B,KS };
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 charge() const { return m_charge; };
36
  SIMPLEPID pid() const { return m_pid; };
37
  float GetMass(SIMPLEPID pid);
38
  float GetMass();
39
  void SetEnergyFromMass (float mass);
40
  void SetEnergyFromPid ();
41
  void SetPid(SIMPLEPID pid){ m_pid = pid; };
42
  int  InMassRange(float mlower,float mupper){ float m = GetMass(); if (m>=mlower && m<=mupper) return 1; else return 0; };
43
  BParticle operator+(const BParticle& b){
44
 
45
        BParticle particle(
46
         px() + b.px(),
47
             py() + b.py(),
48
         pz() + b.pz(),
49
         e()  + b.e(),
50
             charge() + b.charge(),
51
                 PHOTON // wrong
52
    );
53
 
54
    return particle;
55
};  
56
 
57
 BParticle & operator=(const BParticle  &p)
58
 {
59
    //if ( this != &p){
60
         m_px = p.px();
61
         m_py = p.py();
62
         m_pz = p.pz();
63
         m_e  = p.e();
64
         m_charge  = p.charge();
65
         m_pid  =  p.pid();
66
        //}     
67
    return *this;
68
 };
69
 
70
 
71
  ClassDef ( BParticle, 1 ) // Simple particle class
72
};
73
 
74
int SelectParticles(TClonesArray *pin , int charge, SIMPLEPID type, TClonesArray *pout);
75
int CombineParticles(TClonesArray *plist1 ,TClonesArray *plist2 , float masslow, float massup, SIMPLEPID pid, TClonesArray *pout);
76
 
77
 
78
#endif