Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ProcessedFlatTester.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // Test program for ProcessedFlat
00003 // ================================================
00004 
00005 #include "FastShowerUtils/ProcessedFlatTester.h"
00006 #include "FastShowerUtils/ProcessedFlat.h"
00007 #include "FastShowerUtils/IDistProcessor.h"
00008 #include "FastShowerUtils/LinearProcessor.h"
00009 #include "FastShowerUtils/TestStat.h"
00010 
00011 namespace FastShower{
00012   //**********************************************************     
00013   TestStat ProcessedFlatTester::test(){
00014     m_ts+=this->test1();
00015     return m_ts;
00016   }
00017   //**********************************************************     
00018   TestStat ProcessedFlatTester::test1(){
00019     TestStat ts;
00020     const IDistProcessor* lp1 = new LinearProcessor(1., 0.);
00021     const IDistProcessor* lp2 = new LinearProcessor(2., 0.);
00022     const IDistProcessor* lp3 = new LinearProcessor(1., 1.);
00023     ProcessedFlat pf;
00024 
00025     bool pass = true;
00026     const int maxtry = 1000;
00027 
00028     int i = maxtry;
00029     while(i!=0 && pass){
00030       --i;
00031       double samp=pf.sample(lp1);
00032       //      cout<<"[0,1) "<<samp<<endl;
00033       if (samp <0. || samp>=1.) pass = false;
00034     }
00035     pass ? ts.incPass():ts.incFail();
00036 
00037 
00038     pass = true;
00039     i = maxtry;
00040 
00041     while(i!=0 && pass){
00042       --i;
00043       double samp=pf.sample(lp2);
00044       //      cout<<"[0,2) "<<samp<<endl;
00045       if (samp <0. || samp>=2.) pass = false;
00046     }
00047     pass ? ts.incPass():ts.incFail();
00048 
00049 
00050     pass = true;
00051     i = maxtry;
00052 
00053     while(i!=0 && pass){
00054       --i;
00055       double samp=pf.sample(lp3);
00056       //      cout<<"[1,2) "<<samp<<endl;
00057       if (samp <1. || samp>=2.) pass = false;
00058     }
00059 
00060     pass ? ts.incPass():ts.incFail();
00061 
00062     return ts;
00063   }
00064   //**********************************************************     
00065   void ProcessedFlatTester::results() const{
00066     cout<<"ProcessedFlatTester: "<<m_ts;
00067     if(!m_ts) cout<<" Failures! ";
00068     cout<<endl;
00069   }
00070     
00071   
00072 }//namespace
00073 
00074 
00075 
00076 
00077 
00078 

Generated on Tue Mar 18 11:50:03 2003 for FastShowerUtils by doxygen1.3-rc1