10 #include "cetlib_except/exception.h" 12 #include "canvas/Persistency/Common/FindManyP.h" 31 return DUNEAnaPFParticleUtils::GetAssocProductVector<anab::T0>(pParticle,
evt,
label,
label);
38 return DUNEAnaPFParticleUtils::GetAssocProductVector<anab::CosmicTag>(pParticle,
evt,
label,
label);
45 auto theseParticles = evt.
getHandle<std::vector<recob::PFParticle>>(
label);
46 bool success = theseParticles.isValid();
50 mf::LogError(
"LArPandora") <<
" Failed to find product with label " << label <<
" ... returning empty vector" <<
std::endl;
51 return std::vector<art::Ptr<recob::PFParticle>>();
54 std::vector<art::Ptr<recob::PFParticle>> children;
56 for (
unsigned int iPart = 0; iPart < theseParticles->size(); ++iPart)
58 if (theseParticles->at(iPart).Parent() == pParticle.
key())
61 children.push_back(pChild);
73 const std::vector<art::Ptr<recob::Cluster>> theseClusters = DUNEAnaPFParticleUtils::GetAssocProductVector<recob::Cluster>(pParticle,
evt,
label,
label);
75 std::vector<art::Ptr<recob::Hit>> theseHits;
78 const std::vector<art::Ptr<recob::Hit>> tempHits = DUNEAnaPFParticleUtils::GetAssocProductVector<recob::Hit>(pCluster,
evt,
label,
label);
79 theseHits.insert(theseHits.end(),tempHits.begin(),tempHits.end());
89 const std::vector<art::Ptr<recob::Cluster>> theseClusters = DUNEAnaPFParticleUtils::GetAssocProductVector<recob::Cluster>(pParticle,
evt,
label,
label);
91 std::vector<art::Ptr<recob::Hit>> theseHits;
94 const std::vector<art::Ptr<recob::Hit>> tempHits = DUNEAnaPFParticleUtils::GetAssocProductVector<recob::Hit>(pCluster,
evt,
label,
label);
97 if (pHit->View() == view)
99 theseHits.push_back(pHit);
110 return DUNEAnaPFParticleUtils::GetAssocProductVector<recob::SpacePoint>(pParticle,
evt,
label,
label);
117 return DUNEAnaPFParticleUtils::GetAssocProduct<recob::Track>(pParticle,
evt,particleLabel,trackLabel);
124 return DUNEAnaPFParticleUtils::GetAssocProduct<recob::Shower>(pParticle,
evt,particleLabel,showerLabel);
131 return DUNEAnaPFParticleUtils::GetAssocProduct<recob::Vertex>(pParticle,
evt,particleLabel,particleLabel);
141 unsigned int sliceIndex;
144 if (mapItr == metaMap.end())
146 throw cet::exception(
"DUNEAna") <<
" DUNEAnaPFParticleUtils::GetSlice --- No associated slice found";
150 sliceIndex = mapItr->second;
153 return DUNEAnaPFParticleUtils::GetProductVector<recob::Slice>(
evt,
label).at(sliceIndex);
160 return DUNEAnaPFParticleUtils::GetAssocProduct<larpandoraobj::PFParticleMetadata>(pParticle,
evt,
label,
label);
168 const std::vector<art::Ptr<recob::Track>> theseTracks = DUNEAnaPFParticleUtils::GetAssocProductVector<recob::Track>(pParticle,
evt,particleLabel,trackLabel);
170 return !theseTracks.empty();
177 const std::vector<art::Ptr<recob::Shower>> theseShowers = DUNEAnaPFParticleUtils::GetAssocProductVector<recob::Shower>(pParticle,
evt,particleLabel,showerLabel);
179 return !theseShowers.empty();
190 return metaMap.find(
"IsClearCosmic") != metaMap.end();
static std::vector< art::Ptr< anab::T0 > > GetT0(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the T0(s) associated with the particle.
static art::Ptr< recob::Track > GetTrack(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel)
Get the track associated to this particle. Should only be called if IsTrack method succeeds...
static art::Ptr< recob::Slice > GetSlice(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel)
Get the slice associated to this particle.
Handle< PROD > getHandle(SelectorBase const &) const
static bool IsClearCosmic(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel)
Check if this particle is a clear cosmic ray.
static bool IsShower(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel)
Check if this particle has an associated shower.
int PdgCode() const
Return the type of particle as a PDG ID.
static std::vector< art::Ptr< recob::Hit > > GetViewHits(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label, const unsigned short &view)
Get the hits associated to this particle in a given view.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
static art::Ptr< recob::Shower > GetShower(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel)
Get the shower associated to this particle. Should only be called if IsShower method succeeds...
static std::vector< art::Ptr< recob::PFParticle > > GetChildParticles(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the child particles (one step down in the hierarchy) of this particle.
static std::vector< art::Ptr< recob::SpacePoint > > GetSpacePoints(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the spacepoints associated to this particle.
static bool IsNeutrino(const art::Ptr< recob::PFParticle > &pParticle)
Check if this particle is a neutrino.
key_type key() const noexcept
const PropertiesMap & GetPropertiesMap() const
Utility containing helpful functions for end users to access information about PFParticles.
static art::Ptr< larpandoraobj::PFParticleMetadata > GetMetadata(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the metadata associated to this particle.
Declaration of signal hit object.
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the hits associated to this particle.
Provides recob::Track data product.
static art::Ptr< recob::Vertex > GetVertex(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel)
Get the vertex associated to this particle.
static bool IsTrack(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel)
Check if this particle has an associated track.
static std::vector< art::Ptr< anab::CosmicTag > > GetCosmicTag(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label)
Get the Cosmic Tag(s) associated with the particle.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)