Re: Problems with root 2.00/03 and NT4.0

Rene Brun (Rene.Brun@cern.ch)
Mon, 06 Apr 1998 08:52:33 +0200


>Dear rooters,
>the interactive analysis experiences with root up to now show that the
>commands are longer to type than in PAW, however one has the full C++
>language to program some analysis tasks as a macro.
>This is nice, but to get plots I make heavy use of interactive
>manipulations via the editor.
>THIS is my Problem : Root (version 2.00/03 as well as 1.03) crashes very
>often. Okay one can live with that for some time.

Are you working mainly on NT? both NT and Unix ?
It would be nice if you could describe the conditions when you get
a crash, using null pointers? Can you reproduce the crash? We are well
aware
of several problems with the interpreter when macros are reexecuted.
In particular if you have unnamed macros executing in the global scope,
you should not use declarations like
TFile f("file.root")
but instead
TFile *f = new TFile("file.root");
Note that the former declaration is OK and recommended when you execute
standard C++ named procedures. These objects being automatically deleted
when you leave the scope of the procedure.
Root on NT, in addition, has some additional weaknesses regarding
the handling of the mouse in case of multiple canvases.

>Now I tried to save the canvas as a C++ macro. The result is, that some of
>the manipulations of the plot are not saved at all. So saving of the
>work NOT ONLY as postscript, what I normaly do with PAW macros seems to be
>difficult with root. (Do I have to program the whole macro by hand?)

Saving your canvas with Postscript MUST work. If you find one single
case,
please let me know. (see below for other cases)

>What I am currently doing is similar to the "Example of a Graph with
>error bars" from the tutorials. What is not saved is :
>- any manipulations concernig the axis of the plot (Ndivisions, title,
> TitleOffset)

I suppose that you mean "not saved in the generated macro". This case is
true.
There are a few cases related to the current style and graph axis
not fully saved on the macro. The problem is in case of TGraph objects.
Axis are temporary objects not associated with the graph object itself.
I want to reimplement some bits of the internal TPad logic to have
the current x/y axis objects as data members of TPad.
Also note that in case of histograms, the histogram objects are not
saved
in the macro. My assumption was that most of the time they are already
stored in a connected file. I had requests to make the expansion of the
histograms in the macro like it is the case for TGraphs.

To be saved in the generated macro, an object found in a pad must have
a member function SavePrimitive implemented. If you draw your own object
in a pad, you have to implement this member function to get the
expansion
of your object into the macro.
In the case of the Root classes, I have implemented SavePrimitive
for those classes that are likely to be drawn and saved in a macro.
In case, you have drawn an object for which there is no implementation
of this function, TObject::SavePrimitive is called and prints a Warning.

Contrary to the Valery Fine's expectations, we do not rely on Root users
to implement the missing functions. This is the task of the Root team.
You can, however, use the existing Root classes implementing
SavePrimitive
as an example to implement this function for your own classes.

>- any "free" text from the editor in the plot.

I do not believe this.

>Am I missing something ?

May be.
You can save your work in one canvas in different ways:
-1 ps,eps,gif. Ready to print non-editable documents.
-2 macro.C. In principle (see above remarks), you should see again
the same picture when you execute the macro in a new session.
-3 file.root. I realize that not many people are aware of this very
powerful facility. The Root file generated includes all the objects
referenced on the canvas. To use it, select the "SaveAs canvas.root"
item in the canvas "File" menu. This generates a file
canvasname.root.
For example "c1.root". In a new session, you do:
TFile f("c1.root");
c1.Draw();
You can now continue the editing of your picture, including fitting
histograms,etc.

By the way, PAW supports only option 1.

Rene Brun