00001 #include "FastShowerUtils/ProcessedFlat.h"
00002 #include "FastShowerUtils/IDistProcessor.h"
00003 #include "CLHEP/Random/RandFlat.h"
00004 #include <assert.h>
00005 namespace FastShower{
00006 double ProcessedFlat::sample() const{
00007 return RandFlat::shoot();
00008 }
00009 double ProcessedFlat::sample(const IDistProcessor* dp) const{
00010 return dp->process(RandFlat::shoot());
00011 }
00012 double ProcessedFlat::sample(double lowLim,
00013 double upLim,
00014 const IDistProcessor* dp) const{
00015
00016 assert(lowLim<upLim);
00017
00018 double value = dp->process( RandFlat::shoot() );
00019
00020
00021 while(value < lowLim || value > upLim){
00022 value = dp->process( RandFlat::shoot() );
00023 }
00024
00025 return value;
00026 }
00027 IProcessedDist* ProcessedFlat::clone() const {
00028 return new ProcessedFlat(*this);
00029 }
00030 }
00031