using namespace std;
#include "hhodohit2start.h"
#include "hododef.h"
#include "hhodohit.h"
#include "hhododetector.h"
#include "hstartdef.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 "hcategory.h"
#include "hlinearcategory.h"
#include <iostream>
#include <iomanip>
#include <cstdlib>
HHodoHit2Start::HHodoHit2Start(void)
{
hitHodoCat=0;
hitStartCat=0;
iter=0;
}
HHodoHit2Start::HHodoHit2Start(const Text_t *name,const Text_t *title) : HReconstructor(name,title)
{
hitHodoCat=0;
hitStartCat=0;
iter=0;
}
HHodoHit2Start::~HHodoHit2Start(void)
{
}
Bool_t HHodoHit2Start::init(void)
{
HHodoDetector *hodo;
hodo=(HHodoDetector *)gHades->getSetup()->getDetector("Hodo");
if(!hodo){
Error("init","No Hodo Det. found.");
return kFALSE;
}
hitHodoCat=hodo->buildCategory(catHodoHit);
if (!hitHodoCat) return kFALSE;
hitStartCat=gHades->getCurrentEvent()->getCategory(catStartHit);
if (!hitStartCat) {
hitStartCat = new HLinearCategory("HStartHit");
if (!hitStartCat){
Error("init","hitStartCat = new HLinearCategory(\"HStartHit\"); failed!");
return kFALSE;
}else{
gHades->getCurrentEvent()->addCategory(catStartHit,hitStartCat,"Start");
}
}
iter=(HIterator *)hitHodoCat->MakeIterator();
loc.set(1,0);
fActive=kTRUE;
return kTRUE;
}
Int_t HHodoHit2Start::execute(void)
{
HHodoHit *pHodoHit=0;
HStartHit *pStartHit=0;
iter->Reset();
pStartHit=(HStartHit *)hitStartCat->getNewSlot(loc);
if (pStartHit) {
Int_t cnt=0;
Int_t mod=-1, strip=-1;
Int_t mult=-1;
Float_t time=-1000000.0;
Bool_t flag=kFALSE;
pStartHit = new(pStartHit) HStartHit;
pStartHit->setModule(-1);
pStartHit->setStrip(-1);
pStartHit->setTime(time);
pStartHit->setStartMult(-1);
pStartHit->setFlag(kFALSE);
cnt=0;
while ((pHodoHit=(HHodoHit *)iter->Next())!=0) {
Int_t st;
pHodoHit->getAddress(mod,st);
if (mod==usemod && st>=0){
strip=st;
time=pHodoHit->getTime();
mult=pHodoHit->getHodoMult();
flag=pHodoHit->getFlag();
cnt++;
}
}
if( cnt==1){
pStartHit->setModule(0);
pStartHit->setStrip(strip);
pStartHit->setTime(time);
pStartHit->setFlag(kTRUE);
pStartHit->setStartMult(1);
}
} else {
Error("execute()",
"Can't get slot\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
ClassImp(HHodoHit2Start)
Last change: Sat May 22 12:57:25 2010
Last generated: 2010-05-22 12:57
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.