27 std::vector<float> dQdx = calo.
dQdx();
30 if (dQdx.size() <= 1)
return -9999.;
34 if (dQdx.size() % 2 == 0 ) {
35 const auto median_lo = dQdx.begin() + dQdx.size()/2 - 1;
36 const auto median_hi = dQdx.begin() + dQdx.size()/2;
37 std::nth_element(dQdx.begin(), median_lo, dQdx.end());
38 float median_lo_val = *median_lo;
39 std::nth_element(dQdx.begin(), median_hi, dQdx.end());
40 float median_hi_val = *median_hi;
41 median = (median_lo_val + median_hi_val) / 2.;
44 const auto median_ptr = dQdx.begin() + dQdx.size()/2;
45 std::nth_element(dQdx.begin(), median_ptr, dQdx.end());
50 float mean = std::accumulate(dQdx.begin(), dQdx.end(), 0.) / dQdx.size();
53 var += (d -
mean) * (d - mean);
55 var = var / dQdx.size();
61 if (var < (d - mean) * (d - mean)) {
67 if (n_point == 0)
return -9999.;
69 return trunc_sum / n_point;
bool is_contained
is it contained in the "containment volume"?
process_name use argoneut_mc_hitfinder track
float MeanTruncateddQdx(const anab::Calorimetry &calo)
process_name can override from command line with o or output calo
const std::vector< float > & dQdx() const
float TrackMomentum(const numu::RecoTrack &track)
float RangeMomentum(const numu::RecoTrack &track)
float range_momentum_muon
Range momentum calculation of the track using range under the assumption it is a muon [GeV]...
float MCSMomentum(const numu::RecoTrack &track)
float fwd_mcs_momentum
MCS momentum calculation under hypothesis track is forward.
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
MCSFitResult mcs_muon
MCS calculation result for Muon PID hypothesis.