FairRoot/PandaRoot
PndMvdIdealPidAlgo.cxx
Go to the documentation of this file.
1 #include "PndMvdIdealPidAlgo.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 
14  double dE=0;
15  double dx=0;
16  double momentum=0;
17 
18  for (Int_t k=0;k<cand->GetMvdHits(); k++) {
19  dE+=cand->GetMvdHitdE(k);
20  dx+=cand->GetMvdHitdx(k);
21  momentum+=cand->GetMvdHitMomentum(k);
22  }
23 
24  if (dx>0) {
25  double energyloss=dE/dx;
26  momentum=momentum/cand->GetMvdHits();
27 
28  //Proton selector
29  if (energyloss>=LowerProtonBoundary(momentum)) {
30  weightP=1-fPRemainder;
31  weightK=1-LandauIntegral((LowerProtonBoundary(momentum)-LowerBoundary(momentum, fkMass)-fkShift)/fkScale);
32  weightPi=1-LandauIntegral((LowerProtonBoundary(momentum)-LowerBoundary(momentum, fpiMass)-fpiShift)/fpiScale);
33 
34  //Kaon selector
35  } else if (energyloss>=LowerKaonBoundary(momentum)) {
36  weightP=fPRemainder;
38  -fKRemainder;
41 
42  //Pion selector
43  } else if (energyloss>=LowerPionBoundary(momentum)) {
44  weightP=0;
45  weightK=fKRemainder;
47  -fPiRemainder;
48 
49  //Electron selector
50  } else {
51  weightP=0;
52  weightK=0;
53  weightPi=fPiRemainder;
54  }
55  } else {
56  weightP=1;
57  weightK=1;
58  weightPi=1;
59  }
60 
61  //Muons have approximately the same distribution as pions.
62  double sum=weightP+weightK+2*weightPi;
63  weightP/=sum;
64  weightK/=sum;
65  weightPi/=sum;
66 
67  cand->SetLikelihood(211, weightPi);
68  cand->SetLikelihood(2212, weightP);
69  cand->SetLikelihood(321, weightK);
70  cand->SetLikelihood(13, weightPi);
71 }
72 
73 //private
74 
76  return LowerBoundary(p+0.02, fpMass)-5e-4;
77 };
78 
80  return LowerBoundary(p+0.02, fkMass)-3e-4;
81 };
82 
84  return LowerBoundary(p+0.01, fpiMass)-3e-4;
85 };
86 
87 
88 double PndMvdIdealPidAlgo::LowerBoundary(double p, double m) {
89 //Calculate the lower boundary of the energy loss distribution.
90 
91  double sqrfBeta=1/(1+pow(m/p,2));
92  return 4.9312e-05 * (log(2*feMass*fc*fc/feb*sqrfBeta/(1-sqrfBeta))-sqrfBeta)/sqrfBeta;
93 };
94 
96 //compute integral approximation of a Landau-p.d.f from -INF to x
97 //with expected value 0 and deviation 1. Hard coded numbers have
98 //been fitted within their respective intervals.
99 
100  if (x<-0.8)
101  //gauss
102  return 0.199785*exp(-pow(x+0.149198,2)*0.769779);
103  else if (x<0.5)
104  //linear
105  return 0.177214*(x+1.61437);
106  else
107  //power function
108  return 1-19.0054*pow(x+5.860003,-1.84611);
109 }
110 
111 //[GeV/c**2]
112 float PndMvdIdealPidAlgo::fpiMass=0.1396;
113 float PndMvdIdealPidAlgo::fkMass=0.4937;
114 float PndMvdIdealPidAlgo::fpMass=0.9383;
115 float PndMvdIdealPidAlgo::feMass=0.511e-3;
116 //[GeV]
117 float PndMvdIdealPidAlgo::feb=0.14e-6;
118 //[m/s]
119 float PndMvdIdealPidAlgo::fc=2.99792458e8;
120 
121 //Landau distribution parameters; these parameters have been
122 //obtained by fitting the Landau-p.d.f on the energy loss shifted
123 //by the Bethe-Bloch energy loss at momentum >= 0.4 GeV
124 double PndMvdIdealPidAlgo::fkShift=3.38598e-4;
125 double PndMvdIdealPidAlgo::fkScale=1.36362e-4;
126 
127 double PndMvdIdealPidAlgo::fpiShift=3.09159e-4;
128 double PndMvdIdealPidAlgo::fpiScale=1.58696e-4;
129 
130 //General remainders of integrals for integrating from -INF to
131 //below the Bethe-Bloch lower boundary as obtained by MC Simulation
135 
Double_t p
Definition: anasim.C:58
friend F32vec4 exp(const F32vec4 &a)
Definition: P4_F32vec4.h:109
static double LowerKaonBoundary(double momentum)
__m128 m
Definition: P4_F32vec4.h:28
double GetMvdHitdx(int mvdhit) const
friend F32vec4 log(const F32vec4 &a)
Definition: P4_F32vec4.h:110
static double LowerBoundary(double p, double m)
static double fpiScale
static double fpiShift
static double LandauIntegral(double x)
double GetMvdHitMomentum(int mvdhit) const
Double_t dE
Definition: anasim.C:58
static double fKRemainder
static void CalcLikelihood(PndMvdPidCand *cand)
static double fPiRemainder
static double fPRemainder
double dx
Double_t x
static double LowerPionBoundary(double momentum)
double GetMvdHitdE(int mvdhit) const
void SetLikelihood(int lundId, double likelihood)
static double LowerProtonBoundary(double momentum)
int GetMvdHits() const