// Get input from root file.
// Version 0.00 18-Nov-1998 RXD Creation
// 31-Mar-1999 jrb Move to Util (libRootAppsUtil)
#include "readRootFile.h"
#include "TBranch.h"
ClassImp(readRootFile)
//______________________________________________________________________
// readRootFile
//
// EventSource reading from root file
readRootFile::readRootFile(Char_t* rootFileName) {
// constructor
FILE* parFile;
if(!(parFile = fopen(rootFileName,"r"))){
printf("Root file %s could not be openedn", rootFileName);
return;
};
int parfileStatus = fclose(parFile);
// set up root
m_event = new Event();
m_rootFile = new TFile(rootFileName);
T = (TTree*)(m_rootFile->Get("T"));
T->SetBranchAddress("Event",&m_event);
Int_t nEntries = T->GetEntries();
printf("Using Root file %s with %i entries n",
rootFileName,nEntries);
m_nEvent = 0;
}
readRootFile::~readRootFile() {};
Int_t readRootFile::getEvent(Event* event) {
// get next event
Int_t nBytes = T->GetEvent(m_nEvent);
m_nEvent++;
return nBytes;
};
ROOT page - Class index - Top of the page
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.