00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #include "Riostream.h"
00022 
00023 #include "RooRarFit/RooLass.hh"
00024 #include "RooFitCore/RooAbsReal.hh"
00025 #include "RooFitCore/RooRealVar.hh"
00026 #include "RooFitCore/RooComplex.hh"
00027 
00028 #include "TMath.h"
00029 
00030 using std::cout;
00031 using std::cerr;
00032 using std::endl;
00033 
00034 ClassImp(RooLass)
00035 
00036 RooLass::RooLass(const char * name, const char * title, 
00037                  RooAbsReal & fitVariable, RooAbsReal & theMean,
00038                  RooAbsReal & theWidth, RooAbsReal & effectiveRange,
00039                  RooAbsReal & scatteringLength, RooAbsReal & turnOffValue)
00040   : RooAbsPdf(name,title),
00041     x("x","Dependent",this,fitVariable),
00042     mean("mean","Mean",this,theMean),
00043     width("width","Width",this,theWidth),
00044     effRange("effRange","Effective Range",this,effectiveRange),
00045     scatLen("scatLen","Scattering Length",this,scatteringLength),
00046     turnOffVal("turnOffVal","Turn Off Value",this,turnOffValue)
00047 {
00048 }
00049 
00050 RooLass::RooLass(const RooLass & other, const char * name)
00051   : RooAbsPdf(other,name),
00052     x("x",this,other.x),
00053     mean("mean",this,other.mean),
00054     width("width",this,other.width),
00055     effRange("effRange",this,other.effRange),
00056     scatLen("scatLen",this,other.scatLen),
00057     turnOffVal("turnOffVal",this,other.turnOffVal)
00058 {
00059 }
00060 
00061 
00062 Double_t RooLass::getQ(Double_t mass) const
00063 {
00064 
00065   const Double_t m_Kaon = 0.493677;
00066   const Double_t m_Pion = 0.13957018;
00067 
00068   if (mass < (m_Kaon+m_Pion)) {return(0);}
00069 
00070   const Double_t mDaugSumSq  = (m_Kaon+m_Pion)*(m_Kaon+m_Pion);
00071   const Double_t mDaugDiffSq = (m_Kaon-m_Pion)*(m_Kaon-m_Pion);
00072 
00073   Double_t q  = sqrt((mass*mass-mDaugSumSq)*(mass*mass-mDaugDiffSq))/(2*mass);
00074   return(q);
00075 }
00076 
00077 
00078 Double_t RooLass::evaluate() const
00079 {
00080   
00081   return (smatrix());
00082 }
00083 
00084 
00085 Double_t RooLass::kmatrix() const
00086 {
00087   Double_t mass = x;
00088 
00089   Double_t q  = getQ(mass);
00090   if (q==0) {return(0);}
00091 
00092   Double_t q0 = getQ(mean);
00093   if (q0==0) {return(0);}
00094 
00095   Double_t rho  = 2*q/mass;
00096   Double_t rho0 = 2*q0/mean;
00097 
00098   Double_t g0sqr = mean*mass*width/rho0;
00099   
00100   Double_t Khat = g0sqr/(mean*mean - mass*mass);
00101 
00102   if (mass <= turnOffVal) {
00103     
00104     Khat += ((scatLen*mass)/(2+scatLen*effRange*q*q));
00105   }
00106 
00107   RooComplex T(Khat,0.0);
00108   RooComplex denom(1.0,-Khat*rho);
00109   T = T / denom; 
00110 
00111   return (T.abs2()); 
00112 }
00113 
00114 
00115 Double_t RooLass::smatrix() const
00116 {
00117   Double_t mass = x;
00118 
00119   const Double_t q  = getQ(mass);
00120   if (q==0) {return(0);}
00121 
00122   const Double_t qR = getQ(mean);
00123   if (qR==0) {return(0);}
00124 
00125   
00126   RooComplex T2(width*mean*mean/qR,0);
00127   RooComplex bw_denom(mean*mean - mass*mass, -mean*width*q*mean/(mass*qR));
00128   
00129   T2 = T2 / bw_denom;
00130 
00131   RooComplex T(T2);
00132 
00133   if (mass < turnOffVal) {
00134     
00135     Double_t cot_db = 1.0/ (scatLen*q) + (effRange*q)*0.5;
00136     Double_t db = TMath::ATan(1.0/cot_db);
00137 
00138     
00139     RooComplex phase(cos(2*db),sin(2*db));
00140 
00141     
00142     RooComplex T1(mass, 0);
00143     RooComplex s_denom(q*cot_db, -q);
00144 
00145     T = (T1/s_denom) + (phase * T); 
00146   }
00147 
00148   return (T.abs2()); 
00149 }