Bin edge 0. in array for TH1F initialization

From: Adam Roe <adam.roe_at_cern.ch>
Date: Mon, 27 Sep 2010 09:29:06 +0200


Hi,
 I'm seeing strange (i.e. bad) behavior when using an array to pass to the TH1F constructor.

If I do the following:

 const int nbins_eEta=3;
 float eEta[nbins_eEta]={-5.0,-2.5,-0.1};

 TH1F* histo = new TH1F("h_ElectronEta_","ElectronEta_"),nbins_eEta,eEta);

I get no error, but I do notice that the histogram ends at 0, i.e. the last bin is [-0.1,0]. Otherwise it works.

If I try to go positive, i.e.

 const int nbins_eEta=4;
 float eEta[nbins_eEta]={-5.0,-2.5,-0.1,0.1};

I get the following errors:

        init histosError in <TAxis::TAxis::Set>: bins must be in increasing order

        Error in <TAxis::TAxis::Set>: bins must be in increasing order

I suppose I'm doing something wrong in the initialization. Any ideas?

Thanks,
Adam Received on Mon Sep 27 2010 - 09:29:12 CEST

This archive was generated by hypermail 2.2.0 : Mon Sep 27 2010 - 11:50:01 CEST