Re: diff. behaviour ROOT command line - macro

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jun 23 1998 - 18:32:24 MEST


Horst Goeringer wrote:
> 
> Hi ROOTers,
> 
> what's wrong with the following macro:
> ( pads pad1 and pad2 exist,
>   ntuple MW21 with the parameters exists)
> 
> {
>    pad1->cd();
>    MW21->Draw("dMW21r>>hdMW21", "dMW21r > 0");
>       // draw coordinate with cut, save in (not yet existing)
> histogram hdMW21
>    pad2->cd();
>    MW21->Draw("dMW21u>>+hdMW21", "dMW21u > 0");
>       // draw other coordinate with cut, add to histogram hdMW21
> }
> 
> histogram hdMW21 is correctly filled  after macro execution,
> and the graph in pad2 is okay, but pad1 contains the same as pad2!
> If I enter these commands at the ROOT command line,
> pad1 is also okay!
> 
> This behaviour is the same on Linux V2.0 (ROOT 2.00/08) and
> AIX V4.1 (ROOT 2.00/07)!
> 

Hi Horst,
This is the expected behaviour.
When you are in command mode, only the current pad is updated.
However, if you click on your first pad, it will also be updated
and you should see the same picture in both pads.
What you want to do is to display the result of a first pass
in top pad, and in the second pad show a DIFFERENT object.
After the first pass, you should copy the resulting histogram
into a "clone" histogram and add new entries to the clone.
See the modified macro below:

{ 
   pad1->cd(); 
   MW21->Draw("dMW21r>>hdMW21", "dMW21r > 0"); 
      // draw coordinate with cut, save in (not yet existing) histogram
hdMW21 
   TH1F *h2 = (TH1F*)->Clone();
   h2->SetName("h2");
   pad2->cd(); 
   MW21->Draw("dMW21u>>+h2", "dMW21u > 0"); 
      // draw other coordinate with cut, add to histogram hdMW21 
} 


Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET