# Empty bins after calibration

**URL:** <https://root-forum.cern.ch/t/empty-bins-after-calibration/36046>\
**Category:** Newbie\
**Created:** [September 16, 2019, 3:20pm UTC](https://root-forum.cern.ch/t/empty-bins-after-calibration/36046 "2019-09-16T15:20:18Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [September 16, 2019, 3:25pm UTC](https://root-forum.cern.ch/t/empty-bins-after-calibration/36046/3 "2019-09-16T15:25:40Z")

</div>

Maybe it will be sufficient to try:

```auto
Double_t dE = hSpectrumCalibrated->GetBinWidth(1) / 2.0; // half of the "fixed" bin width
// ...
hSpectrumCalibrated->Fill(ENERGY_CAL[i] + dE);

```

However, in principle, you should create a histogram with [variable bin sizes](https://root.cern.ch/doc/master/classTH1.html).

See also:

> [@Can we shift histogram for several channels?](https://root-forum.cern.ch/t/can-we-shift-histogram-for-several-channels/12050/2):
>
> I’m not sure if this is fully kosher, but suit yourself : #include "TAxis.h" #include "TH1.h" #include "TArrayD.h" Double\_t ScaleX(Double\_t x) { Double\_t v; v = 10 \* x + 100; // "linear scaling" function example return v; } Double\_t ScaleY(Double\_t y) { Double\_t v; v = 20 \* y + 200; // "linear scaling" function example return v; } Double\_t ScaleZ(Double\_t z) { Double\_t v; v = 30 \* z + 300; // "linear scaling" function example return v; } void ScaleAxis(TAxis \*a, Double\_t (…

---

_[View the full topic](https://root-forum.cern.ch/t/empty-bins-after-calibration/36046)._
