CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/PhysicsTools/TagAndProbe/src/RooCBExGaussShape.cc

Go to the documentation of this file.
00001 #include "PhysicsTools/TagAndProbe/interface/RooCBExGaussShape.h" 
00002 
00003 ClassImp(RooCBExGaussShape) 
00004 
00005  RooCBExGaussShape::RooCBExGaussShape(const char *name, const char *title, 
00006                                       RooAbsReal& _m,
00007                                       RooAbsReal& _m0,
00008                                       RooAbsReal& _sigma,
00009                                       RooAbsReal& _alpha,
00010                                       RooAbsReal& _n,
00011                                       RooAbsReal& _sigma_2,
00012                                       RooAbsReal& _frac
00013 ) :
00014    RooAbsPdf(name,title), 
00015    m("m","m",this,_m),
00016    m0(" m0"," m0",this,_m0),
00017    sigma(" sigma"," sigma",this,_sigma),
00018    alpha(" alpha"," alpha",this,_alpha),
00019    n(" n"," n",this,_n),
00020    sigma_2(" sigma_2"," sigma_2",this,_sigma_2),
00021    frac(" frac"," frac",this,_frac) 
00022 { }
00023 
00024 RooCBExGaussShape::RooCBExGaussShape(const RooCBExGaussShape& other, const char* name):
00025   RooAbsPdf(other,name), 
00026   m("m",this,other.m),
00027   m0(" m0",this,other. m0),
00028   sigma(" sigma",this,other. sigma),
00029   alpha(" alpha",this,other. alpha),
00030   n(" n",this,other. n),
00031   sigma_2(" sigma_2",this,other. sigma_2),
00032   frac(" frac",this,other. frac)
00033 { }
00034 
00035 
00036  Double_t RooCBExGaussShape::evaluate() const 
00037  { 
00038    Double_t rval=0;
00039 
00040    Double_t t = (m-m0)/sigma;
00041    Double_t t0 = (m-m0)/sigma_2;
00042    if (alpha < 0){ 
00043      t = -t;
00044      t0 = -t0;
00045    }
00046 
00047    Double_t absAlpha = fabs((Double_t)alpha);
00048 
00049    if (t >= -absAlpha) {
00050      rval= frac*exp(-0.5*t*t) + (1.0-frac)*exp(-0.5*t0*t0);
00051    }
00052    else {
00053      Double_t a =  TMath::Power(n/absAlpha,n)*exp(-0.5*absAlpha*absAlpha);
00054      Double_t b= n/absAlpha - absAlpha; 
00055      rval= a/TMath::Power(b - t, n);
00056    }
00057 
00058    //std::cout<<"RooCBExGaussShape: m, evaluate= "<<m<<", "<<rval<<std::endl;
00059    return rval;
00060  }