Logo ROOT   6.08/07
Reference Guide
RooBreitWigner.cxx
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitModels *
4  * @(#)root/roofit:$Id$
5  * Authors: *
6  * AS, Abi Soffer, Colorado State University, abi@slac.stanford.edu *
7  * TS, Thomas Schietinger, SLAC, schieti@slac.stanford.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * Colorado State University *
11  * and Stanford University. All rights reserved. *
12  * *
13  * Redistribution and use in source and binary forms, *
14  * with or without modification, are permitted according to the terms *
15  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
16  *****************************************************************************/
17 
18 /**
19 \file RooBreitWigner.cxx
20 \class RooBreitWigner
21 \ingroup Roofit
22 
23 Class RooBreitWigner is a RooAbsPdf implementation
24 that models a non-relativistic Breit-Wigner shape
25 **/
26 
27 
28 #include "RooFit.h"
29 
30 #include "Riostream.h"
31 #include "Riostream.h"
32 #include <math.h>
33 
34 #include "RooBreitWigner.h"
35 #include "RooAbsReal.h"
36 #include "RooRealVar.h"
37 // #include "RooFitTools/RooRandom.h"
38 
39 using namespace std;
40 
42 
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 
46 RooBreitWigner::RooBreitWigner(const char *name, const char *title,
47  RooAbsReal& _x, RooAbsReal& _mean,
48  RooAbsReal& _width) :
49  RooAbsPdf(name,title),
50  x("x","Dependent",this,_x),
51  mean("mean","Mean",this,_mean),
52  width("width","Width",this,_width)
53 {
54 }
55 
56 
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 
60 RooBreitWigner::RooBreitWigner(const RooBreitWigner& other, const char* name) :
61  RooAbsPdf(other,name), x("x",this,other.x), mean("mean",this,other.mean),
62  width("width",this,other.width)
63 {
64 }
65 
66 
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 
71 {
72  Double_t arg= x - mean;
73  return 1. / (arg*arg + 0.25*width*width);
74 }
75 
76 
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 
80 Int_t RooBreitWigner::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const
81 {
82  if (matchArgs(allVars,analVars,x)) return 1 ;
83  return 0 ;
84 }
85 
86 
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 
90 Double_t RooBreitWigner::analyticalIntegral(Int_t code, const char* rangeName) const
91 {
92  switch(code) {
93  case 1:
94  {
95  Double_t c = 2./width;
96  return c*(atan(c*(x.max(rangeName)-mean)) - atan(c*(x.min(rangeName)-mean)));
97  }
98  }
99 
100  assert(0) ;
101  return 0 ;
102 }
103 
return c
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
Double_t evaluate() const
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral. ...
int Int_t
Definition: RtypesCore.h:41
STL namespace.
Double_t x[n]
Definition: legend1.C:17
RooRealProxy mean
RooRealProxy width
Class RooBreitWigner is a RooAbsPdf implementation that models a non-relativistic Breit-Wigner shape...
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
Definition: TMath.h:811
#define ClassImp(name)
Definition: Rtypes.h:279
Double_t min(const char *rname=0) const
Definition: RooRealProxy.h:56
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
double atan(double)
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported...
RooRealProxy x
Double_t max(const char *rname=0) const
Definition: RooRealProxy.h:57
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
char name[80]
Definition: TGX11.cxx:109