RE: [ROOT] Automation of root executable using a shell script...

From: Valeri Fine (fine@bnl.gov)
Date: Tue Aug 26 2003 - 20:35:33 MEST


Hello Zaldy,

The name of the method "Draw" confuses. 
That TObject::Draw method doesn't really draw anything . It just adds
the user object pointer to the list of the primitive of the current Pad
(that gPad pointer to) to be painted LATER.

By this reason no real rendering is happened at the time the user invoke
the "Draw". The real painting is the event driven and initialized either
by ROOT implicitly or explicitly by user calling TCVanvas::Update
method.
Unless you call that Update no picture rendering is performed. 
That explains your "second" observation.  However I don't understand how
this relates to the "mouse event handling".

As soon as you want your picture to be "refreshed" you should consider
calling 
  gPad->Modified();
  gCanvas->Update();
  gPad->SaveAs(...)

One may argue the explanation above does contradict the "real time
observation".  The problem is ROOT does emit the two macro lines above
automatically just user hits the "Enter" key forcing the current TCanvas
to be updated after any macro statement (after "Draw" as well) typed
from the ROOT prompt.
Anyway it is not case if the same macro statement is a part of the ROOT
macro.

That gives him/her the "false" impression the "Draw" method causes 
the TCanvas painting.

See: 
http://root.bnl.gov/QtRoot/QtRoot.html#gifbatch topic also.

See the small macro that creates the postscript picture with no "SaveAs"
at all:

void Example_read_hist_file_min_list_draw_ps()
{
  TFile f1("Example_read_dst_makehist.root");
  f1.ls();
  TCanvas MyCanvas("CanvasName","Canvas Title",800,600);
  gStyle->SetOptStat(111111);
  TPostScript ps("Example_read_hist_file_min_list_draw_ps.ps",111);
  h1->Draw();
  ps.Close();
}


   My best regards 
                V.Fine

 
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]
> On Behalf Of zaldy
> Sent: Tuesday, August 26, 2003 11:21 AM
> To: roottalk@pcroot.cern.ch
> Subject: [ROOT] Automation of root executable using a shell script...
> 
> 
> Dear Rooters,
> 
> 
> I have two questions.
> 
> First
> ^^^^^
> How do we save 5 histograms in different file with SaveAs(".....")
using
> the same Pad?
> 
> For example, I have several rootfiles and I want to save 5 histograms
> per rootfile in different filename using same pad. The 5 histograms
are
> diffrent so they cannot be of the same pad or plot.
> 
> 
> Second
> ^^^^^^
> Because of the many data files I am thinking of automating it using
> shell scripting. Say I have 300 rootfiles and each file has to produce
5
> histograms.
> 
> My problem is how do we manage the mouse. It seems that every time an
> executable code is run by the script, the mouse waits a click from the
> user before it will start the execution. It seems that this is because
of
> the "pad->Draw()" line.
> 
> Somehow it defeats the idea of automation.
> 
> How do we handle this? Please ...
> 
> Thank you.
> 
> --
> 
> --------------------------------------------------------
>                    Zaldy A. Nawang
>                    PS Users Room 2
>                    Yon Gokan,
>                    E362, Neutrino Group,
>                    IPNS, KEK,
>                    Japan
> 
>                    e-mail: zaldy@neutrino.kek.jp
>                    Tel. No. : (81) 029864 - 5387
> --------------------------------------------------------



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET