Re: [ROOT] Filling hosto in subroutines

From: Gero Flucke (gero.flucke@desy.de)
Date: Fri Oct 17 2003 - 19:39:59 MEST


On Fri, 17 Oct 2003, Elena Vataga wrote:

>
>
> Hello, rooters!
>
>
> Could you, please, give me an advise on the following:
>
> I created function inside my root macro which essentialy
> do the following:
>
> void make_histo(TChain *t ,  TH1F* g, TH1F* b, TCut CUT ) {
>   t->Draw("p2.pt>>g");
>   t->Draw("p2.pt>>b",CUT);
>   g->Sumw2();
>   b->Sumw2();
> }
>
> Histogram I am getting on return are empty.
> I cannot simply make:
>
>  t->Draw("p2.pt>>htemp");
>  TH1F *g = (TH1F*)htemp->Clone("g")
> because I am using non-equidistant binning and need to pass
> booked histo into subroutine.
>
> Any idea how to make it work?
>
> 	Thank you in advance,
> 			Elena
>
>
Hi Elena,

try

void make_histo(TChain *t ,  TH1F* g, TH1F* b, TCut CUT ) {
  t->Draw(Form("p2.pt>>%s", g->GetName()));
  t->Draw(Form("p2.pt>>%s" b->GetName()),CUT);
  g->Sumw2();
  b->Sumw2();
}

Cheers

	Gero


-----------------------------------------------------------------------
Gero Flucke
1a / 603
DESY
Notkestr. 85
22607 Hamburg



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