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
* PIDML evaluate FSE + self-attention network (#5)
* remove detector count setting and reorder network arguments (with NaNs if detector not available)
* update README.md
* markdownlint changes
* MegaLinter fixes (#6)
* fix include missing file, the same way it was before
* readd pLimits to ONNXinterface and pass it to ONNXmodel
* Please consider the following formatting changes (AliceO2Group#9)
* improve qaPidML according to new approach
---------
Co-authored-by: ALICE Builder <alibuild@users.noreply.github.com>
Copy file name to clipboardExpand all lines: Tools/PIDML/README.md
+50-15Lines changed: 50 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# PID ML in O2
2
2
3
-
Particle identification is essential in most of the analyzes. The PID ML interface will help you to make use of the machine learning models to improve purity and efficiency of particle kinds for your analysis. A single model is tailored to a specific particle kind, e.g., pions with PID 211. For each track, the model returns a float value in [0, 1] which measures the ''certainty'' of the model that this track is of given kind.
3
+
Particle identification is essential in most of the analyzes.
4
+
The PID ML interface will help you to make use of the machine learning models to improve purity and efficiency of particle kinds for your analysis.
5
+
A single model is tailored to a specific particle kind, e.g., pions with PID 211. For each track, the model returns a float value in [0, 1] which measures the ''certainty'' of the model that this track is of given kind.
4
6
5
7
## PidONNXModel
6
8
@@ -11,12 +13,16 @@ This class represents a single ML model from an ONNX file. It requires the follo
11
13
- CCDB Api instance created in an analysis task
12
14
- timestamp of the input analysis data -- neded to choose appropriate model
13
15
- PID to be checked
14
-
- detector setup: what detectors should be used for identification. It is described by enum PidMLDetector. Currently available setups: TPC, TPC+TOF, TPC+TOF+TRD
15
16
- minimum certainty for accepting a track to be of given PID
17
+
-*p* limits array - specifiying p limits for each detector configuration (TPC, TPC+TOF, TPC+TOF+TRD)
16
18
17
-
Let's assume your `PidONNXModel` instance is named `pidModel`. Then, inside your analysis task `process()` function, you can iterate over tracks and call: `pidModel.applyModel(track);` to get the certainty of the model. You can also use `pidModel.applyModelBoolean(track);` to receive a true/false answer, whether the track can be accepted based on the minimum certainty provided to the `PidONNXModel` constructor.
19
+
Let's assume your `PidONNXModel` instance is named `pidModel`.
20
+
Then, inside your analysis task `process()` function, you can iterate over tracks and call: `pidModel.applyModel(track);` to get the certainty of the model.
21
+
You can also use `pidModel.applyModelBoolean(track);` to receive a true/false answer, whether the track can be accepted based on the minimum certainty provided to the `PidONNXModel` constructor.
18
22
19
-
You can check [a simple analysis task example](https://github.com/AliceO2Group/O2Physics/blob/master/Tools/PIDML/simpleApplyPidOnnxModel.cxx). It uses configurable parameters and shows how to calculate the data timestamp. Note that the calculation of the timestamp requires subscribing to `aod::Collisions` and `aod::BCsWithTimestamps`. For Hyperloop tests, you can set `cfgUseFixedTimestamp` to true with `cfgTimestamp` set to the default value.
23
+
You can check [a simple analysis task example](https://github.com/AliceO2Group/O2Physics/blob/master/Tools/PIDML/simpleApplyPidOnnxModel.cxx).
24
+
It uses configurable parameters and shows how to calculate the data timestamp. Note that the calculation of the timestamp requires subscribing to `aod::Collisions` and `aod::BCsWithTimestamps`.
25
+
For Hyperloop tests, you can set `cfgUseFixedTimestamp` to true with `cfgTimestamp` set to the default value.
20
26
21
27
On the other hand, it is possible to use locally stored models, and then the timestamp is not used, so it can be a dummy value. `processTracksOnly` presents how to analyze on local-only PID ML models.
22
28
@@ -31,10 +37,10 @@ This is a wrapper around PidONNXModel that contains several models. It has the p
31
37
32
38
Then, obligatory parameters for the interface:
33
39
- a vector of int output PIDs
34
-
- a 2-dimensional LabeledArray of *p*T limits for each PID, for each detector configuration. It describes the minimum *p*T values at which each next detector should be included for predicting given PID
40
+
- a 2-dimensional LabeledArray of *p* limits for each PID, for each detector configuration. It describes the minimum *p* values at which each next detector should be included for predicting given PID
35
41
- a vector of minimum certainties for each PID for accepting a track to be of this PID
36
42
- boolean flag: whether to switch on auto mode. If true, then *p*T limits and minimum certainties can be passed as an empty array and an empty vector, and the interface will fill them with default configuration:
37
-
-*p*T limits: same values for all PIDs: 0.0 (TPC), 0.5 (TPC + TOF), 0.8 (TPC + TOF + TRD)
43
+
-*p* limits: same values for all PIDs: 0.0 (TPC), 0.5 (TPC + TOF), 0.8 (TPC + TOF + TRD)
38
44
- minimum certainties: 0.5 for all PIDs
39
45
40
46
You can use the interface in the same way as the model, by calling `applyModel(track)` or `applyModelBoolean(track)`. The interface will then call the respective method of the model selected with the aforementioned interface parameters.
@@ -48,20 +54,49 @@ There is again [a simple analysis task example](https://github.com/AliceO2Group/
48
54
Currently, only models for run 285064 (timestamp interval: 1524176895000 - 1524212953000) are uploaded to CCDB, so you can use hardcoded timestamp 1524176895000 for tests.
49
55
50
56
Both model and interface analysis examples can be run with a script:
LOG(error) << "No suitable PID ML model found for track: " << track.globalIndex() << " from collision: " << track.collision().globalIndex() << " and expected pid: " << pid;
LOG(error) << "No suitable PID ML model found for track: " << track.globalIndex() << " from collision: " << track.collision().globalIndex() << " and expected pid: " << pid;
0 commit comments