CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/HiggsAnalysis/CombinedLimit/src/HGGRooPdfs.cc

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitModels                                                     *
00004  * @(#)root/roofit:$Id: HGGRooPdfs.cc,v 1.1 2012/02/10 15:10:48 gpetrucc Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 
00018 //
00019 // BEGIN_HTML
00020 // Power function p.d.f
00021 // END_HTML
00022 //
00023 
00024 #include "RooFit.h"
00025 
00026 #include "Riostream.h"
00027 #include "Riostream.h"
00028 #include <math.h>
00029 
00030 #include "../interface/HGGRooPdfs.h"
00031 #include "RooRealVar.h"
00032 
00033 ClassImp(RooPower)
00034 
00035 
00036 //_____________________________________________________________________________
00037 RooPower::RooPower(const char *name, const char *title,
00038                                RooAbsReal& _x, RooAbsReal& _c) :
00039   RooAbsPdf(name, title), 
00040   x("x","Dependent",this,_x),
00041   c("c","Power",this,_c)
00042 {
00043 }
00044 
00045 
00046 //_____________________________________________________________________________
00047 RooPower::RooPower(const RooPower& other, const char* name) :
00048   RooAbsPdf(other, name), x("x",this,other.x), c("c",this,other.c)
00049 {
00050 }
00051 
00052 
00053 //_____________________________________________________________________________
00054 Double_t RooPower::evaluate() const{
00055   //cout << "pow(x=" << x << ",c=" << c << ")=" << pow(x,c) << endl ;
00056   return pow(x,c);
00057 }
00058 
00059 
00060 //_____________________________________________________________________________
00061 Int_t RooPower::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const 
00062 {
00063   if (matchArgs(allVars,analVars,x)) return 1 ;
00064   return 0 ;
00065 }
00066 
00067 
00068 //_____________________________________________________________________________
00069 Double_t RooPower::analyticalIntegral(Int_t code, const char* rangeName) const 
00070 {
00071   switch(code) {
00072   case 1: 
00073     {
00074       Double_t ret(0) ;
00075       if(c == 0.0) {
00076         ret = (x.max(rangeName) - x.min(rangeName));
00077       } else if (c== -1.0) {
00078         ret =  ( log( x.max(rangeName)) - log( x.min(rangeName)) );
00079 
00080       } else {
00081 //      ret =  ( exp( c*x.max(rangeName) ) - exp( c*x.min(rangeName) ) )/c;
00082         ret =  ( pow( x.max(rangeName),  c+1 ) - pow( x.min(rangeName),c+1 ) )/(c+1);
00083       }
00084 
00085       //cout << "Int_exp_dx(c=" << c << ", xmin=" << x.min(rangeName) << ", xmax=" << x.max(rangeName) << ")=" << ret << endl ;
00086       return ret ;
00087     }
00088   }
00089   
00090   assert(0) ;
00091   return 0 ;
00092 }