69 const std::vector<recob::Track>&
tracks,
70 const art::FindManyP< recob::Hit >& fbp);
75 const std::vector<recob::Track>& tracks,
76 const art::FindManyP< recob::Hit >& fbp);
100 produces< std::vector<recob::Hit> >();
113 const std::vector<recob::Track>&
tracks,
114 const art::FindManyP< recob::Hit >& fbp)
116 for (
size_t t = 0;
t < tracks.size();
t++)
117 if (!(tracks[
t].
ID() & 0x10000))
119 std::vector< art::Ptr<recob::Hit> > v = fbp.at(
t);
122 while (ih < hitlist.size())
125 for (
size_t it = 0; it < v.size(); it++)
126 if (v[it].
key() == hitlist[
ih].key())
130 if (found) hitlist.erase(hitlist.begin() +
ih);
138 unsigned int view,
unsigned int tpc,
unsigned int cryo)
145 double max_d2_d = 0.3 * 0.3;
146 double max_d2_w = (wirePitch + 0.1) * (wirePitch + 0.1);
148 bool isClose =
false;
155 double dpx = fabs(p0.X() - p1.X());
156 double dpy = fabs(p0.Y() - p1.Y());
158 if (((dpx > 0.5 * dpy) && (d2 < max_d2_d)) || (d2 < max_d2_w))
160 isClose =
true;
break;
170 const std::vector<recob::Track>&
tracks,
171 const art::FindManyP< recob::Hit >& fbp)
174 while (ih < hitlist.size())
176 bool unmatched =
true,
close =
false;;
177 for (
size_t t = 0;
t < tracks.size();
t++)
179 std::vector< art::Ptr<recob::Hit> > v = fbp.at(
t);
180 for (
size_t it = 0; it < v.size(); it++)
181 if (v[it].
key() == hitlist[
ih].key())
183 unmatched =
false;
break;
185 if (!unmatched)
break;
189 unsigned int plane = hitlist[
ih]->WireID().Plane;
190 unsigned int tpc = hitlist[
ih]->WireID().TPC;
191 unsigned int cryo = hitlist[
ih]->WireID().Cryostat;
194 hitlist[ih]->
WireID().
Wire, hitlist[ih]->PeakTime(), plane, tpc, cryo);
196 for (
size_t t = 0;
t < tracks.size();
t++)
197 if (!(tracks[
t].
ID() & 0x10000) &&
203 if (
close) hitlist.erase(hitlist.begin() +
ih);
211 std::unique_ptr< std::vector< recob::Hit > > not_track_hits(
new std::vector< recob::Hit >);
213 std::vector< art::Ptr<recob::Hit> > hitlist;
217 if (hitListHandle && trkListHandle)
229 for (
auto const&
hit : hitlist) not_track_hits->push_back(
recob::Hit(*
hit));
238 TVector2 v0(psrc); v0 -= p0;
239 TVector2 v1(p1); v1 -= p0;
241 TVector2 v2(psrc); v2 -= p1;
242 TVector2 v3(v1); v3 *= -1.0;
244 double v0Norm2 = v0.Mod2();
245 double v1Norm2 = v1.Mod2();
250 double mag01 = sqrt(v0Norm2 * v1Norm2);
251 double cosine01 = 0.0;
252 if (mag01 != 0.0) cosine01 = v0 * v1 / mag01;
254 double v2Norm2 = v2.Mod2();
255 double mag23 = sqrt(v2Norm2 * v3.Mod2());
256 double cosine23 = 0.0;
257 if (mag23 != 0.0) cosine23 = v2 * v3 / mag23;
260 if ((cosine01 > 0.0) && (cosine23 > 0.0))
262 result = (1.0 - cosine01 * cosine01) * v0Norm2;
266 if (cosine01 <= 0.0) result = v0Norm2;
267 else result = v2Norm2;
270 if (result >= 0.0)
return result;
275 v1 = p0; v1 += p1; v1 *= 0.5;
void produce(art::Event &e) override
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void removeUnmatchedHitsCloseToTracks(detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit > > &hitlist, const std::vector< recob::Track > &tracks, const art::FindManyP< recob::Hit > &fbp)
double Dist2(const TVector2 &v1, const TVector2 &v2)
Handle< PROD > getHandle(SelectorBase const &) const
Point_t const & LocationAtPoint(size_t i) const
EDProducer(fhicl::ParameterSet const &pset)
std::string fHitModuleLabel
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
TVector2 WireDriftToCm(detinfo::DetectorPropertiesData const &detProp, unsigned int wire, float drift, unsigned int plane, unsigned int tpc, unsigned int cryo)
EmLikeHits(fhicl::ParameterSet const &p)
std::string fTrk3DModuleLabel
static double getDist2(const TVector2 &psrc, const TVector2 &p0, const TVector2 &p1)
art framework interface to geometry description
int close(int)
Closes the file descriptor fd.
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
T get(std::string const &key) const
void removeHitsAssignedToTracks(std::vector< art::Ptr< recob::Hit > > &hitlist, const std::vector< recob::Track > &tracks, const art::FindManyP< recob::Hit > &fbp)
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
TVector2 GetVectorProjectionToPlane(const TVector3 &v, unsigned int plane, unsigned int tpc, unsigned int cryo)
Detector simulation of raw signals on wires.
Encapsulate the geometry of a wire.
Implementation of the Projection Matching Algorithm.
Declaration of signal hit object.
Encapsulate the construction of a single detector plane.
Provides recob::Track data product.
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
EmLikeHits & operator=(EmLikeHits const &)=delete
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
2D representation of charge deposited in the TDC/wire plane
void reconfigure(fhicl::ParameterSet const &p)
bool isCloseToTrack(TVector2 p, const recob::Track &trk, unsigned int view, unsigned int tpc, unsigned int cryo)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
QTextStream & endl(QTextStream &s)
Encapsulate the construction of a single detector plane.