Re: your mail, histos with same names

From: Otto Schaile <Otto.Schaile_at_Physik.uni-muenchen.de>
Date: Mon, 11 Apr 2005 13:33:41 +0200 (CEST)


Hi Ajay,
change the name of the 1. histo before reading the 2nd. e.g. ht0->SetName("myh_1");
see below
Cheers
Otto

PS: Please provide a meaningfull Subject:

    otherwise your questions might be ignored

On Mon, 11 Apr 2005, Ajay Thakur wrote:

> Dear all
> I have two .root files
> a.root
> b.root
> in which some histograms are saved with same names.
> I want to read these two .root files in a macro and
> then superimpose and draw the histograms present in
> two say,
> myhistogram in a.root
> myhistogram in b.root.
> I am attaching the macro.
> Please write me what i should do next.
> thanks.
>
>
> void test()
> {
> TFile tf_ht1("a.root");
> TFile tf_ht2("b.root");
> TH1F *ht0 = (TH1F*)tf_ht1.Get("myhistogram");

  ht0->SetName("myh_1");
//  ^^^^^^^^^^^^^^^^^^^^^^

> TH1F *ht1 = (TH1F*)tf_ht2.Get("myhistogram");
>
>
> ht0->Draw();
> ht1->Draw("same");
> }
>
> ________________________________________________________________________
> Yahoo! India Matrimony: Find your life partner online
> Go to: http://yahoo.shaadi.com/india-matrimony
>

-- 
Dr. Otto Schaile            Department f"ur Physik, LMU M"unchen
Phone: +49 89 289 14070     Am Coulombwall 1, D-85748 Garching, Germany
Mobil: +49 160 1553598
FAX:   +49 89 289 14072     EMail: Otto.Schaile_at_Physik.Uni-Muenchen.DE
Received on Mon Apr 11 2005 - 13:33:48 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET