00001 #include <iostream>
00002
00003 #include "MuSR_td_PSI_bin.h"
00004
00005
00006 int check_bin(MuSR_td_PSI_bin *pexample_test) {
00007 int ret;
00008
00009 ret = 0;
00010
00011 if (pexample_test && pexample_test->readingOK()) {
00012
00013 pexample_test->Show();
00014
00015 if (pexample_test->get_numberHisto_int() > 0) {
00016
00017
00018 cout << "Name of first histogram (of Run # : "
00019 << pexample_test->get_runNumber_int() << ") : "
00020 << pexample_test->get_histoNames_vector()[0]
00021 << endl ;
00022
00023 cout << "The t_0 is at : " << pexample_test->get_t0_int(0)
00024 << " and the first_good at : " << pexample_test->get_firstGood_int(0)
00025 << endl ;
00026 cout << "The last_good is at : " << pexample_test->get_lastGood_int(0)
00027 << endl ;
00028 cout << endl ;
00029
00030 int it;
00031
00032 it = pexample_test->get_firstGood_int(0) - pexample_test->get_t0_int(0)+16;
00033 cout << "The bin # " << it << " after t_0 contains : "
00034 << pexample_test->get_histo_vector(0,1)[20+pexample_test->get_t0_int(0)]
00035 << endl ;
00036
00037 cout << "By subtracting the background between 50 and 100, this bins contains : "
00038 << pexample_test->get_histo_fromt0_minus_bckgrd_vector(0,50,100,1)[it]
00039 << endl ;
00040
00041 cout << "and it correspond to the 16th bin after the first_good : "
00042 << pexample_test->get_histo_goodBins_minus_bckgrd_vector(0,50,100,1)[16]
00043 << endl ;
00044
00045
00046 cout << "public variable histos_vector[0][0] = "
00047 << pexample_test->histos_vector[0][0] << endl;
00048 cout << "Will now be set to 15.2" << endl;
00049 pexample_test->histos_vector[0][0] = 15.2;
00050 cout << "histos_vector[0][0] = " << pexample_test->histos_vector[0][0] << endl;
00051
00052
00053 cout << "this does not change histo[0][0]" << endl;
00054 cout << " get_histo(0,0) = " << pexample_test->get_histo(0,0) << endl;
00055 cout << " get_histo_int(0,0) = " << pexample_test->get_histo_int(0,0) << endl;
00056
00057
00058
00059 int *histo0 = pexample_test->get_histo_array_int(0);
00060
00061 if (histo0 != NULL) delete [] histo0; histo0 = NULL;
00062
00063
00064 } else {
00065 cout << "Number of histograms < 1!" << endl;
00066 ret = 1;
00067 }
00068 cout << "***** " << pexample_test->Filename() << endl << endl;
00069
00070 } else {
00071 if (pexample_test == NULL)
00072 cout << "ERROR NULL pointer to MuSR_td_PSI_bin!" << endl;
00073 else if (!pexample_test->readingOK()) {
00074 cout << "ERROR Reading of file " << pexample_test->Filename() << " failed!"
00075 << endl;
00076 cout << "***** " << pexample_test->ReadStatus() << " ******" << endl;
00077 }
00078 ret = 1;
00079 }
00080 return ret;
00081 }
00082
00083 int main( int argc, char ** argv )
00084
00085 {
00086 MuSR_td_PSI_bin example_test ;
00087
00088 example_test.read("deltat_pta_gps_0001.bin") ;
00089 check_bin(&example_test);
00090
00091 example_test.read("pta_gps_2008_07387_14.mdu") ;
00092 check_bin(&example_test);
00093
00094 }
00095