43 std::vector<double>& uvw,
44 std::vector<double>&
t,
49 std::vector<recob::EndPoint2D> EndPoints);
54 std::vector<recob::EndPoint2D>
const& EndPoints,
58 std::vector<recob::SpacePoint>& sps,
59 bool ApplyFilter =
true);
62 std::vector<int>& ConnectionPoint1,
63 std::vector<int>& ConnectionPoint2);
87 produces<std::vector<recob::Seed>>();
99 for (
unsigned int i = 0; i < hith->size(); ++i) {
107 std::vector<recob::Wire>
const& wireVec(*wireHandle);
112 std::vector<recob::EndPoint2D> EndPoints;
120 std::vector<recob::SpacePoint> sps =
Get3DFeaturePoints(clockData, detProp, EndPoints, hitvec);
121 std::vector<recob::Seed> SeedsToStore =
GetValidLines(detProp, sps,
true);
123 std::unique_ptr<std::vector<recob::Seed>>
seeds(
new std::vector<recob::Seed>);
125 for (
size_t i = 0; i != SeedsToStore.size(); ++i)
126 seeds->push_back(SeedsToStore.at(i));
133 std::map<int, std::vector<double>>
136 std::map<int, std::vector<double>> EndPointTimesInPlane;
137 for (
size_t i = 0; i != EndPoints.size(); ++i) {
138 EndPointTimesInPlane[EndPoints.at(i).View()].push_back(EndPoints.at(i).DriftTime());
141 for (std::map<
int, std::vector<double>>::
iterator itEpTime = EndPointTimesInPlane.begin();
142 itEpTime != EndPointTimesInPlane.end();
144 std::sort(itEpTime->second.begin(), itEpTime->second.end());
146 return EndPointTimesInPlane;
151 std::vector<recob::Seed>
153 std::vector<recob::SpacePoint>& spts,
156 std::vector<recob::Seed> SeedsToReturn;
158 std::vector<int> ConnectionPoint1;
159 std::vector<int> ConnectionPoint2;
160 std::map<int, std::vector<int>> SeedConnections;
162 for (
size_t i = 0; i != spts.size(); ++i) {
163 for (
size_t j = 0; j != i; ++j) {
168 std::vector<double> t_i, t_j;
170 std::vector<double> uvw_i;
171 std::vector<double> uvw_j;
173 for (
size_t d = 0;
d != 3; ++
d) {
174 xyz_i[
d] = spts.at(i).XYZ()[
d];
175 xyz_j[
d] = spts.at(j).XYZ()[
d];
181 bool ThisLineGood =
true;
183 for (
size_t p = 0;
p != uvw_i.size(); ++
p) {
196 for (
size_t d = 0;
d != 3; ++
d) {
197 Pos[
d] = 0.5 * (xyz_i[
d] + xyz_j[
d]);
198 Dir[
d] = 0.5 * (xyz_i[
d] - xyz_j[
d]);
202 ConnectionPoint1.push_back(i);
203 ConnectionPoint2.push_back(j);
205 SeedsToReturn.push_back(
recob::Seed(Pos, Dir, Err, Err));
213 <<
"Seeds after filter " << SeedsToReturn.size() <<
" seeds" <<
std::endl;
216 return SeedsToReturn;
223 std::vector<int>& ConnectionPoint1,
224 std::vector<int>& ConnectionPoint2)
227 std::map<int, bool> MarkedForRemoval;
229 std::map<int, std::vector<int>> SeedsSharingPoint;
230 for (
size_t i = 0; i != Seeds.size(); ++i) {
231 SeedsSharingPoint[ConnectionPoint1[i]].push_back(i);
232 SeedsSharingPoint[ConnectionPoint2[i]].push_back(i);
235 for (
size_t s = 0;
s != Seeds.size(); ++
s) {
237 int StartPt = ConnectionPoint1.at(
s);
238 int EndPt = ConnectionPoint2.at(
s);
241 for (
size_t SeedsWithThisStart = 0; SeedsWithThisStart != SeedsSharingPoint[StartPt].size();
242 SeedsWithThisStart++) {
243 int i = SeedsSharingPoint[StartPt].at(SeedsWithThisStart);
244 if (ConnectionPoint1.at(i) == StartPt)
245 MidPt = ConnectionPoint2.at(i);
246 else if (ConnectionPoint2.at(i) == StartPt)
247 MidPt = ConnectionPoint1.at(i);
249 for (
size_t SeedsWithThisMid = 0; SeedsWithThisMid != SeedsSharingPoint[MidPt].size();
250 SeedsWithThisMid++) {
251 int j = SeedsSharingPoint[MidPt].at(SeedsWithThisMid);
252 if ((ConnectionPoint1.at(j) == EndPt) || (ConnectionPoint2.at(j) == EndPt)) {
254 double Lengthi = Seeds.at(i).GetLength();
255 double Lengthj = Seeds.at(j).GetLength();
256 double Lengths = Seeds.at(
s).GetLength();
258 if ((Lengths > Lengthi) && (Lengths > Lengthj)) {
259 MarkedForRemoval[i] =
true;
260 MarkedForRemoval[j] =
true;
263 if ((Lengthi > Lengths) && (Lengthi > Lengthj)) {
264 MarkedForRemoval[
s] =
true;
265 MarkedForRemoval[j] =
true;
267 if ((Lengthj > Lengthi) && (Lengthj > Lengths)) {
268 MarkedForRemoval[
s] =
true;
269 MarkedForRemoval[i] =
true;
275 for (std::map<int, bool>::reverse_iterator itrem = MarkedForRemoval.rbegin();
276 itrem != MarkedForRemoval.rend();
278 if (itrem->second ==
true) {
279 Seeds.erase(Seeds.begin() + itrem->first);
280 ConnectionPoint1.erase(ConnectionPoint1.begin() + itrem->first);
281 ConnectionPoint2.erase(ConnectionPoint2.begin() + itrem->first);
291 std::vector<double>& uvw,
292 std::vector<double>&
t,
303 for (
int plane = 0; plane != NPlanes; plane++) {
304 uvw[plane] = geo->
NearestWire(xyz, plane, tpc, cryo);
311 std::vector<recob::SpacePoint>
314 std::vector<recob::EndPoint2D>
const& EndPoints,
322 itEP != EndPoints.end();
324 int EPMatchCount = 0;
329 if ((itEP->View() == (*itHit)->View()) &&
330 (itEP->WireID().Wire == (*itHit)->WireID().Wire)) {
336 std::vector<recob::SpacePoint> spts;
339 for (
size_t i = 0; i != spts.size(); ++i) {
340 for (
size_t p = 0;
p != 3; ++
p) {
341 double Closest = 100000;
343 for (
size_t epTime = 0; epTime !=
fEndPointTimes[
p].size(); ++epTime) {
std::vector< recob::SpacePoint > Get3DFeaturePoints(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< recob::EndPoint2D > const &EndPoints, art::PtrVector< recob::Hit > const &Hits)
void RemoveDuplicatePaths(std::vector< recob::Seed > &Seeds, std::vector< int > &ConnectionPoint1, std::vector< int > &ConnectionPoint2)
Encapsulate the construction of a single cyostat.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned int Nplanes() const
Number of planes in this tpc.
EDProducer(fhicl::ParameterSet const &pset)
void GetProjectedEnds(detinfo::DetectorPropertiesData const &detProp, TVector3 xyz, std::vector< double > &uvw, std::vector< double > &t, int tpc=0, int cryo=0)
TH2F const & GetWireDataHist(unsigned int) const
void get_feature_points(std::vector< recob::EndPoint2D > &, geo::Geometry const &)
std::map< int, std::vector< double > > ExtractEndPointTimes(std::vector< recob::EndPoint2D > EndPoints)
art framework interface to geometry description
art::ServiceHandle< geo::Geometry const > fGeometryHandle
void GrabWires(std::vector< recob::Wire > const &wireVec, geo::Geometry const &)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
typename data_t::const_iterator const_iterator
#define DEFINE_ART_MODULE(klass)
void produce(art::Event &evt) override
void push_back(Ptr< U > const &p)
algorithm to find feature 2D points
void makeSpacePoints(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::PtrVector< recob::Hit > &hits, std::vector< recob::SpacePoint > &spts) const
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
float line_integral(TH2F const &hist, int x1, float y1, int x2, float y2, float threshold) const
double ConvertXToTicks(double X, int p, int t, int c) const
std::string fCalDataModuleLabel
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
std::map< int, std::vector< double > > fEndPointTimes
std::string fHitModuleLabel
std::vector< TrajPoint > seeds
Declaration of signal hit object.
Contains all timing reference information for the detector.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
std::vector< recob::Seed > GetValidLines(detinfo::DetectorPropertiesData const &detProp, std::vector< recob::SpacePoint > &sps, bool ApplyFilter=true)
Declaration of basic channel signal object.
Algorithm for generating space points from hits.
LArSoft geometry interface.
QTextStream & endl(QTextStream &s)
Encapsulate the construction of a single detector plane.
corner::CornerFinderAlg fCorner
FeatureTracker(fhicl::ParameterSet const &pset)