51 art::Handle<std::vector<sim::MCTrack>> mctHandle;
52 e.getByLabel(
"mcreco", mctHandle);
54 art::Handle<std::vector<sim::SimChannel>> schHandle;
55 e.getByLabel(
"largeant", schHandle);
57 art::Handle<std::vector<recob::Track>> trkHandle;
58 e.getByLabel(
"trackkalmanhit", trkHandle);
60 if (!mctHandle.isValid() || !schHandle.isValid() || !trkHandle.isValid())
return;
63 std::vector<unsigned int> g4_track_id;
64 for (
auto const& mct : *mctHandle) {
66 if (!mct.size())
continue;
68 double dE = (*mct.begin()).Momentum().E() - (*mct.rbegin()).Momentum().E();
69 if (dE > 100) g4_track_id.push_back(mct.TrackID());
72 if (g4_track_id.size()) {
74 art::ServiceHandle<geo::Geometry const> geo;
77 auto sum_mcq_v = alg_mct.MCQSum(2);
78 std::cout <<
"Total charge contents on W plane:" << std::endl;
79 for (
size_t i = 0; i < sum_mcq_v.size() - 1; ++i)
80 std::cout <<
" MCTrack " << i <<
" => " << sum_mcq_v[i] << std::endl;
81 std::cout <<
" Others => " << (*sum_mcq_v.rbegin()) << std::endl;
84 art::FindManyP<recob::Hit> hit_coll_v(trkHandle,
e,
"trackkalmanhit");
85 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
e);
87 for (
size_t i = 0; i < trkHandle->size(); ++i) {
89 const std::vector<art::Ptr<recob::Hit>> hit_coll = hit_coll_v.at(i);
91 std::vector<btutil::WireRange_t> hits;
93 for (
auto const& h_ptr : hit_coll) {
95 if (geo->ChannelToWire(h_ptr->Channel())[0].
Plane != ::
geo::kW)
continue;
97 hits.emplace_back(h_ptr->Channel(), h_ptr->StartTick(), h_ptr->EndTick());
100 auto mcq_v = alg_mct.MCQ(clockData, hits);
101 auto mcq_frac_v = alg_mct.MCQFrac(clockData, hits);
104 <<
"Y plane Charge from first MCTrack: " << mcq_v[0]
105 <<
" ... Purity: " << mcq_frac_v[0]
106 <<
" ... Efficiency: " << mcq_v[0] / sum_mcq_v[0] << std::endl;
BEGIN_PROLOG true icarus_rawdigitfilter FilterTools FilterPlane1 Plane
Planes which measure W (third view for Bo, MicroBooNE, etc).
BEGIN_PROLOG could also be cout