#include "MShowSpect.h"

#include "MLog.h"
#include "MLogManip.h"
#include "MParList.h"      // MParList
#include "MGDisplayAdc.h"  // MGDisplayAdc


////////////////////////////////////////////////////////////////////////
//
//  MGShowSpect.h
//
//  A Gui Task to show the raw ADC values in the histograms
//

ClassImp(MShowSpect)

MShowSpect::MShowSpect(const char *nameHist, const char *name, const char *title)
{
    //
    // default constructor
    //

    *fName  = name ? name : ClassName();
    *fTitle = title ? title : "Task to ??? (Harald?)";

    strcpy( fHistName, nameHist ) ;
} 


Bool_t MShowSpect::PreProcess(MParList *pList)
{
  //
  //   Do the preprocessing for MShowSpect
  // 
  //   Connects Histogramms in the MHFadcCam container as the input
  //

  fHists = (MHFadcCam*) pList->FindObject( fHistName );
  
  if (!fHists)
    {
        *fLog << dbginf << " Error: MHFadcCam '" << fHistName << "' not found!" << endl;
        return kFALSE;
    }
  
  return kTRUE;
} 


Bool_t MShowSpect::PostProcess()
{
  //   just start the gui for displaying the adc spectra

  new MGDisplayAdc(fHists, gClient->GetRoot(), gClient->GetRoot(), 600, 600);

  return kTRUE;
} 

