Hello rooters,
I'm having trouble with a macro. It works just fine when I type it in
line-by-line, but when I execute the macro, it doesn't work. It's
designed to open four files, create a new canvas, divide it into 4 pads,
and draw and fit histograms on each of the pads. But it seems that the
macro executes too quickly for the pads to be drawn, because although it
works line-by-line, when executed, I get four empty pads.
I'm including a much shorter version of the macro that also works
line-by-line, but fails when executed.
Any ideas??
Kevin Rhodes
UW Madison
Amanda Project
void macro_PMT_bare(){
TFile f1("/home/filename.root");
Int_t idvar = 100001
char *hidvar, *cidvar;
hidvar = (char *)calloc(50, sizeof(char));
cidvar = (char *)calloc(50, sizeof(char));
sprintf(hidvar, "%s%d", "h", idvar);
sprintf(cidvar, "%s%d", "c", idvar);
TCanvas *canvas = new TCanvas(cidvar, hidvar);
canvas->Divide(2,2);
canvas->cd(1);
TH1F *h1 = (TH1F*)f1->Get(hidvar);
h1->Draw();
}
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET