FFTGraph.cxx
00001 #include "FFTGraph.h" 00002 #include "TButton.h" 00003 #include "TList.h" 00004 #include "TCanvas.h" 00005 #include "TStyle.h" 00006 #include "TAxis.h" 00007 #include <iostream> 00008 using namespace std; 00009 00010 #include "FFTtools.h" 00011 00012 00013 ClassImp(FFTGraph); 00014 00015 FFTGraph::FFTGraph() 00016 00017 : TGraph(),fNewCanvas(0) 00018 00019 { 00020 this->SetEditable(kFALSE); 00021 } 00022 00023 00024 FFTGraph::FFTGraph(int N, const Int_t *x, const Int_t *y) 00025 00026 : TGraph(N,x,y),fNewCanvas(0) 00027 { 00028 this->SetEditable(kFALSE); 00029 } 00030 00031 FFTGraph::FFTGraph(int N, const Float_t *x, const Float_t *y) 00032 00033 : TGraph(N,x,y),fNewCanvas(0) 00034 { 00035 this->SetEditable(kFALSE); 00036 } 00037 00038 FFTGraph::FFTGraph(int N, const Double_t *x, const Double_t *y) 00039 00040 : TGraph(N,x,y),fNewCanvas(0) 00041 { 00042 this->SetEditable(kFALSE); 00043 } 00044 00045 FFTGraph::~FFTGraph() 00046 { 00047 // std::cout << "~FFTGraph" << std::endl; 00048 } 00049 00050 void FFTGraph::ExecuteEvent(Int_t event, Int_t px, Int_t py) 00051 { 00052 switch (event) { 00053 case kButtonPress: 00054 // cout << "kButtonPress" << endl; 00055 break; 00056 00057 case kButtonDoubleClick: 00058 // std::cout << "kButtonDoubleClick" << std::endl; 00059 new TCanvas(); 00060 break; 00061 00062 case kButton1Down: 00063 // std::cout << "kButton1Down" << std::endl; 00064 if(!fNewCanvas) drawInNewCanvas(); 00065 else this->TGraph::ExecuteEvent(event,px,py); 00066 break; 00067 00068 default: 00069 this->TGraph::ExecuteEvent(event,px,py); 00070 break; 00071 } 00072 } 00073 00074 void FFTGraph::drawInNewCanvas() 00075 { 00076 char graphTitle[180]; 00077 gStyle->SetTitleH(0.1); 00078 gStyle->SetOptTitle(1); 00079 gStyle->SetPadLeftMargin(0.15); 00080 gStyle->SetPadRightMargin(0.1); 00081 gStyle->SetPadTopMargin(0.1); 00082 gStyle->SetPadBottomMargin(0.1); 00083 gStyle->SetCanvasDefW(600); 00084 gStyle->SetCanvasDefH(400); 00085 // gROOT->ForceStyle(); 00086 FFTGraph *thisCopy = (FFTGraph*)this->Clone(); 00087 thisCopy->GetXaxis()->SetLabelSize(0.06); 00088 thisCopy->GetXaxis()->SetTitleSize(0.06); 00089 thisCopy->GetYaxis()->SetLabelSize(0.06); 00090 thisCopy->GetYaxis()->SetTitleSize(0.06); 00091 thisCopy->GetXaxis()->SetTitle("Frequency (MHz)"); 00092 thisCopy->GetYaxis()->SetTitle("dB (m maybe)"); 00093 sprintf(graphTitle,"Channel %d",fChan+1); 00094 thisCopy->SetTitle(graphTitle); 00095 TCanvas *can = new TCanvas(); 00096 can->SetLeftMargin(0.15); 00097 can->SetBottomMargin(0.15); 00098 can->SetTopMargin(0.1); 00099 can->SetRightMargin(0.1); 00100 thisCopy->Draw("al"); 00101 // fNewCanvas=1; 00102 00103 } 00104
Generated on Tue Nov 24 19:04:59 2009 for CREAM TEA -- MCP/TARGET Readout by
1.3.9.1