LArSoft  v06_85_00
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;}
20 namespace pandora {class ParticleFlowObject; class Vertex; typedef std::vector<int> IntVector;}
21 namespace recob {class Cluster; class Hit; class PFParticle; class Seed; class Shower; class SpacePoint; class Track; class Vertex; class Wire;}
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::map< art::Ptr<recob::PFParticle>, TrackVector > PFParticlesToTracks;
51 typedef std::map< art::Ptr<recob::PFParticle>, ShowerVector > PFParticlesToShowers;
52 typedef std::map< art::Ptr<recob::PFParticle>, ClusterVector > PFParticlesToClusters;
53 typedef std::map< art::Ptr<recob::PFParticle>, SeedVector > PFParticlesToSeeds;
54 typedef std::map< art::Ptr<recob::PFParticle>, VertexVector > PFParticlesToVertices;
55 typedef std::map< art::Ptr<recob::PFParticle>, SpacePointVector > PFParticlesToSpacePoints;
56 typedef std::map< art::Ptr<recob::PFParticle>, HitVector > PFParticlesToHits;
57 typedef std::map< art::Ptr<recob::PFParticle>, MetadataVector > PFParticlesToMetadata;
58 typedef std::map< art::Ptr<recob::Track>, HitVector > TracksToHits;
59 typedef std::map< art::Ptr<recob::Shower>, HitVector > ShowersToHits;
60 typedef std::map< art::Ptr<recob::Cluster>, HitVector > ClustersToHits;
61 typedef std::map< art::Ptr<recob::Seed>, art::Ptr<recob::Hit> > SeedsToHits;
62 typedef std::map< art::Ptr<recob::SpacePoint>, art::Ptr<recob::Hit> > SpacePointsToHits;
63 typedef std::map< art::Ptr<simb::MCTruth>, MCParticleVector > MCTruthToMCParticles;
64 typedef std::map< art::Ptr<simb::MCTruth>, HitVector > MCTruthToHits;
65 typedef std::map< art::Ptr<simb::MCTruth>, art::Ptr<recob::PFParticle> > MCTruthToPFParticles;
66 typedef std::map< art::Ptr<simb::MCParticle>, art::Ptr<simb::MCTruth> > MCParticlesToMCTruth;
67 typedef std::map< art::Ptr<simb::MCParticle>, HitVector > MCParticlesToHits;
68 typedef std::map< art::Ptr<simb::MCParticle>, art::Ptr<recob::PFParticle> > MCParticlesToPFParticles;
69 typedef std::map< art::Ptr<recob::Hit>, art::Ptr<recob::SpacePoint> > HitsToSpacePoints;
70 typedef std::map< art::Ptr<recob::Hit>, art::Ptr<recob::PFParticle> > HitsToPFParticles;
71 typedef std::map< art::Ptr<recob::Hit>, art::Ptr<simb::MCParticle> > HitsToMCParticles;
72 typedef std::map< art::Ptr<recob::Hit>, art::Ptr<simb::MCTruth> > HitsToMCTruth;
73 typedef std::map< art::Ptr<recob::Hit>, TrackIDEVector > HitsToTrackIDEs;
74 typedef std::map< art::Ptr<recob::Track>, CosmicTagVector > TracksToCosmicTags;
75 typedef std::map< art::Ptr<recob::PFParticle>, T0Vector > PFParticlesToT0s;
76 
77 typedef std::map< int, art::Ptr<recob::PFParticle> > PFParticleMap;
78 typedef std::map< int, art::Ptr<recob::Cluster> > ClusterMap;
79 typedef std::map< int, art::Ptr<recob::SpacePoint> > SpacePointMap;
80 typedef std::map< int, art::Ptr<recob::Hit> > HitMap;
81 typedef std::map< int, art::Ptr<simb::MCParticle> > MCParticleMap;
82 typedef std::map< int, art::Ptr<sim::SimChannel> > SimChannelMap;
83 
84 typedef std::map< const pandora::ParticleFlowObject*, size_t> ThreeDParticleMap;
85 typedef std::map< const pandora::Vertex*, unsigned int> ThreeDVertexMap;
86 typedef std::map< int, HitVector > HitArray;
87 
92 {
93 public:
98  {
99  kIgnoreDaughters = 0, // Only use parent particles
100  kUseDaughters = 1, // Use both parent and daughter partcles
101  kAddDaughters = 2 // Absorb daughter particles into parent particles
102  };
103 
111  static void CollectWires(const art::Event &evt, const std::string &label, WireVector &wireVector);
112 
120  static void CollectHits(const art::Event &evt, const std::string &label, HitVector &hitVector);
121 
129  static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector);
130 
139  static void CollectSpacePoints(const art::Event &evt, const std::string &label, SpacePointVector &spacePointVector,
140  SpacePointsToHits &spacePointsToHits);
141 
151  static void CollectSpacePoints(const art::Event &evt, const std::string &label, SpacePointVector &spacePointVector,
152  SpacePointsToHits &spacePointsToHits, HitsToSpacePoints &hitsToSpacePoints);
153 
162  static void CollectClusters(const art::Event &evt, const std::string &label, ClusterVector &clusterVector,
163  ClustersToHits &clustersToHits);
164 
173  static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector,
174  PFParticlesToSpacePoints &particlesToSpacePoints);
175 
184  static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector,
185  PFParticlesToClusters &particlesToClusters);
186 
195  static void CollectPFParticleMetadata(const art::Event &evt, const std::string &label, PFParticleVector &particleVector,
196  PFParticlesToMetadata &particlesToMetadata);
197 
206  static void CollectShowers(const art::Event &evt, const std::string &label, ShowerVector &showerVector,
207  PFParticlesToShowers &particlesToShowers);
208 
217  static void CollectShowers(const art::Event &evt, const std::string &label, ShowerVector &showerVector,
218  ShowersToHits &showersToHits);
219 
228  static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector,
229  PFParticlesToTracks &particlesToTracks);
230 
239  static void CollectTracks(const art::Event &evt, const std::string &label, TrackVector &trackVector,
240  TracksToHits &tracksToHits);
241 
250  static void CollectSeeds(const art::Event &evt, const std::string &label, SeedVector &seedVector,
251  PFParticlesToSeeds &particlesToSeeds);
252 
261  static void CollectSeeds(const art::Event &evt, const std::string &label, SeedVector &seedVector,
262  SeedsToHits &seedsToHits);
263 
272  static void CollectVertices(const art::Event &evt, const std::string &label, VertexVector &vertexVector,
273  PFParticlesToVertices &particlesToVertices);
274 
285  static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToSpacePoints &particlesToSpacePoints,
286  const SpacePointsToHits &spacePointsToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles,
287  const DaughterMode daughterMode = kUseDaughters);
288 
299  static void BuildPFParticleHitMaps(const PFParticleVector &particleVector, const PFParticlesToClusters &particlesToClusters,
300  const ClustersToHits &clustersToHits, PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles,
301  const DaughterMode daughterMode = kUseDaughters);
302 
314  static void BuildPFParticleHitMaps(const art::Event &evt, const std::string &label_pfpart, const std::string &label_mid,
315  PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode = kUseDaughters,
316  const bool useClusters = true);
317 
328  static void BuildPFParticleHitMaps(const art::Event &evt, const std::string &label,
329  PFParticlesToHits &particlesToHits, HitsToPFParticles &hitsToParticles, const DaughterMode daughterMode = kUseDaughters,
330  const bool useClusters = true);
331 
340  static void CollectCosmicTags(const art::Event &evt, const std::string &label, CosmicTagVector &cosmicTagVector,
341  TracksToCosmicTags &tracksToCosmicTags);
342 
351  static void CollectT0s(const art::Event &evt, const std::string &label, T0Vector &t0Vector,
352  PFParticlesToT0s &particlesToT0s);
353 
361  static void CollectSimChannels(const art::Event &evt, const std::string &label, SimChannelVector &simChannelVector);
362 
370  static void CollectMCParticles(const art::Event &evt, const std::string &label, MCParticleVector &particleVector);
371 
380  static void CollectGeneratorMCParticles(const art::Event &evt, const std::string &label, RawMCParticleVector &particleVector);
381 
390  static void CollectMCParticles(const art::Event &evt, const std::string &label, MCTruthToMCParticles &truthToParticles,
391  MCParticlesToMCTruth &particlesToTruth);
392 
400  static void BuildMCParticleHitMaps(const HitVector &hitVector, const SimChannelVector &simChannelVector, HitsToTrackIDEs &hitsToTrackIDEs);
401 
411  static void BuildMCParticleHitMaps(const HitsToTrackIDEs &hitsToTrackIDEs, const MCTruthToMCParticles &truthToParticles,
412  MCParticlesToHits &particlesToHits, HitsToMCParticles &hitsToParticles, const DaughterMode daughterMode = kUseDaughters);
413 
424  static void BuildMCParticleHitMaps(const art::Event &evt, const std::string &label, const HitVector &hitVector,
425  MCParticlesToHits &particlesToHits, HitsToMCParticles &hitsToParticles, const DaughterMode daughterMode = kUseDaughters);
426 
435  static void BuildMCParticleHitMaps(const art::Event &evt, const std::string &hitLabel, const std::string &backtrackLabel,
436  HitsToTrackIDEs &hitsToTrackIDEs);
437 
449  static void BuildMCParticleHitMaps(const art::Event &evt, const std::string &truthLabel, const std::string &hitLabel,
450  const std::string &backtrackLabel, MCParticlesToHits &particlesToHits, HitsToMCParticles &hitsToParticles,
451  const DaughterMode daughterMode = kUseDaughters);
452 
462  template <typename T>
463  static void GetAssociatedHits(const art::Event &evt, const std::string &label, const std::vector<art::Ptr<T> > &inputVector,
464  HitVector &associatedHits, const pandora::IntVector* const indexVector = nullptr);
465 
472  static void SelectNeutrinoPFParticles(const PFParticleVector &inputParticles, PFParticleVector &outputParticles);
473 
480  static void SelectFinalStatePFParticles(const PFParticleVector &inputParticles, PFParticleVector &outputParticles);
481 
488  static void BuildMCParticleMap(const MCParticleVector &particleVector, MCParticleMap &particleMap);
489 
496  static void BuildPFParticleMap(const PFParticleVector &particleVector, PFParticleMap &particleMap);
497 
506  static art::Ptr<recob::PFParticle> GetParentPFParticle(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
507 
516  static art::Ptr<recob::PFParticle> GetFinalStatePFParticle(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
517 
526  static art::Ptr<simb::MCParticle> GetParentMCParticle(const MCParticleMap &particleMap, const art::Ptr<simb::MCParticle> daughterParticle);
527 
536  static art::Ptr<simb::MCParticle> GetFinalStateMCParticle(const MCParticleMap &particleMap, const art::Ptr<simb::MCParticle> daughterParticle);
537 
544  static art::Ptr<recob::Track> GetPrimaryTrack(const PFParticlesToTracks &particlesToTracks, const art::Ptr<recob::PFParticle> particle);
545 
554  static int GetGeneration(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
555 
564  static int GetParentNeutrino(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
565 
574  static bool IsFinalState(const PFParticleMap &particleMap, const art::Ptr<recob::PFParticle> daughterParticle);
575 
583  static bool IsNeutrino(const art::Ptr<recob::PFParticle> particle);
584 
592  static bool IsTrack(const art::Ptr<recob::PFParticle> particle);
593 
601  static bool IsShower(const art::Ptr<recob::PFParticle> particle);
602 
610  static bool IsVisible(const art::Ptr<simb::MCParticle> particle);
611 };
612 
613 } // namespace lar_pandora
614 
615 #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
std::map< art::Ptr< simb::MCTruth >, art::Ptr< recob::PFParticle > > MCTruthToPFParticles
Reconstruction base classes.
std::map< art::Ptr< recob::PFParticle >, ClusterVector > PFParticlesToClusters
const std::string label
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
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.
Pandora PFParticleMetadata.
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
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