BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/PipiJpsiAlg/PipiJpsiAlg/trkInfo.h
Go to the documentation of this file.
1#include "CLHEP/Vector/LorentzVector.h"
2#include "string.h"
3#include "MdcRecEvent/RecMdcKalTrack.h"
4const double mmass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
5// mmass[5] = { e, mu, pion, Kion, proton}
6class m_trkInfo{
7 int i;
8 double mom;
9 HepLorentzVector trk;
10 RecMdcKalTrack *mdcTrk;
11 public:
12 m_trkInfo(int index, double momentum, HepLorentzVector trkp, RecMdcKalTrack *mdcKaltrk){
13 i=index;
14 mom=momentum;
15 trk=trkp;
16 mdcTrk=mdcKaltrk;
17 }
18 int getIndex(){return i;}
19 double getMom(){return mom;}
20 HepLorentzVector getTrk(){return trk;}
21 HepLorentzVector getTrk(std::string m_particle_type);
22};
23
24// Define a function which can calculate the momentum difference between two Lorentz vectors.
25inline double cal_via_mom(HepLorentzVector m_mom_a, HepLorentzVector m_mom_b){
26 return( m_mom_b.vect().mag()*1000-m_mom_a.vect().mag());
27} // where a factor 1000 arise from the differences between the unit of MC truth and reconstruction
28
29inline HepLorentzVector m_trkInfo::getTrk(std::string m_part_type){
30 if(m_part_type=="e"){
32 trk.setPx(mdcTrk->px());
33 trk.setPy(mdcTrk->py());
34 trk.setPz(mdcTrk->pz());
35 double p3(mdcTrk->p());
36 trk.setE( sqrt(p3*p3 + mmass[0]*mmass[0]) );
37 return trk;
38 }
39 if(m_part_type=="muon"){
41 trk.setPx(mdcTrk->px());
42 trk.setPy(mdcTrk->py());
43 trk.setPz(mdcTrk->pz());
44 double p3(mdcTrk->p());
45 trk.setE( sqrt(p3*p3 + mmass[1]*mmass[1]) );
46 return trk;
47 }
48 if(m_part_type=="pion"){
50 trk.setPx(mdcTrk->px());
51 trk.setPy(mdcTrk->py());
52 trk.setPz(mdcTrk->pz());
53 double p3(mdcTrk->p());
54 trk.setE( sqrt(p3*p3 + mmass[2]*mmass[2]) );
55 return trk;
56 }
57 if(m_part_type=="kion"){
59 trk.setPx(mdcTrk->px());
60 trk.setPy(mdcTrk->py());
61 trk.setPz(mdcTrk->pz());
62 double p3(mdcTrk->p());
63 trk.setE( sqrt(p3*p3 + mmass[3]*mmass[3]) );
64 return trk;
65 }
66 if(m_part_type=="proton"){
68 trk.setPx(mdcTrk->px());
69 trk.setPy(mdcTrk->py());
70 trk.setPz(mdcTrk->pz());
71 double p3(mdcTrk->p());
72 trk.setE( sqrt(p3*p3 + mmass[4]*mmass[4]) );
73 return trk;
74 }
75 else return trk;
76}
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
double cal_via_mom(HepLorentzVector m_mom_a, HepLorentzVector m_mom_b)
HepLorentzVector getTrk(std::string m_particle_type)
m_trkInfo(int index, double momentum, HepLorentzVector trkp, RecMdcKalTrack *mdcKaltrk)