7 #ifndef LAR_PANDORA_OUTPUT_H 8 #define LAR_PANDORA_OUTPUT_H 15 class PFParticleMetadata;
19 class ClusterParamsAlgBase;
33 #include "Api/PandoraApi.h" 36 class GeometryUtilities;
57 typedef std::unique_ptr<std::vector<larpandoraobj::PFParticleMetadata>>
61 typedef std::unique_ptr<art::Assns<recob::PFParticle, larpandoraobj::PFParticleMetadata>>
63 typedef std::unique_ptr<art::Assns<recob::PFParticle, recob::SpacePoint>>
65 typedef std::unique_ptr<art::Assns<recob::PFParticle, recob::Cluster>>
67 typedef std::unique_ptr<art::Assns<recob::PFParticle, recob::Vertex>>
70 typedef std::unique_ptr<art::Assns<recob::PFParticle, recob::Slice>>
90 void Validate()
const;
115 static void ProduceArtOutput(
const Settings& settings,
128 static bool GetPandoraInstance(
const pandora::Pandora*
const pPrimaryPandora,
129 const std::string& name,
130 const pandora::Pandora*& pPandoraInstance);
138 static void GetPandoraSlices(
const pandora::Pandora*
const pPrimaryPandora,
139 pandora::PfoVector& slicePfos);
148 static bool IsClearCosmic(
const pandora::ParticleFlowObject*
const pPfo);
157 static bool IsFromSlice(
const pandora::ParticleFlowObject*
const pPfo);
166 static unsigned int GetSliceIndex(
const pandora::ParticleFlowObject*
const pPfo);
175 static pandora::PfoVector CollectPfos(
const pandora::Pandora*
const pPrimaryPandora);
184 static pandora::PfoVector CollectAllPfoOutcomes(
const pandora::Pandora*
const pPrimaryPandora);
192 static void CollectPfos(
const pandora::PfoList& parentPfoList, pandora::PfoVector& pfoVector);
205 const pandora::PfoVector& pfoVector,
206 IdToIdVectorMap& pfoToVerticesMap,
207 std::function<
const pandora::Vertex*
const(
const pandora::ParticleFlowObject*
const)>
219 static pandora::ClusterList CollectClusters(
const pandora::PfoVector& pfoVector,
220 IdToIdVectorMap& pfoToClustersMap);
228 static void Collect3DHits(
const pandora::ParticleFlowObject*
const pPfo,
229 pandora::CaloHitVector& caloHits);
240 static pandora::CaloHitList Collect3DHits(
const pandora::PfoVector& pfoVector,
241 IdToIdVectorMap& pfoToThreeDHitsMap);
251 template <
typename T>
252 static size_t GetId(
const T*
const pT,
const std::list<const T*>& tList);
262 template <
typename T>
263 static size_t GetId(
const T*
const pT,
const std::vector<const T*>& tVector);
273 static void GetPandoraToArtHitMap(
const pandora::ClusterList& clusterList,
274 const pandora::CaloHitList& threeDHitList,
276 CaloHitToArtHitMap& pandoraHitToArtHitMap);
285 const pandora::CaloHit*
const pCaloHit);
294 VertexCollection& outputVertices);
307 const std::string& instanceLabel,
308 const pandora::CaloHitList& threeDHitList,
309 const CaloHitToArtHitMap& pandoraHitToArtHitMap,
310 SpacePointCollection& outputSpacePoints,
311 SpacePointToHitCollection& outputSpacePointsToHits);
327 const std::string& instanceLabel,
328 const pandora::ClusterList& clusterList,
329 const CaloHitToArtHitMap& pandoraHitToArtHitMap,
330 const IdToIdVectorMap& pfoToClustersMap,
331 ClusterCollection& outputClusters,
332 ClusterToHitCollection& outputClustersToHits,
333 IdToIdVectorMap& pfoToArtClustersMap);
350 const std::string& instanceLabel,
351 const pandora::PfoVector& pfoVector,
352 const IdToIdVectorMap& pfoToVerticesMap,
353 const IdToIdVectorMap& pfoToThreeDHitsMap,
354 const IdToIdVectorMap& pfoToArtClustersMap,
355 PFParticleCollection& outputParticles,
369 static void AssociateAdditionalVertices(
371 const std::string& instanceLabel,
372 const pandora::PfoVector& pfoVector,
373 const IdToIdVectorMap& pfoToVerticesMap,
385 const std::string& instanceLabel,
386 const pandora::PfoVector& pfoVector,
403 static void BuildSlices(
const Settings& settings,
404 const pandora::Pandora*
const pPrimaryPandora,
406 const std::string& instanceLabel,
407 const pandora::PfoVector& pfoVector,
409 SliceCollection& outputSlices,
411 SliceToHitCollection& outputSlicesToHits);
418 static unsigned int BuildDummySlice(SliceCollection& outputSlices);
432 static void CopyAllHitsToSingleSlice(
const Settings& settings,
434 const std::string& instanceLabel,
435 const pandora::PfoVector& pfoVector,
437 SliceCollection& outputSlices,
439 SliceToHitCollection& outputSlicesToHits);
451 static unsigned int BuildSlice(
const pandora::ParticleFlowObject*
const pParentPfo,
453 const std::string& instanceLabel,
455 SliceCollection& outputSlices,
456 SliceToHitCollection& outputSlicesToHits);
469 const std::string& instanceLabel,
470 const pandora::PfoVector& pfoVector,
471 T0Collection& outputT0s,
472 PFParticleToT0Collection& outputParticlesToT0s);
493 const size_t spacePointId);
501 static void GetHitsInCluster(
const pandora::Cluster*
const pCluster,
502 pandora::CaloHitVector& sortedHits);
516 static std::vector<recob::Cluster> BuildClusters(
518 const pandora::Cluster*
const pCluster,
519 const pandora::ClusterList& clusterList,
520 const CaloHitToArtHitMap& pandoraHitToArtHitMap,
521 IdToIdVectorMap& pandoraClusterToArtClustersMap,
522 std::vector<HitVector>& hitVectors,
554 static recob::PFParticle BuildPFParticle(
const pandora::ParticleFlowObject*
const pPfo,
556 const pandora::PfoVector& pfoVector);
570 const pandora::ParticleFlowObject*
const pPfo,
571 const pandora::PfoVector& pfoVector,
583 template <
typename A,
typename B>
585 const std::string& instanceLabel,
598 template <
typename A,
typename B>
600 const std::string& instanceLabel,
602 const IdToIdVectorMap& aToBMap,
613 template <
typename A,
typename B>
615 const std::string& instanceLabel,
623 template <
typename T>
624 inline size_t LArPandoraOutput::GetId(
const T*
const pT,
const std::list<const T*>& tList)
628 if (it == tList.end())
630 <<
" LArPandoraOutput::GetId --- can't find the id of supplied object";
632 return static_cast<size_t>(std::distance(tList.begin(), it));
637 template <
typename T>
638 inline size_t LArPandoraOutput::GetId(
const T*
const pT,
const std::vector<const T*>& tVector)
641 std::find(tVector.begin(), tVector.end(), pT));
643 if (it == tVector.end())
645 <<
" LArPandoraOutput::GetId --- can't find the id of supplied object";
647 return static_cast<size_t>(std::distance(tVector.begin(), it));
652 template <
typename A,
typename B>
654 const std::string& instanceLabel,
665 association->addSingle(pA, pB);
670 template <
typename A,
typename B>
672 const std::string& instanceLabel,
674 const IdToIdVectorMap& aToBMap,
678 if (it == aToBMap.end())
680 <<
" LArPandoraOutput::AddAssociation --- id doesn't exists in the assocaition map";
686 for (
const size_t idB : it->second) {
688 association->addSingle(pA, pB);
694 template <
typename A,
typename B>
696 const std::string& instanceLabel,
705 association->addSingle(pA, pB);
710 #endif // LAR_PANDORA_OUTPUT_H code to link reconstructed objects back to the MC truth information
std::map< int, art::Ptr< recob::Hit > > IdToHitMap
Interface class for LArPandora producer modules, which reconstruct recob::PFParticles from recob::Hit...
Namespace for general, non-LArSoft-specific utilities.
const pandora::Pandora * m_pPrimaryPandora
Reconstruction base classes.
std::unique_ptr< std::vector< larpandoraobj::PFParticleMetadata > > PFParticleMetadataCollection
std::unique_ptr< art::Assns< recob::PFParticle, recob::Slice > > PFParticleToSliceCollection
std::unique_ptr< std::vector< recob::Slice > > SliceCollection
std::unique_ptr< std::vector< recob::PFParticle > > PFParticleCollection
std::string m_testBeamInteractionVerticesInstanceLabel
The label for the test beam interaction vertices.
std::unique_ptr< std::vector< recob::Vertex > > VertexCollection
std::string m_allOutcomesInstanceLabel
The label for the instance producing all outcomes.
std::map< size_t, IdVector > IdToIdVectorMap
Set of hits with a 2D structure.
std::unique_ptr< art::Assns< recob::PFParticle, larpandoraobj::PFParticleMetadata > > PFParticleToMetadataCollection
bool m_isNeutrinoRecoOnlyNoSlicing
If we are running the neutrino reconstruction only with no slicing.
Cluster finding and building.
Definition of vertex object for LArSoft.
std::unique_ptr< art::Assns< recob::PFParticle, recob::Cluster > > PFParticleToClusterCollection
std::string m_hitfinderModuleLabel
The hit finder module label.
Algorithm collection class computing cluster parameters.
std::unique_ptr< art::Assns< recob::Slice, recob::Hit > > SliceToHitCollection
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< size_t > IdVector
std::unique_ptr< art::Assns< recob::PFParticle, anab::T0 > > PFParticleToT0Collection
std::unique_ptr< art::Assns< recob::SpacePoint, recob::Hit > > SpacePointToHitCollection
std::unique_ptr< std::vector< recob::Cluster > > ClusterCollection
std::map< const pandora::CaloHit *, art::Ptr< recob::Hit > > CaloHitToArtHitMap
std::unique_ptr< art::Assns< recob::PFParticle, recob::Vertex > > PFParticleToVertexCollection
Declaration of cluster object.
bool m_shouldProduceTestBeamInteractionVertices
Whether to write the test beam interaction vertices in a separate collection.
std::unique_ptr< art::Assns< recob::PFParticle, recob::SpacePoint > > PFParticleToSpacePointCollection
std::vector< art::Ptr< recob::Hit > > HitVector
Hierarchical representation of particle flow.
Utility object to perform functions of association.
bool m_shouldRunStitching
std::unique_ptr< std::vector< anab::T0 > > T0Collection
bool m_shouldProduceAllOutcomes
If all outcomes should be produced in separate collections (choose false if you only require the cons...
bool m_shouldProduceSlices
Whether to produce output slices e.g. may not want to do this if only (re)processing single slices...
std::pair< unsigned short, unsigned short > GetSliceIndex(std::string typeName, int uID)
std::vector< art::Ptr< recob::Vertex > > VertexVector
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::unique_ptr< std::vector< recob::SpacePoint > > SpacePointCollection
std::set< art::Ptr< recob::Hit > > HitList
helper function for LArPandoraInterface producer module
std::unique_ptr< art::Assns< recob::Cluster, recob::Hit > > ClusterToHitCollection
cet::coded_exception< error, detail::translate > exception
Event finding and building.