BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtBreitWignerPdf.cc
Go to the documentation of this file.
1#include "EvtPatches.hh"
2/*******************************************************************************
3 * Project: BaBar detector at the SLAC PEP-II B-factory
4 * Package: EvtGenBase
5 * File: $Id: EvtBreitWignerPdf.cc,v 1.1.1.2 2007/10/26 05:03:14 pingrg Exp $
6 * Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002
7 *
8 * Copyright (C) 2002 Caltech
9 *******************************************************************************/
10
11// Breit-Wigner shape PDF. If the width is zero it degenerates into a delta
12// function. The integral and its inverse can be still evaluated.
13
14#include "EvtBreitWignerPdf.hh"
15#include "EvtConst.hh"
16#include "EvtPatches.hh"
17#include <assert.h>
18#include <math.h>
19#include <stdio.h>
20
21EvtBreitWignerPdf::EvtBreitWignerPdf( double min, double max, double m0, double g0 )
22 : EvtIntegPdf1D( min, max ), _m0( m0 ), _g0( g0 ) {}
23
25 : EvtIntegPdf1D( other ), _m0( other._m0 ), _g0( other._g0 ) {}
26
28
29double EvtBreitWignerPdf::pdf( const EvtPoint1D& x ) const {
30 double m = x.value();
31 if ( ( 0 == ( m - _m0 ) ) && ( 0. == _g0 ) )
32 {
33
34 printf( "Delta function Breit-Wigner\n" );
35 assert( 0 );
36 }
37
38 double ret = _g0 / EvtConst::twoPi / ( ( m - _m0 ) * ( m - _m0 ) + _g0 * _g0 / 4 );
39
40 return ret;
41}
42
43double EvtBreitWignerPdf::pdfIntegral( double m ) const {
44 double itg = 0;
45 if ( _g0 == 0 )
46 {
47
48 if ( m > _m0 ) itg = 1.;
49 else if ( m < _m0 ) itg = 0.;
50 else itg = 0.5;
51 }
52 else itg = atan( ( m - _m0 ) / ( _g0 / 2. ) ) / EvtConst::pi + 0.5;
53
54 return itg;
55}
56
57double EvtBreitWignerPdf::pdfIntegralInverse( double x ) const {
58 if ( x < 0 || x > 1 )
59 {
60
61 printf( "Invalid integral value %f\n", x );
62 assert( 0 );
63 }
64
65 double m = _m0;
66 if ( _g0 != 0 ) m = _m0 + ( _g0 / 2. ) * tan( EvtConst::pi * ( x - 0.5 ) );
67
68 return m;
69}
Double_t x[10]
#define min(a, b)
#define max(a, b)
double pdf(const EvtPoint1D &x) const
EvtBreitWignerPdf(double min, double max, double m0, double g0)
double pdfIntegral(double m) const
double pdfIntegralInverse(double x) const
static const double pi
Definition EvtConst.hh:27
static const double twoPi
Definition EvtConst.hh:28
EvtIntegPdf1D(double min, double max)