/* * OverviewFrame.cpp * * Created on: Apr 21, 2015 * Author: Hovanes Egiyan */ #include "OverviewFrame.hh" OverviewFrame::OverviewFrame( const ScanPlot* plot, const TGWindow* pWindow, UInt_t width, UInt_t height ) : TGHorizontalFrame( pWindow, width, height ), ofPlot( plot ), ofDrawButton(0), ofEmbeddedCanvas(0), ofStyle(0) { // cout << "In OverviewFrame::OverviewFrame()" << endl; ofStyle = new TStyle(*gStyle); // Create the draw button ofButtonFrame = new TGVerticalFrame( this, width, height ); ofButtonFrame->SetBackgroundColor(0x333355); ofDrawButton = new TGTextButton(ofButtonFrame, "Analyze"); ofDrawButton->SetMinHeight( 0.6 * height ); ofDrawButton->Connect("Clicked()", "OverviewFrame", this, "LaunchAnalysisFrame()"); ofButtonFrame->AddFrame( ofDrawButton, new TGLayoutHints( kLHintsLeft | kLHintsCenterY, 1, 1, 1, 1) ); this->AddFrame( ofButtonFrame, new TGLayoutHints( kLHintsLeft | kLHintsCenterY, 1, 1, 1, 1) ); // Crate the canvas string canvasName; if( ofPlot != 0 ) canvasName = ofPlot->getName(); ofEmbeddedCanvas = new TRootEmbeddedCanvas( canvasName.c_str(), this, width, height ); this->AddFrame( ofEmbeddedCanvas, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2) ); Resize(width,height); return; } OverviewFrame::~OverviewFrame() { // ofDrawButton->Delete(); // ofButtonFrame->Delete(); // ofEmbeddedCanvas->Delete(); if( ofStyle !=0 ) delete ofStyle; if( ofAnalysisFrame != 0 && ofAnalysisFrame->IsActive() ) ofAnalysisFrame->CloseWindow(); this->Cleanup(); return; } void OverviewFrame::DrawPlot() { if( ofPlot != 0 ) { cout << "Called DrawPlot for " << ofPlot->getName() << endl; } else { cout << "Called DrawPlot for non-existent plot " << endl; } ofStyle->cd(); ofEmbeddedCanvas->GetCanvas()->cd(); ofEmbeddedCanvas->GetCanvas()->SetLeftMargin(0.01); ofEmbeddedCanvas->GetCanvas()->SetRightMargin(0.01); ofEmbeddedCanvas->GetCanvas()->SetTopMargin(0.01); ofEmbeddedCanvas->GetCanvas()->SetBottomMargin(0.01); ofEmbeddedCanvas->GetCanvas()->SetLogy(); ofEmbeddedCanvas->GetCanvas()->SetFillColor(17); if( ofPlot != 0 ) { TGraphErrors* graph = ofPlot->getGraph(); if( graph != 0 ) { ofStyle->SetTitleH(0.7); ofStyle->SetTitleW(0.95); ofPlot->getGraph()->Draw("AWP"); gPad->SetFrameFillColor( 19 ); gPad->Update(); gPad->Modified(); } } // ofEmbeddedCanvas->GetCanvas()->cd(); ofEmbeddedCanvas->GetCanvas()->Update(); ofEmbeddedCanvas->GetCanvas()->Modified(); return; } void OverviewFrame::LaunchAnalysisFrame() { if (ofPlot != 0) { cout << "Launching analysis frame for plot " << ofPlot->getName() << endl; ofAnalysisFrame = new AnalysisMainFrame(gClient->GetRoot(), ofPlot->getName().c_str(), 1600, 700, ofPlot); cout << "Launched analysis frame for plot " << ofPlot->getName() << endl; } return; }