Re: [ROOT] last channel of variable bin size hist

From: Patrick SIZUN (sizun@discovery.saclay.cea.fr)
Date: Wed Feb 11 2004 - 09:19:00 MET


The problem occurs with Root 3.05/07.
I tried Root 3.04/02 which was also installed in my Solaris environment and the 
script works ok.
I will test a more up-to-date version...

Thanks,
Patrick Sizun


>I do not see a problem with the last bin in your example.
>Which version are you using?
>In case you use an old version, please upgrade your system.
>
>Rene Brun
>
>On Tue, 10 Feb 
>2004, Patrick SIZUN wrote:
>
>> Hi,
>> 
>> I face a problem when drawing a variable bin size histo in log scale.
>> The last channel is not displayed correctly but is much larger than it 
should.
>> 
>> Below is an example where I just took  a script given in the roottalk forum 
and 
>> changed the minimum to show the phenomenon.
>> 
>> Can some one help ?
>> 
>> P. Sizun
>> 
>> {
>>    const Int_t nbins = 100;
>>    Double_t xmin = 1e-3;
>>    Double_t xmax = 1e3;
>>    Double_t logxmin = TMath::log10(xmin);
>>    Double_t logxmax = TMath::log10(xmax);
>>    Double_t binwidth = (logxmax-logxmin)/nbins;
>>    Double_t xbins[nbins+1];
>>    xbins[0] = xmin;
>>    for (Int_t i=1;i<=nbins;i++) {
>>       xbins[i] = xmin + TMath::Power(10,logxmin+i*binwidth);
>>    }
>>    TH1F *h = new TH1F("h","hist with log x axis",nbins,xbins);
>>    
>>    Double_t x,xl;
>>    for (Int_t j=0;j<10000;j++) {
>>        xl = 0.5*(logxmin+logxmax) + 12*binwidth*gRandom->Gaus(0,1);
>>        x = xmin + TMath::Power(10,xl);
>>        h->Fill(x);
>>     }
>>     TCanvas *c1 = new TCanvas("c1");
>>     c1->SetLogx();
>>     h->SetMinimum(-200.0);
>>     h->Draw();
>> } 
>> 
>> 
>> 
>

*********************************************
Patrick Sizun

CEA-Saclay
DSM/DAPNIA/Service d'Astrophysique

Orme des Merisiers - Bat.709 - S.153
91191 Gif-sur-Yvette Cedex
France

Tel : +33 (0)1 69 08 48 26
Mel : sizun@discovery.saclay.cea.fr
Fax : +33 (0)1 69 08 65 77 / (0)1 69 08 79 96
*********************************************



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