/* * AnalysisFrame.cpp * * Created on: Apr 22, 2015 * Author: Hovanes Egiyan */ #include "AnalysisFrame.hh" AnalysisFrame::AnalysisFrame( const ScanPlot* plot, string label, const TGWindow* pWindow, UInt_t width, UInt_t height ) : TGVerticalFrame(pWindow, width, height), afEmbeddedCanvas(0), afPlot(plot), afGraphAnalyzer(0), afLabel(label), afStyle(0) { cout << "In AnalysisFrame::AnalysisFrame()" << endl; afStyle = new TStyle(*gStyle); afGraphAnalyzer = new TwoWireGraphAnalyzer( afPlot->getGraph(), afPlot->getScanName(), afLabel ); cout << "GraphAnalyzer has been built for " << afPlot->getGraph()->GetName() << "#" << afLabel << endl; string canvasName; if( afPlot != 0 ) canvasName = afPlot->getName(); afEmbeddedCanvas = new TRootEmbeddedCanvas( canvasName.c_str(), this, width, height ); this->AddFrame( afEmbeddedCanvas, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1) ); string newName = string(afPlot->getGraph()->GetName()) + string(":1") ; afEmbeddedCanvas->GetCanvas()->cd(); afStyle->SetOptFit(111); // afStyle->SetOptDate(1); afDateText = new TText( afStyle->GetDateX(), afStyle->GetDateY(), const_cast( afPlot->getDetector()->getScanStream() )->getScanTime().c_str() ); afDateText->SetX( afStyle->GetDateX() ); afDateText->SetY( afStyle->GetDateY() ); afDateText->SetTextSize(0.025); afDateText->SetNDC( true ); afStyle->SetOptStat(1101); afStyle->SetOptTitle(1); afStyle->SetTitleH(0.2); afStyle->SetTitleW(0.5); afStyle->SetTitleX(0.35); afStyle->SetTitleY(0.98); afStyle->cd(); afGraphAnalyzer->Draw("AWP"); afGraphAnalyzer->FitGraph(); gPad->SetFrameFillColor(0); gPad->SetGrid(1,1); if( afGraphAnalyzer->GetMinimum() > 0 ) gPad->SetLogy(1); // Draw the date afDateText->Draw(); gPad->Update(); gPad->Modified(); return; } AnalysisFrame::~AnalysisFrame() { if( afGraphAnalyzer != 0 ) delete afGraphAnalyzer; this->Cleanup(); delete afDateText; return; } void AnalysisFrame::Fit() { cout << "Fitting graph " << afGraphAnalyzer->GetName() << "#" << afLabel << endl; afGraphAnalyzer->FitGraph(); return; }