using namespace std;
#include "hrichgeantreader.h"
#include "hgeantrich.h"
#include "hgeantmaxtrk.h"
#include "richdef.h"
#include "hdebug.h"
#include "hades.h"
#include "hevent.h"
#include "hcategory.h"
#include "hdatasource.h"
#include "TDirectory.h"
#include <iostream>
#include <iomanip>
ClassImp(HRichGeantReader)
HRichGeantReader::HRichGeantReader(void) {
fEventId = 0;
}
HRichGeantReader::~HRichGeantReader(void) {
}
Bool_t HRichGeantReader::init(void) {
fGeantRichPhotCat = (HMatrixCategory*)(gHades->getCurrentEvent()
->getCategory(catRichGeantRaw));
fGeantRichDirCat = (HMatrixCategory*)(gHades->getCurrentEvent()
->getCategory(catRichGeantRaw+1));
fGeantRichMirrorCat = (HMatrixCategory*)(gHades->getCurrentEvent()
->getCategory(catRichGeantRaw+2));
if (!fGeantRichPhotCat || !fGeantRichDirCat || !fGeantRichMirrorCat) {
if (!fInputFile) {
t = NULL;
return kFALSE;
}
if (fInputFile->cd("dirSimul")) {
fGeantRichPhotCat = (HMatrixCategory*)(gDirectory->Get("HGeantRichPhoton"));
fGeantRichDirCat = (HMatrixCategory*)(gDirectory->Get("HGeantRichDirect"));
fGeantRichMirrorCat = (HMatrixCategory*)(gDirectory->Get("HGeantRichMirror"));
fInputFile->cd("..");
} else {
Int_t ini[2]={6,MAXCKOVRICH};
fGeantRichPhotCat = new HMatrixCategory("HGeantRichPhoton",2,ini,1.0);
Int_t ini1[2]={6,MAXPARTRICH};
fGeantRichDirCat = new HMatrixCategory("HGeantRichDirect",2,ini1,1.0);
Int_t ini2[2] = {6,MAXMIRRRICH};
fGeantRichMirrorCat = new HMatrixCategory("HGeantRichMirror",2,ini2,1.0);
}
gHades->getCurrentEvent()->
addCategory(catRichGeantRaw,fGeantRichPhotCat,"Simul");
gHades->getCurrentEvent()->
addCategory(catRichGeantRaw+1,fGeantRichDirCat,"Simul");
printf("\n%s(%d,%d) matrix category created for HGeant input\n",
fGeantRichPhotCat->getClassName(),
fGeantRichPhotCat->getSize(0), fGeantRichPhotCat->getSize(1));
printf("%s(%d,%d) matrix category created for HGeant input\n",
fGeantRichDirCat->getClassName(),
fGeantRichDirCat->getSize(0), fGeantRichDirCat->getSize(1));
if (fGeantRichMirrorCat) {
gHades->getCurrentEvent()->
addCategory(catRichGeantRaw+2,fGeantRichMirrorCat,"Simul");
printf("%s(%d,%d) matrix category created for HGeant input\n",
fGeantRichMirrorCat->getClassName(),
fGeantRichMirrorCat->getSize(0), fGeantRichMirrorCat->getSize(1));
}
}
if (!fInputFile) {
t = NULL;
return kTRUE;
}
if ((t=(TTree*)fInputFile->Get("T")) == NULL) return kFALSE;
t->SetBranchAddress("HGeantRichPhoton",&fGeantRichPhotCat);
t->SetBranchStatus("HGeantRichPhoton",kTRUE);
fGeantRichPhotCat->activateBranch(t,2);
t->SetBranchAddress("HGeantRichDirect",&fGeantRichDirCat);
t->SetBranchStatus("HGeantRichDirect",kTRUE);
fGeantRichDirCat->activateBranch(t,2);
t->SetBranchAddress("HGeantRichMirror",&fGeantRichMirrorCat);
t->SetBranchStatus("HGeantRichMirror",kTRUE);
fGeantRichPhotCat->activateBranch(t,2);
if (gHades->getOutputFile() != NULL) gHades->getOutputFile()->cd();
return kTRUE;
}
Bool_t HRichGeantReader::execute(void) {
if(t) {
if(t->GetEntry(fEventId)==0) return kFALSE;
}
fEventId++;
return kTRUE;
}
Last change: Sat May 22 13:08:55 2010
Last generated: 2010-05-22 13:08
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.