5 #include "canvas/Persistency/Common/FindManyP.h" 6 #include "canvas/Persistency/Common/FindOneP.h" 26 auto recoSlices = evt.
getValidHandle<std::vector<recob::Slice> >(sliceModule);
27 art::FindManyP<recob::Hit> findHits(recoSlices,evt,sliceModule);
28 std::vector<art::Ptr<recob::Hit>> inputHits = findHits.at(sliceID);
30 std::vector<const recob::Hit*> sliceHits;
34 sliceHits.push_back(
hit.get());
45 auto recoSlices = evt.
getValidHandle<std::vector<recob::Slice> >(sliceModule);
46 std::map<unsigned int, std::vector<const recob::Hit*>> hitMap;
48 for(
auto const slice : *recoSlices){
50 const std::vector<const recob::Hit*> constvec =
GetRecoSliceHits(slice.ID(),
evt,sliceModule);
51 for(
auto const h : constvec){
52 hitMap[slice.ID()].push_back(
h);
64 const std::map<unsigned int, std::vector<const recob::PFParticle*>> sliceMap =
GetPFParticleSliceMap(evt,particleLabel);
66 for(
auto slice : sliceMap){
67 for(
auto particle : slice.second){
96 auto pfParticles = evt.
getValidHandle<std::vector<recob::PFParticle>>(particleLabel);
98 std::map<unsigned int, std::vector<const recob::PFParticle*>> sliceMap;
100 for(
unsigned int p = 0;
p < pfParticles->size(); ++
p){
104 if(primaryOnly && !particle->
IsPrimary())
continue;
108 if(thisSlice != 9999){
109 sliceMap[thisSlice].push_back(particle);
121 auto particles = evt.
getValidHandle<std::vector<recob::PFParticle>>(particleLabel);
122 const art::FindManyP<recob::SpacePoint> findSpacePoints(particles,evt,particleLabel);
123 const std::vector<art::Ptr<recob::SpacePoint>> pfpSpacePoints = findSpacePoints.at(particle.
Self());
126 std::vector<const recob::SpacePoint*> sp;
127 for(
auto pointer : pfpSpacePoints){
128 sp.push_back(pointer.get());
138 auto pfParticles = evt.
getValidHandle<std::vector<recob::PFParticle>>(particleLabel);
139 const art::FindOneP<recob::Slice> findSlice(pfParticles,evt,particleLabel);
158 if(mdMap.find(search) != mdMap.end()){
159 return static_cast<unsigned short>(mdMap.at(search));
171 auto pfParticles = evt.
getValidHandle<std::vector<recob::PFParticle>>(particleLabel);
173 const art::FindManyP<larpandoraobj::PFParticleMetadata> findMetaData(pfParticles,evt,particleLabel);
183 if(mdMap.find(
"IsTestBeam") != mdMap.end()){
const std::map< unsigned int, std::vector< const recob::PFParticle * > > SliceMapHelper(art::Event const &evt, const std::string particleLabel, bool primaryOnly) const
Helper to get the slice map and avoid code repetition.
size_t Self() const
Returns the index of this particle.
const std::map< std::string, float > GetPFParticleMetaData(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the metadata associated to a PFParticle from pandora.
const std::map< unsigned int, std::vector< const recob::PFParticle * > > GetAllPFParticleSliceMap(art::Event const &evt, const std::string particleLabel) const
Get a map of slice index to all of the PFParticles within it.
Metadata associated to PFParticles.
unsigned short GetPFParticleSliceIndex(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the reconstructed slice number associated with a particle.
const std::vector< const recob::Hit * > GetRecoSliceHits(const recob::Slice &slice, art::Event const &evt, const std::string sliceModule) const
const std::vector< const recob::SpacePoint * > GetPFParticleSpacePoints(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the SpacePoints associated to the PFParticle.
const PropertiesMap & GetPropertiesMap() const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
bool IsPrimary() const
Returns whether the particle is the root of the flow.
const recob::Slice * GetPFParticleSlice(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Get the reconstructed slice associated with a particle.
Detector simulation of raw signals on wires.
Declaration of signal hit object.
Hierarchical representation of particle flow.
unsigned short GetBeamSlice(art::Event const &evt, const std::string particleLabel) const
Try to get the slice tagged as beam. Returns 9999 if no beam slice was found.
const std::map< unsigned int, std::vector< const recob::Hit * > > GetRecoSliceHitMap(art::Event const &evt, const std::string sliceModule) const
bool IsBeamParticle(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Use the pandora metadata to tell us if this is a beam particle or not.
const std::map< unsigned int, std::vector< const recob::PFParticle * > > GetPFParticleSliceMap(art::Event const &evt, const std::string particleLabel) const
Get a map of slice index to the primary PFParticles within it.