VariableBinAxis Boolean True! but binning not getting fixed

ROOT Version: 6.14/06
Platform: Ubuntu 16.04
Compiler: 5.4.0

Hi, I have this root file attached, which contains 2D histograms.

I want to change the Y-axis’s lowest binning to start from 12 instead of current 20.

It is a variable bin that I checked with


which gave me

(bool) true

So, I tried to change the lowest Y-bin to start from 12 instead of 20 with

your_histogram->GetXaxis()->GetXbins()[0] = 12.; // the lowest edge

but it gives me

root [3] NUM_LooseID_DEN_genTracks_eta_pt->GetYaxis()->GetYbins()[0] = 12.;
ROOT_prompt_3:1:47: error: no member named 'GetYbins' in 'TAxis'
NUM_LooseID_DEN_genTracks_eta_pt->GetYaxis()->GetYbins()[0] = 12.;

or for x -axis

root [4] NUM_LooseID_DEN_genTracks_eta_pt->GetXaxis()->GetXbins()[0] = 12.;
ROOT_prompt_4:1:61: error: no viable overloaded '='
NUM_LooseID_DEN_genTracks_eta_pt->GetXaxis()->GetXbins()[0] = 12.;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
/home/chad/external/root/include/TArrayD.h:36:16: note: candidate function not viable: 'this' argument has type 'const TArrayD', but method is not marked const
   TArrayD    &operator=(const TArrayD &rhs);

What’s happening? and could you help me to successfully change the bin?

Thank you!RunGH_SF_ID.root (16.2 KB)
(example root file)


(*(TArrayD*)NUM_LooseID_DEN_genTracks_eta_pt->GetXaxis()->GetXbins())[0] = -12.; // -2.4 -> -12.
// one must set the new proper "xmin" and "xmax" for this axis

(*(TArrayD*)NUM_LooseID_DEN_genTracks_eta_pt->GetYaxis()->GetXbins())[0] = 12.; // 20. -> 12.
// one must set the new proper "xmin" and "xmax" for this axis
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.