17 if (AlgorithmString ==
"Cut") {
22 (
float)qualityParams.
getParameter<
double>(
"bendchi2Max"),
31 qualityParams.
getParameter<std::vector<std::string>>(
"featureNames"));
44 std::vector<float> transformedFeatures;
47 std::map<std::string, float> feature_map;
51 std::vector<int> hitpattern_binary = {0, 0, 0, 0, 0, 0, 0};
52 std::vector<int> hitpattern_expanded_binary = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
53 std::vector<float> eta_bins = {0.0, 0.2, 0.41, 0.62, 0.9, 1.26, 1.68, 2.08, 2.4};
58 int hitmap[8][7] = {{0, 1, 2, 3, 4, 5, 11},
59 {0, 1, 2, 3, 4, 5, 11},
60 {0, 1, 2, 3, 4, 5, 11},
61 {0, 1, 2, 3, 4, 5, 11},
62 {0, 1, 2, 3, 4, 5, 11},
63 {0, 1, 2, 6, 7, 8, 9},
64 {0, 1, 7, 8, 9, 10, 11},
65 {0, 6, 7, 8, 9, 10, 11}};
69 for (
int i = 6;
i >= 0;
i--) {
70 int k = tmp_trk_hitpattern >>
i;
72 hitpattern_binary[
i] = 1;
76 int nbits = floor(log2(tmp_trk_hitpattern)) + 1;
78 int tmp_trk_nlaymiss_interior = 0;
80 for (
int i = 0;
i < nbits;
i++) {
81 lay_i = ((1 <<
i) & tmp_trk_hitpattern) >>
i;
86 tmp_trk_nlaymiss_interior++;
90 int eta_size =
static_cast<int>(eta_bins.size());
93 for (
int j = 1;
j < eta_size;
j++) {
94 if (
eta < eta_bins[
j] &&
eta >= eta_bins[
j - 1])
97 for (
int k = 0;
k <= 6;
k++)
99 hitpattern_expanded_binary[hitmap[
j - 1][
k]] = hitpattern_binary[
k];
104 int tmp_trk_ltot = 0;
106 for (
int i = 0;
i < 6; ++
i) {
107 tmp_trk_ltot += hitpattern_expanded_binary[
i];
110 int tmp_trk_dtot = 0;
112 for (
int i = 6;
i < 11; ++
i) {
113 tmp_trk_dtot += hitpattern_expanded_binary[
i];
118 std::array<float, 8> bendchi2_bins{{0, 0.5, 1.25, 2, 3, 5, 10, 50}};
119 int n_bendchi2 =
static_cast<int>(bendchi2_bins.size());
120 float tmp_trk_bendchi2_bin = -1;
121 for (
int i = 0;
i < (n_bendchi2 - 1);
i++) {
122 if (tmp_trk_bendchi2 >= bendchi2_bins[
i] && tmp_trk_bendchi2 < bendchi2_bins[
i + 1]) {
123 tmp_trk_bendchi2_bin =
i;
127 if (tmp_trk_bendchi2_bin < 0)
128 tmp_trk_bendchi2_bin = n_bendchi2;
131 float tmp_trk_chi2rphi = aTrack.
chi2XY();
132 std::array<float, 16> chi2rphi_bins{{0, 0.25, 0.5, 1, 2, 3, 5, 7, 10, 20, 40, 100, 200, 500, 1000, 3000}};
133 int n_chi2rphi =
static_cast<int>(chi2rphi_bins.size());
134 float tmp_trk_chi2rphi_bin = -1;
135 for (
int i = 0;
i < (n_chi2rphi - 1);
i++) {
136 if (tmp_trk_chi2rphi >= chi2rphi_bins[
i] && tmp_trk_chi2rphi < chi2rphi_bins[
i + 1]) {
137 tmp_trk_chi2rphi_bin =
i;
141 if (tmp_trk_chi2rphi_bin < 0)
142 tmp_trk_chi2rphi_bin = n_chi2rphi;
145 float tmp_trk_chi2rz = aTrack.
chi2Z();
146 std::array<float, 16> chi2rz_bins{{0, 0.25, 0.5, 1, 2, 3, 5, 7, 10, 20, 40, 100, 200, 500, 1000, 3000}};
147 int n_chi2rz =
static_cast<int>(chi2rz_bins.size());
148 float tmp_trk_chi2rz_bin = -1;
149 for (
int i = 0;
i < (n_chi2rz - 1);
i++) {
150 if (tmp_trk_chi2rz >= chi2rz_bins[
i] && tmp_trk_chi2rz < chi2rz_bins[
i + 1]) {
151 tmp_trk_chi2rz_bin =
i;
155 if (tmp_trk_chi2rz_bin < 0)
156 tmp_trk_chi2rz_bin = n_chi2rz;
163 feature_map[
"nstub"] = stubRefs.size();
165 feature_map[
"tanl"] =
abs(aTrack.
tanL());
166 feature_map[
"z0"] = aTrack.
z0();
167 feature_map[
"phi"] = aTrack.
phi();
169 feature_map[
"eta"] = aTrack.
eta();
171 float tmp_trk_chi2 = aTrack.
chi2();
172 feature_map[
"chi2"] = tmp_trk_chi2;
173 feature_map[
"log_chi2"] =
log(tmp_trk_chi2);
175 feature_map[
"chi2rphi"] = tmp_trk_chi2rphi;
176 feature_map[
"log_chi2rphi"] =
log(tmp_trk_chi2rphi);
178 feature_map[
"chi2rz"] = tmp_trk_chi2rz;
179 feature_map[
"log_chi2rz"] =
log(tmp_trk_chi2rz);
181 feature_map[
"chi2rz"] = tmp_trk_chi2rz;
182 feature_map[
"log_chi2rz"] =
log(tmp_trk_chi2rz);
184 feature_map[
"bendchi2"] = tmp_trk_bendchi2;
185 feature_map[
"log_bendchi2"] =
log(tmp_trk_bendchi2);
187 feature_map[
"lay1_hits"] =
float(hitpattern_expanded_binary[0]);
188 feature_map[
"lay2_hits"] =
float(hitpattern_expanded_binary[1]);
189 feature_map[
"lay3_hits"] =
float(hitpattern_expanded_binary[2]);
190 feature_map[
"lay4_hits"] =
float(hitpattern_expanded_binary[3]);
191 feature_map[
"lay5_hits"] =
float(hitpattern_expanded_binary[4]);
192 feature_map[
"lay6_hits"] =
float(hitpattern_expanded_binary[5]);
193 feature_map[
"disk1_hits"] =
float(hitpattern_expanded_binary[6]);
194 feature_map[
"disk2_hits"] =
float(hitpattern_expanded_binary[7]);
195 feature_map[
"disk3_hits"] =
float(hitpattern_expanded_binary[8]);
196 feature_map[
"disk4_hits"] =
float(hitpattern_expanded_binary[9]);
197 feature_map[
"disk5_hits"] =
float(hitpattern_expanded_binary[10]);
199 feature_map[
"dtot"] =
float(tmp_trk_dtot);
200 feature_map[
"ltot"] =
float(tmp_trk_ltot);
202 feature_map[
"nlaymiss_interior"] =
float(tmp_trk_nlaymiss_interior);
203 feature_map[
"bendchi2_bin"] = tmp_trk_bendchi2_bin;
204 feature_map[
"chi2rphi_bin"] = tmp_trk_chi2rphi_bin;
205 feature_map[
"chi2rz_bin"] = tmp_trk_chi2rz_bin;
210 transformedFeatures.push_back(feature_map[feature]);
212 return transformedFeatures;
220 float trk_z0 = aTrack.
z0();
222 float trk_chi2 = aTrack.
chi2();
224 int nStubs = stubRefs.size();
226 float classification = 0.0;
230 classification = 1.0;
238 std::vector<std::string> ortinput_names;
239 std::vector<std::string> ortoutput_names;
252 ortinput.push_back(Transformed_features);
257 ortoutputs = Runtime.run(ortinput_names, ortinput, {}, ortoutput_names, batch_size);
296 if (AlgorithmString ==
"NN") {
298 }
else if (AlgorithmString ==
"GBDT") {
T getParameter(std::string const &) const
double eta() const
Track eta.
std::string fullPath() const
void setL1TrackQuality(TTTrack< Ref_Phase2TrackerDigi_ > &aTrack)
void setCutParameters(std::string const &AlgorithmString, float maxZ0, float maxEta, float chi2dofMax, float bendchi2Max, float minPt, int nStubmin)
double phi() const
Track phi.
double tanL() const
Track tanL.
unsigned int hitPattern() const
Hit Pattern.
double chi2Z() const
Chi2Z.
GlobalVector momentum() const
Track momentum.
std::vector< std::vector< float > > FloatArrays
const std::vector< std::string > & getOutputNames() const
void setONNXModel(std::string const &AlgorithmString, edm::FileInPath const &ONNXmodel, std::string const &ONNXInputName, std::vector< std::string > const &featureNames)
void settrkMVA1(double atrkMVA1)
QualityAlgorithm qualityAlgorithm_
Abs< T >::type abs(const T &t)
double rInv() const
Track curvature.
double chi2XY() const
Chi2XY.
Class to store the L1 Track Trigger stubs.
std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > getStubRefs() const
Track components.
std::vector< float > featureTransform(TTTrack< Ref_Phase2TrackerDigi_ > &aTrack, std::vector< std::string > const &featureNames)
Class to store the L1 Track Trigger tracks.
double stubPtConsistency() const
StubPtConsistency.
std::vector< std::string > featureNames_
edm::FileInPath ONNXmodel_
double z0() const
Track z0.
std::string ONNXInputName_