73 if (fClusters->GetEntries() == 0)
79 TPython::Bind(fClusters,
"keras_tca");
80 TPython::Exec(
"keras_data = np.array([[cluster.GetT(), cluster.GetE(), cluster.GetSize(), cluster.GetEToF(), "
81 "cluster.GetEnergyMoment(), (cluster.GetLastHit().GetT() - cluster.GetFirstHit().GetT()), "
82 "cluster.GetMaxEnergyHit().GetE(), cluster.GetPosition().X(), cluster.GetPosition().Y(), "
83 "cluster.GetPosition().Z()] for cluster in keras_tca])");
85 TPython::Exec(
"keras_data_scaled = keras_scaler.transform(keras_data)");
89 TPython::Exec(
"keras_results = keras_model.predict(keras_data_scaled)[:, 1]");
93 std::vector<ClusterWithProba> cwps;
94 const int nClusters = fClusters->GetEntries();
95 cwps.reserve(nClusters);
96 for (
int i = 0; i < nClusters; i++)
99 (Double_t)TPython::Eval(TString::Format(
"keras_results[%d]", i)) });
103 std::sort(cwps.begin(), cwps.end(), std::greater<ClusterWithProba>());
106 if (FairLogger::GetLogger()->IsLogNeeded(fair::Severity::debug))
108 LOG(debug) <<
"R3BNeulandNeutronsKeras::Exec";
109 for (
const auto& cwp : cwps)
111 LOG(debug) << cwp.c->GetPosition().X() <<
"\t" << cwp.p <<
"\t";
116 const auto mult = fMultiplicity->GetMultiplicity();
117 for (
size_t n = 0; n < cwps.size() && n < mult; n++)
119 if (cwps.at(n).p > fMinProb)