]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 1 | #include "EvtGenBase/EvtPatches.hh" |
2 | /******************************************************************************* | |
3 | * Project: BaBar detector at the SLAC PEP-II B-factory | |
4 | * Package: EvtGenBase | |
5 | * File: $Id: EvtIntervalFlatPdf.cc,v 1.4 2004/12/21 19:58:44 ryd 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 | : EvtPdf<EvtPoint1D>(), _min(min), _max(max) | |
18 | { | |
19 | assert(max >= min); | |
20 | } | |
21 | ||
22 | EvtIntervalFlatPdf::EvtIntervalFlatPdf(const EvtIntervalFlatPdf& other) | |
23 | : EvtPdf<EvtPoint1D>(other), _min(other._min), _max(other._max) | |
24 | {} | |
25 | ||
26 | EvtIntervalFlatPdf::~EvtIntervalFlatPdf() | |
27 | {} | |
28 | ||
29 | EvtPdf<EvtPoint1D>* EvtIntervalFlatPdf::clone() const | |
30 | { | |
31 | return new EvtIntervalFlatPdf(*this); | |
32 | } | |
33 | ||
34 | double EvtIntervalFlatPdf::pdf(const EvtPoint1D&) const | |
35 | { | |
36 | return 1.; | |
37 | } | |
38 | ||
39 | EvtValError EvtIntervalFlatPdf::compute_integral() const | |
40 | { | |
41 | return EvtValError(_max-_min,0.); | |
42 | } | |
43 | ||
44 | EvtPoint1D EvtIntervalFlatPdf::randomPoint() | |
45 | { | |
46 | return EvtPoint1D(_min,_max,EvtRandom::Flat(_min,_max)); | |
47 | } |