# 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:** 51

<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 26, 2018, 4:57pm UTC](https://root-forum.cern.ch/t/help-on-method-s-to-create-tree-from-multi-fold-gamma-ray-coincidence-data/29704/51 "2018-07-26T16:57:12Z")

</div>

For “METHOD1” and “METHOD2” you should use:

```auto
TFile *f = TFile::Open("cub_his3D.root");
TH3 *his3D; f->GetObject("his3D", his3D);

```

For “METHOD3” and “METHOD4” you should use:

```auto
TFile *f = TFile::Open("cub_sparse.root");
THnSparse *his3D; f->GetObject("his3D", his3D);

```

I’m not sure if the “number of entries” is what you want. I guess you’d better try with the [TH1::Integral](https://root.cern.ch/doc/master/classTH1.html#a919887c7b8431299713ec22e544cc396) method.

Note also that, in any operations, entire bins are always taken into account so, if you want to compare numbers, you need to make sure that e.g. `zaxis->GetBinLowEdge(zaxis->FindFixBin( zmin ))` and `zaxis->GetBinUpEdge(zaxis->FindFixBin( zmax ))` (and so on) are equal for all histograms that you want to compare (btw. following the standard convention for numbering bins, the low-edge is included but the upper-edge is excluded).

Please compare input parameters of the [TAxis::SetRange](https://root.cern.ch/doc/master/classTAxis.html#aed523b084d6b3f24f6b1128d7810e199), the [TAxis::SetRangeUser](https://root.cern.ch/doc/master/classTAxis.html#ac85f8261dedc23bbe68f90afd196cdb8) and the [TH1::SetAxisRange](https://root.cern.ch/doc/master/classTH1.html#adbae3b5110245637496d843afd55717f) methods.

> [@How to set ranges on axis?](https://root-forum.cern.ch/t/how-to-set-ranges-on-axis/28254):
>
> The viewing range for a histogram axis can be set from bin ifirst to ilast using the method TAxis::SetRange(ifirst, ilast). Example (hpxpy is a 2D histogram): { TFile f("hsimple.root"); hpxpy-\>Draw("colz"); hpxpy-\>GetYaxis()-\>SetRange(22,23); hpxpy-\>GetXaxis()-\>SetRange(18,19); } Sometimes it is more convenient to set this range using “User’s Coordinates” (axis values) rather than bin numbers. To do that one should use TAxis::SetRangeUser(ufirst, ulast). This method computes the cl…

---

_[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)._
