#include "hdirectsource.h"
#include "TROOT.h"
#include "hgeantreader.h"
#include "hrecevent.h"
#include "hpartialevent.h"
#include "hcategory.h"
HDirectSource::HDirectSource(void) {
fCurrentRunId = 0;
}
HDirectSource::HDirectSource(HDirectSource &s) {
fReaderList.Delete();
fReaderList.AddAll(&s.fReaderList);
fCurrentRunId = s.fCurrentRunId;
}
HDirectSource::~HDirectSource(void) {
fReaderList.Delete();
}
Bool_t HDirectSource::addGeantReader(HGeantReader *r) {
r->setInput(NULL);
fReaderList.Add(r);
return kTRUE;
}
Bool_t HDirectSource::finalize(void) {
TIterator *iter=fReaderList.MakeIterator();
HGeantReader *reader=0;
while ( (reader=(HGeantReader *)iter->Next())!= 0 ) {
if (!reader->finalize()) return kFALSE;
}
return kTRUE;
}
Bool_t HDirectSource::init(void) {
TIter next(&fReaderList);
HGeantReader *fReader;
HRecEvent* fEv = (HRecEvent*)(*fEventAddr);
if(fEv == NULL) {
printf("\n*** No HRecEvent exists.\n");
return kFALSE;
}
HPartialEvent* fSimul = fEv->getPartialEvent(catSimul);
if(fSimul == NULL) {
printf("\n*** No Simul partial event exists.\n");
return kFALSE;
}
while ( (fReader=(HGeantReader*)next())!=NULL) {
if (!fReader->init()) return kFALSE;
}
return kTRUE;
}
EDsState HDirectSource::getNextEvent(void) {
TIter next(&fReaderList);
HGeantReader *fReader;
Int_t returnCode;
gROOT->ProcessLine("doGeant(\"trigger 1\");");
while ( (fReader=(HGeantReader *)next())!=NULL) {
returnCode = fReader->execute();
if(returnCode != kTRUE) return kDsEndData;
}
return kDsOk;
}
ClassImp(HDirectSource)
Last change: Sat May 22 12:54:48 2010
Last generated: 2010-05-22 12:54
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.