using namespace std;
#include "hkinegeantreader.h"
#include "hgeantkine.h"
#include "hgeantheader.h"
#include "hdebug.h"
#include "hades.h"
#include "hevent.h"
#include "hrecevent.h"
#include "hpartialevent.h"
#include "hlinearcategory.h"
#include "hlocation.h"
#include "TDirectory.h"
#include <iostream>
#include <iomanip>
ClassImp(HKineGeantReader)
HKineGeantReader::HKineGeantReader(void) {
fEventId = 0;
}
HKineGeantReader::~HKineGeantReader(void) {
}
Bool_t HKineGeantReader::init(void) {
fEventId = 0;
fGeantKineCat = (HLinearCategory*)(gHades->getCurrentEvent()
->getCategory(catGeantKine));
if (!fGeantKineCat) {
if (!fInputFile) {
t = NULL;
return kFALSE;
}
if (fInputFile->cd("dirSimul")) {
fGeantKineCat=(HLinearCategory*)gDirectory->Get("HGeantKine");
fInputFile->cd("..");
} else {
fGeantKineCat = new HLinearCategory("HGeantKine",10000);
}
gHades->getCurrentEvent()->
addCategory(catGeantKine,fGeantKineCat,"Simul");
printf("\n%s linear category created for HGeant input\n",
fGeantKineCat->getClassName());
}
if (!fInputFile) {
t = NULL;
return kTRUE;
}
if ((t=(TTree*)fInputFile->Get("T")) == NULL) return kFALSE;
t->SetBranchAddress("HGeantKine",&fGeantKineCat);
t->SetBranchStatus("HGeantKine",kTRUE);
Int_t splitLevel = 2;
Char_t sl = *(strchr(t->GetTitle(),'.')+1);
switch (sl) {
case '0' : splitLevel = 0; break;
case '1' : splitLevel = 1; break;
case '2' : splitLevel = 2; break;
default : ;
}
fGeantKineCat->activateBranch(t,splitLevel);
HRecEvent* fEvent = (HRecEvent*)(gHades->getCurrentEvent());
HGeantHeader* fSimulHeader = (HGeantHeader*)(fEvent->getPartialEvent(catSimul)
->getSubHeader());
if(!fSimulHeader) {
fEvent->getPartialEvent(catSimul)->setSubHeader(new HGeantHeader());
fSimulHeader = (HGeantHeader*)(fEvent->getPartialEvent(catSimul)->getSubHeader());
}
t->SetBranchAddress("Simul.Header",&fSimulHeader);
t->SetBranchStatus("Simul.Header",1);
t->SetBranchAddress("Event",&fEvent);
t->SetBranchStatus("Event",1);
if (gHades->getOutputFile() != NULL) gHades->getOutputFile()->cd();
return kTRUE;
}
Bool_t HKineGeantReader::execute(void) {
if(t) {
if(t->GetEntry(fEventId)==0) return kFALSE;
}
fEventId++;
return kTRUE;
}
Last change: Sat May 22 12:58:52 2010
Last generated: 2010-05-22 12:58
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.