Re: TProfile2D

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Mon, 27 Feb 2006 10:19:43 +0100 (MET)


There is no TGraph3D class (I assume you mean TGraph2D). You do not need to copy the errors to a TGraph2D object, simply draw the TProfile2D object with the "e" option as shown in the example below

Rene Brun

void profile2d() {

     TProfile2D *p = new TProfile2D("p","test profile",20,-3,3,20,-3,3);
     p->SetErrorOption("s");
     TRandom r;
     for (Int_t i=0;i<100000;i++) {
        Double_t x = r.Gaus(0,1);
        Double_t y = r.Gaus(0,1);
        p->Fill(x,y,x*x+y*y);
     }
     p->Draw("e1");
     p->Print("all");

}

On
Mon, 27
Feb
2006, FAIGL Zoltán wrote:

> Thank you for the solution.
>
> So If I would like to draw the TProfile2D of
> RMS values, than I must fill a TProfile2D with my values, than for each
> bin read the RMS values with p->GetBinError(), and fill these values in a
> TGraph3D instance. I mean this is the simplest solution.
>
> If not, please tel me about a simpler one.
>
> Best regards,
> Zoltan Faigl
>
> On Sat, 25 Feb 2006, Rene Brun wrote:
>
>> see example below for a TProfile. You can change the example
>> to produce a TProfile2D in the same way.
>>
>> Rene Brun
>>
>>
>> void profile() {
>> TProfile *p = new TProfile("p","test profile",50,-3,3);
>> p->SetErrorOption("s");
>> TRandom r;
>> for (Int_t i=0;i<10000;i++) {
>> Double_t x = r.Gaus(0,1);
>> Double_t y = r.Gaus(0,1);
>> p->Fill(x,x*x+y*y);
>> }
>> p->Draw();
>> for (Int_t i=1;i<=50;i++) {
>> printf("bin: %2d, mean = %g, rms = %g\n",i,
>> p->GetBinContent(i),p->GetBinError(i));
>> }
>> }
>>
>>
>> On Wed, 22 Feb
>> 2006, FAIGL Zoltán wrote:
>>
>>> Dear all,
>>>
>>> I have created TProfile2D histograms in my work to analyse graphically
>>> the dependencies between different data.
>>>
>>> The root user guide writes this about TProfile2D histograms:
>>>
>>> Profile histograms:
>>> . TProfile: one dimensional profiles
>>> . TProfile2D: two dimensional profiles
>>> Profile histograms are used to display the mean value of Y and its RMS for
>>> each bin in X. Profile histograms are
>>> in many cases an elegant replacement of two-dimensional histograms. The
>>> inter-relation of two measured
>>> quantities X and Y can always be visualized with a two-dimensional
>>> histogram or scatter-plot. If Y is an
>>> unknown but single-valued approximate function of X, it will have greater
>>> precisions in a profile histogram than
>>> in a scatter plot.
>>>
>>>
>>>
>>> My question is the following:
>>> Is it true, that by default, when I draw a TProfile histogram, then I get
>>> the mean of the values in each bin?
>>>
>>> How can we plot only the RMS of the values in each bin? I didn't
>>> find this imformation anywhere.
>>>
>>> Thank you for your help.
>>> Br.
>>> Zoltan
>>>
>
Received on Mon Feb 27 2006 - 10:19:56 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET