LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
LArPandoraHelper.h
Go to the documentation of this file.
1 
7 #ifndef LAR_PANDORA_HELPER_H
8 #define LAR_PANDORA_HELPER_H
9 
11 
13 
14 #include <map>
15 #include <set>
16 #include <vector>
17 
18 namespace anab {class CosmicTag; class T0;}
19 namespace pandora {class ParticleFlowObject; class Vertex; typedef std::vector<int> IntVector;}
20 namespace recob {class Cluster; class Hit; class PFParticle; class Seed; class Shower; class Slice; class SpacePoint; class Track; class Vertex; class Wire;}
21 namespace larpandoraobj {class PFParticleMetadata;}
22 namespace sim {class SimChannel; struct TrackIDE;}
23 namespace simb {class MCParticle; class MCTruth;}
24 
25 //------------------------------------------------------------------------------------------------------------------------------------------
26 
27 namespace lar_pandora
28 {
29 
30 typedef std::set< art::Ptr<recob::Hit> > HitList;
31 
32 typedef std::vector< art::Ptr<recob::Wire> > WireVector;
33 typedef std::vector< art::Ptr<recob::Hit> > HitVector;
34 typedef std::vector< art::Ptr<recob::SpacePoint> > SpacePointVector;
35 typedef std::vector< art::Ptr<recob::Cluster> > ClusterVector;
36 typedef std::vector< art::Ptr<recob::Seed> > SeedVector;
37 typedef std::vector< art::Ptr<recob::Vertex> > VertexVector;
38 typedef std::vector< art::Ptr<recob::Track> > TrackVector;
39 typedef std::vector< art::Ptr<recob::Shower> > ShowerVector;
40 typedef std::vector< art::Ptr<recob::PFParticle> > PFParticleVector;
41 typedef std::vector< art::Ptr<simb::MCTruth> > MCTruthVector;
42 typedef std::vector< art::Ptr<simb::MCParticle> > MCParticleVector;
43 typedef std::vector< simb::MCParticle> RawMCParticleVector;
44 typedef std::vector< art::Ptr<sim::SimChannel> > SimChannelVector;
45 typedef std::vector< sim::TrackIDE > TrackIDEVector;
46 typedef std::vector< art::Ptr<anab::CosmicTag> > CosmicTagVector;
47 typedef std::vector< art::Ptr<anab::T0> > T0Vector;
48 typedef std::vector< art::Ptr<larpandoraobj::PFParticleMetadata> > MetadataVector;
49 
50 typedef std::unordered_set< art::Ptr<recob::Hit> > HitSet;
51 
52 typedef std::map< art::Ptr<recob::PFParticle>, TrackVector > PFParticlesToTracks;
53 typedef std::map< art::Ptr<recob::PFParticle>, ShowerVector > PFParticlesToShowers;
54 typedef std::map< art::Ptr<recob::PFParticle>, ClusterVector > PFParticlesToClusters;
55 typedef std::map< art::Ptr<recob::PFParticle>, SeedVector > PFParticlesToSeeds;
56 typedef std::map< art::Ptr<recob::PFParticle>, VertexVector > PFParticlesToVertices;
57 typedef std::map< art::Ptr<recob::PFParticle>, SpacePointVector > PFParticlesToSpacePoints;
58 typedef std::map< art::Ptr<recob::PFParticle>, HitVector > PFParticlesToHits;
59 typedef std::map< art::Ptr<recob::PFParticle>, MetadataVector > PFParticlesToMetadata;
60 typedef std::map< art::Ptr<recob::Track>, HitVector > TracksToHits;
61 typedef std::map< art::Ptr<recob::Shower>, HitVector > ShowersToHits;
62 typedef std::map< art::Ptr<recob::Cluster>, HitVector > ClustersToHits;
63 typedef std::map< art::Ptr<recob::Seed>, art::Ptr<recob::Hit> > SeedsToHits;
64 typedef std::map< art::Ptr<recob::SpacePoint>, art::Ptr<recob::Hit> > SpacePointsToHits;
65 typedef std::map< art::Ptr<simb::MCTruth>, MCParticleVector > MCTruthToMCParticles;
66 typedef std::map< art::Ptr<simb::MCTruth>, HitVector > MCTruthToHits;
67 typedef std::map< art::Ptr<simb::MCTruth>, art::Ptr<recob::PFParticle> > MCTruthToPFParticles;
68 typedef std::map< art::Ptr<simb::MCParticle>, art::Ptr<simb::MCTruth> > MCParticlesToMCTruth;
69 typedef std::map< art::Ptr<simb::MCParticle>, HitVector > MCParticlesToHits;
70 typedef std::map< art::Ptr<simb::MCParticle>, art::Ptr<recob::PFParticle> > MCParticlesToPFParticles;
71 typedef std::map< art::Ptr<recob::Hit>, art::Ptr<recob::SpacePoint> > HitsToSpacePoints;
72 typedef std::map< art::Ptr<recob::Hit>, art::Ptr<recob::PFParticle> > HitsToPFParticles;
73 typedef std::map< art::Ptr<recob::Hit>, art::Ptr<simb::MCParticle> > HitsToMCParticles;
74 typedef std::map< art::Ptr<recob::Hit>, art::Ptr<simb::MCTruth> > HitsToMCTruth;
75 typedef std::map< art::Ptr<recob::Hit>, TrackIDEVector > HitsToTrackIDEs;
76 typedef std::map< art::Ptr<recob::Track>, CosmicTagVector > TracksToCosmicTags;
77 typedef std::map< art::Ptr<recob::PFParticle>, T0Vector > PFParticlesToT0s;
78 
79 typedef std::map< int, art::Ptr<recob::PFParticle> > PFParticleMap;
80 typedef std::map< int, art::Ptr<recob::Cluster> > ClusterMap;
81 typedef std::map< int, art::Ptr<recob::SpacePoint> > SpacePointMap;
82 typedef std::map< int, art::Ptr<recob::Hit> > HitMap;
83 typedef std::map< int, art::Ptr<simb::MCParticle> > MCParticleMap;
84 typedef std::map< int, art::Ptr<sim::SimChannel> > SimChannelMap;
85 
86 typedef std::map< const pandora::ParticleFlowObject*, size_t> ThreeDParticleMap;
87 typedef std::map< const pandora::Vertex*, unsigned int> ThreeDVertexMap;
88 typedef std::map< int, HitVector > HitArray;
89 
94 {
95 public:
100  {
101  kIgnoreDaughters = 0, // Only use parent particles
102  kUseDaughters = 1, // Use both parent and daughter partcles
103  kAddDaughters = 2 // Absorb daughter particles into parent particles
104  };
105 
113  static void CollectWires(const art::Event &evt, const std::string &label, WireVector &wireVector);
114 
122  static void CollectHits(const art::Event &evt, const std::string &label, HitVector &hitVector);
123 
131  static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector);
132 
141  static void CollectSpacePoints(const art::Event &evt, const std::string &label, SpacePointVector &spacePointVector,
142  SpacePointsToHits &spacePointsToHits);
143 
153  static void CollectSpacePoints(const art::Event &evt, const std::string &label, SpacePointVector &spacePointVector,
154  SpacePointsToHits &spacePointsToHits, HitsToSpacePoints &hitsToSpacePoints);
155 
164  static void CollectClusters(const art::Event &evt, const std::string &label, ClusterVector &clusterVector,
165  ClustersToHits &clustersToHits);
166 
175  static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector,
176  PFParticlesToSpacePoints &particlesToSpacePoints);
177 
186  static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector,
187  PFParticlesToClusters &particlesToClusters);
188 
197  static void CollectPFParticleMetadata(const art::Event &evt, const std::string &label, PFParticleVector &particleVector,
198  PFParticlesToMetadata &particlesToMetadata);
199 
208  static void CollectShowers(const art::Event &evt, const std::string &label, ShowerVector &showerVector,
209  PFParticlesToShowers &particlesToShowers);
210 
219  static void CollectShowers(const art::Event &evt, const std::string &label, ShowerVector &showerVector,
220  ShowersToHits &showersToHits);
221 
230  static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector,
231  PFParticlesToTracks &particlesToTracks);
232 
241  static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector,
242  TracksToHits &tracksToHits);
243 
252  static void CollectSeeds(const art::Event &evt, const std::string &label, SeedVector &seedVector,
253  PFParticlesToSeeds &particlesToSeeds);
254 
263  static void CollectSeeds(const art::Event &evt, const std::string &label, SeedVector &seedVector,
264  SeedsToHits &seedsToHits);
265 
274  static void CollectVertices(const art::Event &evt, const std::string &label, VertexVector &vertexVector,
275  PFParticlesToVertices &particlesToVertices);
276 
287  static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints,
288  const SpacePointsToHits &spacePointsToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles,
289  const DaughterMode daughterMode = kUseDaughters);
290 
301  static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToClusters &particlesToClusters,
302  const ClustersToHits &clustersToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles,
303  const DaughterMode daughterMode = kUseDaughters);
304 
316  static void BuildPFParticleHitMaps(const art::Event &evt, const std::string &label_pfpart, const std::string &label_mid,
317  PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode = kUseDaughters,
318  const bool useClusters = true);
319 
330  static void BuildPFParticleHitMaps(const art::Event &evt, const std::string &label,
331  PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode = kUseDaughters,
332  const bool useClusters = true);
333 
342  static void CollectCosmicTags(const art::Event &evt, const std::string &label, CosmicTagVector &cosmicTagVector,
343  TracksToCosmicTags &tracksToCosmicTags);
344 
353  static void CollectT0s(const art::Event &evt, const std::string &label, T0Vector &t0Vector,
354  PFParticlesToT0s &particlesToT0s);
355 
363  static void CollectSimChannels(const art::Event &evt, const std::string &label, SimChannelVector &simChannelVector);
364 
372  static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector);
373 
382  static void CollectGeneratorMCParticles(const art::Event &evt, const std::string &label, RawMCParticleVector &particleVector);
383 
392  static void CollectMCParticles(const art::Event &evt, const std::string &label, MCTruthToMCParticles &truthToParticles,
393  MCParticlesToMCTruth &particlesToTruth);
394 
402  static void BuildMCParticleHitMaps(const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs);
403 
413  static void BuildMCParticleHitMaps(const HitsToTrackIDEs &hitsToTrackIDEs, const MCTruthToMCParticles &truthToParticles,
414  MCParticlesToHits &particlesToHits, HitsToMCParticles &hitsToParticles, const DaughterMode daughterMode = kUseDaughters);
415 
426  static void BuildMCParticleHitMaps(const art::Event &evt, const std::string &label, const HitVector &hitVector,
427  MCParticlesToHits &particlesToHits, HitsToMCParticles &hitsToParticles, const DaughterMode daughterMode = kUseDaughters);
428 
437  static void BuildMCParticleHitMaps(const art::Event &evt, const std::string &hitLabel, const std::string &backtrackLabel,
438  HitsToTrackIDEs &hitsToTrackIDEs);
439 
451  static void BuildMCParticleHitMaps(const art::Event &evt, const std::string &truthLabel, const std::string &hitLabel,
452  const std::string &backtrackLabel, MCParticlesToHits &particlesToHits, HitsToMCParticles &hitsToParticles,
453  const DaughterMode daughterMode = kUseDaughters);
454 
464  template <typename T>
465  static void GetAssociatedHits(const art::Event &evt, const std::string &label, const std::vector<art::Ptr<T> > &inputVector,
466  HitVector &associatedHits, const pandora::IntVector* const indexVector = nullptr);
467 
474  static void SelectNeutrinoPFParticles(const PFParticleVector &inputParticles, PFParticleVector &outputParticles);
475 
482  static void SelectFinalStatePFParticles(const PFParticleVector &inputParticles, PFParticleVector &outputParticles);
483 
490  static void BuildMCParticleMap(const MCParticleVector &particleVector, MCParticleMap &particleMap);
491 
498  static void BuildPFParticleMap(const PFParticleVector &particleVector, PFParticleMap &particleMap);
499 
508  static art::Ptr<recob::PFParticle> GetParentPFParticle(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
509 
518  static art::Ptr<recob::PFParticle> GetFinalStatePFParticle(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
519 
528  static art::Ptr<simb::MCParticle> GetParentMCParticle(const MCParticleMap &particleMap, const art::Ptr<simb::MCParticle> daughterParticle);
529 
538  static art::Ptr<simb::MCParticle> GetFinalStateMCParticle(const MCParticleMap &particleMap, const art::Ptr<simb::MCParticle> daughterParticle);
539 
546  static art::Ptr<recob::Track> GetPrimaryTrack(const PFParticlesToTracks &particlesToTracks, const art::Ptr<recob::PFParticle> particle);
547 
556  static int GetGeneration(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
557 
566  static int GetParentNeutrino(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
567 
576  static bool IsFinalState(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
577 
585  static bool IsNeutrino(const art::Ptr<recob::PFParticle> particle);
586 
594  static bool IsTrack(const art::Ptr<recob::PFParticle> particle);
595 
603  static bool IsShower(const art::Ptr<recob::PFParticle> particle);
604 
612  static bool IsVisible(const art::Ptr<simb::MCParticle> particle);
613 
614  static larpandoraobj::PFParticleMetadata GetPFParticleMetadata(const pandora::ParticleFlowObject *const pPfo);
615 };
616 
617 } // namespace lar_pandora
618 
619 #endif // LAR_PANDORA_HELPER_H
std::vector< sim::TrackIDE > TrackIDEVector
std::map< art::Ptr< recob::Hit >, TrackIDEVector > HitsToTrackIDEs
std::vector< art::Ptr< recob::Seed > > SeedVector
std::map< art::Ptr< simb::MCTruth >, HitVector > MCTruthToHits
std::map< int, art::Ptr< sim::SimChannel > > SimChannelMap
std::map< art::Ptr< recob::SpacePoint >, art::Ptr< recob::Hit > > SpacePointsToHits
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::PFParticle > > HitsToPFParticles
SlicingAlgorithm::Slice Slice
std::map< art::Ptr< simb::MCTruth >, art::Ptr< recob::PFParticle > > MCTruthToPFParticles
Reconstruction base classes.
std::map< art::Ptr< recob::PFParticle >, ClusterVector > PFParticlesToClusters
std::map< int, art::Ptr< recob::Cluster > > ClusterMap
std::map< art::Ptr< recob::Shower >, HitVector > ShowersToHits
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
std::map< art::Ptr< simb::MCTruth >, MCParticleVector > MCTruthToMCParticles
std::map< int, art::Ptr< simb::MCParticle > > MCParticleMap
std::map< art::Ptr< simb::MCParticle >, art::Ptr< recob::PFParticle > > MCParticlesToPFParticles
std::map< art::Ptr< recob::Track >, HitVector > TracksToHits
std::vector< int > IntVector
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
std::map< art::Ptr< recob::PFParticle >, std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > > PFParticlesToMetadata
std::map< art::Ptr< recob::PFParticle >, SeedVector > PFParticlesToSeeds
std::map< art::Ptr< simb::MCParticle >, art::Ptr< simb::MCTruth > > MCParticlesToMCTruth
std::map< const pandora::ParticleFlowObject *, size_t > ThreeDParticleMap
std::vector< art::Ptr< recob::Track > > TrackVector
std::vector< art::Ptr< sim::SimChannel > > SimChannelVector
std::unordered_set< art::Ptr< recob::Hit > > HitSet
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::map< int, art::Ptr< recob::PFParticle > > PFParticleMap
std::map< const pandora::Vertex *, unsigned int > ThreeDVertexMap
std::vector< art::Ptr< simb::MCTruth > > MCTruthVector
LArPandoraHelper class.
Metadata associated to PFParticles.
std::map< int, HitVector > HitArray
std::map< art::Ptr< recob::PFParticle >, T0Vector > PFParticlesToT0s
std::map< art::Ptr< recob::Hit >, art::Ptr< recob::SpacePoint > > HitsToSpacePoints
std::map< int, art::Ptr< recob::SpacePoint > > SpacePointMap
std::map< art::Ptr< recob::Cluster >, HitVector > ClustersToHits
std::vector< art::Ptr< recob::Wire > > WireVector
std::vector< art::Ptr< larpandoraobj::PFParticleMetadata > > MetadataVector
std::map< art::Ptr< recob::PFParticle >, VertexVector > PFParticlesToVertices
std::vector< art::Ptr< anab::T0 > > T0Vector
std::map< art::Ptr< recob::PFParticle >, ShowerVector > PFParticlesToShowers
Monte Carlo Simulation.
std::vector< art::Ptr< recob::Shower > > ShowerVector
std::vector< art::Ptr< recob::SpacePoint > > SpacePointVector
std::vector< art::Ptr< recob::Hit > > HitVector
Framework includes.
std::map< art::Ptr< recob::PFParticle >, TrackVector > PFParticlesToTracks
std::map< art::Ptr< recob::PFParticle >, HitVector > PFParticlesToHits
DaughterMode
DaughterMode enumeration.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
std::map< art::Ptr< recob::Seed >, art::Ptr< recob::Hit > > SeedsToHits
std::vector< simb::MCParticle > RawMCParticleVector
std::map< art::Ptr< recob::Track >, CosmicTagVector > TracksToCosmicTags
std::map< art::Ptr< simb::MCParticle >, HitVector > MCParticlesToHits
std::vector< art::Ptr< anab::CosmicTag > > CosmicTagVector
object containing MC truth information necessary for making RawDigits and doing back tracking ...
std::map< art::Ptr< recob::PFParticle >, SpacePointVector > PFParticlesToSpacePoints
TCEvent evt
Definition: DataStructs.cxx:5
std::set< art::Ptr< recob::Hit > > HitList
Definition: Track.hh:43
std::map< int, art::Ptr< recob::Hit > > HitMap
std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCParticle > > HitsToMCParticles
std::map< art::Ptr< recob::Hit >, art::Ptr< simb::MCTruth > > HitsToMCTruth
std::vector< art::Ptr< recob::Vertex > > VertexVector