63 std::array<float, 6> x_dphi;
64 std::array<float, 6> x_dtheta;
65 std::array<float, 4> x_bend_emtf;
66 std::array<float, 1> x_fr_emtf;
67 std::array<float, 1> x_trk_theta;
68 std::array<float, 1> x_me11ring;
69 std::array<float, 4> x_rpcbit;
83 const int invalid_dtheta = 127;
84 const int invalid_dphi = 8191;
87 int dPhi_12, dPhi_13, dPhi_14, dPhi_23, dPhi_24, dPhi_34;
88 int dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34;
90 int bend_1, bend_2, bend_3, bend_4;
91 int rpc_1, rpc_2, rpc_3, rpc_4;
94 int pat1 = -99, pat2 = -99, pat3 = -99, pat4 = -99;
97 int st1 = (track.
Mode() >= 8);
98 int st2 = ((track.
Mode() % 8) >= 4);
99 int st3 = ((track.
Mode() % 4) >= 2);
100 int st4 = ((track.
Mode() % 2) == 1);
116 rpc_1 = (st1 ? (pat1 == 0) : 0);
117 rpc_2 = (st2 ? (pat2 == 0) : 0);
118 rpc_3 = (st3 ? (pat3 == 0) : 0);
119 rpc_4 = (st4 ? (pat4 == 0) : 0);
138 if (
std::abs(bend_1) == 5 && rpc_1 == 1)
140 if (
std::abs(bend_2) == 5 && rpc_2 == 1)
142 if (
std::abs(bend_3) == 5 && rpc_3 == 1)
144 if (
std::abs(bend_4) == 5 && rpc_4 == 1)
212 x_dtheta[0] = dTh_12;
213 x_dtheta[1] = dTh_13;
214 x_dtheta[2] = dTh_14;
215 x_dtheta[3] = dTh_23;
216 x_dtheta[4] = dTh_24;
217 x_dtheta[5] = dTh_34;
220 x_bend_emtf[0] = bend_1;
221 x_bend_emtf[1] = bend_2;
222 x_bend_emtf[2] = bend_3;
223 x_bend_emtf[3] = bend_4;
227 x_me11ring[0] = St1_ring2;
234 feature = {{x_dphi[0], x_dphi[1], x_dphi[2], x_dphi[3], x_dphi[4], x_dphi[5],
235 x_dtheta[0], x_dtheta[1], x_dtheta[2], x_dtheta[3], x_dtheta[4], x_dtheta[5],
236 x_bend_emtf[0], x_bend_emtf[1], x_bend_emtf[2], x_bend_emtf[3], x_fr_emtf[0], x_trk_theta[0],
237 x_me11ring[0], x_rpcbit[0], x_rpcbit[1], x_rpcbit[2], x_rpcbit[3]}};
243 std::vector<tensorflow::Tensor> outputs;
252 const float reg_pt_scale = 100.0;
253 const float reg_dxy_scale = 1.0;
255 prediction.at(0) = outputs[0].matrix<
float>()(0, 0);
256 prediction.at(1) = outputs[0].matrix<
float>()(0, 1);
259 prediction.at(0) /= reg_pt_scale;
260 prediction.at(1) /= reg_dxy_scale;
Session * createSession(SessionOptions &sessionOptions)
virtual ~PtAssignmentEngineDxy()
static PFTauRenderPlugin instance
GraphDef * loadGraphDef(const std::string &pbFile)
std::vector< std::string > outputNamesDxy_
constexpr int NUM_PREDICTIONS
tensorflow::Session * sessionDxy_
void configure(int verbose, const std::string pbFileNameDxy)
static std::string const input
tensorflow::GraphDef * graphDefDxy_
std::array< float, NUM_PREDICTIONS > Prediction
int calcBendFromPattern(const int pattern, const int endcap) const
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, std::vector< Tensor > *outputs, const thread::ThreadPoolOptions &threadPoolOptions)
bool closeSession(Session *&session)
Abs< T >::type abs(const T &t)
const PtAssignmentEngineAux2017 & aux() const
virtual void preprocessing_dxy(const EMTFTrack &track, emtf::Feature &feature) const
std::string inputNameDxy_
constexpr int NUM_FEATURES
std::string pbFileNameDxy_
char data[epos_bytes_allocation]
std::array< float, NUM_FEATURES > Feature
virtual void call_tensorflow_dxy(const emtf::Feature &feature, emtf::Prediction &prediction) const
std::string pbFilePathDxy_
virtual void calculate_pt_dxy(const EMTFTrack &track, emtf::Feature &feature, emtf::Prediction &prediction) const