Project
Loading...
Searching...
No Matches
PID.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef TRD_PID_H
16#define TRD_PID_H
17
18#include <array>
19#include <unordered_map>
20#include <string>
21#include <iostream>
22
23namespace o2
24{
25namespace trd
26{
27
29enum class PIDPolicy : unsigned int {
30 // Classical Algorithms
31 LQ1D = 0,
32 LQ2D,
33 LQ3D,
34
35#ifdef TRDPID_WITH_ONNX
36 // ML models
37 XGB,
38 PY,
39#endif
40
41 // Do not add anything after this!
42 NMODELS,
43 Dummy,
44 DEFAULT = Dummy,
45};
46
47inline std::ostream& operator<<(std::ostream& os, const PIDPolicy& policy)
48{
49 std::string name;
50 switch (policy) {
51 case PIDPolicy::LQ1D:
52 name = "LQ1D";
53 break;
54 case PIDPolicy::LQ2D:
55 name = "LQ2D";
56 break;
57 case PIDPolicy::LQ3D:
58 name = "LQ3D";
59 break;
60#ifdef TRDPID_WITH_ONNX
61 case PIDPolicy::XGB:
62 name = "XGBoost";
63 break;
64 case PIDPolicy::PY:
65 name = "PyTorch";
66 break;
67#endif
69 name = "Dummy";
70 break;
71 default:
72 name = "Default";
73 }
74 os << name;
75 return os;
76}
77
79static const std::unordered_map<std::string, PIDPolicy> PIDPolicyString{
80 // Classical Algorithms
81 {"LQ1D", PIDPolicy::LQ1D},
82 {"LQ2D", PIDPolicy::LQ2D},
83 {"LQ3D", PIDPolicy::LQ3D},
84
85#ifdef TRDPID_WITH_ONNX
86 // ML models
87 {"XGB", PIDPolicy::XGB},
88 {"PY", PIDPolicy::PY},
89#endif
90
91 // General
92 {"DUMMY", PIDPolicy::Dummy},
93 // Default
94 {"default", PIDPolicy::DEFAULT},
95};
96
97} // namespace trd
98} // namespace o2
99
100#endif
PyTorch Model.
Definition ML.h:115
XGBoost Model.
Definition ML.h:94
GLuint const GLchar * name
Definition glcorearb.h:781
PIDPolicy
Option for available PID policies.
Definition PID.h:29
@ LQ3D
3-Dimensional Likelihood model
@ DEFAULT
The default option.
@ NMODELS
Count of all models.
@ LQ2D
2-Dimensional Likelihood model
@ Dummy
Dummy object outputting -1.f.
@ LQ1D
1-Dimensional Likelihood model
LQND< 2 > LQ2D
Definition LQND.h:154
std::ostream & operator<<(std::ostream &stream, const Digit &d)
Definition Digit.cxx:78
LQND< 3 > LQ3D
Definition LQND.h:155
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...