Subversion Repositories f9daq

Rev

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