Thank you so much for your quick reply.
Using your attached programs in previous mail,
I modified one of the programs (pym.C) like bottom of
this mail (mod_pym.C) for compiling via g++.
I certainly could do what I want to do. But, I got new error
message.
Error in <TApplication::TApplication>: only one instance of TApplication allowed
What is the meaning ?
And also I have one more question.
In fact, ProjectionXY is defiend in my origianl main program and
h , other histograms(h1_px, h1_py) and pad are
also defined in the top of the main program like below.
This procedure is wrong ?
In such a case that I want to do, Must I separate ProjectionXY in atnoter
file in order to use gROOT->ProcessLine() ?
TH2F *h;
TH1F *h1_px, *h1_py;
TPad *pad[4];
int main ( int argc, char** argv ) {
:
:
}
void ProjectionXY() {
:
:
}
Thank you,
Harufumi Tsuchiya
-------------------------
mod_pym.C
-------------------------
#include <TROOT.h>
#include <TH1.h>
#include <TH2.h>
#include <TExec.h>
#include <TCanvas.h>
#include <TFile.h>
#include <TApplication.h>
TH2F *h;
TH1D *h1_px, *h1_py;
int main (int argc, char** argv) {
gROOT->ProcessLine(".L py.C");
TApplication *app = new TApplication("app", &argc, argv);
TExec *ex_proj = new TExec("ex_proj", "ProjectionXY()");
TFile f("hsimple.root");
h = (TH2F*)gDirectory->Get("hpxpy");
h->GetListOfFunctions()->Add(ex_proj);
h1_px = 0; h1_py = 0;
TCanvas c1("c1");
c1.Divide(2,2);
c1.cd(1);
h->Draw("colz");
app->Run();
}
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:10 MET