7#ifndef LAR_PANDORA_HELPER_H
8#define LAR_PANDORA_HELPER_H
14#include "canvas/Persistency/Common/Ptr.h"
18#include <unordered_set>
26 class ParticleFlowObject;
43 class PFParticleMetadata;
46#include "lardataobj/Simulation/SimChannel.h"
47#include "nusimdata/SimulationBase/MCParticle.h"
57 typedef std::set<art::Ptr<recob::Hit>>
HitList;
60 typedef std::vector<art::Ptr<recob::Hit>>
HitVector;
74 typedef std::vector<art::Ptr<anab::T0>>
T0Vector;
75 typedef std::vector<art::Ptr<larpandoraobj::PFParticleMetadata>>
MetadataVector;
77 typedef std::unordered_set<art::Ptr<recob::Hit>>
HitSet;
90 typedef std::map<art::Ptr<recob::Seed>, art::Ptr<recob::Hit>>
SeedsToHits;
97 typedef std::map<art::Ptr<simb::MCParticle>, art::Ptr<recob::PFParticle>>
102 typedef std::map<art::Ptr<recob::Hit>, art::Ptr<simb::MCTruth>>
HitsToMCTruth;
110 typedef std::map<int, art::Ptr<recob::Hit>>
HitMap;
140 const std::string& label,
160 const std::string& label,
172 const std::string& label,
186 const std::string& label,
200 const std::string& label,
213 const std::string& label,
226 const std::string& label,
239 const std::string& label,
252 const std::string& label,
265 const std::string& label,
278 const std::string& label,
291 const std::string& label,
304 const std::string& label,
317 const std::string& label,
330 const std::string& label,
380 const std::string& label_pfpart,
381 const std::string& label_mid,
385 const bool useClusters =
true);
398 const std::string& label,
402 const bool useClusters =
true);
413 const std::string& label,
426 const std::string& label,
439 const std::string& label,
441 bool& areSimChannelsValid);
451 const std::string& label,
463 const std::string& label,
475 const std::string& label,
518 const std::string& label,
533 const std::string& hitLabel,
534 const std::string& backtrackLabel,
549 const std::string& truthLabel,
550 const std::string& hitLabel,
551 const std::string& backtrackLabel,
565 template <
typename T>
567 const std::string& label,
568 const std::vector<art::Ptr<T>>& inputVector,
618 const art::Ptr<recob::PFParticle> daughterParticle);
630 const art::Ptr<recob::PFParticle> daughterParticle);
642 const art::Ptr<simb::MCParticle> daughterParticle);
654 const art::Ptr<simb::MCParticle> daughterParticle);
663 const art::Ptr<recob::PFParticle> particle);
674 const art::Ptr<recob::PFParticle> daughterParticle);
685 const art::Ptr<recob::PFParticle> daughterParticle);
696 const art::Ptr<recob::PFParticle> daughterParticle);
705 static bool IsNeutrino(
const art::Ptr<recob::PFParticle> particle);
714 static bool IsTrack(
const art::Ptr<recob::PFParticle> particle);
723 static bool IsShower(
const art::Ptr<recob::PFParticle> particle);
732 static bool IsVisible(
const art::Ptr<simb::MCParticle> particle);
static void CollectShowers(const art::Event &evt, const std::string &label, ShowerVector &showerVector, PFParticlesToShowers &particlesToShowers)
Collect the reconstructed PFParticles and associated Showers from the ART event record.
static void CollectClusters(const art::Event &evt, const std::string &label, ClusterVector &clusterVector, ClustersToHits &clustersToHits)
Collect the reconstructed Clusters and associated hits from the ART event record.
static void SelectNeutrinoPFParticles(const PFParticleVector &inputParticles, PFParticleVector &outputParticles)
Select reconstructed neutrino particles from a list of all reconstructed particles.
static void CollectHits(const art::Event &evt, const std::string &label, HitVector &hitVector)
Collect the reconstructed Hits from the ART event record.
DaughterMode
DaughterMode enumeration.
static void BuildMCParticleMap(const MCParticleVector &particleVector, MCParticleMap &particleMap)
Build particle maps for true particles.
static larpandoraobj::PFParticleMetadata GetPFParticleMetadata(const pandora::ParticleFlowObject *const pPfo)
Get metadata associated to a PFO.
static void CollectVertices(const art::Event &evt, const std::string &label, VertexVector &vertexVector, PFParticlesToVertices &particlesToVertices)
Collect the reconstructed PFParticles and associated Vertices from the ART event record.
static art::Ptr< simb::MCParticle > GetFinalStateMCParticle(const MCParticleMap &particleMap, const art::Ptr< simb::MCParticle > daughterParticle)
Return the final-state parent particle by navigating up the chain of parent/daughter associations.
static void BuildPFParticleMap(const PFParticleVector &particleVector, PFParticleMap &particleMap)
Build particle maps for reconstructed particles.
static void CollectSeeds(const art::Event &evt, const std::string &label, SeedVector &seedVector, PFParticlesToSeeds &particlesToSeeds)
Collect the reconstructed PFParticles and associated Seeds from the ART event record.
static void CollectPFParticleMetadata(const art::Event &evt, const std::string &label, PFParticleVector &particleVector, PFParticlesToMetadata &particlesToMetadata)
Collect the reconstructed PFParticle Metadata from the ART event record.
static art::Ptr< recob::PFParticle > GetFinalStatePFParticle(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Return the final-state parent particle by navigating up the chain of parent/daughter associations.
static void CollectSpacePoints(const art::Event &evt, const std::string &label, SpacePointVector &spacePointVector, SpacePointsToHits &spacePointsToHits)
Collect the reconstructed SpacePoints and associated hits from the ART event record.
static art::Ptr< simb::MCParticle > GetParentMCParticle(const MCParticleMap &particleMap, const art::Ptr< simb::MCParticle > daughterParticle)
Return the top-level parent particle by navigating up the chain of parent/daughter associations.
static void CollectT0s(const art::Event &evt, const std::string &label, T0Vector &t0Vector, PFParticlesToT0s &particlesToT0s)
Collect a vector of T0s from the ART event record.
static void SelectFinalStatePFParticles(const PFParticleVector &inputParticles, PFParticleVector &outputParticles)
Select final-state reconstructed particles from a list of all reconstructed particles.
static bool IsVisible(const art::Ptr< simb::MCParticle > particle)
Determine whether a particle is visible (i.e. long-lived charged particle)
static void GetAssociatedHits(const art::Event &evt, const std::string &label, const std::vector< art::Ptr< T > > &inputVector, HitVector &associatedHits, const pandora::IntVector *const indexVector=nullptr)
Get all hits associated with input clusters.
static void BuildMCParticleHitMaps(const art::Event &evt, const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs)
Collect the links from reconstructed hits to their true energy deposits.
static art::Ptr< recob::PFParticle > GetParentPFParticle(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Return the top-level parent particle by navigating up the chain of parent/daughter associations.
static bool IsTrack(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as track-like.
static void CollectSimChannels(const art::Event &evt, const std::string &label, SimChannelVector &simChannelVector, bool &areSimChannelsValid)
Collect a vector of SimChannel objects from the ART event record.
static void CollectWires(const art::Event &evt, const std::string &label, WireVector &wireVector)
Collect the reconstructed wires from the ART event record.
static int GetParentNeutrino(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Return the parent neutrino PDG code (or zero for cosmics) for a given reconstructed particle.
static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector)
Collect the reconstructed PFParticles from the ART event record.
static void CollectCosmicTags(const art::Event &evt, const std::string &label, CosmicTagVector &cosmicTagVector, TracksToCosmicTags &tracksToCosmicTags)
Collect a vector of cosmic tags from the ART event record.
static bool IsFinalState(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Determine whether a particle has been reconstructed as a final-state particle.
static void CollectGeneratorMCParticles(const art::Event &evt, const std::string &label, RawMCParticleVector &particleVector)
Collect a vector of MCParticle objects from the generator in the ART event record....
static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector, PFParticlesToTracks &particlesToTracks)
Collect the reconstructed PFParticles and associated Tracks from the ART event record.
static bool IsNeutrino(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as a neutrino.
static int GetGeneration(const PFParticleMap &particleMap, const art::Ptr< recob::PFParticle > daughterParticle)
Return the generation of this particle (first generation if primary)
static art::Ptr< recob::Track > GetPrimaryTrack(const PFParticlesToTracks &particlesToTracks, const art::Ptr< recob::PFParticle > particle)
Return the primary track associated with a PFParticle.
static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints, const SpacePointsToHits &spacePointsToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode=kUseDaughters)
Build mapping between PFParticles and Hits using PFParticle/SpacePoint/Hit maps.
static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector)
Collect a vector of MCParticle objects from the ART event record.
static bool IsShower(const art::Ptr< recob::PFParticle > particle)
Determine whether a particle has been reconstructed as shower-like.
ParticleFlowObject class.
std::map< art::Ptr< recob::PFParticle >, T0Vector > PFParticlesToT0s
std::vector< art::Ptr< anab::T0 > > T0Vector
std::map< int, art::Ptr< recob::PFParticle > > PFParticleMap
std::vector< art::Ptr< recob::Track > > TrackVector
std::map< int, art::Ptr< simb::MCParticle > > MCParticleMap
std::map< art::Ptr< recob::Seed >, art::Ptr< recob::Hit > > SeedsToHits
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
std::vector< sim::TrackIDE > TrackIDEVector
std::map< art::Ptr< recob::Hit >, TrackIDEVector > HitsToTrackIDEs
std::vector< art::Ptr< recob::Shower > > ShowerVector
std::map< art::Ptr< recob::PFParticle >, ClusterVector > PFParticlesToClusters
std::vector< art::Ptr< recob::Vertex > > VertexVector
std::map< art::Ptr< recob::PFParticle >, ShowerVector > PFParticlesToShowers
std::vector< simb::MCParticle > RawMCParticleVector
std::map< const pandora::Vertex *, unsigned int > ThreeDVertexMap
std::map< int, art::Ptr< recob::Cluster > > ClusterMap
std::vector< art::Ptr< sim::SimChannel > > SimChannelVector
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
std::map< art::Ptr< recob::PFParticle >, SpacePointVector > PFParticlesToSpacePoints
std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > MetadataVector
std::map< art::Ptr< simb::MCTruth >, art::Ptr< recob::PFParticle > > MCTruthToPFParticles
std::vector< art::Ptr< recob::Cluster > > ClusterVector
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticlesToHits
std::vector< art::Ptr< recob::Hit > > HitVector
std::map< int, art::Ptr< recob::Hit > > HitMap
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::vector< art::Ptr< simb::MCTruth > > MCTruthVector
std::map< art::Ptr< recob::Shower >, HitVector > ShowersToHits
std::vector< art::Ptr< anab::CosmicTag > > CosmicTagVector
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
std::map< art::Ptr< simb::MCParticle >, art::Ptr< recob::PFParticle > > MCParticlesToPFParticles
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
std::map< art::Ptr< recob::Track >, HitVector > TracksToHits
std::map< art::Ptr< recob::PFParticle >, MetadataVector > PFParticlesToMetadata
std::set< art::Ptr< recob::Hit > > HitList
std::map< int, HitVector > HitArray
std::unordered_set< art::Ptr< recob::Hit > > HitSet
std::map< art::Ptr< recob::SpacePoint >, art::Ptr< recob::Hit > > SpacePointsToHits
std::map< art::Ptr< simb::MCParticle >, HitVector > MCParticlesToHits
std::map< art::Ptr< simb::MCTruth >, HitVector > MCTruthToHits
std::vector< art::Ptr< recob::SpacePoint > > SpacePointVector
std::map< int, art::Ptr< sim::SimChannel > > SimChannelMap
std::map< const pandora::ParticleFlowObject *, size_t > ThreeDParticleMap
std::map< art::Ptr< recob::Cluster >, HitVector > ClustersToHits
std::map< art::Ptr< recob::PFParticle >, SeedVector > PFParticlesToSeeds
std::vector< art::Ptr< recob::Seed > > SeedVector
std::map< int, art::Ptr< recob::SpacePoint > > SpacePointMap
std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCTruth > > HitsToMCTruth
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCParticle > > HitsToMCParticles
std::vector< art::Ptr< recob::Wire > > WireVector
std::map< art::Ptr< recob::PFParticle >, VertexVector > PFParticlesToVertices
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::SpacePoint > > HitsToSpacePoints
std::map< art::Ptr< recob::Track >, CosmicTagVector > TracksToCosmicTags
std::vector< int > IntVector