7 #ifndef LAR_PANDORA_OUTPUT_H 8 #define LAR_PANDORA_OUTPUT_H 21 #include "Pandora/PandoraInternal.h" 23 namespace art {
class EDProducer;}
24 namespace pandora {
class Pandora;}
71 void Validate()
const;
101 static bool GetPandoraInstance(
const pandora::Pandora *
const pPrimaryPandora,
const std::string &name,
102 const pandora::Pandora *&pPandoraInstance);
110 static void GetPandoraSlices(
const pandora::Pandora *
const pPrimaryPandora, pandora::PfoVector &slicePfos);
119 static bool IsClearCosmic(
const pandora::ParticleFlowObject *
const pPfo);
128 static bool IsFromSlice(
const pandora::ParticleFlowObject *
const pPfo);
137 static unsigned int GetSliceIndex(
const pandora::ParticleFlowObject *
const pPfo);
146 static pandora::PfoVector CollectPfos(
const pandora::Pandora *
const pPrimaryPandora);
155 static pandora::PfoVector CollectAllPfoOutcomes(
const pandora::Pandora *
const pPrimaryPandora);
163 static void CollectPfos(
const pandora::PfoList &parentPfoList, pandora::PfoVector &pfoVector);
174 static pandora::VertexVector CollectVertices(
const pandora::PfoVector &pfoVector, IdToIdVectorMap &pfoToVerticesMap);
185 static pandora::ClusterList CollectClusters(
const pandora::PfoVector &pfoVector, IdToIdVectorMap &pfoToClustersMap);
193 static void Collect3DHits(
const pandora::ParticleFlowObject *
const pPfo, pandora::CaloHitVector &caloHits);
204 static pandora::CaloHitList Collect3DHits(
const pandora::PfoVector &pfoVector, IdToIdVectorMap &pfoToThreeDHitsMap);
214 template <
typename T>
215 static size_t GetId(
const T *
const pT,
const std::list<const T*> &tList);
225 template <
typename T>
226 static size_t GetId(
const T *
const pT,
const std::vector<const T*> &tVector);
236 static void GetPandoraToArtHitMap(
const pandora::ClusterList &clusterList,
const pandora::CaloHitList &threeDHitList,
237 const IdToHitMap &idToHitMap, CaloHitToArtHitMap &pandoraHitToArtHitMap);
253 static void BuildVertices(
const pandora::VertexVector &vertexVector, VertexCollection &outputVertices);
267 const pandora::CaloHitList &threeDHitList,
const CaloHitToArtHitMap &pandoraHitToArtHitMap, SpacePointCollection &outputSpacePoints,
268 SpacePointToHitCollection &outputSpacePointsToHits);
285 const pandora::ClusterList &clusterList,
const CaloHitToArtHitMap &pandoraHitToArtHitMap,
const IdToIdVectorMap &pfoToClustersMap,
286 ClusterCollection &outputClusters, ClusterToHitCollection &outputClustersToHits, IdToIdVectorMap &pfoToArtClustersMap);
304 const pandora::PfoVector &pfoVector,
const IdToIdVectorMap &pfoToVerticesMap,
const IdToIdVectorMap &pfoToThreeDHitsMap,
305 const IdToIdVectorMap &pfoToArtClustersMap, PFParticleCollection &outputParticles,
306 PFParticleToVertexCollection &outputParticlesToVertices, PFParticleToSpacePointCollection &outputParticlesToSpacePoints,
307 PFParticleToClusterCollection &outputParticlesToClusters);
319 const pandora::PfoVector &pfoVector, PFParticleMetadataCollection &outputParticleMetadata,
320 PFParticleToMetadataCollection &outputParticlesToMetadata);
336 static void BuildSlices(
const Settings &settings,
const pandora::Pandora *
const pPrimaryPandora,
const art::Event &
event,
337 const art::EDProducer *
const pProducer,
const std::string &instanceLabel,
const pandora::PfoVector &pfoVector,
338 const IdToHitMap &idToHitMap, SliceCollection &outputSlices, PFParticleToSliceCollection &outputParticlesToSlices,
339 SliceToHitCollection &outputSlicesToHits);
346 static unsigned int BuildDummySlice(SliceCollection &outputSlices);
362 const std::string &instanceLabel,
const pandora::PfoVector &pfoVector,
const IdToHitMap &idToHitMap, SliceCollection &outputSlices,
363 PFParticleToSliceCollection &outputParticlesToSlices, SliceToHitCollection &outputSlicesToHits);
376 static unsigned int BuildSlice(
const pandora::ParticleFlowObject *
const pParentPfo,
const art::Event &
event,
377 const art::EDProducer *
const pProducer,
const std::string &instanceLabel,
const IdToHitMap &idToHitMap, SliceCollection &outputSlices,
378 SliceToHitCollection &outputSlicesToHits);
392 const pandora::PfoVector &pfoVector, T0Collection &outputT0s,
const CaloHitToArtHitMap &pandoraHitToArtHitMap,
393 PFParticleToT0Collection &outputParticlesToT0s);
403 static recob::Vertex BuildVertex(
const pandora::Vertex *
const pVertex,
const size_t vertexId);
413 static recob::SpacePoint BuildSpacePoint(
const pandora::CaloHit *
const pCaloHit,
const size_t spacePointId);
421 static void GetHitsInCluster(
const pandora::Cluster *
const pCluster, pandora::CaloHitVector &sortedHits);
435 static std::vector<recob::Cluster> BuildClusters(
const pandora::Cluster *
const pCluster,
const pandora::ClusterList &clusterList,
436 const CaloHitToArtHitMap &pandoraHitToArtHitMap, IdToIdVectorMap &pandoraClusterToArtClustersMap, std::vector<HitVector> &hitVectors,
464 static recob::PFParticle BuildPFParticle(
const pandora::ParticleFlowObject *
const pPfo,
const size_t pfoId,
const pandora::PfoVector &pfoVector);
477 static bool BuildT0(
const pandora::ParticleFlowObject *
const pPfo,
const pandora::PfoVector &pfoVector,
size_t &nextId,
478 const CaloHitToArtHitMap &pandoraHitToArtHitMap,
anab::T0 &
t0);
499 template <
typename A,
typename B>
501 const size_t idA,
const size_t idB, std::unique_ptr<
art::Assns<A, B> > &association);
512 template <
typename A,
typename B>
514 const size_t idA,
const IdToIdVectorMap &aToBMap, std::unique_ptr<
art::Assns<A, B> > &association);
525 template <
typename A,
typename B>
532 template <
typename T>
533 inline size_t LArPandoraOutput::GetId(
const T *
const pT,
const std::list<const T*> &tList)
537 if (it == tList.end())
538 throw cet::exception(
"LArPandora") <<
" LArPandoraOutput::GetId --- can't find the id of supplied object";
540 return static_cast<size_t>(std::distance(tList.begin(), it));
545 template <
typename T>
546 inline size_t LArPandoraOutput::GetId(
const T *
const pT,
const std::vector<const T*> &tVector)
550 if (it == tVector.end())
551 throw cet::exception(
"LArPandora") <<
" LArPandoraOutput::GetId --- can't find the id of supplied object";
553 return static_cast<size_t>(std::distance(tVector.begin(), it));
558 template <
typename A,
typename B>
560 const std::string &instanceLabel,
const size_t idA,
const size_t idB, std::unique_ptr<
art::Assns<A, B> > &association)
568 association->addSingle(pA, pB);
573 template <
typename A,
typename B>
578 if (it == aToBMap.end())
579 throw cet::exception(
"LArPandora") <<
" LArPandoraOutput::AddAssociation --- id doesn't exists in the assocaition map";
585 for (
const size_t idB : it->second)
588 association->addSingle(pA, pB);
594 template <
typename A,
typename B>
603 association->addSingle(pA, pB);
608 #endif // LAR_PANDORA_OUTPUT_H code to link reconstructed objects back to the MC truth information
std::unique_ptr< art::Assns< recob::PFParticle, anab::T0 > > PFParticleToT0Collection
Interface class for LArPandora producer modules, which reconstruct recob::PFParticles from recob::Hit...
art::EDProducer * m_pProducer
std::unique_ptr< std::vector< recob::Cluster > > ClusterCollection
const pandora::Pandora * m_pPrimaryPandora
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::map< int, art::Ptr< recob::Hit > > IdToHitMap
bool m_isNeutrinoRecoOnlyNoSlicing
If we are running the neutrino reconstruction only with no slicing.
std::map< const pandora::CaloHit *, art::Ptr< recob::Hit > > CaloHitToArtHitMap
std::unique_ptr< std::vector< recob::SpacePoint > > SpacePointCollection
Definition of vertex object for LArSoft.
std::unique_ptr< std::vector< recob::Slice > > SliceCollection
std::string m_hitfinderModuleLabel
The hit finder module label.
Algorithm collection class computing cluster parameters.
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::SpacePoint, recob::Hit > > SpacePointToHitCollection
std::unique_ptr< art::Assns< recob::PFParticle, recob::Slice > > PFParticleToSliceCollection
std::unique_ptr< std::vector< recob::Vertex > > VertexCollection
std::unique_ptr< std::vector< larpandoraobj::PFParticleMetadata > > PFParticleMetadataCollection
std::unique_ptr< std::vector< recob::PFParticle > > PFParticleCollection
Declaration of cluster object.
std::unique_ptr< art::Assns< recob::PFParticle, larpandoraobj::PFParticleMetadata > > PFParticleToMetadataCollection
std::vector< art::Ptr< recob::Hit > > HitVector
Detector simulation of raw signals on wires.
std::unique_ptr< art::Assns< recob::PFParticle, recob::Vertex > > PFParticleToVertexCollection
Hierarchical representation of particle flow.
Utility object to perform functions of association.
std::unique_ptr< std::vector< anab::T0 > > T0Collection
std::unique_ptr< art::Assns< recob::PFParticle, recob::Cluster > > PFParticleToClusterCollection
bool m_shouldRunStitching
Interface for a algorithm class computing cluster parameters.
bool m_shouldProduceAllOutcomes
If all outcomes should be produced in separate collections (choose false if you only require the cons...
std::pair< unsigned short, unsigned short > GetSliceIndex(std::string typeName, int uID)
std::unique_ptr< art::Assns< recob::Slice, recob::Hit > > SliceToHitCollection
std::unique_ptr< art::Assns< recob::PFParticle, recob::SpacePoint > > PFParticleToSpacePointCollection
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.
std::vector< art::Ptr< recob::Vertex > > VertexVector