hep: groot/rtree: problem reading slices with formula?

I am trying to read a slice, i.e a vector<float> branch with a rtree.Formula, using something like:

VarsName := []string{"hits"}, 
Fct :=: func(xs []float32) []float64 {
    res := make([]float64, len(xs))
    for i, x := range xs { res[i] = float64(x)  } 
    return res
}
f := r.FormulaFunc(VarsName, Fct)
getSlice := f.Func().(func() []float64)

In the event loop, getSlice() returns always an empty slice. Given it’s quite late, it’s not impossible I am doing a mistake … But I wanted to know if there would be a reason why reading slices can fail with rtree.Formula.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

amazing, it works!

ok, thanks.

as soon as I finished my “entretien annuel”, I’ll commit the fix:

$> root-dump
2020/05/29 10:02:22 evt[0]: [24.412797927856445 23.422243118286133 23.469839096069336 24.914079666137695 23.116113662719727 23.13003921508789 23.375518798828125 23.057828903198242 25.786481857299805 22.85857582092285] | [12.206399 11.711122 11.73492 12.45704 11.558057 11.56502 11.687759 11.528914 12.893241 11.429288] n=10
2020/05/29 10:02:22 evt[1]: [23.436037063598633 25.970693588256836 24.462419509887695 23.650163650512695 24.811952590942383 30.67894172668457 23.878101348876953 25.87006378173828 27.323381423950195 23.939083099365234 23.786226272583008] | [11.718019 12.985347 12.23121 11.825082 12.405976 15.339471 11.939051 12.935032 13.661691 11.969542 11.893113] n=11
2020/05/29 10:02:22 evt[2]: [24.462657928466797 24.429365158081055 24.389734268188477 24.492183685302734 23.71849822998047 38.71868133544922 24.310426712036133 24.45393180847168 -9.42474365234375 23.703657150268555 23.761384963989258 23.640995025634766 23.732669830322266 26.57146644592285 -9.294095039367676] | [12.231329 12.214683 12.194867 12.246092 11.859249 19.35934 12.155213 12.226966 -4.712372 11.851829 11.8806925 11.8204975 11.866335 13.285733 -4.6470475] n=15
2020/05/29 10:02:22 evt[3]: [22.6768798828125 23.451208114624023 25.548261642456055 24.217187881469727 24.384170532226562 24.241182327270508 24.25889015197754 24.366979598999023 23.182010650634766] | [11.33844 11.725604 12.774131 12.108594 12.192085 12.120591 12.129445 12.18349 11.591005] n=9
2020/05/29 10:02:22 evt[4]: [24.312828063964844 25.28243064880371 23.35763168334961 24.659414291381836 23.15633773803711 25.025495529174805 23.680923461914062 28.24120330810547 23.750375747680664 28.266529083251953 28.211824417114258 29.810104370117188 23.62776756286621] | [12.156414 12.641215 11.678816 12.329707 11.578169 12.512748 11.840462 14.120602 11.875188 14.133265 14.105912 14.905052 11.813884] n=13