Re: [ROOT] Fill histograms problem using TString

From: Martin Simard (msimard@slac.stanford.edu)
Date: Thu May 20 2004 - 06:46:15 MEST


Hi Rene,

Thanks for the answer, but I want to use the TString like a
leaf in a ntuple. For example,

h1.Fill(track_number);  // for example track_number is 1 or 2

TString s="track_number";
h2.Fill(s,1); // do not fill the integer value of track_number

h1 gives 2 colonnes with values 1 or 2 and
h2 give histograms with a colonne named track_number

How can I do this properly to get h2 = h1 ?
And is it possible...

Thanks
Martin


On Sat, 15 May 2004, Rene Brun wrote:

> 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