]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TEvtGen/EvtGenModels/EvtPFermi.cpp
addition to previous fix: remove unnecessary if in deleting the pointer
[u/mrichter/AliRoot.git] / TEvtGen / EvtGenModels / EvtPFermi.cpp
1 //-----------------------------------------------------------------------
2 // File and Version Information:
3 //
4 // Copyright Information: See EvtGen/COPYRIGHT
5 //
6 //
7 // Description:
8 //   DFN model:
9 //      F(k+) = N (1-x)^a exp((1+a)x) ,x=k+/(mB-mb) 
10 //      the fermi motion distribution according to
11 //      hep-ph/9905351 v2
12 //   BLNP model:
13 //      F(wtilde,Lambda,b) = pow(_b,_b)/(tgamma(_b)*_Lambda)*pow(wtilde/_Lambda,_b-1)*
14 //                           exp(-_b*wtilde/Lambda);
15 //      the leading order shape function (exp) (hep-ph/0504071)
16 // Environment:
17 //      Software developed for the BaBar Detector at the SLAC B-Factory.
18 //
19 // Author List:
20 //      Sven Menke (DFN model)
21 //      Alexei Volk (BLNP model)
22 //-----------------------------------------------------------------------
23 //-----------------------
24 // This Class's Header --
25 //-----------------------
26 #include "EvtGenBase/EvtPatches.hh"
27 #include "EvtGenModels/EvtPFermi.hh"
28 #include "EvtGenBase/EvtReport.hh"
29 //---------------
30 // C Headers --
31 //---------------
32 #include <math.h>
33 #include <stdlib.h>
34
35 //----------------
36 // Constructors --
37 //----------------
38
39 //for DFN model
40 EvtPFermi::EvtPFermi(const double &a, const double &mB, const double &mb)
41 {
42   _a = a;
43   _mb = mb;
44   _mB = mB;
45 }
46
47 // for BLNP modell
48 EvtPFermi::EvtPFermi(const double &Lambda, const double &b)
49 {
50   _Lambda = Lambda;
51   _b = b;
52 }
53
54
55 //--------------
56 // Destructor --
57 //--------------
58
59 EvtPFermi::~EvtPFermi( )
60 {
61 }
62
63 //-----------
64 // Methods --
65 //-----------
66
67 double EvtPFermi::getFPFermi(const double &kplus)
68 {
69   double FKplus;
70   double x = kplus/(_mB-_mb);
71
72   if ( x      >= 1)   return 0;
73   if ( kplus <= -_mb) return 0; 
74
75   FKplus = pow(1-x,_a)*exp((1+_a)*x);
76
77   return FKplus;
78 }
79
80 // get value for the leading order exponential SF 
81 double EvtPFermi::getSFBLNP(const double &what)
82 {
83   double SF;
84   double massB = 5.2792; 
85   
86
87   if ( what      > massB )   return 0;
88   if ( what < 0 ) return 0; 
89
90 #if defined(__SUNPRO_CC)
91   report(ERROR,"EvtGen") << "The tgamma function is not available on this platform\n";
92   report(ERROR,"EvtGen") <<"Presumably, you are getting the wrong answer, so I abort..";
93   ::abort();
94 #else
95   SF = pow(_b,_b)/(tgamma(_b)*_Lambda)*pow(what/_Lambda,_b-1)*exp(-_b*what/_Lambda); 
96 #endif
97   
98   return SF;
99 }
100