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

<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:** [August 11, 2018, 7:08am UTC](https://root-forum.cern.ch/t/help-on-method-s-to-create-tree-from-multi-fold-gamma-ray-coincidence-data/29704/67 "2018-08-11T07:08:10Z")

</div>

I think you can easily reduce the amount of the required RAM by (up to) a factor 6, if you explicitly sort your gammas:

```auto
#include <algorithm>
// ...
      for(int j = 0; j < (No_Clover - 2); j++) {
        for(int k = (j + 1); k < (No_Clover - 1); k++) { // (k > j)
          for(int l = (k + 1); l < No_Clover; l++) { // (l > k)
            // ...
                        // Double_t x[3] = {(Double_T_t)Eclab[j], (Double_T_t)Eclab[k], (Double_T_t)Eclab[l]};
                        // Double_t x[3] = {(Eclab[j] + 1.e-6), (Eclab[k] + 1.e-6), (Eclab[l] + 1.e-6)};
                        Double_t x[3] = {(Eclab[j] + 0.5), (Eclab[k] + 0.5), (Eclab[l] + 0.5)};
                        std::sort(x, x + 3); // sort in an increasing order
                        if (his3D->GetNbins() <= MaxNbins) his3D->Fill(x);
                        // ...

```

When you do not sort your gammas, each triple of energies appears 6 times in your 3D histogram so, there are 6 “peaks” in different areas of the 3D histogram (where 6 is the number of permutations, of course).

If you sort them (in an increasing order), you will get 1 “peak” only (always energy\_gamma\_1 \<= energy\_gamma\_2 \<= energy\_gamma\_3).

This makes your 3D histogram “totally unsymmetric” but, I think you can take it into account when projecting / analysing it later (well, I’m afraid that this idea requires some detailed thoughtful examination so, you should discuss it with your colleagues).

---

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