![]() |
Project
|
Activate PID during tracking with the '–with-pid' flag.
o2-trd-global-tracking --with-pid --policy ML
Specify a which algorithm (called policy) should be use. Implemented are the following:
- LQ1D - LQ2D - LQ3D - ML (every model, which is exported to the ONNX format): - XGB (XGBoost model) - NN (Pytorch model) - Dummy (returns only -1) - Test (one of the above) - Default (one of the above, gets picked if '--policy' is unspecified)
Every TRDTrack gets a PID value set (mSignal), which then gets propergated to the AO2D writer.
The base interface for PID is defined in here. The 'init' function is such that each policy can specify what if anything it needs from the CCDB. For the 'process' each policy defines how a TRDTrack gets assigned a PID value. Additionally, the base class implements how to get the corrected charges from the tracklets. Corrected charges means z-row merged and calibrated charges.
The classical LQND policies (here) require an array of lookup tables (LUTs) from the ccdb. $N$ stands for the dimension. Then the electron likelihood for layer $i$ is defined as this:
$$L_i(e|Q_i)=\frac{P(Q_i|e)}{P(Q_i|e)+P(Q_i|\pi)}$$
From the charge $Q_i$ the LUTs give the corresponding $L_i$. The combined electron likelihood is obtained by this formula:
$$L(e|Q)=\frac{\prod_i L_i(e|Q_i)}{\prod_i L_i(e|Q_i) + \prod_i L_i(\pi|Q_i)}$$
where $L_i(\pi|Q_i)=1-L_i(e|Q_i)$.
Extension to higher dimensions is easy each tracklet has charges $Q_j$ which cover the integral of the pulse height spectrum in different slice ($j\in [0,1,2]$). In our case $Q0$ covers the pulse height peak, $Q1$ the Transition Radiation peak and $Q2$ the plateau. For each charge $j$ a LUT is available which gives the likelihood $L^e_j$. For each layer $i$ the likelihood is then:
$$L_i(e|Q)=\frac{\prod_j L_{i,j}(e|Q_j)}{\prod_j L_{i,j}(e|Q_j) + \prod_j L_{i,j}(\pi|Q_j)}$$
The combined electron likelihood is then:
$$L(e|Q)=\frac{\prod_{i,j} L_{i,j}(e|Q_j)}{\prod_{i,j} L_{i,j}(e|Q_j) + \prod_{i,j} L_{i,j}(\pi|Q_j)}$$
The ML policies (here) are uploaded to the CCDB in the ONNX file format (most python machine learning libraries support this standardized format). In O2 we leverage the ONNXRuntime to use these formats and calculate a PID value. The models can thus be trained in python which is very convenient. The code should take care of most of the annoying stuff. Policies just have to specify how to get the electron likelihood from the ONNXRuntime output (each python library varies in that somewhat). The 'prepareModelInput' prepares the TRDTracks as input.