CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HGGRooPdfs.cc
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitModels *
4  * @(#)root/roofit:$Id: HGGRooPdfs.cc,v 1.1 2012/02/10 15:10:48 gpetrucc Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 
18 //
19 // BEGIN_HTML
20 // Power function p.d.f
21 // END_HTML
22 //
23 
24 #include "RooFit.h"
25 
26 #include "Riostream.h"
27 #include "Riostream.h"
28 #include <math.h>
29 
30 #include "../interface/HGGRooPdfs.h"
31 #include "RooRealVar.h"
32 
33 ClassImp(RooPower)
34 
35 
36 //_____________________________________________________________________________
38  RooAbsReal& _x, RooAbsReal& _c) :
39  RooAbsPdf(name, title),
40  x("x","Dependent",this,_x),
41  c("c","Power",this,_c)
42 {
43 }
44 
45 
46 //_____________________________________________________________________________
47 RooPower::RooPower(const RooPower& other, const char* name) :
48  RooAbsPdf(other, name), x("x",this,other.x), c("c",this,other.c)
49 {
50 }
51 
52 
53 //_____________________________________________________________________________
54 Double_t RooPower::evaluate() const{
55  //cout << "pow(x=" << x << ",c=" << c << ")=" << pow(x,c) << endl ;
56  return pow(x,c);
57 }
58 
59 
60 //_____________________________________________________________________________
61 Int_t RooPower::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const
62 {
63  if (matchArgs(allVars,analVars,x)) return 1 ;
64  return 0 ;
65 }
66 
67 
68 //_____________________________________________________________________________
69 Double_t RooPower::analyticalIntegral(Int_t code, const char* rangeName) const
70 {
71  switch(code) {
72  case 1:
73  {
74  Double_t ret(0) ;
75  if(c == 0.0) {
76  ret = (x.max(rangeName) - x.min(rangeName));
77  } else if (c== -1.0) {
78  ret = ( log( x.max(rangeName)) - log( x.min(rangeName)) );
79 
80  } else {
81 // ret = ( exp( c*x.max(rangeName) ) - exp( c*x.min(rangeName) ) )/c;
82  ret = ( pow( x.max(rangeName), c+1 ) - pow( x.min(rangeName),c+1 ) )/(c+1);
83  }
84 
85  //cout << "Int_exp_dx(c=" << c << ", xmin=" << x.min(rangeName) << ", xmax=" << x.max(rangeName) << ")=" << ret << endl ;
86  return ret ;
87  }
88  }
89 
90  assert(0) ;
91  return 0 ;
92 }
Double_t evaluate() const
Definition: HGGRooPdfs.cc:54
RooRealProxy c
Definition: HGGRooPdfs.h:39
RooRealProxy x
Definition: HGGRooPdfs.h:38
RooPower()
Definition: HGGRooPdfs.h:27
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Definition: HGGRooPdfs.cc:69
string const
Definition: compareJSON.py:14
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Definition: HGGRooPdfs.cc:61
Definition: DDAxes.h:10
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40