PT-Cooling-Log 1.0
PTCoolingLogViewer
src/PtFlowHe4View.cc
00001 #include "PtFlowHe4View.hh"
00002 #include "LogViewer.hh"
00003 #include <TROOT.h>
00004 #include <TGraph.h>
00005 
00006 #include <iostream>
00007 #include <iomanip>
00008 
00009 using namespace std;
00010 
00011 PtFlowHe4View::PtFlowHe4View() :
00012   PtView( LogViewer::tgFlwHe4 ),
00013   sep_( NULL ), eva_( NULL ), sepDo_( NULL ), precool_( NULL )
00014 {
00015   
00016   this->title() = "Flow (He4)";
00017   this->add( "separator",               "Sep.",      kBlue );
00018   this->add( "evaporator",              "Eva.",      kMagenta );
00019   this->add( "separator_do",            "Sep. (DO)", kCyan );
00020   this->add( "precooling",              "Precool.",  kRed );
00021   
00022   sep_     = new TGraph;
00023   eva_     = new TGraph;
00024   sepDo_   = new TGraph;
00025   precool_ = new TGraph;
00026   
00027 }
00028 
00029 PtFlowHe4View::~PtFlowHe4View(){
00030 }
00031 
00032 void PtFlowHe4View::analysis(){
00033 
00034   
00035 }
00036 
00037 void PtFlowHe4View::average( TGraph* org, TGraph* ave, 
00038                              const double& interval ){
00039   
00040   ave->SetLineWidth( org->GetLineWidth() );
00041   ave->SetLineStyle( org->GetLineStyle() );
00042   ave->SetLineColor( org->GetLineColor() );
00043   
00044   double start( -100.0 );
00045   double volume = 0.0;
00046   for( int i = 0; i < org->GetN(); i++ ){
00047     double x, y;
00048     org->GetPoint( i, x, y );
00049     volume += y;
00050     if( start == -100.0 ) start = x;
00051     if( x - start < interval ) continue;
00052     
00053     volume /= ( x - start );
00054     int n = ave->GetN();
00055     ave->Set( n + 1 );
00056     ave->SetPoint( n, 0.5 * ( x + start ), volume );
00057     start  = -100.0;
00058     volume = 0.0;
00059   }
00060 }
00061 
00062 void PtFlowHe4View::setRange(){
00063   
00064   TGraph& se = (*this)[ 2 ].graph();
00065   TGraph& ev = (*this)[ 3 ].graph();
00066   TGraph& sd = (*this)[ 4 ].graph();
00067   TGraph& pr = (*this)[ 5 ].graph();
00068 
00069   this->average( &se, sep_ );
00070   this->average( &ev, eva_ );
00071   this->average( &sd, sepDo_ );
00072   this->average( &pr, precool_ );
00073   
00074   vector< TGraph* > gs;
00075   gs.push_back( sep_ );
00076   gs.push_back( eva_ );
00077   gs.push_back( sepDo_ );
00078   gs.push_back( precool_ );
00079 
00080   double x,y( 0.0 );
00081   for( int i = 0; i < gs.size(); i++ ){
00082     for( int j = 0; j < gs[ i ]->GetN(); j++ ){
00083       gs[ i ]->GetPoint( j, x, y );
00084       ymin_ = ( y < ymin_ ? y : ymin_ );
00085       ymax_ = ( y > ymax_ ? y : ymax_ );
00086     }
00087   }
00088   
00089 }
00090 
00091 void PtFlowHe4View::drawGraph(){
00092 
00093   sep_->Draw( "L" );
00094   eva_->Draw( "L" );
00095   sepDo_->Draw( "L" );
00096   precool_->Draw( "L" );
00097 
00098 }
 全て クラス ファイル 関数 変数