My Project
|
00001 /* 00002 $Id: OnLineGnuPlot.hh 2284 2011-07-16 11:54:52Z jisuzuki $ 00003 */ 00004 00005 #ifndef ONLINEGNUPLOT 00006 #define ONLINEGNUPLOT 00007 00008 #include "Header.hh" 00009 #include "GslHistogram.hh" 00010 #include "GnuplotInterface.hh" 00011 #include "StringTools.hh" 00012 00013 class OnLineGnuPlot { 00014 00015 private: 00016 GnuplotInterface *gi; 00017 //vector< vector< GslHistogram* > * > *dat; 00018 void mplot(); 00019 void splot(); 00020 StringTools *st; 00021 00022 protected: 00023 vector< vector< GslHistogram* > * > *dat; 00024 00025 public: 00026 OnLineGnuPlot( string command="gnuplot" ); 00027 ~OnLineGnuPlot(); 00028 00029 void e( string command ){ gi->e( command ); } 00030 void SetGrayColor(); 00031 void SetDataObj( vector<GslHistogram*> *data, 00032 vector< vector< UInt4 > > dim ); 00033 void SetDataObj( vector<GslHistogram*> *data, 00034 UInt4 x, UInt4 y ); 00035 00036 void MapPlot(); 00037 void SurfacePlot(); 00038 00039 void MapPlot( UInt4 tof ); 00040 void SurfacePlot( UInt4 tof ); 00041 00042 void TofVsCounts( UInt4 Psd ); 00043 }; 00044 00045 #endif 00046 00047 /* 00048 // the following is a sample code with this class. 00049 00050 EventDataToHistogramSample *eh = 00051 new EventDataToHistogramSample( 40, 100 ); 00052 00053 // Set parameters and input event data 00054 00055 00056 OnLineGnuPlot *olg = new OnLineGnuPlot(); 00057 vector< vector< UInt4 > > vvu; 00058 vector<UInt4> v0; 00059 vector<UInt4> v1; 00060 vector<UInt4> v2; 00061 for( UInt4 i=0; i<10; i++ ){ 00062 v0.push_back( i ); 00063 v1.push_back( i+10 ); 00064 v2.push_back( i+20 ); 00065 } 00066 vvu.push_back(v0); 00067 vvu.push_back(v1); 00068 vvu.push_back(v2); 00069 00070 vector<GslHistogram*> * vh = eh->PutGslHistogramVec(); 00071 olg->SetDataObj( eh->PutGslHistogramVec(), vvu ); 00072 olg -> SurfacePlot(); 00073 00074 // input event data 00075 00076 olg -> SurfacePlot(); // show summed data 00077 olg -> SurfacePlot( 20 ); // show tof data 00078 00079 delete olg; 00080 */