Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:22

0001  /***************************************************************************** 
0002   * Project: RooFit                                                           * 
0003   *                                                                           * 
0004   * Copyright (c) 2000-2005, Regents of the University of California          * 
0005   *                          and Stanford University. All rights reserved.    * 
0006   *                                                                           * 
0007   * Redistribution and use in source and binary forms,                        * 
0008   * with or without modification, are permitted according to the terms        * 
0009   * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             * 
0010   *****************************************************************************/ 
0011 
0012  // -- CLASS DESCRIPTION [PDF] -- 
0013  // Your description goes here... 
0014 
0015  #include "Riostream.h" 
0016 
0017  #include "RooCBExGaussShape.h" 
0018  #include "RooAbsReal.h" 
0019  #include "RooAbsCategory.h" 
0020 
0021  ClassImp(RooCBExGaussShape); 
0022 
0023  RooCBExGaussShape::RooCBExGaussShape(const char *name, const char *title, 
0024                       RooAbsReal& _m, //x
0025                       RooAbsReal& _m0, //p1
0026                       RooAbsReal& _sigma, //p2
0027                       RooAbsReal& _alpha, //p3
0028                       RooAbsReal& _n, //p4
0029                       RooAbsReal& _sigma_2, //sigma
0030                       RooAbsReal& _frac //frac
0031 ) :
0032    RooAbsPdf(name,title), 
0033    m("m","m",this,_m),
0034     m0(" m0"," m0",this,_m0),
0035     sigma(" sigma"," sigma",this,_sigma),
0036     alpha(" alpha"," alpha",this,_alpha),
0037     n(" n"," n",this,_n),
0038     sigma_2(" sigma_2"," sigma_2",this,_sigma_2),
0039     frac(" frac"," frac",this,_frac) 
0040 { 
0041  } 
0042 
0043 
0044  RooCBExGaussShape::RooCBExGaussShape(const RooCBExGaussShape& other, const char* name) :  
0045    RooAbsPdf(other,name), 
0046     m("m",this,other.m),
0047     m0(" m0",this,other. m0),
0048     sigma(" sigma",this,other. sigma),
0049     alpha(" alpha",this,other. alpha),
0050     n(" n",this,other. n),
0051     sigma_2(" sigma_2",this,other. sigma_2),
0052     frac(" frac",this,other. frac)
0053  { 
0054  } 
0055 
0056 
0057 
0058  Double_t RooCBExGaussShape::evaluate() const 
0059  { 
0060    // ENTER EXPRESSION IN TERMS OF VARIABLE ARGUMENTS HERE 
0061 
0062 
0063    Double_t t = (m-m0)/sigma;
0064    Double_t t0 = (m-m0)/sigma_2;
0065    if (alpha < 0){ 
0066      t = -t;
0067      t0 = -t0;
0068    }
0069 
0070    Double_t absAlpha = fabs((Double_t)alpha);
0071 
0072    if (t >= -absAlpha) {
0073    //if ((t+t0)/2.0 >= -absAlpha) {
0074      return frac*exp(-0.5*t*t) + (1.0-frac)*exp(-0.5*t0*t0);
0075      //return 1.0*(exp(-0.5*t*t));// + exp(-0.5*t0*t0));
0076    }
0077    else {
0078      Double_t a =  TMath::Power(n/absAlpha,n)*exp(-0.5*absAlpha*absAlpha);
0079      Double_t b= n/absAlpha - absAlpha; 
0080 
0081      return a/TMath::Power(b - t, n);
0082      //return a/TMath::Power(b - (t+t0)/2.0, n);
0083    }
0084 
0085 
0086 
0087 
0088    //return 1.0 ; 
0089  } 
0090 
0091 
0092