Re: [ROOT] Fill histograms problem using TString

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat May 15 2004 - 09:09:17 MEST


Hi Martin,

On Fri, 14 May 2004, Martin Simard wrote:

> 
> Hello,
> 
> I want to fill histograms using TString like this.
> 
> HistoName->Fill(Variable);
> 
> Do Variable can be a TString??

Yes, you can, but must specify the weight argument

TString s="Martin"
h.Fill(s,1);

See an example in $ROOTSYS/tutorials/hlabels1.C
Don't forget to:
  h.SetBit(TH1::kCanRebin); //before filling
  h.LabelsDeflate(); // before drawing

These two calls are automatically generated when projecting a 
Tree string variable to a histogram.

Rene Brun

> 
> 
> I know there is a way to use a TString by Project like this.
> 
> ntuple->Project(HistoName, Variable, weight(cut));
> 
> For this case, How can I use this in a Loop over all entries?
> 
> 
> Thanks
> Martin
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET