FairRoot/PandaRoot
PndMvdSimplePidAlgo.cxx
Go to the documentation of this file.
1 #include "PndMvdSimplePidAlgo.h"
2 #include "PndMvdPidCand.h"
3 //public
4 
6  //computes pid likelihoods for pi, k, p, mu and stores them in the likelihood map
7  //with the map key used as pdg id. This is basically done by integrating the
8  //respective energy loss distribution within the chosen selector limits
9 
10  double weightP;
11  double weightK;
12  double weightPi;
13  double weightE;
14 
15  double dE=0;
16  double dx=0;
17  double momentum=0;
18 
19  for (Int_t k=0;k<cand->GetMvdHits(); k++) {
20  dE+=cand->GetMvdHitdE(k);
21  dx+=cand->GetMvdHitdx(k);
22  momentum+=cand->GetMvdHitMomentum(k);
23  }
24 
25  if (dx>0) {
26 
27  double energyloss=dE/dx;
28  momentum=momentum/cand->GetMvdHits();
29 
30  //Proton selector
31  if (energyloss>=LowerProtonBoundary(momentum)) {
32  if (momentum<0.4) {
33  weightP=0.92;
34  weightK=0.008;
35  } else {
36  weightP=0.97;
37  weightK=1-LandauIntegral((LowerProtonBoundary(momentum)-LowerBoundary(momentum, fkMass)-fkShift)/fkScale);
38  }
39  weightPi=1-LandauIntegral((LowerProtonBoundary(momentum)-LowerBoundary(momentum, fpiMass)-fpiShift)/fpiScale);
40  weightE=weightPi;
41 
42  //Kaon selector
43  } else if (energyloss>=LowerKaonBoundary(momentum)) {
44  if (momentum<0.4) {
45  weightP=0.06;
46  weightK=0.98;
47  } else {
48  weightP=0.03;
49  weightK=LandauIntegral((LowerProtonBoundary(momentum)-LowerBoundary(momentum, fkMass)-fkShift)/fkScale)-0.01;
50  }
55 
56  //Pion selector
57  } else if (energyloss>=LowerMuonBoundary(momentum)) {
58  weightK=0.005;
59  weightP=0.002;
60  weightPi=LandauIntegral((LowerKaonBoundary(momentum)-LowerBoundary(momentum, fpiMass)-fpiShift)/fpiScale)-0.001;
61  weightE=LandauIntegral((LowerKaonBoundary(momentum)-feShift)/feScale)
63 
64  //Electron selector
65  } else {
66  weightP=0;
67  weightPi=0.001;
68  weightK=0;
69  weightE=LandauIntegral((LowerMuonBoundary(momentum)-feShift)/feScale)+0.004;
70  }
71 
72  } else {
73  weightP=1;
74  weightK=1;
75  weightPi=1;
76  weightE=1;
77  }
78 
79  //Muons have approximately the same distribution as pions.
80  double sum=weightP+weightK+2*weightPi+weightE;
81  weightP/=sum;
82  weightK/=sum;
83  weightPi/=sum;
84  weightE/=sum;
85 
86  cand->SetLikelihood(211, weightPi);
87  cand->SetLikelihood(2212, weightP);
88  cand->SetLikelihood(321, weightK);
89  cand->SetLikelihood(13, weightPi);
90  cand->SetLikelihood(11, weightE);
91 }
92 
93 //private
94 
96  return LowerBoundary(p+0.02, fpMass)-5e-4;
97 };
98 
100  return LowerBoundary(p+0.02, fkMass)-3e-4;
101 };
102 
104  return LowerBoundary(p+0.01, fpiMass)-3e-4;
105 };
106 
107 
108 double PndMvdSimplePidAlgo::LowerBoundary(double p, double m) {
109 //Calculate the lower boundary of the energy loss distribution.
110 
111  double sqrfBeta=1/(1+pow(m/p,2));
112  return 4.9312e-05 * (log(2*feMass*fc*fc/feb*sqrfBeta/(1-sqrfBeta))-sqrfBeta)/sqrfBeta;
113 };
114 
116 //compute integral approximation of a Landau-p.d.f from -INF to x
117 //with expected value 0 and deviation 1. Hard coded numbers have
118 //been fitted within their respective intervals.
119 
120  if (x<-0.8)
121  //gauss
122  return 0.199785*exp(-pow(x+0.149198,2)*0.769779);
123  else if (x<0.5)
124  //linear
125  return 0.177214*(x+1.61437);
126  else
127  //power function
128  return 1-19.0054*pow(x+5.860003,-1.84611);
129 }
130 
131 //[GeV/c**2]
132 float PndMvdSimplePidAlgo::fpiMass=0.1396;
133 float PndMvdSimplePidAlgo::fmuMass=0.1058;
134 float PndMvdSimplePidAlgo::fkMass=0.4937;
135 float PndMvdSimplePidAlgo::fpMass=0.9383;
136 float PndMvdSimplePidAlgo::feMass=0.511e-3;
137 //[GeV]
138 float PndMvdSimplePidAlgo::feb=0.14e-6;
139 //[m/s]
140 float PndMvdSimplePidAlgo::fc=2.99792458e8;
141 
142 //Landau distribution parameters; these parameters have been
143 //obtained by fitting the Landau-p.d.f on the energy loss shifted
144 //by the Bethe-Bloch energy loss at momentum >= 0.4 GeV
145 double PndMvdSimplePidAlgo::fkShift=3.38598e-4;
146 double PndMvdSimplePidAlgo::fkScale=1.36362e-4;
147 
148 double PndMvdSimplePidAlgo::fpiShift=3.09159e-4;
149 double PndMvdSimplePidAlgo::fpiScale=1.58696e-4;
150 
151 double PndMvdSimplePidAlgo::feShift=2.96566e-3;
152 double PndMvdSimplePidAlgo::feScale=1.88056e-4;
153 
Double_t p
Definition: anasim.C:58
friend F32vec4 exp(const F32vec4 &a)
Definition: P4_F32vec4.h:109
static void CalcLikelihood(PndMvdPidCand *cand)
__m128 m
Definition: P4_F32vec4.h:28
double GetMvdHitdx(int mvdhit) const
static double LowerMuonBoundary(double momentum)
static double LowerKaonBoundary(double momentum)
friend F32vec4 log(const F32vec4 &a)
Definition: P4_F32vec4.h:110
static double LowerProtonBoundary(double momentum)
static double LandauIntegral(double x)
double GetMvdHitMomentum(int mvdhit) const
Double_t dE
Definition: anasim.C:58
double dx
Double_t x
double GetMvdHitdE(int mvdhit) const
void SetLikelihood(int lundId, double likelihood)
int GetMvdHits() const
static double LowerBoundary(double p, double m)