// : Author  J.Markert

//_HADES_CLASS_DESCRIPTION 
///////////////////////////////////////////////////////////////////////////////
//
// HStartCalibrationGo4Mon
//
///////////////////////////////////////////////////////////////////////////////
using namespace std;
#include "hstartcalibrationgo4mon.h"
#include "hstarthistfiller.h"
#include "hstarthistbooker.h"

#include "hstartdef.h"
#include "hcategory.h"
#include "hstartcal.h"
#include "hstartraw.h"
#include "hstarthit.h"

#include "hdebug.h"
#include "hades.h"
#include "hiterator.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "hdetector.h"
#include "hevent.h"

#include <iostream> 
#include <iomanip>
#include <stdlib.h>
#include "TIterator.h"

ClassImp(HStartCalibrationGo4Mon)

HStartHistBooker* HStartCalibrationGo4Mon::startHistbooker=0;

HStartCalibrationGo4Mon::HStartCalibrationGo4Mon(void) {
  // Default constructor .
  initVariables();
}

HStartCalibrationGo4Mon::HStartCalibrationGo4Mon(const Text_t* name,const Text_t* title)
                 :  HReconstructor(name,title) {
  // Constructor calls the constructor of class HReconstructor with the name
  // and the title as arguments.
  initVariables();

}

HStartCalibrationGo4Mon::~HStartCalibrationGo4Mon(void) {
  // destructor deletes the iterator
  if (itercal) delete itercal;
  if (iterraw) delete iterraw;
  if (iterhit) delete iterhit;
  itercal=0;
  iterraw=0;
  iterhit=0;
}
void HStartCalibrationGo4Mon::initVariables()
{
    // iterator+categories
    calCat =0;
    rawCat =0;
    hitCat =0;
    boxCat =0;
    itercal=0;
    iterraw=0;
    iterhit=0;
    iterbox=0;

}
void HStartCalibrationGo4Mon::printStatus(){
    cout << "************* HStartCalibrationGo4Mon ***************" << endl;
    cout << "******************************************" << endl;
}
void HStartCalibrationGo4Mon::setParContainers() {

    startHistbooker = HStartHistBooker::getExObject();
    if(!startHistbooker)
    {
      Error("HStartCalibrationGo4Mon::setParContainers()","ZERO POINTER FOR HSTARTHISTBOOKER RECEIVED!");
      exit(1);
    }
}
Bool_t HStartCalibrationGo4Mon::init(void) {

    Bool_t test=kFALSE;
    setParContainers();
    test=getCategories();
    printStatus();

    fActive=kTRUE;
    return test;
}
Bool_t HStartCalibrationGo4Mon::reinit(void)
{
    startHistbooker = HStartHistBooker::getExObject();
    startHistbooker->printStatus();
    fActive=kTRUE;
    return kTRUE;
}
Bool_t HStartCalibrationGo4Mon::getCategories()
{

    rawCat=(HCategory*)(((HEvent*)(gHades->getCurrentEvent()))->getCategory(catStartRaw));
    if (!rawCat) {
	Warning("HStartCalibrationGo4Mon:init()","CATEGORY HSTARTRAW IS NOT FILLED!");
    }

    calCat=(HCategory*)(((HEvent*)(gHades->getCurrentEvent()))->getCategory(catStartCal));
    if (!calCat) {
	Warning("HStartCalibrationGo4Mon:init()","CATEGORY HSTARTCAL IS NOT FILLED!");
    }
    hitCat=(HCategory*)(((HEvent*)(gHades->getCurrentEvent()))->getCategory(catStartHit));
    if (!hitCat) {
	Warning("HStartCalibrationGo4Mon:init()","CATEGORY HSTARTHIT IS NOT FILLED!");
    }
	boxCat=(HCategory*)(((HEvent*)(gHades->getCurrentEvent()))->getCategory(catTBoxChan));
    if (!boxCat) {
	Warning("HStartCalibrationGo4Mon:init()","CATEGORY HTBOXCHAN IS NOT FILLED!");
    }


    if (rawCat)
    {
	iterraw =(HIterator *)((HCategory*)rawCat)->MakeIterator("native");
    }
    if (calCat)
    {
	itercal=(HIterator *)((HCategory*)calCat)->MakeIterator("native");
    }
    if (hitCat)
    {
	iterhit =(HIterator *)((HCategory*)hitCat)->MakeIterator("native");
    }
    if (boxCat)
    {
	iterbox =(HIterator *)((HCategory*)boxCat)->MakeIterator("native");
    }
 return kTRUE;
}
Int_t HStartCalibrationGo4Mon::execute(){
    //startHistbooker->resetActiveList(2,gHades->getEventCounter()); // if feature of incremental update should be used
    
	 startHistbooker->getStartFiller()->fillLatch();
    
	 if(rawCat)
    {
	iterraw->Reset();
	//########################## Fill RAW HISTS ################################
        startHistbooker->getStartFiller()->fillRaw(iterraw);
    }
    if(calCat)
    {
        itercal->Reset();
	//######################### FIll CAL HISTS ################################
	startHistbooker->getStartFiller()->fillCal(itercal);
	//##########################################################################
    }
    if(hitCat)
    {
	iterhit->Reset();
	//########################## Fill HIT HISTS ################################
	startHistbooker->getStartFiller()->fillHit(iterhit);
    }
    if(boxCat)
    {
	iterbox->Reset();
	//########################## Fill SCALER  HISTS ############################
	startHistbooker->getStartFiller()->fillScaler(iterbox);
    }
	return 0;
}
Bool_t HStartCalibrationGo4Mon::finalize()
{
    return kTRUE;
}


Last change: Sat May 22 13:14:38 2010
Last generated: 2010-05-22 13:14

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.