// ----------------------------------------------------------------------------
// $Id: LCDreadRootFile.cxx,v 1.1 2001/05/10 20:40:01 toshi Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDreadRootFile.cxx,v $
// Revision 1.1 2001/05/10 20:40:01 toshi
// C++ file name convention has been changed from *.C to *.cxx .
//
//
// Get input from root file.
// Version 0.00 18-Nov-1998 RXD Creation
// 31-Mar-1999 jrb Move to Util (libRootAppsUtil)
#include <iostream.h>
#include "LCDreadRootFile.h"
#include "TBranch.h"
ClassImp(LCDreadRootFile)
//______________________________________________________________________
// readRootFile
//
// EventSource reading from root file
LCDreadRootFile::LCDreadRootFile(Char_t* rootFileName, LCDEvent* event) {
// constructor
FILE* parFile = fopen(rootFileName,"r");
if(!(parFile)){
printf("Root file %s could not be openedn", rootFileName);
return;
}
fclose(parFile);
// int parfileStatus = fclose(parFile);
// set up root
if (event == 0) {
m_event = new LCDEvent();
m_ownevent=kTRUE;
} else {
m_event = event;
m_ownevent=kFALSE;
}
m_rootFile = new TFile(rootFileName);
T = (TTree*)m_rootFile->Get("T");
T->SetBranchAddress("LCDEvent",&m_event);
T->ls();
Int_t nEntries = (Int_t) T->GetEntries();
printf("Using Root file %s with %i entries n",
rootFileName,nEntries);
m_nEvent = 0;
}
LCDreadRootFile::~LCDreadRootFile() {
if (m_ownevent) {
m_event->Delete();
delete m_event;
}
}
Int_t LCDreadRootFile::GetEvent(LCDEvent* event) {
if (event) {
T->SetBranchAddress("LCDEvent",&event);
}
return T->GetEvent(m_nEvent++);
}
Int_t LCDreadRootFile::GetEvent(Int_t ievt, LCDEvent* event) {
if (event) {
T->SetBranchAddress("LCDEvent",&event);
}
return T->GetEvent(ievt);
}
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.