Line data Source code
1 : #include "EvtGenBase/EvtPatches.hh"
2 : /*******************************************************************************
3 : * Project: BaBar detector at the SLAC PEP-II B-factory
4 : * Package: EvtGenBase
5 : * File: $Id: EvtIntervalFlatPdf.cpp,v 1.3 2009-03-16 15:51:08 robbep Exp $
6 : * Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002
7 : *
8 : * Copyright (C) 2002 Caltech
9 : *******************************************************************************/
10 :
11 : #include "EvtGenBase/EvtPatches.hh"
12 : #include <assert.h>
13 : #include "EvtGenBase/EvtIntervalFlatPdf.hh"
14 : #include "EvtGenBase/EvtRandom.hh"
15 :
16 : EvtIntervalFlatPdf::EvtIntervalFlatPdf(double min, double max)
17 0 : : EvtPdf<EvtPoint1D>(), _min(min), _max(max)
18 0 : {
19 0 : assert(max >= min);
20 0 : }
21 :
22 : EvtIntervalFlatPdf::EvtIntervalFlatPdf(const EvtIntervalFlatPdf& other)
23 0 : : EvtPdf<EvtPoint1D>(other), _min(other._min), _max(other._max)
24 0 : {}
25 :
26 : EvtIntervalFlatPdf::~EvtIntervalFlatPdf()
27 0 : {}
28 :
29 : EvtPdf<EvtPoint1D>* EvtIntervalFlatPdf::clone() const
30 : {
31 0 : return new EvtIntervalFlatPdf(*this);
32 0 : }
33 :
34 : double EvtIntervalFlatPdf::pdf(const EvtPoint1D&) const
35 : {
36 0 : return 1.;
37 : }
38 :
39 : EvtValError EvtIntervalFlatPdf::compute_integral() const
40 : {
41 0 : return EvtValError(_max-_min,0.);
42 : }
43 :
44 : EvtPoint1D EvtIntervalFlatPdf::randomPoint()
45 : {
46 0 : return EvtPoint1D(_min,_max,EvtRandom::Flat(_min,_max));
47 : }
|