00001 #include "EvtGenBase/EvtPatches.hh" 00002 /******************************************************************************* 00003 * Project: BaBar detector at the SLAC PEP-II B-factory 00004 * Package: EvtGenBase 00005 * File: $Id: EvtIntervalFlatPdf.cc,v 1.1.1.2 2007/10/26 05:03:14 pingrg Exp $ 00006 * Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002 00007 * 00008 * Copyright (C) 2002 Caltech 00009 *******************************************************************************/ 00010 00011 #include "EvtGenBase/EvtPatches.hh" 00012 #include <assert.h> 00013 #include "EvtGenBase/EvtIntervalFlatPdf.hh" 00014 #include "EvtGenBase/EvtRandom.hh" 00015 00016 EvtIntervalFlatPdf::EvtIntervalFlatPdf(double min, double max) 00017 : EvtPdf<EvtPoint1D>(), _min(min), _max(max) 00018 { 00019 assert(max >= min); 00020 } 00021 00022 EvtIntervalFlatPdf::EvtIntervalFlatPdf(const EvtIntervalFlatPdf& other) 00023 : EvtPdf<EvtPoint1D>(other), _min(other._min), _max(other._max) 00024 {} 00025 00026 EvtIntervalFlatPdf::~EvtIntervalFlatPdf() 00027 {} 00028 00029 EvtPdf<EvtPoint1D>* EvtIntervalFlatPdf::clone() const 00030 { 00031 return new EvtIntervalFlatPdf(*this); 00032 } 00033 00034 double EvtIntervalFlatPdf::pdf(const EvtPoint1D&) const 00035 { 00036 return 1.; 00037 } 00038 00039 EvtValError EvtIntervalFlatPdf::compute_integral() const 00040 { 00041 return EvtValError(_max-_min,0.); 00042 } 00043 00044 EvtPoint1D EvtIntervalFlatPdf::randomPoint() 00045 { 00046 return EvtPoint1D(_min,_max,EvtRandom::Flat(_min,_max)); 00047 }