249 double tot_charge = 0.;
250 for (
size_t h = 0;
h < daughterPFP_hits.size(); ++
h) {
251 std::array<float,4> cnn_out = CNN_results.
getOutput( daughterPFP_hits[
h] );
252 double hitcharge = daughterPFP_hits[
h]->Integral();
253 double track_score = cnn_out[ CNN_results.
getIndex(
"track") ];
254 double em_score = cnn_out[ CNN_results.
getIndex(
"em") ];
255 double michel_score = cnn_out[ CNN_results.
getIndex(
"michel") ];
256 double none_score = cnn_out[ CNN_results.
getIndex(
"none") ];
257 output.track += track_score;
258 output.em += em_score;
259 output.michel += michel_score;
260 output.none += none_score;
261 output.track_weight_by_charge += hitcharge*track_score;
262 output.em_weight_by_charge += hitcharge*em_score;
263 output.michel_weight_by_charge += hitcharge*michel_score;
264 output.none_weight_by_charge += hitcharge*none_score;
265 tot_charge += hitcharge;
267 output.nHits = daughterPFP_hits.size();
268 if (tot_charge != 0) {
269 output.track_weight_by_charge /= tot_charge;
270 output.em_weight_by_charge /= tot_charge;
271 output.michel_weight_by_charge /= tot_charge;
272 output.none_weight_by_charge /= tot_charge;
275 output.track_weight_by_charge = -999.;
276 output.em_weight_by_charge = -999.;
277 output.michel_weight_by_charge = -999.;
278 output.none_weight_by_charge = -999.;
int getIndex(const std::string &name) const
Index of column with given name, or -1 if name not found.
const std::vector< art::Ptr< recob::Hit > > GetPFParticleHitsFromPlane_Ptrs(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, size_t planeID) const
std::array< float, N > getOutput(size_t key) const
Get copy of the MVA output vector at index "key".