#include "CbmTofOnlineDisplay.h" #include "FairLogger.h" #include "TCanvas.h" #include "TPad.h" #include "TStyle.h" #include "TH1.h" #include "TH2.h" #include "TString.h" #include "TROOT.h" // ---- Default constructor ------------------------------------------- CbmTofOnlineDisplay::CbmTofOnlineDisplay() :FairTask("CbmTofOnlineDisplay"), fOverview(NULL), fNumberOfTDC(46), fUpdateInterval(100), fEventCounter(0), fbMonitorRes(kFALSE), fOverviewRes(NULL), fhResolutionSummary(NULL) { fLogger->Debug(MESSAGE_ORIGIN,"Defaul Constructor of CbmTofOnlineDisplay"); } // ---- Destructor ---------------------------------------------------- CbmTofOnlineDisplay::~CbmTofOnlineDisplay() { fLogger->Debug(MESSAGE_ORIGIN,"Destructor of CbmTofOnlineDisplay"); } // ---- Initialisation ---------------------------------------------- void CbmTofOnlineDisplay::SetParContainers() { fLogger->Debug(MESSAGE_ORIGIN,"SetParContainers of CbmTofOnlineDisplay"); } // ---- Init ---------------------------------------------------------- InitStatus CbmTofOnlineDisplay::Init() { fLogger->Debug(MESSAGE_ORIGIN,"Initilization of CbmTofOnlineDisplay"); fOverview = new TCanvas("Overview","Overview",48,56,1000,700); fOverview->Divide(8,6,0.01,0.01); // can->Divide(2,2,0,0); Float_t lsize=0.07; // Should be set for each pad of the Canvas gPad->SetFillColor(0); gStyle->SetPalette(1); gStyle->SetLabelSize(lsize); TH1 *h1; for(Int_t iCh=0; iChcd(iCh+1); gROOT->cd(); TString hname=Form("tof_trb_ch_occ_%03d",iCh); h1=(TH1 *)gROOT->FindObjectAny(hname); if (h1!=NULL) { h1->Draw(""); gPad->SetLogy(); } else { LOG(INFO)<<"Histogram "<SetStats(kFALSE); } // if( kTRUE == fbMonitorRes ) return kSUCCESS; } // ---- ReInit ------------------------------------------------------- InitStatus CbmTofOnlineDisplay::ReInit() { fLogger->Debug(MESSAGE_ORIGIN,"Initilization of CbmTofOnlineDisplay"); return kSUCCESS; } // ---- Exec ---------------------------------------------------------- void CbmTofOnlineDisplay::Exec(Option_t* option) { fEventCounter++; if ( 0 == fEventCounter%fUpdateInterval ) { LOG(DEBUG)<<"Update Canvas for Event "<< fEventCounter << FairLogger::endl; for(Int_t iCh=0; iChcd(iCh+1); gPad->Modified(); gPad->Update(); } fOverview->Modified(); fOverview->Update(); if( kTRUE == fbMonitorRes ) { fhResolutionSummary->Reset(); TH2 *h2; for(Int_t iTdc1 = 0; iTdc1 < fNumberOfTDC - 1; iTdc1++) { // First get the reference comp histogram TString hname=Form("tof_trb_RefChComp_b%03d", iTdc1); h2=(TH2 *)gROOT->FindObjectAny(hname); if (h2!=NULL) { // Fit a gaussian for each pair TObjArray aSlices; h2->FitSlicesY( 0, 0, -1, 0, "QNR", &aSlices); // Read the obtained sigma and fill it in the 2D summary histogram for(Int_t iTdc2 = iTdc1 + 1; iTdc2 < fNumberOfTDC; iTdc2++) fhResolutionSummary->Fill(iTdc1, iTdc2, ((TH2*)aSlices[2])->GetBinContent( iTdc2 - iTdc1 ) ); } // if (h2!=NULL) else LOG(INFO)<<"Histogram "<cd(); fhResolutionSummary->Draw("colz"); ( fhResolutionSummary->GetZaxis() )->SetRangeUser(0.0, 100.0); fOverviewRes->Modified(); fOverviewRes->Update(); } // if( kTRUE == fbMonitorRes ) } } // ---- Finish -------------------------------------------------------- void CbmTofOnlineDisplay::Finish() { LOG(INFO)<<"Finish of CbmTofOnlineDisplay"<Update(); if( kTRUE == fbMonitorRes ) fOverviewRes->Update(); } ClassImp(CbmTofOnlineDisplay)