Hi Michal,
Yes, today we have also realized that this problem can happen
when executing a macro multiple times in the same session.
This is a consequence of Root being organized in independent libs.
The library libHistPainter is now loaded dynamically when it is
necessary. However, when CINT needs a reexecute a macro, it deletes
the recently loaded shared libs.
This problem has been reported to Masa and we hope to get a fix very soon.
Meanwhile, you can circumvent the problem by adding in your rootlogon.C
macro the following statement:
gSystem->Load("libHistPainter");
Rene Brun
On 18 Oct 1999 lijowski@cosray2.wustl.edu wrote:
>
> Hello,
>
> Below is a sample macro which when executed more than once in a single
> root 2.23/04 session (SunOS5.7) crashes with segment violation
> in line 60 while there is no problem executing it several times
> in root 2.22/10.
>
> Thank you and regards,
>
> Michal Lijowski
>
> // ------------------------------------------------------------------------
>
> void test_hist()
>
> {
> gROOT -> Reset();
>
> Char_t MacroName[40] = "test_hist";
> gBenchmark -> Start(MacroName);
> gROOT -> SetStyle("Plain");
> gStyle -> SetOptStat(11);
> gStyle -> SetCanvasColor(10);
>
> const Int_t Xsize = 1100, Ysize = 520;
>
> // create a new Root file
> Char_t outfile[200];
>
> sprintf(outfile, "%s%s.root", MacroName);
> printf(" Output file %s\n", outfile);
>
> TFile *top = new TFile(outfile, "recreate");
>
> Char_t htitle[80], ctitle[40], cname[40], outps[120];
>
> Float_t AA = 100.0;
> Float_t BB1 = 550.0;
> Float_t BB2 = 260.0;
> Float_t CC1 = 200.0;
> Float_t CC2 = 100.0;
>
> sprintf(htitle, "TEST HISTOGRAM");
>
> Float_t xxmin = 0, xxmax = Xsize, yymin = 0, yymax = Ysize;
> TH2F *HH = new TH2F("HH", htitle, Xsize, xxmin, xxmax, Ysize, yymin, yymax);
> HH -> SetXTitle("X - coordinate (half pixel)");
> HH -> GetXaxis() -> CenterTitle(kTRUE);
> HH -> SetYTitle("Y - coordinate (half pixel)");
> HH -> GetYaxis() -> CenterTitle(kTRUE);
>
> // fill the histogram
> Float_t wwmin = 5.0, wwmax = 10.0;
> for (Int_t yk = 0; yk < Ysize; yk++) {
> Float_t YY = (Float_t) yk;
> for (Int_t xk = 0; xk < Xsize; xk++) {
> Float_t XX = (Float_t) xk;
>
> Float_t argx = (XX - BB1) / CC1;
> Float_t argy = (YY - BB2) / CC2;
> Float_t ZZ1 = TMath::Exp(-0.5 * argx * argx);
> Float_t ZZ2 = TMath::Exp(-0.5 * argy * argy);
> Float_t ww = AA * ZZ1 * ZZ2;
>
> HH -> Fill(XX, YY, ww);
> }
> }
>
> printf(" Done filling histogram %d\n", HH -> GetEntries());
>
> Int_t ii = 0;
> sprintf(ctitle, "Canvas %d", ii);
> cc1 = new TCanvas("cc1", ctitle, 1100, 900);
> cc1 -> SetTicks();
> HH -> DrawCopy();
>
> cc1 -> Update();
>
> top -> Write();
> top -> Close();
> gBenchmark -> Show(MacroName);
> }
>
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:41 MET