6 #include "art/Framework/Core/EDAnalyzer.h"
7 #include "art/Framework/Core/ModuleMacros.h"
8 #include "art/Framework/Principal/Event.h"
9 #include "art/Framework/Principal/Handle.h"
10 #include "art/Framework/Principal/Run.h"
11 #include "art/Framework/Principal/SubRun.h"
12 #include "canvas/Utilities/InputTag.h"
13 #include "fhiclcpp/ParameterSet.h"
14 #include "messagefacility/MessageLogger/MessageLogger.h"
16 #include "art_root_io/TFileService.h"
27 #include "nusimdata/SimulationBase/MCParticle.h"
40 #include "../LArRecoProducer/LArReco/TrackMomentumCalculator.h"
48 class NuVertexChargeTree;
70 void analyze(art::Event
const&
e)
override;
81 bool InFV(TVector3 pos);
85 const std::vector<art::Ptr<recob::PFParticle>> &slice_pfps,
87 const std::vector<art::Ptr<simb::MCParticle>> &g4_mcparticles,
88 const std::vector<const sim::GeneratedParticleInfo *> &infos,
97 const std::vector<art::Ptr<simb::MCParticle>> &trueParticles);
100 const std::vector<sbn::StubInfo> &stubs,
101 const std::vector<unsigned> &stub_hit_inds,
105 const std::vector<art::Ptr<simb::MCParticle>> &trueParticles);
108 const std::vector<art::Ptr<recob::PFParticle>> &stub_pfps,
111 const std::vector<art::Ptr<simb::MCParticle>> &trueParticles);
245 fPFParticleTags(
p.get<std::vector<std::string>>(
"ParticleTags")),
246 fVertexHitTags(
p.get<std::vector<std::string>>(
"VertexHitTags")),
247 fStubTags(
p.get<std::vector<std::string>>(
"StubTags")),
248 fFiducialInset({
p.get<
float>(
"xmin"),
p.get<
float>(
"xmax"),
p.get<
float>(
"ymin"),
p.get<
float>(
"ymax"),
p.get<
float>(
"zmin"),
p.get<
float>(
"zmax")}),
250 fCorrectSCE(
p.get<
bool>(
"CorrectSCE"))
254 art::ServiceHandle<art::TFileService>
tfs;
256 _tree = tfs->make<TTree>(
"VertexEAnalyzer",
"kink_tree");
259 _tree->Branch(
"ievt", &fIEvt,
"ievt/i");
260 _tree->Branch(
"evt", &fEvt,
"evt/i");
262 _tree->Branch(
"nue", &fNuE,
"nue/F");
263 _tree->Branch(
"numode", &fNuMode,
"numode/i");
264 _tree->Branch(
"nuinttype", &fNuIntType,
"nuinttype/i");
266 _tree->Branch(
"fsp_px", &fFSPPx);
267 _tree->Branch(
"fsp_py", &fFSPPy);
268 _tree->Branch(
"fsp_pz", &fFSPPz);
270 _tree->Branch(
"fsp_start_x", &fFSPStartZ);
271 _tree->Branch(
"fsp_start_y", &fFSPStartY);
272 _tree->Branch(
"fsp_start_z", &fFSPStartZ);
273 _tree->Branch(
"fsp_end_x", &fFSPEndZ);
274 _tree->Branch(
"fsp_end_y", &fFSPEndY);
275 _tree->Branch(
"fsp_end_z", &fFSPEndZ);
277 _tree->Branch(
"fsp_e", &fFSPE);
278 _tree->Branch(
"fsp_ke", &fFSPKE);
279 _tree->Branch(
"fsp_vise", &fFSPVisE);
280 _tree->Branch(
"fsp_q", &fFSPQ);
281 _tree->Branch(
"fsp_len", &fFSPLen);
282 _tree->Branch(
"fsp_pid", &fFSPPID);
283 _tree->Branch(
"fsp_matched", &fFSPMatched);
284 _tree->Branch(
"fsp_matched_pfp_primary", &fFSPMatchedPFPPrimary);
285 _tree->Branch(
"fsp_matched_pid", &fFSPMatchedPID);
286 _tree->Branch(
"fsp_matched_primary", &fFSPMtachedPrimary);
287 _tree->Branch(
"fsp_process_is_topping", &fFSPIsStopping);
289 _tree->Branch(
"fsp_maxq0", &fFSPMaxQ0);
290 _tree->Branch(
"fsp_maxq1", &fFSPMaxQ1);
291 _tree->Branch(
"fsp_maxq2", &fFSPMaxQ2);
292 _tree->Branch(
"fsp_pitch0", &fFSPPitch0);
293 _tree->Branch(
"fsp_pitch1", &fFSPPitch1);
294 _tree->Branch(
"fsp_pitch2", &fFSPPitch2);
296 _tree->Branch(
"reco_vert_dist", &fRecoVertDist,
"reco_vert_dist/F");
298 _tree->Branch(
"vertex_hit_spid", &fVertexHitSPID);
299 _tree->Branch(
"vertex_hit_pitch", &fVertexHitPitch);
300 _tree->Branch(
"vertex_hit_dqdx", &fVertexHitdQdx);
301 _tree->Branch(
"vertex_hit_dedx", &fVertexHitdEdx);
302 _tree->Branch(
"vertex_hit_charge", &fVertexHitCharge);
303 _tree->Branch(
"vertex_hit_dist", &fVertexHitDist);
304 _tree->Branch(
"vertex_hit_vtxw", &fVertexHitVtxW);
305 _tree->Branch(
"vertex_hit_plane", &fVertexHitPlane);
306 _tree->Branch(
"vertex_hit_wire", &fVertexHitWire);
307 _tree->Branch(
"vertex_hit_peak_x", &fVertexHitPeakX);
308 _tree->Branch(
"vertex_hit_true_e", &fVertexHitTrueEnergy);
309 _tree->Branch(
"vertex_hit_true_proton_e", &fVertexHitTrueProtonEnergy);
310 _tree->Branch(
"vertex_hit_true_bragg_proton_e", &fVertexHitTrueBraggProtonEnergy);
311 _tree->Branch(
"vertex_hit_true_x", &fVertexHitTrueX);
312 _tree->Branch(
"vertex_hit_true_y", &fVertexHitTrueY);
313 _tree->Branch(
"vertex_hit_true_z", &fVertexHitTrueZ);
315 _tree->Branch(
"stub_endx", &fStubEndx);
316 _tree->Branch(
"stub_endy", &fStubEndy);
317 _tree->Branch(
"stub_endz", &fStubEndz);
319 _tree->Branch(
"stub_dirx", &fStubDirx);
320 _tree->Branch(
"stub_diry", &fStubDiry);
321 _tree->Branch(
"stub_dirz", &fStubDirz);
322 _tree->Branch(
"stub_length", &fStubLength);
323 _tree->Branch(
"stub_lenp", &fStubLenP);
324 _tree->Branch(
"stub_charge", &fStubCharge);
325 _tree->Branch(
"stub_trk_pitch", &fStubTrkPitch);
326 _tree->Branch(
"stub_pitch", &fStubPitch);
327 _tree->Branch(
"stub_nwire", &fStubNWire);
328 _tree->Branch(
"stub_hit_ind", &fStubHitInd);
329 _tree->Branch(
"stub_pfpid", &fStubPFPID);
330 _tree->Branch(
"stub_nplane", &fStubNPlane);
331 _tree->Branch(
"stub_vtx_w", &fStubVtxW);
332 _tree->Branch(
"stub_end_w", &fStubEndW);
333 _tree->Branch(
"stub_vtx_efield", &fStubVtxEField);
334 _tree->Branch(
"stub_end_efield", &fStubEndEField);
336 _tree->Branch(
"stub_qlength", &fStubQLength);
337 _tree->Branch(
"stub_qs", &fStubQs);
338 _tree->Branch(
"stub_ontracks", &fStubOnTracks);
339 _tree->Branch(
"stub_wires", &fStubWires);
341 _tree->Branch(
"stub_true_ke", &fStubTrueKE);
342 _tree->Branch(
"stub_true_length", &fStubTrueLength);
343 _tree->Branch(
"stub_true_id", &fStubTrueID);
345 _tree->Branch(
"stub_true_pdg", &fStubTruePdg);
346 _tree->Branch(
"stub_true_px", &fStubTruePx);
347 _tree->Branch(
"stub_true_py", &fStubTruePy);
348 _tree->Branch(
"stub_true_pz", &fStubTruePz);
350 _tree->Branch(
"stub_pfp_true_pdg", &fStubPFPTruePdg);
351 _tree->Branch(
"stub_pfp_true_px", &fStubPFPTruePx);
352 _tree->Branch(
"stub_pfp_true_py", &fStubPFPTruePy);
353 _tree->Branch(
"stub_pfp_true_pz", &fStubPFPTruePz);
355 _tree->Branch(
"stub_match_length", &fStubMatchLength);
356 _tree->Branch(
"stub_match", &fStubMatch);
357 _tree->Branch(
"stub_match_overlaps", &fStubMatchOverlaps);
358 _tree->Branch(
"stub_match_dot", &fStubMatchDot);
360 _tree->Branch(
"stub_xplane_match_length", &fStubXPlaneMatchLength);
361 _tree->Branch(
"stub_xplane_match", &fStubXPlaneMatch);
362 _tree->Branch(
"stub_xplane_match_toff", &fStubXPlaneMatchTOff);
363 _tree->Branch(
"stub_xplane_match_qoff", &fStubXPlaneMatchQOff);
364 _tree->Branch(
"stub_xplane_match_dqdxoff", &fStubXPlaneMatchdQdxOff);
365 _tree->Branch(
"stub_xplane_match_peakqoff", &fStubXPlaneMatchPeakQOff);
367 _tree->Branch(
"n_slice_particles", &fNSliceParticles,
"n_slice_particles/i");
368 _tree->Branch(
"n_slice_primary_particles", &fNSlicePrimaryParticles,
"n_slice_primary_particles/i");
369 _tree->Branch(
"n_slice_primary_tracks", &fNSlicePrimaryTracks,
"n_slice_primary_tracks/i");
370 _tree->Branch(
"n_slice_primary_nus", &fNSlicePrimaryNus,
"n_slice_primary_nus/i");
371 _tree->Branch(
"n_slice_primary_showers", &fNSlicePrimaryShowers,
"n_slice_primary_showers/i");
378 tend = geometry->
end_TPC(cryo.ID());
379 std::vector<geo::BoxBoundedGeo> this_tpc_volumes;
380 while (iTPC != tend) {
385 fTPCVolumes.push_back(std::move(this_tpc_volumes));
389 for (
const std::vector<geo::BoxBoundedGeo> &tpcs: fTPCVolumes) {
390 double XMin = std::min_element(tpcs.begin(), tpcs.end(), [](
auto &lhs,
auto &rhs) {
return lhs.MinX() < rhs.MinX(); })->MinX();
391 double YMin = std::min_element(tpcs.begin(), tpcs.end(), [](
auto &lhs,
auto &rhs) {
return lhs.MinY() < rhs.MinY(); })->MinY();
392 double ZMin = std::min_element(tpcs.begin(), tpcs.end(), [](
auto &lhs,
auto &rhs) {
return lhs.MinZ() < rhs.MinZ(); })->MinZ();
394 double XMax = std::max_element(tpcs.begin(), tpcs.end(), [](
auto &lhs,
auto &rhs) {
return lhs.MaxX() < rhs.MaxX(); })->MaxX();
395 double YMax = std::max_element(tpcs.begin(), tpcs.end(), [](
auto &lhs,
auto &rhs) {
return lhs.MaxY() < rhs.MaxY(); })->MaxY();
396 double ZMax = std::max_element(tpcs.begin(), tpcs.end(), [](
auto &lhs,
auto &rhs) {
return lhs.MaxZ() < rhs.MaxZ(); })->MaxZ();
399 fFiducialVolumes.emplace_back(XMin + fFiducialInset[0], XMax - fFiducialInset[1],
400 YMin + fFiducialInset[2], YMax - fFiducialInset[3],
401 ZMin + fFiducialInset[4], ZMax - fFiducialInset[5]);
406 for (
auto const &FV: fFiducialVolumes) {
407 if (FV.ContainsPosition(pos))
return true;
413 const simb::MCParticle &genie_part,
414 const simb::MCTruth &mctruth,
415 const std::vector<art::Ptr<simb::MCParticle>> &g4_mcparticles,
416 const std::vector<const sim::GeneratedParticleInfo *> infos) {
418 const simb::MCParticle *ret =
nullptr;
419 for (
int iparticle = 0; iparticle < (int)g4_mcparticles.size(); iparticle++) {
420 if (infos[iparticle]->hasGeneratedParticleIndex() &&
421 (int)infos[iparticle]->generatedParticleIndex() < mctruth.NParticles() &&
422 mctruth.GetParticle(infos[iparticle]->generatedParticleIndex()).TrackId() == genie_part.TrackId() &&
423 g4_mcparticles[iparticle]->Process() ==
"primary" ) {
430 const simb::MCParticle& matched_genie_particle = mctruth.GetParticle(infos[iparticle]->generatedParticleIndex());
431 if ((matched_genie_particle.Position().Vect() - g4_mcparticles[iparticle]->Position().Vect()).Mag() < 1
e-4 &&
432 matched_genie_particle.PdgCode() == g4_mcparticles[iparticle]->PdgCode()) {
435 assert(ret ==
nullptr);
436 ret = g4_mcparticles[iparticle].get();
468 fFSPMatchedPFPPrimary.clear();
469 fFSPMatchedPID.clear();
470 fFSPMtachedPrimary.clear();
471 fFSPIsStopping.clear();
481 fVertexHitSPID.clear();
482 fVertexHitPitch.clear();
483 fVertexHitdQdx.clear();
484 fVertexHitdEdx.clear();
485 fVertexHitCharge.clear();
486 fVertexHitDist.clear();
487 fVertexHitVtxW.clear();
488 fVertexHitPlane.clear();
489 fVertexHitWire.clear();
490 fVertexHitPeakX.clear();
491 fVertexHitTrueEnergy.clear();
492 fVertexHitTrueProtonEnergy.clear();
493 fVertexHitTrueBraggProtonEnergy.clear();
494 fVertexHitTrueX.clear();
495 fVertexHitTrueY.clear();
496 fVertexHitTrueZ.clear();
507 fStubTrkPitch.clear();
515 fStubVtxEField.clear();
516 fStubEndEField.clear();
518 fStubQLength.clear();
520 fStubOnTracks.clear();
524 fStubTrueLength.clear();
526 fStubTruePdg.clear();
530 fStubPFPTruePdg.clear();
531 fStubPFPTruePx.clear();
532 fStubPFPTruePy.clear();
533 fStubPFPTruePz.clear();
535 fStubMatchLength.clear();
537 fStubMatchOverlaps.clear();
538 fStubMatchDot.clear();
540 fStubXPlaneMatchLength.clear();
541 fStubXPlaneMatch.clear();
542 fStubXPlaneMatchTOff.clear();
543 fStubXPlaneMatchQOff.clear();
544 fStubXPlaneMatchdQdxOff.clear();
545 fStubXPlaneMatchPeakQOff.clear();
547 fNSliceParticles = 0;
548 fNSlicePrimaryParticles = 0;
549 fNSlicePrimaryTracks = 0;
550 fNSlicePrimaryNus = 0;
551 fNSlicePrimaryShowers = 0;
560 fNSliceParticles = slice_particles.size();
561 for (
unsigned i = 0; i < slice_particles.size(); i++) {
562 bool is_primary = slice_particles[i]->IsPrimary();
564 int parent = slice_particles[i]->Parent();
565 for (
unsigned j = 0; j < slice_particles.size(); j++) {
566 if ((
int)slice_particles[j]->Self() == parent) {
573 fNSlicePrimaryParticles ++;
577 fNSlicePrimaryTracks ++;
580 fNSlicePrimaryShowers ++;
583 fNSlicePrimaryNus ++;
590 const std::vector<art::Ptr<recob::PFParticle>> &stub_pfps,
593 const std::vector<art::Ptr<simb::MCParticle>> &trueParticles) {
595 for (
unsigned i_stub = 0; i_stub < stub_pfps.size(); i_stub++) {
597 if (stub_pfps[i_stub]) {
598 fStubPFPID.push_back(stub_pfps[i_stub]->Self());
601 fStubPFPID.push_back(-1);
607 std::sort(matches.begin(), matches.end(),
608 [](
auto const &lhs,
auto const &rhs) {
609 return lhs.second > rhs.second;
613 art::Ptr<simb::MCParticle> G4;
614 int matched_track_id = matches.size() ?
abs(matches[0].
first) : -1;
615 for (
unsigned i_g4 = 0; i_g4 < trueParticles.size(); i_g4++) {
616 if (matched_track_id == trueParticles[i_g4]->TrackId()) {
617 G4 = trueParticles[i_g4];
623 fStubPFPTruePdg.push_back(G4->PdgCode());
624 fStubPFPTruePx.push_back(G4->Momentum().Px());
625 fStubPFPTruePy.push_back(G4->Momentum().Py());
626 fStubPFPTruePz.push_back(G4->Momentum().Pz());
629 fStubPFPTruePdg.push_back(-1);
630 fStubPFPTruePx.push_back(-1);
631 fStubPFPTruePy.push_back(-1);
632 fStubPFPTruePz.push_back(-1);
639 const std::vector<sbn::StubInfo> &stubs,
640 const std::vector<unsigned> &stub_hit_inds,
644 const std::vector<art::Ptr<simb::MCParticle>> &trueParticles) {
649 for (
unsigned i_stub = 0; i_stub < stubs.size(); i_stub++) {
650 const sbn::Stub &stub = stubs[i_stub].stub;
653 fStubLength.push_back((stub.
vtx - stub.
end).r());
654 fStubEndx.push_back(stub.
end.X());
655 fStubEndy.push_back(stub.
end.Y());
656 fStubEndz.push_back(stub.
end.Z());
658 fStubDirx.push_back((stub.
end - stub.
vtx).Unit().X());
659 fStubDiry.push_back((stub.
end - stub.
vtx).Unit().Y());
660 fStubDirz.push_back((stub.
end - stub.
vtx).Unit().Z());
661 fStubNWire.push_back(stub.
CoreNHit());
662 fStubTrkPitch.push_back(stub.
trkpitch.front());
663 fStubPitch.push_back(stub.
pitch.front());
671 fStubQLength.push_back(stub.
hits.front().size());
673 fStubQs.push_back(
h.charge);
674 fStubOnTracks.push_back(
h.ontrack);
675 fStubWires.push_back(
h.wire);
678 fStubHitInd.push_back(stub_hit_inds[i_stub]);
679 fStubNPlane.push_back(stub.
plane.size());
680 fStubVtxW.push_back(stub.
vtx_w.front());
681 fStubEndW.push_back(stub.
hit_w.front());
689 std::sort(matches.begin(), matches.end(),
690 [](
auto const &lhs,
auto const &rhs) {
691 return lhs.second > rhs.second;
695 art::Ptr<simb::MCParticle> G4;
696 int matched_track_id = matches.size() ?
abs(matches[0].
first) : -1;
697 for (
unsigned i_g4 = 0; i_g4 < trueParticles.size(); i_g4++) {
698 if (matched_track_id == trueParticles[i_g4]->TrackId()) {
699 G4 = trueParticles[i_g4];
706 fStubTruePdg.push_back(G4->PdgCode());
707 fStubTrueID.push_back(G4->TrackId());
708 fStubTrueKE.push_back(G4->Momentum().E() - G4->Momentum().M());
709 fStubTrueLength.push_back((G4->Position().Vect() - G4->EndPosition().Vect()).Mag());
711 fStubTruePx.push_back(G4->Momentum().Px());
712 fStubTruePy.push_back(G4->Momentum().Py());
713 fStubTruePz.push_back(G4->Momentum().Pz());
716 fStubTruePdg.push_back(-1);
717 fStubTrueID.push_back(-1);
718 fStubTrueKE.push_back(-1);
719 fStubTrueLength.push_back(-1);
721 fStubTruePx.push_back(-1);
722 fStubTruePy.push_back(-1);
723 fStubTruePz.push_back(-1);
728 unsigned start_size = fStubMatch.size();
729 for (
unsigned j_stub = 0; j_stub < stubs.size(); j_stub++) {
730 if (i_stub == j_stub)
continue;
731 if (stubs[i_stub].stub.
plane.size() != 1 || stubs[j_stub].stub.plane.size() != 1)
continue;
732 if (stubs[i_stub].stub.
plane.front() == stubs[j_stub].stub.plane.front()) {
733 fStubMatch.push_back(j_stub);
738 fStubMatchLength.push_back(fStubMatch.size() - start_size);
743 unsigned start_size = fStubXPlaneMatch.size();
744 for (
unsigned j_stub = 0; j_stub < stubs.size(); j_stub++) {
745 if (i_stub == j_stub)
continue;
746 if (stubs[i_stub].stub.
plane.size() != 1 || stubs[j_stub].stub.plane.size() != 1)
continue;
747 if (stubs[i_stub].stub.
plane.front().Plane != stubs[j_stub].stub.plane.front().Plane) {
748 fStubXPlaneMatch.push_back(j_stub);
749 fStubXPlaneMatchTOff.push_back(
sbn::StubTimeOffset(stubs[i_stub], stubs[j_stub], clock_data, dprop));
752 fStubXPlaneMatchdQdxOff.push_back((stubs[i_stub].stub.
plane.front().TPC == stubs[j_stub].stub.plane.front().TPC) ?
753 sbn::StubPeakdQdxOffset(stubs[i_stub], stubs[j_stub], geo, sce, dprop) : std::numeric_limits<float>::signaling_NaN());
756 fStubXPlaneMatchLength.push_back(fStubXPlaneMatch.size() - start_size);
766 const std::vector<art::Ptr<simb::MCParticle>> &trueParticles) {
768 for (
unsigned i_hit = 0; i_hit < hits.size(); i_hit++) {
771 fVertexHitPlane.push_back(plane);
772 fVertexHitWire.push_back(hit.
wire.
Wire);
773 fVertexHitPeakX.push_back(dprop.
ConvertTicksToX(hit_hits[i_hit]->PeakTime(), hit_hits[i_hit]->WireID()));
774 fVertexHitCharge.push_back(hit.
charge);
776 fVertexHitVtxW.push_back(hit.
vtxw);
777 fVertexHitdQdx.push_back(hit.
dqdx);
778 fVertexHitSPID.push_back(hit.
spID);
779 fVertexHitPitch.push_back(hit.
pitch);
780 fVertexHitdEdx.push_back(hit.
dedx);
782 fVertexHitTrueEnergy.push_back(0.);
783 fVertexHitTrueProtonEnergy.push_back(0.);
784 fVertexHitTrueBraggProtonEnergy.push_back(0.);
786 fVertexHitTrueX.push_back(0.);
787 fVertexHitTrueY.push_back(0.);
788 fVertexHitTrueZ.push_back(0.);
791 art::ServiceHandle<cheat::BackTrackerService> bt;
792 std::vector<sim::IDE> hit_ides;
794 std::vector<sim::IDE> try_get_hit_ides = bt->HitToAvgSimIDEs(clock_data, *hit_hits[i_hit]);
795 hit_ides = try_get_hit_ides;
799 for (
unsigned i_ide = 0; i_ide < hit_ides.size(); i_ide++) {
800 fVertexHitTrueEnergy.back() += hit_ides[i_ide].energy;
801 fVertexHitTrueX.back() += hit_ides[i_ide].energy * hit_ides[i_ide].x;
802 fVertexHitTrueY.back() += hit_ides[i_ide].energy * hit_ides[i_ide].y;
803 fVertexHitTrueZ.back() += hit_ides[i_ide].energy * hit_ides[i_ide].z;
805 for (
unsigned i_g4 = 0; i_g4 < trueParticles.size(); i_g4++) {
806 if (
abs(hit_ides[i_ide].trackID) == trueParticles[i_g4]->TrackId()) {
807 if (
abs(trueParticles[i_g4]->PdgCode()) == 2212) {
808 fVertexHitTrueProtonEnergy.back() += hit_ides[i_ide].energy;
809 TVector3 ide_pos(hit_ides[i_ide].
x, hit_ides[i_ide].
y, hit_ides[i_ide].
z);
810 if ((trueParticles[i_g4]->EndPosition().Vect() - ide_pos).Mag() < 0.5) {
811 fVertexHitTrueBraggProtonEnergy.back() += hit_ides[i_ide].energy;
819 if (hit_ides.size()) {
820 fVertexHitTrueX.back() /= fVertexHitTrueEnergy.back();
821 fVertexHitTrueY.back() /= fVertexHitTrueEnergy.back();
822 fVertexHitTrueZ.back() /= fVertexHitTrueEnergy.back();
830 const std::vector<art::Ptr<recob::PFParticle>> &slice_pfps,
832 const std::vector<art::Ptr<simb::MCParticle>> &g4_mcparticles,
833 const std::vector<const sim::GeneratedParticleInfo *> &infos,
837 art::ServiceHandle<cheat::BackTrackerService> backtracker;
841 if (!fCorrectSCE) sce =
nullptr;
845 if (nu.NeutrinoSet()) {
846 fRecoVertDist = (nu.GetNeutrino().Nu().Position().Vect() - vpos).Mag();
848 fNuE = nu.GetNeutrino().Nu().E();
849 fNuMode = nu.GetNeutrino().Mode();
850 fNuIntType = nu.GetNeutrino().InteractionType();
853 fRecoVertDist = (nu.GetParticle(0).Position().Vect() - vpos).Mag();
861 for (
int i_part = 0; i_part < nu.NParticles(); i_part++) {
862 const simb::MCParticle &particle = nu.GetParticle(i_part);
864 if (particle.StatusCode() != 1)
continue;
877 fFSPPx.push_back(particle.Momentum().Px());
878 fFSPPy.push_back(particle.Momentum().Py());
879 fFSPPz.push_back(particle.Momentum().Pz());
881 fFSPStartX.push_back(G4->Position().X());
882 fFSPStartY.push_back(G4->Position().Y());
883 fFSPStartZ.push_back(G4->Position().Z());
884 fFSPEndX.push_back(G4->EndPosition().X());
885 fFSPEndY.push_back(G4->EndPosition().Y());
886 fFSPEndZ.push_back(G4->EndPosition().Z());
888 fFSPE.push_back(particle.Momentum().E());
889 fFSPKE.push_back(particle.Momentum().E() - particle.Momentum().M());
890 fFSPPID.push_back(particle.PdgCode());
892 fFSPLen.push_back((G4->Position().Vect() - G4->EndPosition().Vect()).Mag());
894 bool is_stopping = (G4->EndProcess() ==
"Decay" ||
895 G4->EndProcess() ==
"CoupledTransportation" ||
896 G4->EndProcess() ==
"FastScintillation" ||
897 G4->EndProcess() ==
"muMinusCaptureAtRest" ||
898 G4->EndProcess() ==
"LArVoxelReadoutScoringProcess");
899 fFSPIsStopping.push_back(is_stopping);
907 std::map<geo::WireID, float> chargemap;
909 std::vector<const sim::IDE*> particle_ides(backtracker->TrackIdToSimIDEs_Ps(G4->TrackId(), view));
910 for (
const sim::IDE *ide: particle_ides) {
911 thisVisE += ide->energy;
930 fFSPVisE.push_back(thisVisE / 3. );
931 fFSPQ.push_back(thisQ / 3.);
933 for (
unsigned p = 0;
p < 3;
p++) {
935 for (
auto const &pair: chargemap) {
936 if (pair.first.Plane ==
p) {
937 if (pair.second > maxQ) maxQ = pair.second;
941 if (
p == 0) fFSPMaxQ0.push_back(maxQ);
942 if (
p == 1) fFSPMaxQ1.push_back(maxQ);
943 if (
p == 2) fFSPMaxQ2.push_back(maxQ);
955 fFSPPitch0.push_back(-1);
956 fFSPPitch1.push_back(-1);
957 fFSPPitch2.push_back(-1);
960 bool found_match =
false;
961 bool primary_match =
false;
963 bool is_primary =
false;
964 for (
unsigned i_pfp = 0; i_pfp < slice_pfp_matches.size(); i_pfp++) {
965 for (
unsigned i_match = 0; i_match < slice_pfp_matches[i_pfp].size(); i_match++) {
967 if (slice_pfp_matches[i_pfp][i_match].
first == G4->TrackId() &&
968 (slice_pfp_matches[i_pfp][i_match].second / thisVisE > 0.5)) {
970 primary_match = i_match == 0;
971 pfp_pdgid = slice_pfps[i_pfp]->PdgCode();
973 is_primary = slice_pfps[i_pfp]->IsPrimary();
975 int parent = slice_pfps[i_pfp]->Parent();
976 for (
unsigned j_pfp = 0; j_pfp < slice_pfps.size(); j_pfp++) {
977 if ((
int)slice_pfps[j_pfp]->Self() == parent) {
994 if (found_match)
break;
997 fFSPMatched.push_back(found_match);
998 fFSPMatchedPFPPrimary.push_back(is_primary);
999 fFSPMatchedPID.push_back(pfp_pdgid);
1000 fFSPMtachedPrimary.push_back(primary_match);
1007 art::ServiceHandle<cheat::BackTrackerService> backtracker;
1008 art::ServiceHandle<cheat::ParticleInventoryService> inventory_service;
1009 auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
1011 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clock_data);
1015 std::vector<std::vector<art::Ptr<recob::Slice>>> sliceList;
1016 std::vector<art::FindManyP<recob::Hit>> sliceHitList;
1017 std::vector<art::FindManyP<recob::PFParticle>> slicePFParticleList;
1018 std::vector<art::FindManyP<sbn::VertexHit>> sliceVertexHitList;
1020 for (
unsigned i = 0; i < fPFParticleTags.size(); i++) {
1021 art::Handle<std::vector<recob::Slice>> slice_handle;
1022 evt.getByLabel(fPFParticleTags.at(i), slice_handle);
1023 sliceList.emplace_back();
1024 art::fill_ptr_vector(sliceList.back(), slice_handle);
1025 sliceHitList.emplace_back(sliceList.back(),
evt, fPFParticleTags.at(i));
1026 slicePFParticleList.emplace_back(sliceList.back(),
evt, fPFParticleTags.at(i));
1027 sliceVertexHitList.emplace_back(sliceList.back(),
evt, fVertexHitTags.at(i));
1031 std::vector<art::Ptr<recob::Slice>>
slices;
1032 std::vector<std::vector<art::Ptr<recob::Hit>>> sliceHits;
1034 std::vector<std::vector<art::Ptr<recob::PFParticle>>> sliceParticles;
1035 std::vector<std::vector<std::vector<art::Ptr<recob::Hit>>>> sliceParticleHits;
1036 std::vector<std::vector<std::vector<art::Ptr<recob::Vertex>>>> sliceParticleVertexs;
1038 std::vector<std::vector<art::Ptr<sbn::VertexHit>>> sliceVertexHits;
1039 std::vector<std::vector<art::Ptr<recob::Vertex>>> sliceVertexHitVtxs;
1040 std::vector<std::vector<art::Ptr<recob::Hit>>> sliceVertexHitHits;
1041 std::vector<std::vector<art::Ptr<recob::SpacePoint>>> sliceVertexHitSPs;
1042 std::vector<std::vector<art::Ptr<sbn::Stub>>> sliceStubs;
1043 std::vector<std::vector<unsigned>> sliceStubHitInds;
1044 std::vector<std::vector<std::vector<art::Ptr<recob::Hit>>>> sliceStubHits;
1045 std::vector<std::vector<art::Ptr<recob::PFParticle>>> sliceStubPFPs;
1046 std::vector<std::vector<std::vector<art::Ptr<recob::Hit>>>> sliceStubPFPHits;
1048 for (
unsigned i = 0; i < sliceList.size(); i++) {
1049 slices.insert(slices.end(), sliceList[i].begin(), sliceList[i].end());
1050 for (
unsigned j = 0; j < sliceList[i].size(); j++) {
1051 sliceHits.push_back(sliceHitList[i].at(j));
1052 sliceParticles.push_back(slicePFParticleList[i].at(j));
1054 sliceParticleHits.emplace_back();
1055 art::FindManyP<recob::Cluster> sliceParticleClusters(sliceParticles.back(),
evt, fPFParticleTags.at(i));
1056 for (
unsigned i_pfp = 0; i_pfp < sliceParticles.back().size(); i_pfp++) {
1057 sliceParticleHits.back().emplace_back();
1058 const std::vector<art::Ptr<recob::Cluster>> &thisParticleClusters = sliceParticleClusters.at(i_pfp);
1059 art::FindManyP<recob::Hit> clusterHits(thisParticleClusters, evt, fPFParticleTags.at(i));
1060 for (
unsigned i_clus = 0; i_clus < thisParticleClusters.size(); i_clus++) {
1061 sliceParticleHits.back().back().insert(sliceParticleHits.back().back().end(), clusterHits.at(i_clus).begin(), clusterHits.at(i_clus).end());
1065 sliceParticleVertexs.emplace_back();
1066 art::FindManyP<recob::Vertex> findSliceParticleVertexs(sliceParticles.back(),
evt, fPFParticleTags.at(i));
1067 for (
unsigned i_pfp = 0; i_pfp < sliceParticles.back().size(); i_pfp++) {
1068 sliceParticleVertexs.back().push_back(findSliceParticleVertexs.at(i_pfp));
1071 sliceVertexHits.push_back(sliceVertexHitList[i].at(j));
1073 art::FindManyP<recob::Vertex> vertexHitVtxs(sliceVertexHits.back(),
evt, fVertexHitTags.at(i));
1074 sliceVertexHitVtxs.emplace_back();
1075 for (
unsigned i_vhit = 0; i_vhit < sliceVertexHits.back().size(); i_vhit++) {
1076 sliceVertexHitVtxs.back().push_back(vertexHitVtxs.at(i_vhit).at(0));
1079 art::FindManyP<recob::Hit> vertexHitHits(sliceVertexHits.back(),
evt, fVertexHitTags.at(i));
1080 sliceVertexHitHits.emplace_back();
1081 for (
unsigned i_vhit = 0; i_vhit < sliceVertexHits.back().size(); i_vhit++) {
1082 sliceVertexHitHits.back().push_back(vertexHitHits.at(i_vhit).at(0));
1085 art::Ptr<recob::SpacePoint> nullSP;
1086 art::FindManyP<recob::SpacePoint> vertexHitSPs(sliceVertexHitHits.back(),
evt, fPFParticleTags.at(i));
1087 sliceVertexHitSPs.emplace_back();
1088 for (
unsigned i_sp = 0; i_sp < sliceVertexHitHits.back().size(); i_sp++) {
1089 const std::vector<art::Ptr<recob::SpacePoint>> &this_sp = vertexHitSPs.at(i_sp);
1090 if (this_sp.size()) sliceVertexHitSPs.back().push_back(this_sp.at(0));
1091 else sliceVertexHitSPs.back().push_back(nullSP);
1095 art::FindManyP<sbn::Stub> vertexStubs(sliceVertexHits.back(),
evt, fStubTags.at(i));
1096 sliceStubs.emplace_back();
1097 sliceStubHitInds.emplace_back();
1098 for (
unsigned i_stub = 0; i_stub < sliceVertexHits.back().size(); i_stub++) {
1099 const std::vector<art::Ptr<sbn::Stub>> &this_vh = vertexStubs.at(i_stub);
1100 for (
unsigned i_vh_stub = 0; i_vh_stub < this_vh.size(); i_vh_stub++) {
1101 sliceStubs.back().push_back(this_vh.at(i_vh_stub));
1102 sliceStubHitInds.back().push_back(i_stub);
1106 art::FindManyP<recob::Hit> vertexStubHits(sliceStubs.back(),
evt, fStubTags.at(i));
1107 sliceStubHits.emplace_back();
1108 for (
unsigned i_stub = 0; i_stub < sliceStubs.back().size(); i_stub++) {
1109 sliceStubHits.back().push_back(vertexStubHits.at(i_stub));
1112 art::FindManyP<recob::PFParticle> vertexStubPFPs(sliceStubs.back(),
evt, fStubTags.at(i));
1113 art::Ptr<recob::PFParticle> nullPFP;
1114 sliceStubPFPs.emplace_back();
1115 for (
unsigned i_stub = 0; i_stub < sliceStubs.back().size(); i_stub++) {
1116 const std::vector<art::Ptr<recob::PFParticle>> &thisStubPFP = vertexStubPFPs.at(i_stub);
1117 if (thisStubPFP.size()) sliceStubPFPs.back().push_back(thisStubPFP.at(0));
1118 else sliceStubPFPs.back().push_back(nullPFP);
1121 sliceStubPFPHits.emplace_back();
1122 for (
unsigned i_stub = 0; i_stub < sliceStubPFPs.back().size(); i_stub++) {
1124 for (
unsigned i_pfp = 0; i_pfp < sliceParticles.back().size(); i_pfp++) {
1125 if (sliceStubPFPs.back()[i_stub] == sliceParticles.back()[i_pfp]) {
1126 sliceStubPFPHits.back().push_back(sliceParticleHits.back()[i_pfp]);
1132 sliceStubPFPHits.back().emplace_back();
1140 art::Handle<std::vector<simb::MCTruth>> trueNuHandle;
1141 evt.getByLabel(
"generator", trueNuHandle);
1142 std::vector<art::Ptr<simb::MCTruth>> trueNus;
1143 art::fill_ptr_vector(trueNus, trueNuHandle);
1145 art::Handle<std::vector<simb::MCParticle>> trueParticleHandle;
1146 evt.getByLabel(
"largeant", trueParticleHandle);
1147 std::vector<art::Ptr<simb::MCParticle>> trueParticles;
1148 art::fill_ptr_vector(trueParticles, trueParticleHandle);
1151 art::FindManyP<simb::MCParticle, sim::GeneratedParticleInfo> truth_to_particles(trueNus, evt,
"largeant");
1159 for (
unsigned i_nu = 0; i_nu < trueNus.size(); i_nu++) {
1160 const simb::MCTruth &
nu = *trueNus[i_nu];
1162 TVector3 true_vertex = nu.NeutrinoSet() ? nu.GetNeutrino().Nu().Position().Vect() : nu.GetParticle(0).Position().Vect();
1163 if (!
InFV(true_vertex))
continue;
1169 for (
unsigned i_g4 = 0; i_g4 < trueParticles.size(); i_g4++) {
1170 const simb::MCParticle &particle = *trueParticles[i_g4];
1171 art::Ptr<simb::MCTruth> truth = inventory_service->TrackIdToMCTruth_P(particle.TrackId());
1172 if (truth == trueNus[i_nu]) {
1173 std::vector<const sim::IDE*> particle_ides(backtracker->TrackIdToSimIDEs_Ps(particle.TrackId()));
1174 for (
const sim::IDE *ide: particle_ides) visE += ide->energy;
1178 int slice_match = -1;
1180 for (
unsigned i_slice = 0; i_slice < slices.size(); i_slice++) {
1183 float matchingE = 0.;
1186 for (
unsigned i_match = 0; i_match < matches.size(); i_match++) {
1187 totalE += matches[i_match].second;
1190 for (
unsigned i_g4 = 0; i_g4 < trueParticles.size(); i_g4++) {
1191 for (
unsigned i_match = 0; i_match < matches.size(); i_match++) {
1192 if (matches[i_match].
first == trueParticles[i_g4]->TrackId()) {
1193 art::Ptr<simb::MCTruth> truth = inventory_service->TrackIdToMCTruth_P(trueParticles[i_g4]->TrackId());
1194 if (truth == trueNus[i_nu]) {
1195 matchingE += matches[i_match].second;
1204 if (matchingE / visE > 0.5) {
1205 if (matchingE / totalE > 0.5) slice_match = i_slice;
1210 if (slice_match < 0)
continue;
1215 const std::vector<art::Ptr<recob::PFParticle>> thisSliceParticles = sliceParticles.at(slice_match);
1216 const std::vector<std::vector<art::Ptr<recob::Hit>>> thisSliceParticleHits = sliceParticleHits.at(slice_match);
1217 const std::vector<std::vector<art::Ptr<recob::Vertex>>> thisSliceParticleVertexs = sliceParticleVertexs.at(slice_match);
1219 const std::vector<art::Ptr<sbn::VertexHit>> &thisVertexHits = sliceVertexHits.at(slice_match);
1220 const std::vector<art::Ptr<recob::Hit>> &thisVertexHitHits = sliceVertexHitHits.at(slice_match);
1221 const std::vector<art::Ptr<recob::SpacePoint>> &thisVertexHitSPs = sliceVertexHitSPs.at(slice_match);
1222 const std::vector<art::Ptr<recob::Vertex>> &thisVertexHitVtxs = sliceVertexHitVtxs.at(slice_match);
1224 const std::vector<art::Ptr<sbn::Stub>> &thisStubs = sliceStubs.at(slice_match);
1225 const std::vector<std::vector<art::Ptr<recob::Hit>>> &thisStubHits = sliceStubHits.at(slice_match);
1226 const std::vector<unsigned> &thisStubHitInds = sliceStubHitInds.at(slice_match);
1227 const std::vector<art::Ptr<recob::PFParticle>> &thisStubPFPs = sliceStubPFPs.at(slice_match);
1228 const std::vector<std::vector<art::Ptr<recob::Hit>>> &thisStubPFPHits = sliceStubPFPHits.at(slice_match);
1231 std::vector<sbn::StubInfo> thisStubInfos;
1232 for (
unsigned i = 0; i < thisStubs.size(); i++) {
1233 thisStubInfos.emplace_back();
1237 newStub.
stub = *thisStubs[i];
1238 newStub.
pfp = thisStubPFPs.at(i);
1239 newStub.
hits = thisStubHits.at(i);
1240 newStub.
vhit = thisVertexHits.at(thisStubHitInds[i]);
1241 newStub.
vhit_hit = thisVertexHitHits.at(thisStubHitInds[i]);
1244 (
void) thisVertexHitSPs;
1245 (
void) thisVertexHitVtxs;
1255 art::Ptr<recob::Vertex> vert;
1256 for (
unsigned i_pfp = 0; i_pfp < thisSliceParticles.size(); i_pfp++) {
1257 if (thisSliceParticles[i_pfp]->
IsPrimary() &&
1258 thisSliceParticleVertexs.at(i_pfp).size()) {
1259 vert = thisSliceParticleVertexs.at(i_pfp).at(0);
1264 double badpos[3] {-999., -999., -999.};
1269 std::vector<std::vector<std::pair<int, float>>> thisSlicePFPMatches;
1270 for (
unsigned i_pfp = 0; i_pfp < thisSliceParticles.size(); i_pfp++) {
1273 std::sort(matches.begin(), matches.end(),
1274 [](
auto const &lhs,
auto const &rhs) {
1275 return lhs.second > rhs.second;
1277 thisSlicePFPMatches.push_back(matches);
1284 FillNeutrino(nu, nu_vert, thisSliceParticles, thisSlicePFPMatches, truth_to_particles.at(i_nu), truth_to_particles.data(i_nu), *geo, dprop);
1287 FillVertexHits(thisVertexHits, thisVertexHitHits, dprop, clock_data, trueParticles);
1289 FillStubs(thisStubInfos, thisStubHitInds, geo, dprop, clock_data, trueParticles);
1291 FillStubPFPs(thisStubPFPs, thisStubPFPHits, clock_data, trueParticles);
1293 FillSlice(thisSliceParticles);
float StubChargeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B)
Difference of the total charge between two stubs.
float StubTimeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B, const detinfo::DetectorClocksData &dclock, const detinfo::DetectorPropertiesData &dprop)
process_name opflash particleana ie ie ie z
std::vector< float > fVertexHitTrueZ
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
std::vector< float > fFSPMaxQ2
std::vector< float > fVertexHitVtxW
std::vector< float > fStubXPlaneMatchdQdxOff
float dqdx
charge/pitch [#elec/cm]
std::vector< int > fStubNPlane
std::vector< float > fStubLenP
std::vector< int > fStubXPlaneMatch
std::vector< float > fFSPEndZ
std::vector< int > fStubNWire
Utilities related to art service access.
std::vector< float > fFSPEndX
std::vector< float > fStubXPlaneMatchPeakQOff
float StubPeakdQdxOffset(const sbn::StubInfo &A, const sbn::StubInfo &B, const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce, const detinfo::DetectorPropertiesData &dprop)
Difference of the endpoint dQ/dx between two stubs.
std::vector< float > fVertexHitTrueY
std::vector< int > fStubOnTracks
std::vector< int > fVertexHitPlane
std::vector< float > fFSPPx
std::vector< float > fFSPPitch2
const geo::GeometryCore * geometry
process_name opflash particleana ie x
std::vector< geo::PlaneID > plane
The plane ID.
std::vector< bool > fFSPMatched
std::vector< float > fStubMatchDot
std::vector< std::string > fStubTags
Analyzer module for use with sbn::Stub and sbn::VertexHit objects.
float dedx
Recombination corrected dQ/dx [MeV/cm].
static bool IsNeutrino(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as a neutrino.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::vector< geo::BoxBoundedGeo > fFiducialVolumes
std::vector< int > fStubPFPID
std::vector< float > fVertexHitTrueEnergy
geo::WireID wire
Wire that the hit is on.
Declaration of signal hit object.
float StubDirectionDot(const sbn::StubInfo &A, const sbn::StubInfo &B, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
Computes the dot product of two stubs.
std::set< geo::View_t > const & Views() const
Returns a list of possible views in the detector.
std::vector< float > fVertexHitCharge
std::vector< std::vector< StubHit > > hits
Hits on each plane. Ordered vtx->end.
The data type to uniquely identify a Plane.
geo::Point_t end
End of Stub. Space charge corrected. [cm].
Geometry information for a single TPC.
geo::PlaneGeo const & FirstPlane() const
Returns the first wire plane (the closest to TPC center).
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
static bool IsShower(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as shower-like.
geo::TPCGeo const * PositionToTPCptr(geo::Point_t const &point) const
Returns the TPC at specified location.
double ElectronLifetime() const
std::vector< float > fStubDirz
std::vector< int > fStubWires
WireID_t Wire
Index of the wire within its plane.
Internal struct: contains information on stub and other associated data products. ...
std::vector< float > fFSPStartX
bool IsPrimary(const caf::SRTrueParticleProxy &p)
Whether this is a primary particle or generated by a secondary interaction.
std::vector< float > fVertexHitTrueX
float CoreCharge(unsigned plane_index=0) const
Helper functions.
std::vector< int > fStubTruePdg
std::vector< int > fVertexHitWire
std::vector< float > fFSPMaxQ1
geo::Point_t vtx
Interaction Vertex / Start of Stub. Space charge corrected. [cm].
Definition of vertex object for LArSoft.
float charge
Calibrated and lifetime-corrected charge on the hit [#elec].
std::vector< int > fVertexHitSPID
fRangeCalculator(p.get< float >("MinTrackLength", 0.1))
std::vector< float > fStubPFPTruePx
std::vector< std::string > fPFParticleTags
std::vector< float > fStubTrkPitch
TPC_iterator begin_TPC() const
Returns an iterator pointing to the first TPC in the detector.
std::vector< float > vtx_w
Wire coordinate of the vertex on this plane.
std::vector< float > fFSPPz
std::vector< art::Ptr< recob::Hit > > hits
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
std::vector< int > fStubEndW
std::vector< std::pair< int, float > > AllTrueParticleIDEnergyMatches(const detinfo::DetectorClocksData &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
void analyze(art::Event const &e) override
Access the description of detector geometry.
std::vector< float > fStubDirx
std::vector< float > fStubVtxEField
Collection of exceptions for Geometry system.
std::vector< float > fFSPMaxQ0
std::vector< std::string > fVertexHitTags
std::vector< int > fStubHitInd
process_name opflash particleana ie ie y
std::vector< float > fVertexHitdEdx
std::vector< float > fStubPFPTruePy
Ionization at a point of the TPC sensitive volume.
std::vector< float > fStubEndy
NuVertexChargeTree & operator=(NuVertexChargeTree const &)=delete
NuVertexChargeTree(fhicl::ParameterSet const &p)
std::vector< int > fStubMatchOverlaps
std::vector< short > hit_w
Wire of the end point hit on this plane.
std::vector< float > fFSPStartZ
std::vector< float > fStubCharge
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
std::vector< float > fStubTruePx
void FillVertexHits(const std::vector< art::Ptr< sbn::VertexHit >> &hits, const std::vector< art::Ptr< recob::Hit >> &hit_hits, const detinfo::DetectorPropertiesData &dprop, const detinfo::DetectorClocksData &clock_data, const std::vector< art::Ptr< simb::MCParticle >> &trueParticles)
std::vector< float > fFSPKE
bool StubContains(const sbn::StubInfo &A, const sbn::StubInfo &B)
Returns whether stub A contains stub B.
float proj_dist_to_vertex
Distnace from the hit to the vertex on the wireplane.
std::vector< float > fFSPEndY
art::Ptr< recob::Hit > vhit_hit
int fNSlicePrimaryShowers
std::vector< float > fFSPPy
double GetPitch(const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce, geo::Point_t loc, geo::Vector_t dir, geo::View_t view, geo::TPCID tpc, bool correct_sce, bool track_is_sce_corrected, float xsign=1.)
Computes the track-pitch on a plane given an input direction and location.
std::vector< std::vector< geo::BoxBoundedGeo > > fTPCVolumes
std::vector< float > fStubDiry
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
std::vector< float > fStubTrueLength
std::vector< int > fStubMatch
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
std::vector< float > fVertexHitdQdx
Description of geometry of one entire detector.
Declaration of cluster object.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
void FillStubPFPs(const std::vector< art::Ptr< recob::PFParticle >> &stub_pfps, const std::vector< std::vector< art::Ptr< recob::Hit >>> &stub_pfp_hits, const detinfo::DetectorClocksData &clock_data, const std::vector< art::Ptr< simb::MCParticle >> &trueParticles)
void FillNeutrino(const simb::MCTruth &nu, const recob::Vertex &vert, const std::vector< art::Ptr< recob::PFParticle >> &slice_pfps, const std::vector< std::vector< std::pair< int, float >>> &slice_pfp_matches, const std::vector< art::Ptr< simb::MCParticle >> &g4_mcparticles, const std::vector< const sim::GeneratedParticleInfo * > &infos, const geo::GeometryCore &geo, const detinfo::DetectorPropertiesData &dprop)
std::vector< int > fStubPFPTruePdg
trkf::TrackMomentumCalculator fRangeCalculator
float efield_end
The E-Field at the stub end point.
std::vector< float > fFSPStartY
void respondToOpenInputFile(const art::FileBlock &fb) override
Provides recob::Track data product.
float efield_vtx
The E-Field at the reconstructed vertex.
std::vector< float > fFSPE
std::vector< float > fStubEndEField
int fNSlicePrimaryParticles
std::vector< int > fFSPMatchedPID
Provides a base class aware of world box coordinates.
std::vector< TCSlice > slices
std::vector< bool > fFSPIsStopping
void FillMeta(const art::Event &evt)
std::vector< float > fStubTruePy
std::array< float, 6 > fFiducialInset
double ConvertTicksToX(double ticks, int p, int t, int c) const
IteratorBox< cryostat_iterator,&GeometryCore::begin_cryostat,&GeometryCore::end_cryostat > IterateCryostats() const
Enables ranged-for loops on all cryostats of the detector.
art::Ptr< sbn::VertexHit > vhit
std::vector< float > fVertexHitTrueBraggProtonEnergy
std::vector< float > fVertexHitPeakX
const simb::MCParticle * Genie2G4MCParticle(const simb::MCParticle &genie_part, const simb::MCTruth &mctruth, const std::vector< art::Ptr< simb::MCParticle >> &g4_mcparticles, const std::vector< const sim::GeneratedParticleInfo * > infos)
std::vector< float > fFSPVisE
float pitch
Computed pitch of a track traversing from the vertex to this hit. Space charge corrected. [cm].
std::vector< float > fStubXPlaneMatchTOff
std::vector< float > fStubEndx
std::vector< bool > fFSPMtachedPrimary
Contains all timing reference information for the detector.
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
std::vector< int > fFSPPID
std::vector< float > fStubTrueKE
std::vector< int > fStubQLength
std::vector< float > fStubLength
std::vector< float > fVertexHitPitch
std::vector< int > fStubTrueID
std::vector< float > fStubQs
std::vector< bool > fFSPMatchedPFPPrimary
static bool IsTrack(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as track-like.
std::vector< float > fStubPitch
Exception thrown on invalid wire number.
std::vector< float > fVertexHitTrueProtonEnergy
std::vector< float > fFSPLen
std::vector< float > fStubVtxW
std::vector< float > fVertexHitDist
std::vector< float > fFSPPitch1
int spID
ID of the SpacePoint associated with this hit.
std::vector< float > trkpitch
Pitch of the matched track on each wire [cm].
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
art::ServiceHandle< art::TFileService > tfs
std::vector< float > fFSPPitch0
float StubPeakChargeOffset(const sbn::StubInfo &A, const sbn::StubInfo &B)
Difference of the endpoint charge between two stubs.
int CoreNHit(unsigned plane_index=0) const
Returns the number of hits along the core of the stub on the given plane index.
std::vector< float > fStubTruePz
std::vector< int > fStubXPlaneMatchLength
Forward iterator browsing all geometry elements in the detector.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
std::vector< float > pitch
Pitch of stub on each wire [cm].
std::vector< int > fStubMatchLength
helper function for LArPandoraInterface producer module
std::vector< float > fFSPQ
const Point_t & position() const
Return vertex 3D position.
art framework interface to geometry description
void FillStubs(const std::vector< sbn::StubInfo > &stubs, const std::vector< unsigned > &stub_hit_inds, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop, const detinfo::DetectorClocksData &clock_data, const std::vector< art::Ptr< simb::MCParticle >> &trueParticles)
std::vector< float > fStubEndz
void FillSlice(const std::vector< art::Ptr< recob::PFParticle >> &slice_particles)
std::vector< float > fStubXPlaneMatchQOff
TPC_iterator end_TPC() const
Returns an iterator pointing after the last TPC in the detector.
std::vector< float > fStubPFPTruePz
float vtxw
Wire of the vertex associated with this hit. Not space charge corrected. [cm].
art::Ptr< recob::PFParticle > pfp