Selection on TTree std::vector

Hi,

I’m trying to view an ntuple composed of multiple vectors. I would like to write a selection so that whenever it is passed, I get all the elements of all vectors involved.

For example, with this tree:

***********************************************
*    Row   * Instance *        v1 *        v2 *
***********************************************
*       21 *        0 *        10 *         0 *
*       21 *        1 *        10 *         1 *
*       21 *        2 *        10 *         2 *
*       21 *        3 *           *         3 *
*       21 *        4 *           *         4 *
*       22 *        0 *         0 *         0 *
*       22 *        1 *         1 *         1 *
*       22 *        2 *         2 *         2 *
*       22 *        3 *           *         3 *
*       22 *        4 *           *         4 *

I would like to scan this tree and get only those entries in which any element in v1 is 0.

When doing:

tree->Scan("v1:v2","v1==0"); 

I get only the first element in v1 and v2:

***********************************************
*    Row   * Instance *        v1 *        v2 *
***********************************************
*       22 *        0 *         0 *         0 *

I would like a selection that gives me:

***********************************************
*    Row   * Instance *        v1 *        v2 *
***********************************************
*       22 *        0 *         0 *         0 *
*       22 *        1 *         1 *         1 *
*       22 *        2 *         2 *         2 *
*       22 *        3 *           *         3 *
*       22 *        4 *           *         4 *

Can this be done?

Thanks,
N.

Hi,

Yes, apriori the following should work:tree->Scan("v1:v2","Sum$(v1==0) > 0");i.e. you have to transform the selection in something unique for the entry instead of something that has multiple values. (Sum$ is the sum over all the instances in the entry).

Cheers,
Philippe.