10 #include "art/Framework/Core/EDAnalyzer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "canvas/Utilities/InputTag.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
20 #include "art_root_io/TFileService.h"
26 #include "nusimdata/SimulationBase/MCParticle.h"
27 #include "sbnobj/Common/Reco/PCAnglePlane.h"
28 #include "sbnobj/Common/Reco/PCAngleKink.h"
38 class PCAngleKinkTree;
55 void analyze(art::Event
const&
e)
override;
67 void FillTruth(
const simb::MCParticle &trueParticle,
const std::vector<art::Ptr<simb::MCParticle>> &allParticles);
68 void FillTrueScatter(TLorentzVector pos, TLorentzVector mom0, TLorentzVector mom1,
bool elastic);
75 std::vector<int> &scatter_match_plane,
76 std::vector<float> &scatter_dist_plane,
77 const std::vector<float> &scatterW,
78 const std::vector<float> &reco_kinkT,
79 const std::vector<float> &reco_kinkW);
201 fPFParticleTags(
p.get<std::vector<std::string>>(
"ParticleTags")),
202 fAngleTags(
p.get<std::vector<std::string>>(
"AngleTags")),
203 fKinkTags(
p.get<std::vector<std::string>>(
"KinkTags")),
204 fAngleCut(
p.get<
float>(
"AngleCut", 5.)),
205 fRequireReco(
p.get<
bool>(
"RequireReco",
false))
210 art::ServiceHandle<art::TFileService>
tfs;
212 _tree = tfs->make<TTree>(
"PCAngleKinkAnalyzer",
"kink_tree");
214 _tree->Branch(
"pcangle_u", &fPCAngleU);
215 _tree->Branch(
"pcangle_v", &fPCAngleV);
216 _tree->Branch(
"pcangle_y", &fPCAngleY);
218 _tree->Branch(
"pcangle_u_id", &fPCAngleUID);
219 _tree->Branch(
"pcangle_v_id", &fPCAngleVID);
220 _tree->Branch(
"pcangle_y_id", &fPCAngleYID);
222 _tree->Branch(
"pcangle_u_gen", &fPCAngleUGen);
223 _tree->Branch(
"pcangle_v_gen", &fPCAngleVGen);
224 _tree->Branch(
"pcangle_y_gen", &fPCAngleYGen);
226 _tree->Branch(
"kink_time_max_u", &fKinkTimeMaxU);
227 _tree->Branch(
"kink_wire_max_u", &fKinkWireMaxU);
228 _tree->Branch(
"kink_time_lo_u", &fKinkTimeLoU);
229 _tree->Branch(
"kink_wire_lo_u", &fKinkWireLoU);
230 _tree->Branch(
"kink_time_hi_u", &fKinkTimeHiU);
231 _tree->Branch(
"kink_wire_hi_u", &fKinkWireHiU);
232 _tree->Branch(
"kink_est_angle_u", &fKinkEstAngleU);
233 _tree->Branch(
"kink_max_angle_u", &fKinkMaxAngleU);
234 _tree->Branch(
"kink_lohi_angle_u", &fKinkLoHiAngleU);
235 _tree->Branch(
"kink_fit_angle_u", &fKinkFitAngleU);
236 _tree->Branch(
"kink_fit_pitch_u", &fKinkFitPitchU);
237 _tree->Branch(
"kink_fit_chi2_u", &fKinkFitChi2U);
239 _tree->Branch(
"kink_time_max_v", &fKinkTimeMaxV);
240 _tree->Branch(
"kink_wire_max_v", &fKinkWireMaxV);
241 _tree->Branch(
"kink_time_lo_v", &fKinkTimeLoV);
242 _tree->Branch(
"kink_wire_lo_v", &fKinkWireLoV);
243 _tree->Branch(
"kink_time_hi_v", &fKinkTimeHiV);
244 _tree->Branch(
"kink_wire_hi_v", &fKinkWireHiV);
245 _tree->Branch(
"kink_est_angle_v", &fKinkEstAngleV);
246 _tree->Branch(
"kink_max_angle_v", &fKinkMaxAngleV);
247 _tree->Branch(
"kink_lohi_angle_v", &fKinkLoHiAngleV);
248 _tree->Branch(
"kink_fit_angle_v", &fKinkFitAngleV);
249 _tree->Branch(
"kink_fit_pitch_v", &fKinkFitPitchV);
250 _tree->Branch(
"kink_fit_chi2_v", &fKinkFitChi2V);
252 _tree->Branch(
"kink_time_max_y", &fKinkTimeMaxY);
253 _tree->Branch(
"kink_wire_max_y", &fKinkWireMaxY);
254 _tree->Branch(
"kink_time_lo_y", &fKinkTimeLoY);
255 _tree->Branch(
"kink_wire_lo_y", &fKinkWireLoY);
256 _tree->Branch(
"kink_time_hi_y", &fKinkTimeHiY);
257 _tree->Branch(
"kink_wire_hi_y", &fKinkWireHiY);
258 _tree->Branch(
"kink_est_angle_y", &fKinkEstAngleY);
259 _tree->Branch(
"kink_max_angle_y", &fKinkMaxAngleY);
260 _tree->Branch(
"kink_lohi_angle_y", &fKinkLoHiAngleY);
261 _tree->Branch(
"kink_fit_angle_y", &fKinkFitAngleY);
262 _tree->Branch(
"kink_fit_pitch_y", &fKinkFitPitchY);
263 _tree->Branch(
"kink_fit_chi2_y", &fKinkFitChi2Y);
265 _tree->Branch(
"traj_x", &fTrajX);
266 _tree->Branch(
"traj_y", &fTrajY);
267 _tree->Branch(
"traj_z", &fTrajZ);
268 _tree->Branch(
"traj_pu", &fTrajPU);
269 _tree->Branch(
"traj_pv", &fTrajPV);
270 _tree->Branch(
"traj_py", &fTrajPY);
271 _tree->Branch(
"traj_pt", &fTrajPT);
273 _tree->Branch(
"scatter_mom1_x", &fScatterM1X);
274 _tree->Branch(
"scatter_mom1_y", &fScatterM1Y);
275 _tree->Branch(
"scatter_mom1_z", &fScatterM1Z);
276 _tree->Branch(
"scatter_mom1_p", &fScatterM1P);
277 _tree->Branch(
"scatter_mom0_x", &fScatterM0X);
278 _tree->Branch(
"scatter_mom0_y", &fScatterM0Y);
279 _tree->Branch(
"scatter_mom0_z", &fScatterM0Z);
280 _tree->Branch(
"scatter_mom0_p", &fScatterM0P);
282 _tree->Branch(
"scatter_x", &fScatterX);
283 _tree->Branch(
"scatter_y", &fScatterY);
284 _tree->Branch(
"scatter_z", &fScatterZ);
285 _tree->Branch(
"scatter_pu", &fScatterPU);
286 _tree->Branch(
"scatter_pv", &fScatterPV);
287 _tree->Branch(
"scatter_py", &fScatterPY);
288 _tree->Branch(
"scatter_pt", &fScatterPT);
290 _tree->Branch(
"scatter_mag", &fScatterMag);
291 _tree->Branch(
"scatter_mag_u", &fScatterMagU);
292 _tree->Branch(
"scatter_mag_v", &fScatterMagV);
293 _tree->Branch(
"scatter_mag_y", &fScatterMagY);
295 _tree->Branch(
"scatter_is_elastic", &fScatterIsElastic);
297 _tree->Branch(
"scatter_match_u", &fScatterMatchU);
298 _tree->Branch(
"scatter_match_dist_u", &fScatterMatchDistU);
299 _tree->Branch(
"scatter_match_v", &fScatterMatchV);
300 _tree->Branch(
"scatter_match_dist_v", &fScatterMatchDistV);
301 _tree->Branch(
"scatter_match_y", &fScatterMatchY);
302 _tree->Branch(
"scatter_match_dist_y", &fScatterMatchDistY);
304 _tree->Branch(
"true_pdg", &fTruePDG,
"true_pdg/i");
305 _tree->Branch(
"true_p", &fTrueP,
"true_p/F");
306 _tree->Branch(
"true_e", &fTrueE,
"true_e/F");
307 _tree->Branch(
"true_end_p", &fTrueEndP,
"true_end_p/F");
308 _tree->Branch(
"true_end_e", &fTrueEndE,
"true_end_e/F");
309 _tree->Branch(
"true_end_scatter", &fTrueEndScatter,
"true_end_scatter/O");
312 _tree->Branch(
"ievt", &fIEvt,
"ievt/i");
313 _tree->Branch(
"evt", &fEvt,
"evt/i");
314 _tree->Branch(
"pfpid", &fPFPID,
"pfpid/i");
326 fPCAngleUGen.clear();
327 fPCAngleVGen.clear();
328 fPCAngleYGen.clear();
330 fKinkTimeMaxU.clear();
331 fKinkWireMaxU.clear();
332 fKinkTimeLoU.clear();
333 fKinkWireLoU.clear();
334 fKinkTimeHiU.clear();
335 fKinkWireHiU.clear();
336 fKinkEstAngleU.clear();
337 fKinkMaxAngleU.clear();
338 fKinkLoHiAngleU.clear();
339 fKinkFitAngleU.clear();
340 fKinkFitPitchU.clear();
341 fKinkFitChi2U.clear();
343 fKinkTimeMaxV.clear();
344 fKinkWireMaxV.clear();
345 fKinkTimeLoV.clear();
346 fKinkWireLoV.clear();
347 fKinkTimeHiV.clear();
348 fKinkWireHiV.clear();
349 fKinkEstAngleV.clear();
350 fKinkMaxAngleV.clear();
351 fKinkLoHiAngleV.clear();
352 fKinkFitAngleV.clear();
353 fKinkFitPitchV.clear();
354 fKinkFitChi2V.clear();
356 fKinkTimeMaxY.clear();
357 fKinkWireMaxY.clear();
358 fKinkTimeLoY.clear();
359 fKinkWireLoY.clear();
360 fKinkTimeHiY.clear();
361 fKinkWireHiY.clear();
362 fKinkEstAngleY.clear();
363 fKinkMaxAngleY.clear();
364 fKinkLoHiAngleY.clear();
365 fKinkFitAngleY.clear();
366 fKinkFitPitchY.clear();
367 fKinkFitChi2Y.clear();
392 fScatterMagU.clear();
393 fScatterMagV.clear();
394 fScatterMagY.clear();
396 fScatterIsElastic.clear();
398 fScatterMatchU.clear();
399 fScatterMatchDistU.clear();
400 fScatterMatchV.clear();
401 fScatterMatchDistV.clear();
402 fScatterMatchY.clear();
403 fScatterMatchDistY.clear();
419 fTrueEndScatter =
false;
432 pos.Vect().GetXYZ(posarr);
437 float angle = mom1.Vect().Angle(mom0.Vect());
439 std::cout <<
"Parent momentum: " << mom0.Px() <<
" " << mom0.Py() <<
" " << mom0.Pz() << std::endl;
440 std::cout <<
"Child momentum: " << mom1.Px() <<
" " << mom1.Py() <<
" " << mom1.Pz() << std::endl;
441 std::cout <<
"angle: " << angle << std::endl;
444 if (angle*(180. / M_PI) < fAngleCut)
return;
446 fScatterM1X.push_back(mom1.Px());
447 fScatterM1Y.push_back(mom1.Py());
448 fScatterM1Z.push_back(mom1.Pz());
449 fScatterM1P.push_back(mom1.P());
451 fScatterM0X.push_back(mom0.Px());
452 fScatterM0Y.push_back(mom0.Py());
453 fScatterM0Z.push_back(mom0.Pz());
454 fScatterM0P.push_back(mom0.P());
456 fScatterX.push_back(pos.X());
457 fScatterY.push_back(pos.Y());
458 fScatterZ.push_back(pos.Z());
463 fScatterPT.push_back(pos.X());
465 fScatterMag.push_back(angle);
468 double scatter_wireplane[3];
469 for (
unsigned i_plane = 0; i_plane < 3; i_plane++) {
472 TVector3 v0(mom0.Px(),
473 sin(wire_angle_tovert) * mom0.Pz() + cos(wire_angle_tovert) * mom0.Py(), 0.);
474 TVector3 v1(mom1.Px(),
475 sin(wire_angle_tovert) * mom1.Pz() + cos(wire_angle_tovert) * mom1.Py(), 0.);
476 if (v0.Mag() < 1
e-6 || v1.Mag() < 1
e-6) scatter_wireplane[i_plane] = 0.;
477 else scatter_wireplane[i_plane] = v1.Unit().Angle(v0.Unit());
479 fScatterMagU.push_back(scatter_wireplane[0]);
480 fScatterMagV.push_back(scatter_wireplane[1]);
481 fScatterMagY.push_back(scatter_wireplane[2]);
483 fScatterIsElastic.push_back(elastic);
490 fTruePDG = trueParticle.PdgCode();
491 fTrueE = trueParticle.Momentum().E();
492 fTrueP = trueParticle.Momentum().P();
494 fTrueEndP = trueParticle.EndMomentum().P();
495 fTrueEndE = trueParticle.EndMomentum().E();
497 bool scatters = !(trueParticle.EndProcess() ==
"Decay" ||
498 trueParticle.EndProcess() ==
"CoupledTransportation" ||
499 trueParticle.EndProcess() ==
"FastScintillation" ||
500 trueParticle.EndProcess() ==
"muMinusCaptureAtRest" ||
501 trueParticle.EndProcess() ==
"LArVoxelReadoutScoringProcess");
502 fTrueEndScatter = scatters;
505 for (
unsigned i_traj = 0; i_traj < trueParticle.NumberTrajectoryPoints(); i_traj ++) {
506 TLorentzVector pos = trueParticle.Position(i_traj);
507 TLorentzVector mom = trueParticle.Momentum(i_traj);
509 fTrajX.push_back(pos.X());
510 fTrajY.push_back(pos.Y());
511 fTrajZ.push_back(pos.Z());
516 fTrajPT.push_back(pos.X());
520 FillTrueScatter(trueParticle.Position(i_traj), trueParticle.Momentum(i_traj-1), trueParticle.Momentum(i_traj),
true);
525 if (scatters && trueParticle.NumberTrajectoryPoints() > 1) {
526 for (
int i_daughter = 0; i_daughter < trueParticle.NumberDaughters(); i_daughter++) {
527 int daughterID = trueParticle.Daughter(i_daughter);
528 int daughter_ind = -1;
529 for (
unsigned i = 0; i < allParticles.size(); i++) {
530 if (allParticles[i]->TrackId() == daughterID) {
536 if (daughter_ind >= 0) {
537 const simb::MCParticle &daughter = *allParticles[daughter_ind];
538 int pdg =
abs(daughter.PdgCode());
539 if (pdg == 211 || pdg == 2112) {
540 FillTrueScatter(trueParticle.EndPosition(), trueParticle.Momentum(trueParticle.NumberTrajectoryPoints() - 2), daughter.Momentum(),
false);
550 for (
unsigned i_kink = 0; i_kink < kinks.size(); i_kink++) {
551 const sbn::PCAngleKink &kink = *kinks[i_kink];
552 unsigned plane_no = kink.maxWire.Plane;
554 fKinkTimeMaxU.push_back(kink.position_max[0]);
555 fKinkWireMaxU.push_back(kink.position_max[1]);
556 fKinkTimeLoU.push_back(kink.position_lo[0]);
557 fKinkWireLoU.push_back(kink.position_lo[1]);
558 fKinkTimeHiU.push_back(kink.position_hi[0]);
559 fKinkWireHiU.push_back(kink.position_hi[1]);
560 fKinkEstAngleU.push_back(kink.est_angle);
561 fKinkMaxAngleU.push_back(kink.max_angle);
562 fKinkLoHiAngleU.push_back(M_PI -
sbnpca::VecAngle(kink.vec_lo_at_halfmax_lo, kink.vec_hi_at_halfmax_hi));
563 fKinkFitAngleU.push_back(kink.fit_angle);
564 fKinkFitPitchU.push_back(kink.fit_pitch);
565 fKinkFitChi2U.push_back(kink.fit_chi2);
567 else if (plane_no == 1) {
568 fKinkTimeMaxV.push_back(kink.position_max[0]);
569 fKinkWireMaxV.push_back(kink.position_max[1]);
570 fKinkTimeLoV.push_back(kink.position_lo[0]);
571 fKinkWireLoV.push_back(kink.position_lo[1]);
572 fKinkTimeHiV.push_back(kink.position_hi[0]);
573 fKinkWireHiV.push_back(kink.position_hi[1]);
574 fKinkEstAngleV.push_back(kink.est_angle);
575 fKinkMaxAngleV.push_back(kink.max_angle);
576 fKinkLoHiAngleV.push_back(M_PI -
sbnpca::VecAngle(kink.vec_lo_at_halfmax_lo, kink.vec_hi_at_halfmax_hi));
577 fKinkFitAngleV.push_back(kink.fit_angle);
578 fKinkFitPitchV.push_back(kink.fit_pitch);
579 fKinkFitChi2V.push_back(kink.fit_chi2);
581 else if (plane_no == 2) {
582 fKinkTimeMaxY.push_back(kink.position_max[0]);
583 fKinkWireMaxY.push_back(kink.position_max[1]);
584 fKinkTimeLoY.push_back(kink.position_lo[0]);
585 fKinkWireLoY.push_back(kink.position_lo[1]);
586 fKinkTimeHiY.push_back(kink.position_hi[0]);
587 fKinkWireHiY.push_back(kink.position_hi[1]);
588 fKinkEstAngleY.push_back(kink.est_angle);
589 fKinkMaxAngleY.push_back(kink.max_angle);
590 fKinkLoHiAngleY.push_back(M_PI -
sbnpca::VecAngle(kink.vec_lo_at_halfmax_lo, kink.vec_hi_at_halfmax_hi));
591 fKinkFitAngleY.push_back(kink.fit_angle);
592 fKinkFitPitchY.push_back(kink.fit_pitch);
593 fKinkFitChi2Y.push_back(kink.fit_chi2);
599 fPFPID = particle.
Self();
603 for (
unsigned i_angle = 0; i_angle < angles.size(); i_angle++) {
604 const sbn::PCAnglePlane &
angle = *angles[i_angle];
605 if (angle.plane.Plane == 0) {
606 for (
unsigned i = 0; i < angle.angles.size(); i++) {
607 for (
const sbn::PCAngle &
a: angle.angles[i]) {
608 fPCAngleU.push_back(
a);
609 fPCAngleUID.push_back(angle.branchIDs[i]);
610 fPCAngleUGen.push_back(angle.generations[i]);
614 else if (angle.plane.Plane == 1) {
615 for (
unsigned i = 0; i < angle.angles.size(); i++) {
616 for (
const sbn::PCAngle &
a: angle.angles[i]) {
617 fPCAngleV.push_back(
a);
618 fPCAngleVID.push_back(angle.branchIDs[i]);
619 fPCAngleVGen.push_back(angle.generations[i]);
623 else if (angle.plane.Plane == 2) {
624 for (
unsigned i = 0; i < angle.angles.size(); i++) {
625 for (
const sbn::PCAngle &
a: angle.angles[i]) {
626 fPCAngleY.push_back(
a);
627 fPCAngleYID.push_back(angle.branchIDs[i]);
628 fPCAngleYGen.push_back(angle.generations[i]);
637 std::vector<int> &scatter_match_plane,
638 std::vector<float> &scatter_dist_plane,
639 const std::vector<float> &scatterW,
640 const std::vector<float> &reco_kinkT,
641 const std::vector<float> &reco_kinkW) {
643 for (
unsigned i = 0; i < scatterW.size(); i++) {
644 TVector3 true_scatter(fScatterPT[i], scatterW[i], 0.);
645 float min_dist = 100000000.;
647 for (
unsigned j = 0; j < reco_kinkT.size(); j++) {
648 TVector3 reco_kink(reco_kinkT[j], reco_kinkW[j], 0.);
649 if ((true_scatter - reco_kink).Mag() < min_dist) {
650 min_dist = (true_scatter - reco_kink).Mag();
654 scatter_match_plane.push_back(min_ind);
655 scatter_dist_plane.push_back(min_dist);
661 MatchPlaneKinks(0, fScatterMatchU, fScatterMatchDistU, fScatterPU, fKinkTimeMaxU, fKinkWireMaxU);
662 MatchPlaneKinks(1, fScatterMatchV, fScatterMatchDistV, fScatterPV, fKinkTimeMaxV, fKinkWireMaxV);
663 MatchPlaneKinks(2, fScatterMatchY, fScatterMatchDistY, fScatterPY, fKinkTimeMaxY, fKinkWireMaxY);
669 art::ServiceHandle<cheat::BackTrackerService> bt;
670 auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
673 std::vector<std::vector<art::Ptr<recob::PFParticle>>> particleList;
674 std::vector<art::FindManyP<sbn::PCAnglePlane>> particleAngleList;
675 std::vector<art::FindManyP<sbn::PCAngleKink>> particleKinkList;
676 std::vector<art::FindManyP<recob::Cluster>> particleClusterList;
678 for (
unsigned i = 0; i < fPFParticleTags.size(); i++) {
679 art::Handle<std::vector<recob::PFParticle>> pfparticle_handle;
680 evt.getByLabel(fPFParticleTags.at(i), pfparticle_handle);
681 particleList.emplace_back();
682 art::fill_ptr_vector(particleList.back(), pfparticle_handle);
683 particleAngleList.emplace_back(particleList.back(),
evt, fAngleTags.at(i));
684 particleKinkList.emplace_back(particleList.back(),
evt, fKinkTags.at(i));
685 particleClusterList.emplace_back(particleList.back(),
evt, fPFParticleTags.at(i));
689 std::vector<art::Ptr<recob::PFParticle>> particles;
690 std::vector<std::vector<art::Ptr<sbn::PCAnglePlane>>> particleAngles;
691 std::vector<std::vector<art::Ptr<sbn::PCAngleKink>>> particleKinks;
692 std::vector<std::vector<art::Ptr<recob::Cluster>>> particleClusters;
693 std::vector<std::vector<art::Ptr<recob::Hit>>> particleHits;
695 for (
unsigned i = 0; i < particleList.size(); i++) {
696 particles.insert(particles.end(), particleList[i].begin(), particleList[i].end());
698 for (
unsigned j = 0; j < particleList[i].size(); j++) {
699 particleAngles.push_back(particleAngleList[i].at(j));
700 particleKinks.push_back(particleKinkList[i].at(j));
701 particleClusters.push_back(particleClusterList[i].at(j));
703 particleHits.emplace_back();
704 art::FindManyP<recob::Hit> clusterHits(particleClusters.back(),
evt, fPFParticleTags.at(i));
705 for (
unsigned i_clus = 0; i_clus < particleClusters.back().size(); i_clus++) {
706 particleHits.back().insert(particleHits.back().end(), clusterHits.at(i_clus).begin(), clusterHits.at(i_clus).end());
712 art::Handle<std::vector<simb::MCParticle>> trueParticleHandle;
713 evt.getByLabel(
"largeant", trueParticleHandle);
714 std::vector<art::Ptr<simb::MCParticle>> trueParticles;
715 art::fill_ptr_vector(trueParticles, trueParticleHandle);
717 std::vector<unsigned> primary;
719 for (
unsigned i_mcpart = 0; i_mcpart < trueParticles.size(); i_mcpart++) {
720 if (trueParticles[i_mcpart]->Process() ==
"primary") {
721 primary.push_back(i_mcpart);
726 for (
unsigned i_mcpart: primary) {
727 const art::Ptr<simb::MCParticle> &truep = trueParticles[i_mcpart];
734 FillTruth(*truep, trueParticles);
738 const std::vector<const sim::IDE*> mcparticle_ides = bt->TrackIdToSimIDEs_Ps(truep->TrackId());
740 float mcparticle_energy = 0.;
741 for (
auto const &ide: mcparticle_ides) {
742 mcparticle_energy += ide->energy;
747 int i_reco_match = -1;
748 for (
unsigned i_part = 0; i_part < particles.size(); i_part++) {
749 const std::vector<art::Ptr<recob::Hit>> &hits = particleHits[i_part];
752 int match_id = matches.size() ? std::max_element(matches.begin(), matches.end(),
753 [](
const auto &
a,
const auto &b) {
return a.second < b.second; })->
first : -1;
754 float matchE = matches.size() ? std::max_element(matches.begin(), matches.end(),
755 [](
const auto &
a,
const auto &b) {
return a.second < b.second; })->
second : -1;
756 float totalE = std::accumulate(matches.begin(), matches.end(), 0.,
757 [](
auto const &
a,
auto const &b) {
return a + b.second;});
759 if (match_id == truep->TrackId() && matchE / mcparticle_energy > 0.5 && matchE / totalE > 0.5) {
760 i_reco_match = i_part;
766 if (i_reco_match >= 0) {
768 const std::vector<art::Ptr<sbn::PCAnglePlane>> &
angle = particleAngles[i_reco_match];
769 const std::vector<art::Ptr<sbn::PCAngleKink>> &kinks = particleKinks[i_reco_match];
771 FillParticle(particle);
772 FillAngles(particle, angle);
773 FillKinks(particle, kinks);
778 if (i_reco_match < 0 && fRequireReco)
continue;
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
std::vector< int > fPCAngleVGen
std::vector< float > fKinkWireHiU
std::vector< float > fScatterMatchDistV
std::vector< float > fKinkTimeHiU
std::vector< sbn::PCAngle > fPCAngleV
std::vector< float > fScatterMag
std::vector< float > fScatterPU
std::vector< std::string > fKinkTags
std::vector< float > fScatterMagU
void FillParticle(const recob::PFParticle &particle)
BEGIN_PROLOG true icarus_rawdigitfilter FilterTools FilterPlane1 Plane
std::vector< int > fScatterMatchU
std::vector< float > fKinkFitChi2Y
static constexpr TPCID_t InvalidID
Special code for an invalid ID.
size_t Self() const
Returns the index of this particle.
void MatchPlaneKinks(unsigned Plane, std::vector< int > &scatter_match_plane, std::vector< float > &scatter_dist_plane, const std::vector< float > &scatterW, const std::vector< float > &reco_kinkT, const std::vector< float > &reco_kinkW)
std::vector< float > fScatterMagV
std::vector< float > fScatterM1Y
std::vector< int > fScatterMatchY
void FillTruth(const simb::MCParticle &trueParticle, const std::vector< art::Ptr< simb::MCParticle >> &allParticles)
std::vector< float > fKinkWireHiV
std::vector< float > fKinkWireHiY
Declaration of signal hit object.
std::vector< int > fScatterMatchV
The data type to uniquely identify a Plane.
std::vector< float > fTrajPT
std::vector< float > fScatterY
std::vector< float > fKinkWireLoU
std::vector< float > fKinkFitAngleY
std::vector< float > fScatterM0Z
std::vector< float > fKinkTimeLoU
std::vector< float > fKinkTimeMaxV
std::vector< float > fKinkEstAngleU
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
std::vector< float > fKinkLoHiAngleU
std::vector< float > fKinkTimeLoV
std::vector< float > fKinkMaxAngleY
void FillKinks(const recob::PFParticle &particle, const std::vector< art::Ptr< sbn::PCAngleKink >> &kinks)
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
std::vector< sbn::PCAngle > fPCAngleU
std::vector< int > fPCAngleVID
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.
std::vector< int > fPCAngleYID
Access the description of detector geometry.
std::vector< std::string > fPFParticleTags
std::vector< float > fScatterMatchDistY
std::vector< float > fTrajPU
std::vector< float > fKinkFitPitchV
void FillMeta(const art::Event &evt)
std::vector< float > fScatterMatchDistU
std::vector< float > fKinkFitPitchU
std::vector< float > fTrajZ
void FillTrueScatter(TLorentzVector pos, TLorentzVector mom0, TLorentzVector mom1, bool elastic)
std::vector< float > fKinkTimeHiY
float VecAngle(std::array< float, 2 > A, std::array< float, 2 > B)
void analyze(art::Event const &e) override
The data type to uniquely identify a TPC.
Description of geometry of one entire detector.
Declaration of cluster object.
std::vector< float > fKinkFitAngleV
std::vector< float > fKinkLoHiAngleV
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
std::vector< float > fTrajY
std::vector< float > fKinkFitChi2U
std::vector< float > fKinkTimeLoY
std::vector< float > fKinkFitChi2V
std::vector< float > fScatterM0Y
std::vector< float > fScatterM0X
std::vector< float > fScatterMagY
std::vector< float > fKinkFitPitchY
std::vector< float > fKinkWireMaxU
Hierarchical representation of particle flow.
PCAngleKinkTree(fhicl::ParameterSet const &p)
std::vector< float > fKinkWireMaxV
std::vector< sbn::PCAngle > fPCAngleY
std::vector< float > fScatterPT
std::vector< float > fKinkEstAngleY
std::vector< float > fKinkWireLoV
std::vector< float > fScatterM1Z
void respondToOpenInputFile(const art::FileBlock &fb)
std::vector< int > fPCAngleUID
std::vector< float > fKinkLoHiAngleY
std::vector< float > fScatterM0P
std::vector< float > fKinkTimeMaxY
std::vector< float > fScatterPV
std::vector< float > fTrajPY
std::vector< bool > fScatterIsElastic
PCAngleKinkTree & operator=(PCAngleKinkTree const &)=delete
finds tracks best matching by angle
std::vector< float > fKinkTimeMaxU
std::vector< float > fKinkFitAngleU
std::vector< float > fKinkWireLoY
art::ServiceHandle< art::TFileService > tfs
std::vector< float > fScatterZ
std::vector< float > fScatterPY
std::vector< float > fTrajPV
TPCID_t TPC
Index of the TPC within its cryostat.
std::vector< float > fScatterM1X
std::vector< float > fKinkEstAngleV
std::vector< float > fKinkMaxAngleV
void FillAngles(const recob::PFParticle &particle, const std::vector< art::Ptr< sbn::PCAnglePlane >> &angles)
std::vector< std::string > fAngleTags
double WireAngleToVertical(geo::View_t view, geo::TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
std::vector< float > fKinkTimeHiV
art framework interface to geometry description
BEGIN_PROLOG could also be cout
std::vector< float > fScatterM1P
std::vector< int > fPCAngleUGen
std::vector< float > fKinkWireMaxY
std::vector< float > fTrajX
std::vector< float > fScatterX
std::vector< float > fKinkMaxAngleU
std::vector< int > fPCAngleYGen