Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
LArPandoraEventDump_module.cc
Go to the documentation of this file.
1
7#include "art/Framework/Core/EDAnalyzer.h"
8#include "art/Framework/Core/ModuleMacros.h"
9#include "art/Framework/Principal/Event.h"
10
11#include "fhiclcpp/ParameterSet.h"
12
13#include "lardata/Utilities/AssociationUtil.h"
14
15#include "lardataobj/RecoBase/Cluster.h"
16#include "lardataobj/RecoBase/Hit.h"
17#include "lardataobj/RecoBase/PCAxis.h"
18#include "lardataobj/RecoBase/PFParticle.h"
19#include "lardataobj/RecoBase/PFParticleMetadata.h"
20#include "lardataobj/RecoBase/Seed.h"
21#include "lardataobj/RecoBase/Shower.h"
22#include "lardataobj/RecoBase/Slice.h"
23#include "lardataobj/RecoBase/SpacePoint.h"
24#include "lardataobj/RecoBase/Track.h"
25#include "lardataobj/RecoBase/Vertex.h"
26
28
29namespace lar_pandora {
30
31 class LArPandoraEventDump : public art::EDAnalyzer {
32 public:
33 explicit LArPandoraEventDump(fhicl::ParameterSet const& pset);
34
39
40 void analyze(art::Event const& evt) override;
41
42 private:
43 template <class T>
44 using Collection = art::Handle<std::vector<T>>;
45
46 template <class T>
47 using Association = art::FindManyP<T>;
48
53 public:
62 PandoraData(const art::Event& evt,
63 const std::string& pandoraLabel,
64 const std::string& trackLabel = "",
65 const std::string& showerLabel = "");
66
71
72 // Collections
83
84 // Associations
99
105
108
109 private:
117 template <class T>
118 void LoadCollection(const art::Event& evt,
119 const std::string& label,
120 Collection<T>& collection);
121
130 template <class T, class U>
131 void LoadAssociation(const art::Event& evt,
132 const std::string& label,
133 const Collection<T>& collection,
134 Association<U>*& pAssociation);
135 };
136
137 // -------------------------------------------------------------------------------------------------------------------------------------
138
144 void PrintEventMetadata(const art::Event& evt) const;
145
151 void PrintEventSummary(const PandoraData& data) const;
152
158 void PrintPFParticleHierarchy(const PandoraData& data) const;
159
166 void BuildPFParticleMap(const PandoraData& data, PFParticleMap& pfParticleMap) const;
167
176 void PrintParticle(const art::Ptr<recob::PFParticle>& particle,
177 const PFParticleMap& pfParticleMap,
178 const PandoraData& data,
179 const unsigned int depth) const;
180
187 void PrintHit(const art::Ptr<recob::Hit>& hit, const unsigned int depth) const;
188
196 void PrintSlice(const art::Ptr<recob::Slice>& slice,
197 const PandoraData& data,
198 const unsigned int depth) const;
199
207 void PrintCluster(const art::Ptr<recob::Cluster>& cluster,
208 const PandoraData& data,
209 const unsigned int depth) const;
210
217 void PrintVertex(const art::Ptr<recob::Vertex>& vertex, const unsigned int depth) const;
218
226 void PrintSpacePoint(const art::Ptr<recob::SpacePoint>& spacePoint,
227 const PandoraData& data,
228 const unsigned int depth) const;
229
237 void PrintTrack(const art::Ptr<recob::Track>& track,
238 const PandoraData& data,
239 const unsigned int depth) const;
240
248 void PrintShower(const art::Ptr<recob::Shower>& shower,
249 const PandoraData& data,
250 const unsigned int depth) const;
251
257 void PrintRule(const unsigned int depth) const;
258
265 void PrintTitle(const std::string& name, const unsigned int depth) const;
266
274 template <class T>
275 void PrintProperty(const std::string& name, const T& value, const unsigned int depth) const;
276
277 std::string m_verbosityLevel;
278 std::string m_pandoraLabel;
279 std::string m_trackLabel;
280 std::string m_showerLabel;
281 };
282
283 DEFINE_ART_MODULE(LArPandoraEventDump)
284
285} // namespace lar_pandora
286
287//------------------------------------------------------------------------------------------------------------------------------------------
288// implementation follows
289
290namespace lar_pandora {
291
292 LArPandoraEventDump::LArPandoraEventDump(fhicl::ParameterSet const& pset)
293 : EDAnalyzer(pset)
294 , m_pandoraLabel(pset.get<std::string>("PandoraLabel"))
295 , m_trackLabel(pset.get<std::string>("TrackLabel", ""))
296 , m_showerLabel(pset.get<std::string>("ShowerLabel", ""))
297 {
298 m_verbosityLevel = pset.get<std::string>("VerbosityLevel");
299 std::transform(
300 m_verbosityLevel.begin(), m_verbosityLevel.end(), m_verbosityLevel.begin(), ::tolower);
301
302 if (m_verbosityLevel != "brief" && m_verbosityLevel != "summary" &&
303 m_verbosityLevel != "detailed" && m_verbosityLevel != "extreme") {
304 throw cet::exception("LArPandoraEventDump")
305 << "Unknown verbosity level: " << m_verbosityLevel << std::endl;
306 }
307 }
308
309 //------------------------------------------------------------------------------------------------------------------------------------------
310
311 void LArPandoraEventDump::analyze(art::Event const& evt)
312 {
313 // Load the Pandora owned collections from the event
315
316 this->PrintEventMetadata(evt);
317 this->PrintEventSummary(data);
318
319 if (m_verbosityLevel != "brief") this->PrintPFParticleHierarchy(data);
320 }
321
322 //------------------------------------------------------------------------------------------------------------------------------------------
323
324 void LArPandoraEventDump::PrintEventMetadata(const art::Event& evt) const
325 {
326 std::cout << std::string(80, '=') << std::endl;
327 std::cout << "run : " << evt.run() << std::endl;
328 std::cout << "subRun : " << evt.subRun() << std::endl;
329 std::cout << "event : " << evt.event() << std::endl;
330 std::cout << std::endl;
331 }
332
333 //------------------------------------------------------------------------------------------------------------------------------------------
334
336 {
337 std::cout << std::string(80, '-') << std::endl;
338 std::cout << "Collection sizes" << std::endl;
339 std::cout << std::string(80, '-') << std::endl;
340
341 std::cout << "PFParticle : " << data.m_pfParticleCollection->size() << std::endl;
342 std::cout << "PFParticleMetadata : " << data.m_pfParticleMetadataCollection->size()
343 << std::endl;
344 std::cout << "Cluster : " << data.m_clusterCollection->size() << std::endl;
345 std::cout << "SpacePoint : " << data.m_spacePointCollection->size() << std::endl;
346 std::cout << "Vertex : " << data.m_vertexCollection->size() << std::endl;
347 std::cout << "Track : " << data.m_trackCollection->size() << std::endl;
348 std::cout << "Shower : " << data.m_showerCollection->size() << std::endl;
349 std::cout << "PCAxis : " << data.m_pcAxisCollection->size() << std::endl;
350 std::cout << "Slice : " << data.m_sliceCollection->size() << std::endl;
351 std::cout << std::endl;
352
353 std::cout << std::string(80, '-') << std::endl;
354 std::cout << "Association sizes" << std::endl;
355 std::cout << std::string(80, '-') << std::endl;
356
358 std::cout << "PFParticle -> Metadata : " << data.m_pPFParticleToMetadataAssociation->size()
359 << std::endl;
360
362 std::cout << "PFParticle -> Cluster : " << data.m_pPFParticleToClusterAssociation->size()
363 << std::endl;
364
366 std::cout << "PFParticle -> SpacePoint : "
367 << data.m_pPFParticleToSpacePointAssociation->size() << std::endl;
368
370 std::cout << "PFParticle -> Vertex : " << data.m_pPFParticleToVertexAssociation->size()
371 << std::endl;
372
374 std::cout << "PFParticle -> Track : " << data.m_pPFParticleToTrackAssociation->size()
375 << std::endl;
376
378 std::cout << "PFParticle -> Shower : " << data.m_pPFParticleToShowerAssociation->size()
379 << std::endl;
380
382 std::cout << "PFParticle -> Slice : " << data.m_pPFParticleToSliceAssociation->size()
383 << std::endl;
384
386 std::cout << "Cluster -> Hit : " << data.m_pClusterToHitAssociation->size()
387 << std::endl;
388
390 std::cout << "SpacePoint -> Hit : " << data.m_pSpacePointToHitAssociation->size()
391 << std::endl;
392
394 std::cout << "Track -> Hit : " << data.m_pTrackToHitAssociation->size()
395 << std::endl;
396
398 std::cout << "Shower -> Hit : " << data.m_pShowerToHitAssociation->size()
399 << std::endl;
400
402 std::cout << "Shower -> PCAxis : " << data.m_pShowerToPCAxisAssociation->size()
403 << std::endl;
404
406 std::cout << "Slice -> Hit : " << data.m_pSliceToHitAssociation->size()
407 << std::endl;
408
409 std::cout << std::endl;
410 }
411
412 //------------------------------------------------------------------------------------------------------------------------------------------
413
415 {
416 // Get the mapping from PFParticle ID to PFParticle
417 PFParticleMap pfParticleMap;
418 this->BuildPFParticleMap(data, pfParticleMap);
419
420 // Print all primary PFParticles
421 for (unsigned int i = 0; i < data.m_pfParticleCollection->size(); ++i) {
422 const art::Ptr<recob::PFParticle> particle(data.m_pfParticleCollection, i);
423
424 if (!particle->IsPrimary()) continue;
425
426 this->PrintParticle(particle, pfParticleMap, data, 0);
427 }
428 }
429
430 //------------------------------------------------------------------------------------------------------------------------------------------
431
433 PFParticleMap& pfParticleMap) const
434 {
435 for (unsigned int i = 0; i < data.m_pfParticleCollection->size(); ++i) {
436 const art::Ptr<recob::PFParticle> particle(data.m_pfParticleCollection, i);
437 pfParticleMap[particle->Self()] = particle;
438 }
439 }
440
441 //------------------------------------------------------------------------------------------------------------------------------------------
442
443 void LArPandoraEventDump::PrintParticle(const art::Ptr<recob::PFParticle>& particle,
444 const PFParticleMap& pfParticleMap,
445 const PandoraData& data,
446 const unsigned int depth) const
447 {
448 this->PrintRule(depth);
449 this->PrintTitle("PFParticle", depth);
450 this->PrintRule(depth);
451
452 // Print the PFParticle details
453 this->PrintProperty("Key", particle.key(), depth);
454 this->PrintProperty("Id", particle->Self(), depth);
455 this->PrintProperty("PDG", particle->PdgCode(), depth);
456 this->PrintProperty("IsPrimary", particle->IsPrimary(), depth);
457
458 if (!particle->IsPrimary()) this->PrintProperty("Parent", particle->Parent(), depth);
459
460 // Print the metadata
462 const auto& metadata(data.m_pPFParticleToMetadataAssociation->at(particle.key()));
463 this->PrintProperty("# Metadata", metadata.size(), depth);
464
465 for (const auto& metadatum : metadata) {
466 const auto& propertiesMap(metadatum->GetPropertiesMap());
467 this->PrintProperty("# Properties", propertiesMap.size(), depth + 2);
468
469 for (const auto& propertiesMapEntry : propertiesMap)
470 this->PrintProperty(propertiesMapEntry.first, propertiesMapEntry.second, depth + 4);
471 }
472 }
473
474 // Print the slices
476 const auto& slices(data.m_pPFParticleToSliceAssociation->at(particle.key()));
477 this->PrintProperty("# Slices", slices.size(), depth);
478
479 if (m_verbosityLevel != "summary") {
480 for (const auto& slice : slices)
481 this->PrintSlice(slice, data, depth + 2);
482 }
483 }
484
485 // Print the clusters
487 const auto& clusters(data.m_pPFParticleToClusterAssociation->at(particle.key()));
488 this->PrintProperty("# Clusters", clusters.size(), depth);
489
490 if (m_verbosityLevel != "summary") {
491 for (const auto& cluster : clusters)
492 this->PrintCluster(cluster, data, depth + 2);
493 }
494 }
495
496 // Print the space points
498 const auto& spacePoints(data.m_pPFParticleToSpacePointAssociation->at(particle.key()));
499 this->PrintProperty("# SpacePoints", spacePoints.size(), depth);
500
501 if (m_verbosityLevel != "summary") {
502 for (const auto& spacePoint : spacePoints)
503 this->PrintSpacePoint(spacePoint, data, depth + 2);
504 }
505 }
506
507 // Print the vertices
509 const auto& vertices(data.m_pPFParticleToVertexAssociation->at(particle.key()));
510 this->PrintProperty("# Vertices", vertices.size(), depth);
511
512 if (m_verbosityLevel != "summary") {
513 for (const auto& vertex : vertices)
514 this->PrintVertex(vertex, depth + 2);
515 }
516 }
517
518 // Print the tracks
520 const auto& tracks(data.m_pPFParticleToTrackAssociation->at(particle.key()));
521 this->PrintProperty("# Tracks", tracks.size(), depth);
522
523 if (m_verbosityLevel != "summary") {
524 for (const auto& track : tracks)
525 this->PrintTrack(track, data, depth + 2);
526 }
527 }
528
529 // Print the showers
531 const auto& showers(data.m_pPFParticleToShowerAssociation->at(particle.key()));
532 this->PrintProperty("# Showers", showers.size(), depth);
533
534 if (m_verbosityLevel != "summary") {
535 for (const auto& shower : showers)
536 this->PrintShower(shower, data, depth + 2);
537 }
538 }
539
540 // Print the daughters
541 this->PrintProperty("# Daughters", particle->NumDaughters(), depth);
542 this->PrintRule(depth);
543
544 for (auto& daughterId : particle->Daughters()) {
545 const auto daughterIter(pfParticleMap.find(daughterId));
546
547 if (daughterIter == pfParticleMap.end())
548 throw cet::exception("LArPandoraEventDump")
549 << "Couldn't find daughter of PFParticle in the PFParticle map";
550
551 const auto& daughter(daughterIter->second);
552 this->PrintParticle(daughter, pfParticleMap, data, depth + 4);
553 }
554 }
555
556 //------------------------------------------------------------------------------------------------------------------------------------------
557
558 void LArPandoraEventDump::PrintHit(const art::Ptr<recob::Hit>& hit,
559 const unsigned int depth) const
560 {
561 this->PrintTitle("Hit", depth);
562 this->PrintProperty("Key", hit.key(), depth + 2);
563 this->PrintProperty("Channel", hit->Channel(), depth + 2);
564 this->PrintProperty("View", hit->View(), depth + 2);
565 this->PrintProperty("Peak time", hit->PeakTime(), depth + 2);
566 this->PrintProperty("RMS", hit->RMS(), depth + 2);
567 }
568
569 //------------------------------------------------------------------------------------------------------------------------------------------
570
571 void LArPandoraEventDump::PrintSlice(const art::Ptr<recob::Slice>& slice,
572 const PandoraData& data,
573 const unsigned int depth) const
574 {
575 this->PrintTitle("Slice", depth);
576 this->PrintProperty("Key", slice.key(), depth + 2);
577 this->PrintProperty("ID", slice->ID(), depth + 2);
578
579 if (!data.m_pSliceToHitAssociation) return;
580
581 const auto& hits(data.m_pSliceToHitAssociation->at(slice.key()));
582 this->PrintProperty("# Hits", hits.size(), depth + 2);
583
584 if (m_verbosityLevel != "extreme") return;
585
586 // Print each associated hit
587 for (const auto& hit : hits)
588 this->PrintHit(hit, depth + 4);
589 }
590
591 //------------------------------------------------------------------------------------------------------------------------------------------
592
593 void LArPandoraEventDump::PrintCluster(const art::Ptr<recob::Cluster>& cluster,
594 const PandoraData& data,
595 const unsigned int depth) const
596 {
597 this->PrintTitle("Cluster", depth);
598 this->PrintProperty("Key", cluster.key(), depth + 2);
599 this->PrintProperty("ID", cluster->ID(), depth + 2);
600 this->PrintProperty("View", cluster->View(), depth + 2);
601
602 if (!data.m_pClusterToHitAssociation) return;
603
604 const auto& hits(data.m_pClusterToHitAssociation->at(cluster.key()));
605 this->PrintProperty("# Hits", hits.size(), depth + 2);
606
607 if (m_verbosityLevel == "detailed") return;
608
609 // Print each associated hit
610 for (const auto& hit : hits)
611 this->PrintHit(hit, depth + 4);
612 }
613
614 //------------------------------------------------------------------------------------------------------------------------------------------
615
616 void LArPandoraEventDump::PrintSpacePoint(const art::Ptr<recob::SpacePoint>& spacePoint,
617 const PandoraData& data,
618 const unsigned int depth) const
619 {
620 this->PrintTitle("SpacePoint", depth);
621 this->PrintProperty("Key", spacePoint.key(), depth + 2);
622 this->PrintProperty("ID", spacePoint->ID(), depth + 2);
623 const auto& position(spacePoint->XYZ());
624 this->PrintProperty("X", position[0], depth + 2);
625 this->PrintProperty("Y", position[1], depth + 2);
626 this->PrintProperty("Z", position[2], depth + 2);
627
628 if (!data.m_pSpacePointToHitAssociation) return;
629
630 const auto& hits(data.m_pSpacePointToHitAssociation->at(spacePoint.key()));
631 this->PrintProperty("# Hits", hits.size(), depth + 2);
632
633 if (m_verbosityLevel == "detailed") return;
634
635 // Print each associated hit
636 for (const auto& hit : hits)
637 this->PrintHit(hit, depth + 4);
638 }
639
640 //------------------------------------------------------------------------------------------------------------------------------------------
641
642 void LArPandoraEventDump::PrintVertex(const art::Ptr<recob::Vertex>& vertex,
643 const unsigned int depth) const
644 {
645 this->PrintTitle("Vertex", depth);
646 this->PrintProperty("Key", vertex.key(), depth + 2);
647 this->PrintProperty("ID", vertex->ID(), depth + 2);
648 const auto& position(vertex->position());
649 this->PrintProperty("X", position.X(), depth + 2);
650 this->PrintProperty("Y", position.Y(), depth + 2);
651 this->PrintProperty("Z", position.Z(), depth + 2);
652 }
653
654 //------------------------------------------------------------------------------------------------------------------------------------------
655
656 void LArPandoraEventDump::PrintTrack(const art::Ptr<recob::Track>& track,
657 const PandoraData& data,
658 const unsigned int depth) const
659 {
660 this->PrintTitle("Track", depth);
661 this->PrintProperty("Key", track.key(), depth + 2);
662 this->PrintProperty("# Trajectory points", track->NumberTrajectoryPoints(), depth + 2);
663 this->PrintProperty("Length", track->Length(), depth + 2);
664
665 if (!data.m_pTrackToHitAssociation) return;
666
667 const auto& hits(data.m_pTrackToHitAssociation->at(track.key()));
668 this->PrintProperty("# Hits", hits.size(), depth + 2);
669
670 if (m_verbosityLevel == "detailed") return;
671
672 // Print each associated hit
673 for (const auto& hit : hits)
674 this->PrintHit(hit, depth + 4);
675 }
676
677 //------------------------------------------------------------------------------------------------------------------------------------------
678
679 void LArPandoraEventDump::PrintShower(const art::Ptr<recob::Shower>& shower,
680 const PandoraData& data,
681 const unsigned int depth) const
682 {
683 this->PrintTitle("Shower", depth);
684 this->PrintProperty("Key", shower.key(), depth + 2);
685 this->PrintProperty("ID", shower->ID(), depth + 2);
686 this->PrintProperty("StartX", shower->ShowerStart().X(), depth + 2);
687 this->PrintProperty("StartY", shower->ShowerStart().Y(), depth + 2);
688 this->PrintProperty("StartZ", shower->ShowerStart().Z(), depth + 2);
689 this->PrintProperty("Length", shower->Length(), depth + 2);
690 this->PrintProperty("OpenAngle", shower->OpenAngle(), depth + 2);
691
693 const auto& pcAxes(data.m_pShowerToPCAxisAssociation->at(shower.key()));
694 this->PrintProperty("# PCAxes", pcAxes.size(), depth + 2);
695
696 for (const auto& pcAxis : pcAxes) {
697 this->PrintTitle("PCAxis", depth + 4);
698 this->PrintProperty("Key", pcAxis.key(), depth + 6);
699 this->PrintProperty("ID", pcAxis->getID(), depth + 6);
700 this->PrintProperty("# Hits used", pcAxis->getNumHitsUsed(), depth + 6);
701 }
702 }
703
704 if (!data.m_pShowerToHitAssociation) return;
705
706 const auto& hits(data.m_pShowerToHitAssociation->at(shower.key()));
707 this->PrintProperty("# Hits", hits.size(), depth + 2);
708
709 if (m_verbosityLevel == "detailed") return;
710
711 // Print each associated hit
712 for (const auto& hit : hits)
713 this->PrintHit(hit, depth + 4);
714 }
715
716 //------------------------------------------------------------------------------------------------------------------------------------------
717
718 void LArPandoraEventDump::PrintRule(const unsigned int depth) const
719 {
720 const unsigned int nDashes(std::max(0, 120 - static_cast<int>(depth)));
721
722 std::cout << std::string(depth, ' ') << std::string(nDashes, '-') << std::endl;
723 }
724
725 //------------------------------------------------------------------------------------------------------------------------------------------
726
727 void LArPandoraEventDump::PrintTitle(const std::string& name, const unsigned int depth) const
728 {
729 std::cout << std::string(depth, ' ') << name << std::endl;
730 }
731
732 //------------------------------------------------------------------------------------------------------------------------------------------
733
734 template <class T>
735 void LArPandoraEventDump::PrintProperty(const std::string& name,
736 const T& value,
737 const unsigned int depth) const
738 {
739 // The separation between the property name and property value
740 const unsigned int separation(std::max(0, 32 - static_cast<int>(depth)));
741
742 std::cout << std::string(depth, ' ') << std::setw(separation) << std::left << ("- " + name)
743 << value << std::endl;
744 }
745
746 //------------------------------------------------------------------------------------------------------------------------------------------
747 //------------------------------------------------------------------------------------------------------------------------------------------
748
750 const std::string& pandoraLabel,
751 const std::string& trackLabel,
752 const std::string& showerLabel)
753 : m_pPFParticleToMetadataAssociation(nullptr)
754 , m_pPFParticleToClusterAssociation(nullptr)
755 , m_pPFParticleToSpacePointAssociation(nullptr)
756 , m_pPFParticleToVertexAssociation(nullptr)
757 , m_pPFParticleToTrackAssociation(nullptr)
758 , m_pPFParticleToShowerAssociation(nullptr)
759 , m_pPFParticleToSliceAssociation(nullptr)
760 , m_pClusterToHitAssociation(nullptr)
761 , m_pSpacePointToHitAssociation(nullptr)
762 , m_pTrackToHitAssociation(nullptr)
763 , m_pShowerToHitAssociation(nullptr)
764 , m_pSliceToHitAssociation(nullptr)
765 , m_pShowerToPCAxisAssociation(nullptr)
766 {
767
768 // Load the collections
769 this->LoadCollection(evt, pandoraLabel, m_pfParticleCollection);
770 this->LoadCollection(evt, pandoraLabel, m_pfParticleMetadataCollection);
771 this->LoadCollection(evt, pandoraLabel, m_clusterCollection);
772 this->LoadCollection(evt, pandoraLabel, m_spacePointCollection);
773 this->LoadCollection(evt, pandoraLabel, m_vertexCollection);
774 this->LoadCollection(evt, trackLabel, m_trackCollection);
775 this->LoadCollection(evt, showerLabel, m_showerCollection);
776 this->LoadCollection(evt, showerLabel, m_pcAxisCollection);
777 this->LoadCollection(evt, pandoraLabel, m_sliceCollection);
778
779 // Load the associations
780 this->LoadAssociation(
782 this->LoadAssociation(
784 this->LoadAssociation(
786 this->LoadAssociation(
788 this->LoadAssociation(
793
796
797 this->LoadAssociation(
801 }
802
803 //------------------------------------------------------------------------------------------------------------------------------------------
804
806 {
807 // Clean up all heap memory
808 delete m_pPFParticleToMetadataAssociation;
809 delete m_pPFParticleToClusterAssociation;
810 delete m_pPFParticleToSpacePointAssociation;
811 delete m_pPFParticleToVertexAssociation;
812 delete m_pPFParticleToTrackAssociation;
813 delete m_pPFParticleToShowerAssociation;
814 delete m_pPFParticleToSliceAssociation;
815 delete m_pClusterToHitAssociation;
816 delete m_pSpacePointToHitAssociation;
817 delete m_pTrackToHitAssociation;
818 delete m_pShowerToHitAssociation;
819 delete m_pShowerToPCAxisAssociation;
820 delete m_pSliceToHitAssociation;
821 }
822
823 //------------------------------------------------------------------------------------------------------------------------------------------
824
825 template <class T>
827 const std::string& label,
828 Collection<T>& collection)
829 {
830 if (label.empty()) return;
831
832 evt.getByLabel(label, collection);
833 }
834
835 //------------------------------------------------------------------------------------------------------------------------------------------
836
837 template <class T, class U>
839 const std::string& label,
840 const Collection<T>& collection,
841 Association<U>*& pAssociation)
842 {
843 if (label.empty()) return;
844
845 if (pAssociation)
846 throw cet::exception("LArPandoraEventDump")
847 << "Association supplied type has already been loaded!";
848
849 pAssociation = new Association<U>(collection, evt, label);
850 }
851
852} // namespace lar_pandora
helper function for LArPandoraInterface producer module
Class holding the handle for all of the data types from Pandora.
Association< recob::Cluster > * m_pPFParticleToClusterAssociation
The PFParticle to cluster association.
Collection< recob::Cluster > m_clusterCollection
The Cluster handle.
Association< recob::SpacePoint > * m_pPFParticleToSpacePointAssociation
The PFParticle to space point association.
Association< recob::Hit > * m_pClusterToHitAssociation
The Cluster to hit association.
void LoadAssociation(const art::Event &evt, const std::string &label, const Collection< T > &collection, Association< U > *&pAssociation)
Load an association from the event.
Collection< recob::Track > m_trackCollection
The Track handle.
Association< larpandoraobj::PFParticleMetadata > * m_pPFParticleToMetadataAssociation
The PFParticle to metadata association.
void LoadCollection(const art::Event &evt, const std::string &label, Collection< T > &collection)
Load a collection from the event.
PandoraData(const art::Event &evt, const std::string &pandoraLabel, const std::string &trackLabel="", const std::string &showerLabel="")
Default constructor.
Collection< larpandoraobj::PFParticleMetadata > m_pfParticleMetadataCollection
The PFParticleMetadata handle.
Collection< recob::Slice > m_sliceCollection
The Slice handle.
Association< recob::Track > * m_pPFParticleToTrackAssociation
The PFParticle to track association.
Collection< recob::Shower > m_showerCollection
The Shower handle.
Association< recob::Slice > * m_pPFParticleToSliceAssociation
The PFParticle to slice association.
Collection< recob::PFParticle > m_pfParticleCollection
The PFParticle handle.
Collection< recob::SpacePoint > m_spacePointCollection
The SpacePoint handle.
Collection< recob::PCAxis > m_pcAxisCollection
The PCAxis handle.
Association< recob::Hit > * m_pShowerToHitAssociation
The Shower to hit association.
Association< recob::Hit > * m_pTrackToHitAssociation
The Track to hit association.
Association< recob::Vertex > * m_pPFParticleToVertexAssociation
The PFParticle to vertex association.
Collection< recob::Vertex > m_vertexCollection
The Vertex handle.
Association< recob::Hit > * m_pSpacePointToHitAssociation
The SpacePoint to hit association.
Association< recob::Hit > * m_pSliceToHitAssociation
The Slice to hit association.
Association< recob::Shower > * m_pPFParticleToShowerAssociation
The PFParticle to shower association.
Association< recob::PCAxis > * m_pShowerToPCAxisAssociation
The Shower to PCAxis association.
LArPandoraEventDump & operator=(LArPandoraEventDump const &)=delete
void PrintCluster(const art::Ptr< recob::Cluster > &cluster, const PandoraData &data, const unsigned int depth) const
Print a given Cluster.
void PrintHit(const art::Ptr< recob::Hit > &hit, const unsigned int depth) const
Print a given Hit.
void PrintEventSummary(const PandoraData &data) const
Print a summary of the event similar to the standard event dump.
void PrintSpacePoint(const art::Ptr< recob::SpacePoint > &spacePoint, const PandoraData &data, const unsigned int depth) const
Print a given SpacePoint.
void PrintEventMetadata(const art::Event &evt) const
Print the metadata about the event.
void PrintVertex(const art::Ptr< recob::Vertex > &vertex, const unsigned int depth) const
Print a given Vertex.
void PrintProperty(const std::string &name, const T &value, const unsigned int depth) const
Print a given property with the correct amount of whitespace.
void PrintPFParticleHierarchy(const PandoraData &data) const
Print the full PFParticle Hierarchy.
void PrintTrack(const art::Ptr< recob::Track > &track, const PandoraData &data, const unsigned int depth) const
Print a given Track.
art::Handle< std::vector< T > > Collection
std::string m_pandoraLabel
The label of the Pandora pattern recognition producer.
void PrintRule(const unsigned int depth) const
Print a horizontal line.
void BuildPFParticleMap(const PandoraData &data, PFParticleMap &pfParticleMap) const
Build the map from PFParticle ID to PFParticle from the input data.
std::string m_verbosityLevel
The level of verbosity to use.
std::string m_trackLabel
The track producer label.
std::string m_showerLabel
The shower producer label.
void analyze(art::Event const &evt) override
LArPandoraEventDump & operator=(LArPandoraEventDump &&)=delete
void PrintSlice(const art::Ptr< recob::Slice > &slice, const PandoraData &data, const unsigned int depth) const
Print a given Slice.
LArPandoraEventDump(LArPandoraEventDump &&)=delete
void PrintShower(const art::Ptr< recob::Shower > &shower, const PandoraData &data, const unsigned int depth) const
Print a given Shower.
void PrintParticle(const art::Ptr< recob::PFParticle > &particle, const PFParticleMap &pfParticleMap, const PandoraData &data, const unsigned int depth) const
Print a given PFParticle.
LArPandoraEventDump(fhicl::ParameterSet const &pset)
LArPandoraEventDump(LArPandoraEventDump const &)=delete
void PrintTitle(const std::string &name, const unsigned int depth) const
Print a title line.
std::map< int, art::Ptr< recob::PFParticle > > PFParticleMap