file macro.C:[code]
{
gROOT->Reset();
TFile *file = new TFile(“file.root”,“READ”);
TTree tree = (TTree)file->Get(“tree”);
TEvent *event = new TEvent;
tree->SetBranchAddress(“TEvent”,&event);
…
gROOT->LoadMacro(“functions.C+”);
}[/code]
file functions.C:[code]
#include “TEvent.h”
#include “TFile.h”
#include “TTree.h”
// ??? TTree *tree =
// ??? TEvent *event =
void foo1()
{
…
for (Int_t i = 0; i < tree->GetEntries(); i++) {
tree->GetEntry(i);
bla = event->GetBla();
}
…
}
void foo2()
{
…
for (Int_t i = 0; i < tree->GetEntries(); i++) {
tree->GetEntry(i);
bla2 = event->GetBla2();
}
…
}
void foo3()
{
// using global variables from file macro.C
}
[/code]
How define global variables from macro.C (with their values !) in functions foo ? or another way ?
Thanks, Jan