244 std::unique_ptr<std::vector<sbn::VertexHit>> outVHit(
new std::vector<sbn::VertexHit>);
245 std::unique_ptr<art::Assns<recob::Slice, sbn::VertexHit>> assn(
new art::Assns<recob::Slice, sbn::VertexHit>);
246 std::unique_ptr<art::Assns<recob::Vertex, sbn::VertexHit>> vtxAssn(
new art::Assns<recob::Vertex, sbn::VertexHit>);
247 std::unique_ptr<art::Assns<recob::Hit, sbn::VertexHit>> hitAssn(
new art::Assns<recob::Hit, sbn::VertexHit>);
249 art::PtrMaker<sbn::VertexHit> vhitPtrMaker {
evt};
253 auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
evt);
255 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(
evt, clock_data);
256 auto const* sce = lar::providerFrom<spacecharge::SpaceChargeService>();
261 art::Handle<std::vector<recob::PFParticle>> pfparticle_handle;
264 std::vector<art::Ptr<recob::PFParticle>> pfparticles;
265 art::fill_ptr_vector(pfparticles, pfparticle_handle);
270 art::FindManyP<recob::Track> pfparticleTracks(pfparticles,
evt,
fTrackLabel);
273 std::map<unsigned, art::Ptr<recob::PFParticle>> id_to_pfp;
274 for (
unsigned i = 0; i < pfparticles.size(); i++) {
275 id_to_pfp[pfparticles[i]->Self()] = pfparticles[i];
289 for (
unsigned i_pfp = 0; i_pfp < pfparticles.size(); i_pfp++) {
293 if (!pfparticleVertices.at(i_pfp).size())
continue;
298 (pfpPDGC != 12) && (pfpPDGC != 14) && (pfpPDGC != 16) )
continue;
301 const art::Ptr<recob::Vertex> &vtx_ptr = pfparticleVertices.at(i_pfp).at(0);
322 const std::vector<size_t> &daughters = pfp.
Daughters();
323 std::vector<art::Ptr<recob::PFParticle>> daughterPFPs;
324 for (
size_t d: daughters) {
325 daughterPFPs.push_back(id_to_pfp.at(d));
329 std::array<std::vector<std::vector<art::Ptr<recob::Hit>>>, 3> daughterPlaneHits;
330 for (
const art::Ptr<recob::PFParticle> &d: daughterPFPs) {
331 for (
unsigned i_plane = 0; i_plane < 3; i_plane++) {
332 daughterPlaneHits[i_plane].emplace_back();
334 const std::vector<art::Ptr<recob::Cluster>> &d_clusters = pfparticleClusters.at(d.key());
336 for (
unsigned i = 0; i < d_clusters.size(); i++) {
337 const std::vector<art::Ptr<recob::Hit>> &this_cluster_hits = d_cluster_hits.at(i);
338 daughterPlaneHits[d_clusters[i]->Plane().Plane].back().insert(
339 daughterPlaneHits[d_clusters[i]->
Plane().
Plane].back().
end(),
340 this_cluster_hits.begin(), this_cluster_hits.end());
345 art::Ptr<recob::Slice> thisSlc = pfparticleSlices.at(i_pfp).at(0);
348 const std::vector<art::Ptr<recob::Hit>> &hits = thisSlcHits.at(0);
351 for (
unsigned i_plane = 0; i_plane < 3; i_plane++) {
353 std::vector<art::Ptr<recob::Hit>> nearbyHits;
354 for (
unsigned i_hit = 0; i_hit < hits.size(); i_hit++) {
358 nearbyHits.push_back(hits[i_hit]);
367 for (
unsigned i_hit = 0; i_hit < nearbyHits.size(); i_hit++) {
374 vhit.
vtxx = vert_atwires.position().x();
375 vhit.
vtxXYZ = vert_absolute.position();
379 vert_absolute.position() ,
386 const std::vector<art::Ptr<recob::SpacePoint>> &hit_sp = hitSPs.at(i_hit);
388 bool has_xyz =
false;
400 unsigned plane = hit.WireID().Plane;
401 art::Ptr<recob::PFParticle> matchingPFP;
402 for (
unsigned i_pfp_chk = 0; i_pfp_chk < daughterPlaneHits[plane].size(); i_pfp_chk++) {
403 for (
unsigned i_hit_chk = 0; i_hit_chk < daughterPlaneHits[plane][i_pfp_chk].size(); i_hit_chk++) {
404 if (daughterPlaneHits[plane][i_pfp_chk][i_hit_chk] == nearbyHits[i_hit]) {
405 matchingPFP = daughterPFPs[i_pfp_chk];
411 const std::vector<art::Ptr<recob::Track>> &pfptrack = pfparticleTracks.at(matchingPFP.key());
412 if (pfptrack.size()) {
433 float EField =
sbn::GetEfield(dprop, sce, spXYZ, hit.WireID(),
false);
445 outVHit->push_back(vhit);
446 art::Ptr<sbn::VertexHit> thisVHitPtr = vhitPtrMaker(outVHit->size()-1);
447 assn->addSingle(thisSlc, thisVHitPtr);
448 vtxAssn->addSingle(vtx_ptr, thisVHitPtr);
449 hitAssn->addSingle(nearbyHits[i_hit], thisVHitPtr);
455 evt.put(std::move(outVHit));
456 evt.put(std::move(vtxAssn));
457 evt.put(std::move(assn));
458 evt.put(std::move(hitAssn));
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
art::InputTag fTrackLabel
const std::vector< size_t > & Daughters() const
Returns the collection of daughter particles.
float dqdx
charge/pitch [#elec/cm]
BEGIN_PROLOG true icarus_rawdigitfilter FilterTools FilterPlane1 Plane
geo::Point_t spXYZ
3D location of the SpacePoint associated with this hit. Space charge corrected. [cm] ...
float dedx
Recombination corrected dQ/dx [MeV/cm].
geo::WireID WireID() const
geo::WireID wire
Wire that the hit is on.
geo::Point_t PositionAbsolute(const geo::Point_t &p, const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce)
geo::Point_t position() const
Returns the position of the point in world coordinates [cm].
int PdgCode() const
Return the type of particle as a PDG ID.
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
Definition of vertex object for LArSoft.
float charge
Calibrated and lifetime-corrected charge on the hit [#elec].
double ElectronsFromADCArea(double area, unsigned short plane) const
double Normalize(double dQdx, const art::Event &e, const recob::Hit &h, const geo::Point_t &location, const geo::Vector_t &direction, double t0)
auto end(FixedBins< T, C > const &) noexcept
float proj_dist_to_vertex
Distnace from the hit to the vertex on the wireplane.
bool IsPrimary() const
Returns whether the particle is the root of the flow.
double GetPitch(const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce, geo::Point_t loc, geo::Vector_t dir, geo::View_t view, geo::TPCID tpc, bool correct_sce, bool track_is_sce_corrected, float xsign=1.)
Computes the track-pitch on a plane given an input direction and location.
PlaneID_t Plane
Index of the plane within its TPC.
Description of geometry of one entire detector.
float vtxx
X-Position of the vertex associated with this hit as seen by wire-planes. Not space charge corrected...
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
float Vert2HitDistance(const recob::Hit &hit, const recob::Vertex &vert, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
geo::Point_t PlaceHitAlongTrack(const recob::Track &trk, const recob::Vertex &vert, const recob::Hit &hit, const geo::GeometryCore *geo, const detinfo::DetectorPropertiesData &dprop)
const SMatrixSym33 & covariance() const
Return vertex 3D covariance (be careful, the matrix may have rank=2).
float pitch
Computed pitch of a track traversing from the vertex to this hit. Space charge corrected. [cm].
Hierarchical representation of particle flow.
calo::CalorimetryAlg fCaloAlg
int ID() const
Return vertex id.
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
geo::Point_t PositionAtWires(const geo::Point_t &p, const geo::GeometryCore *geo, const spacecharge::SpaceCharge *sce)
double GetEfield(const detinfo::DetectorPropertiesData &dprop, const spacecharge::SpaceCharge *sce, geo::Point_t loc, geo::TPCID TPC, bool correct_loc_sce, float xsign=1.)
Get the E-Field in the presence of space charge.
int spID
ID of the SpacePoint associated with this hit.
2D representation of charge deposited in the TDC/wire plane
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
const Point_t & position() const
Return vertex 3D position.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
art::InputTag fPFParticleLabel
geo::Point_t vtxXYZ
3D location of the Vertex associated with this hit. Space charge corrected. [cm]
float vtxw
Wire of the vertex associated with this hit. Not space charge corrected. [cm].