15 if (AlgorithmString ==
"Cut") {
20 (
float)qualityParams.
getParameter<
double>(
"bendchi2Max"),
29 qualityParams.
getParameter<std::vector<std::string>>(
"featureNames"));
30 if ((AlgorithmString ==
"GBDT") || (AlgorithmString ==
"NN"))
43 std::vector<float> transformedFeatures;
46 std::map<std::string, float> feature_map;
52 int nbits = floor(log2(tmp_trk_hitpattern)) + 1;
54 int tmp_trk_nlaymiss_interior = 0;
56 for (
int i = 0;
i < nbits;
i++) {
57 lay_i = ((1 <<
i) & tmp_trk_hitpattern) >>
i;
62 tmp_trk_nlaymiss_interior++;
73 int tmp_trk_nstub = stubRefs.size();
76 float tmp_trk_z0 = aTrack.
z0();
77 float tmp_trk_z0_scaled = tmp_trk_z0 /
abs(aTrack.
minZ0);
78 float tmp_trk_phi = aTrack.
phi();
79 float tmp_trk_eta = aTrack.
eta();
80 float tmp_trk_tanl = aTrack.
tanL();
84 feature_map[
"nstub"] =
float(tmp_trk_nstub);
85 feature_map[
"z0"] = tmp_trk_z0;
86 feature_map[
"z0_scaled"] = tmp_trk_z0_scaled;
87 feature_map[
"phi"] = tmp_trk_phi;
88 feature_map[
"eta"] = tmp_trk_eta;
89 feature_map[
"nlaymiss_interior"] =
float(tmp_trk_nlaymiss_interior);
90 feature_map[
"bendchi2_bin"] = tmp_trk_bendchi2_bin;
91 feature_map[
"chi2rphi_bin"] = tmp_trk_chi2rphi_bin;
92 feature_map[
"chi2rz_bin"] = tmp_trk_chi2rz_bin;
93 feature_map[
"tanl"] = tmp_trk_tanl;
98 transformedFeatures.push_back(feature_map[feature]);
100 return transformedFeatures;
108 float trk_z0 = aTrack.
z0();
112 int nStubs = stubRefs.size();
114 float classification = 0.0;
118 classification = 1.0;
130 std::vector<float>
output = bdt.decision_function(
inputs);
136 std::vector<std::string> ortinput_names;
137 std::vector<std::string> ortoutput_names;
146 ortoutput_names =
runTime_->getOutputNames();
150 ortinput.push_back(Transformed_features);
155 ortoutputs =
runTime_->run(ortinput_names, ortinput, {}, ortoutput_names, batch_size);
179 std::vector<ap_fixed<10, 5>>
output = bdt.decision_function(inputFeatures);
180 return output.at(0).to_float();
204 if (AlgorithmString ==
"NN") {
206 }
else if (AlgorithmString ==
"GBDT") {
208 }
else if (AlgorithmString ==
"GBDT_cpp") {
T getParameter(std::string const &) const
double eta() const
Track eta.
std::string fullPath() const
unsigned int getChi2RZBits() 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)
static constexpr double minZ0
unsigned int getChi2RPhiBits() const
double phi() const
Track phi.
double tanL() const
Track tanL.
unsigned int hitPattern() const
Hit Pattern.
GlobalVector momentum() const
Track momentum.
std::vector< std::vector< float > > FloatArrays
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)
float runEmulatedTQ(std::vector< ap_fixed< 10, 5 >> inputFeatures)
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.
std::vector< float > bonusFeatures_
std::unique_ptr< cms::Ort::ONNXRuntime > runTime_
double stubPtConsistency() const
StubPtConsistency.
std::vector< std::string > featureNames_
unsigned int getBendChi2Bits() const
edm::FileInPath ONNXmodel_
double z0() const
Track z0.
std::string ONNXInputName_
void setBonusFeatures(std::vector< float > bonusFeatures)