using namespace std;
#include "hstart2hodo.h"
#include "hododef.h"
#include "hhodoraw.h"
#include "hhododetector.h"
#include "hstartdef.h"
#include "hstartraw.h"
#include "hstartdetector.h"
#include "hdebug.h"
#include "hades.h"
#include "hiterator.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "hdetector.h"
#include "hevent.h"
#include "hcategory.h"
#include "hlinearcategory.h"
#include <iostream>
#include <iomanip>
#include <cstdlib>
HStart2Hodo::HStart2Hodo(void)
{
rawHodoCat=0;
rawStartCat=0;
iter=0;
}
HStart2Hodo::HStart2Hodo(const Text_t *name,const Text_t *title) : HReconstructor(name,title)
{
rawHodoCat=0;
rawStartCat=0;
iter=0;
}
HStart2Hodo::~HStart2Hodo(void)
{
}
Bool_t HStart2Hodo::init(void)
{
HStartDetector *start;
start=(HStartDetector *)gHades->getSetup()->getDetector("Start");
if(!start){
Error("init","No Start Det. found.");
return kFALSE;
}
rawStartCat=start->buildCategory(catStartRaw);
if (!rawStartCat) return kFALSE;
rawHodoCat = gHades->getCurrentEvent ()->getCategory (catHodoRaw);
if (!rawHodoCat) {
rawHodoCat = gHades->getSetup ()->getDetector ("Hodo")->buildCategory (catHodoRaw);
if (!rawHodoCat){
Error("init","rawHodoCat = new HLinearCategory(\"HHodoRaw\"); failed!");
return kFALSE;
}else{
gHades->getCurrentEvent ()->addCategory (catHodoRaw, rawHodoCat, "Hodo");
}
}
loc.set (2,0,0);
iter=(HIterator *)rawStartCat->MakeIterator();
fActive=kTRUE;
return kTRUE;
}
Int_t HStart2Hodo::execute(void)
{
HHodoRaw *pHodoRaw=0;
HStartRaw *pStartRaw=0;
iter->Reset();
while ((pStartRaw=(HStartRaw *)iter->Next())!=0) {
Int_t st, mod;
pStartRaw->getAddress(mod,st);
if (mod==smod && st>=0){
loc[0] = hmod;
loc[1] = st;
pHodoRaw = (HHodoRaw *) rawHodoCat->getObject (loc);
if (!pHodoRaw) {
pHodoRaw = (HHodoRaw *) rawHodoCat->getSlot (loc);
if (pHodoRaw) {
pHodoRaw = new (pHodoRaw) HHodoRaw;
pHodoRaw->setAddress(loc[0], loc[1]);
}
else {
Error ("execute()", "Can't get slot");
cerr << "execute(): Can't get slot Mod: "<<loc[0] << " Slot " << loc[1] << endl;
return EXIT_FAILURE;
}
} else {
Error ("execute()", "Slot already exists! This should not happen!");
cerr << "execute(): Slot already exists! Mod: "<<loc[0] << " Slot " << loc[1] << endl;
return EXIT_FAILURE;
}
pHodoRaw->fill(pStartRaw->getTime(),1);
}
}
return EXIT_SUCCESS;
}
ClassImp(HStart2Hodo)
Last change: Sat May 22 13:14:33 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.