shtol
November 16, 2022, 5:28am
1
I have an array parameter in TTree and do a simple operation:
root [1] t1->Scan("endep[1-1]-endep[0]","nc==2")
************************
* Row * endep[1-1 *
************************
* 1 * -790.7999 *
* 2 * -80.19995 *
* 5 * -190.4000 *
* 7 * -23.60003 *
* 9 * -153.5 *
* 10 * -215.7999 *
* 12 * -61.60003 *
It seems I should get the identical zero, but no…
More interesting:
root [2] t1->Scan("endep[2-1]-endep[1]","nc==2")
************************
* Row * endep[2-1 *
************************
* 1 * 787 *
* 2 * -731.5000 *
* 5 * -227.3000 *
* 7 * -783.4000 *
* 9 * -390.6000 *
* 10 * -395.5999 *
* 12 * -849.6999 *
* 13 * 392.20001 *
* 15 * 208.20001 *
But:
root [3] t1->Scan("endep[nc-1]-endep[1]","nc==2")
************************
* Row * endep[nc- *
************************
* 1 * 0 *
* 2 * 0 *
* 5 * 0 *
* 7 * 0 *
* 9 * 0 *
* 10 * 0 *
So it seems using variable in expression works OK, but not constant…
ROOT Version: ROOT 6.22/06
Platform: Linux 3.10.0-862.3.2.el7.x86_64 x86_64
Compiler: gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
What do you get from; t1->Print("endep*")
shtol
November 16, 2022, 6:01am
3
Wile_E_Coyote:
t1->Print(“endep*”)
root [4] t1->Print("endep*")
******************************************************************************
*Tree :t1 : my *
*Entries : 15671 : Total = 89074375 bytes File Size = 34164106 *
* : : Tree compression factor = 2.61 *
******************************************************************************
*Br 0 :endep : endep[np]/F *
*Entries : 15671 : Total Size= 279022 bytes File Size = 165098 *
*Baskets : 11 : Basket Size= 96256 bytes Compression= 1.69 *
*............................................................................*
So you need: "np > 1 && nc == 2"
shtol
November 16, 2022, 6:21am
5
Wile_E_Coyote:
“np > 1 && nc == 2”
The result is the same, because np>=nc for all events.
root [7] t1->Scan("endep[2-1]-endep[1]","np>1 && nc==2")
************************
* Row * endep[2-1 *
************************
* 1 * 787 *
* 2 * -731.5000 *
* 5 * -227.3000 *
* 7 * -783.4000 *
* 9 * -390.6000 *
* 10 * -395.5999 *
* 12 * -849.6999 *
* 13 * 392.20001 *
* 15 * 208.20001 *
* 20 * 595.59999 *
That’s something for @couet then.
couet
November 16, 2022, 6:51am
7
Can you post the ROOT file containing this tree?
couet
November 16, 2022, 7:03am
8
Actually, I have some trees with arrays, and, yes, it seems that “0” is not equivalent to “1-1” when they are array indices:
root [9] EV0->Scan("El_E[0]")
************************
* Row * El_E[0] *
************************
* 0 * 58633 *
* 1 * 46366 *
* 2 * 109071 *
* 3 * 70727 *
* 4 * 61007 *
* 5 * 482409 *
* 6 * 21184 *
* 7 * 46740 *
* 8 * 93066.442 *
* 9 * 69574 *
************************
(long long) 10
root [10] EV0->Scan("El_E[1-1]")
************************
* Row * El_E[1-1] *
************************
* 0 * 44863 *
* 1 * 16814 *
* 2 * 103139.00 *
* 3 * 61016 *
* 4 * 37655.107 *
* 5 * 482875 *
* 6 * 31752 *
* 7 * 34897 *
* 8 * 37487 *
* 9 * 62128 *
************************
(long long) 10
I think that’s for @pcanal
couet
November 16, 2022, 7:10am
9
Indeed, if you enclose the formula, with brackets, then it is ok:
root [54] EV0->Scan("El_E[0]:El_E[1]:El_E[1-1]:El_E[(1-1)]")
************************************************************
* Row * El_E[0] * El_E[1] * El_E[1-1] * El_E[(1-1 *
************************************************************
* 0 * 58633 * 44863 * 44863 * 58633 *
* 1 * 46366 * 16814 * 16814 * 46366 *
* 2 * 109071 * 103139.00 * 103139.00 * 109071 *
* 3 * 70727 * 61016 * 61016 * 70727 *
* 4 * 61007 * 37655.107 * 37655.107 * 61007 *
* 5 * 482409 * 482875 * 482875 * 482409 *
* 6 * 21184 * 31752 * 31752 * 21184 *
* 7 * 46740 * 34897 * 34897 * 46740 *
* 8 * 93066.442 * 37487 * 37487 * 93066.442 *
* 9 * 69574 * 62128 * 62128 * 69574 *
************************************************************
(long long) 10
root [55]
it seems “1-1” without brackets behaves like “1” and “(1-1)” is really. 0.
Can you try if the brackets help in you case ?
Again I think @pcanal may have some ideas about it.
shtol
November 16, 2022, 7:40am
10
For this file the similar effect is for
root [3] t1->Scan("energy[2-1]-energy[1]","np>=1 && nc==2")
************************
* Row * energy[2- *
************************
* 2 * 9.5522766 *
* 3 * 230.34356 *
* 4 * *
* 5 * 373.09463 *
* 6 * *
* 9 * 185.91172 *
* 10 * 198.78469 *
hadron-wrc_nemcc-775–1-100-100.root (257.0 KB)
couet
November 16, 2022, 7:47am
11
Thanks for the file. Indeed, the workaround I mentioned works:
root [2] t1->Scan("energy[(2-1)]-energy[1]","np>=1 && nc==2")
************************
* Row * energy[(2 *
************************
* 2 * 0 *
* 3 * 0 *
* 4 * 0 *
* 5 * 0 *
* 6 * 0 *
* 9 * 0 *
* 10 * 0 *
* 11 * 0 *
* 12 * 0 *
* 15 * 0 *
* 16 * 0 *
* 17 * 0 *
* 18 * 0 *
* 19 * 0 *
* 20 * 0 *
* 22 * 0 *
* 25 * 0 *
* 27 * 0 *
* 30 * 0 *
* 33 * 0 *
* 34 * 0 *
* 38 * 0 *
* 39 * 0 *
* 41 * 0 *
* 46 * 0 *
couet
November 16, 2022, 8:29am
12
I created an issue .
Thanks for reporting.
system
Closed
November 30, 2022, 8:29am
13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.