You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
filteredTracks will contain only the tracks in the table which pass the condition `track::pt > 1`.
46
+
filteredTracks will contain only the tracks in the table which pass the condition `track::pt > 1.f`.
47
+
48
+
Filter is automatically associated with a compatible table, i.e. table that has all the columns that are present in the filter expression.
49
+
It is currently impossible to have a filter that uses columns from more than one table.
50
+
If there are several filters declared, that are compatible with a single table, they are combined with logical "and".
51
+
52
+
### Expressions
53
+
`Filters` and `Partitions` are defined using `expressions`, as in the example above, which are C++ expressions that can contain _columns_, numerical and boolean _constants_, single-valued _configurables_, a limited set of special _functions_ and _branching_ conditions. The expressions are compiled on-the-fly to be applied and therefore require _explicit_ types to be used. For example in the expression `track::pt > 1.f` the numerical constant is marked to be `float`, while a simple `1` would be parsed as `int` and `1.` would be parsed as `double`.
54
+
55
+
`Filters` and `Partitions` require the expression result to be `boolean`.
56
+
57
+
The following funcitons and operations are permitted in expressions. Each `expr1` and `expr2` can be a single column, constant, configurable, condition, or a valid expression. Previously defined filters can also be used by name. Parentheses can be used as usual.
58
+
59
+
| Operation | Syntax | Description |
60
+
|:----------|:----------|:----------|
61
+
| Logical "and" | `expr1 && expr2` | logical multiplication of two expressions (both boolean) |
62
+
| Logical "or" | `expr1 \|\| expr2` | logical addition of two expressions (bothboolean) |
63
+
| Addition | `expr1 + expr2` | Addition of two expressions (compatible types) |
64
+
| Subtraction | `expr1 - expr2` | Subtraction of two expressions (compatible types) |
65
+
| Division | `expr1 / expr2` | Division of two expressions (compatibel types) |
66
+
| Multiplication | `expr1 * expr2` | Multiplication of two expressions (compatible types) |
| Branching condition | `ifnode(expr_condition, expr_if_true, expr_if_false)` | Conditional expression, depending if the `expr_condition` is true or false, the result of this expression is either `expr_if_true` or `expr_if_false` |
92
+
93
+
Note that while normal function can be used in expressions, they are **evaluated on construction** so they are equivalent to numerical constants. All the specially declared functions that can act on `expressions` start with `n`.
47
94
48
-
You can specify multiple filters which will be applied in a sequence effectively resulting in the intersection of all them.
49
95
50
-
You can also specify filters on associated quantities:
i.e. `Filter` is applied to the objects before passing them to the `process` method, while `Select` objects can be used to do further reduction inside the `process` method itself.
121
+
`Filter` is applied to the objects before passing them to the `process` method, while `Partitions` exist independently.
88
122
89
123
## Filtering and partitioning together
90
124
91
-
It is also possible to filter and partition data in the same task. Therefore, multiple `Filter`s are combined using the logical `AND`. These filters then are combined by a logical `AND` with all the specified selections `Select`, which themself are combined by logical `OR`s. E.g., `(Filter1 && Filter2) && (Select1 || Select2)`.
125
+
It is possible to use filters and partition data in the same task. Filters are applied as usual, combined with logical "and", therefore `tracks` table will only have entries that satisfy the filter conditions. The partitions, however, are _independent_ and _not grouped_ (by collision, in this example).
92
126
127
+
One can also define a partition _over a filtered type_, `Partition<soa::Filtered<aod::Tracks>> part = nabs(track::eta) < 1.f`. Doing this will put the partition selection on top of whatever filter selections are also present in the same task.
93
128
```cpp
94
129
usingnamespaceo2::aod;
95
130
@@ -111,22 +146,17 @@ struct partandfiltexample {
111
146
112
147
## Configuring filters
113
148
114
-
One of the features of the current framework is the ability to customize on the fly cuts and selection. The idea is to allow that by having a `configurable("mnemonic-name-of-the-parameter")`helper which can be used to refer to configurable options. The previous example will then become:
149
+
One of the features of the current framework is the ability to customize on the fly cuts and selection. Single-valued configurabled can be used in filter expressions directly, with some caveats. Configurables are defined to be implicitly convertable to their underlying type, however you do not want that to happen in your filter expressions as it would substitute its default value. It is possible to use the `.node()` method of the configurable in the expression, to ensure that it creates a placeholder node.
0 commit comments