# Help on Method/s to create Tree from multi-fold gamma-ray coincidence data

**URL:** <https://root-forum.cern.ch/t/help-on-method-s-to-create-tree-from-multi-fold-gamma-ray-coincidence-data/29704>\
**Category:** ROOT\
**Created:** [July 9, 2018, 7:06am UTC](https://root-forum.cern.ch/t/help-on-method-s-to-create-tree-from-multi-fold-gamma-ray-coincidence-data/29704 "2018-07-09T07:06:20Z")\
**Posts on this page:** 1\
**Showing post:** 35

<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:** [July 21, 2018, 9:05pm UTC](https://root-forum.cern.ch/t/help-on-method-s-to-create-tree-from-multi-fold-gamma-ray-coincidence-data/29704/35 "2018-07-21T21:05:46Z")

</div>

I understand that you want to make your “his2D” histogram “symmetric”. I just say that you should maybe care about the “statistics” of your histogram, too (unless you do not need / use it afterwards at all). If you use the same pair twice, your “statistics” is artificially increased (doubled). So, you either should fill the histogram explicitly setting the “weight = 0.5” (i.e. `his2D->Fill(x, y, 0.5);`), or you should “scale” the histogram by a factor 0.5 afterwards (i.e. `his2D->Scale(0.5);`).

Well, I assume that your “Eclab” values come from some kind of an ADC converter so they are actually “discrete integer values”. I guess the real “average signal height” value for every ADC channel should be increased by the half of the ADC channel’s width (i.e. 0.5). This is not strictly needed of course. It’s up to you if you want to apply this correction.

There exists, however, some [problem with bins’ edges calculation in ROOT (coming from floating point “rounding errors”)](https://root-forum.cern.ch/t/polar-color-graph/29629/16) which you can easily overcome if you add some small “shift” to the integer ADC values. This “shift” does not need to be 0.5 of course. A small value like 1.e-6 (or even 1.e-9) would be sufficient:

```auto
double x = (Eclab[j] + 1.e-6), y = (Eclab[k] + 1.e-6);

```

In general, a [TH3](https://root.cern.ch/doc/master/classTH3.html) histogram uses at least `(nbins_x + 2) * (nbins_y + 2) * (nbins_z + 2) * bytes_per_cell` bytes (or the double of this amount if [TH1::Sumw2](https://root.cern.ch/doc/master/classTH1.html#aefa4ee94f053ec3d217f3223b01fa014) is effective).  
So, for a “cubic” [TH3F](https://root.cern.ch/doc/master/classTH3.html) (a “single-precision floating-point” value uses 4 bytes) and `nbins_x = nbins_y = nbins_z = 2048` this would be at least 32GB (or 64GB) RAM.

However, because ROOT uses “Int\_t” (32 bit signed integer) values for “global bin” numbers, you must make sure that `(nbins_x + 2) * (nbins_y + 2) * (nbins_z + 2) <= 2147483647` (e.g. that would be `nbins_x = nbins_y = nbins_z <= 1288`).

That said, for `CubDim = 512`, your “his3D” will use at least 518MB (or 1.01GB) RAM.

Try to check:  
[bash]$ ulimit -S -a  
[bash]$ ulimit -H -a  
[tcsh]$ limit  
[tcsh]$ limit -h  
and make sure that you do not exceed any limits.

---

_[View the full topic](https://root-forum.cern.ch/t/help-on-method-s-to-create-tree-from-multi-fold-gamma-ray-coincidence-data/29704)._
