43 std::vector<double>& uvw,
44 std::vector<double>& t);
47 std::vector<recob::EndPoint2D> EndPoints);
52 std::vector<recob::EndPoint2D>
const& EndPoints,
56 std::vector<recob::SpacePoint>& sps,
57 bool ApplyFilter =
true);
60 std::vector<int>& ConnectionPoint1,
61 std::vector<int>& ConnectionPoint2);
85 produces<std::vector<recob::Seed>>();
96 for (
unsigned int i = 0; i < hith->size(); ++i) {
104 std::vector<recob::Wire>
const& wireVec(*wireHandle);
109 std::vector<recob::EndPoint2D> EndPoints;
117 std::vector<recob::SpacePoint> sps =
Get3DFeaturePoints(clockData, detProp, EndPoints, hitvec);
118 std::vector<recob::Seed> SeedsToStore =
GetValidLines(detProp, sps,
true);
120 std::unique_ptr<std::vector<recob::Seed>>
seeds(
new std::vector<recob::Seed>);
122 for (
size_t i = 0; i != SeedsToStore.size(); ++i)
123 seeds->push_back(SeedsToStore.at(i));
125 evt.
put(std::move(seeds));
131 std::vector<recob::EndPoint2D> EndPoints)
133 std::map<int, std::vector<double>> EndPointTimesInPlane;
134 for (
size_t i = 0; i != EndPoints.size(); ++i) {
135 EndPointTimesInPlane[EndPoints.at(i).View()].push_back(EndPoints.at(i).DriftTime());
138 for (std::map<
int, std::vector<double>>::
iterator itEpTime = EndPointTimesInPlane.begin();
139 itEpTime != EndPointTimesInPlane.end();
141 std::sort(itEpTime->second.begin(), itEpTime->second.end());
143 return EndPointTimesInPlane;
150 std::vector<recob::SpacePoint>& spts,
153 std::vector<recob::Seed> SeedsToReturn;
155 std::vector<int> ConnectionPoint1;
156 std::vector<int> ConnectionPoint2;
157 std::map<int, std::vector<int>> SeedConnections;
159 for (
size_t i = 0; i != spts.size(); ++i) {
160 for (
size_t j = 0; j != i; ++j) {
162 auto const& xyz_i = spts[i].position();
163 auto const& xyz_j = spts[j].position();
165 std::vector<double> t_i, t_j;
166 std::vector<double> uvw_i, uvw_j;
171 bool ThisLineGood =
true;
173 for (
size_t p = 0; p != uvw_i.size(); ++p) {
183 double Pos[3] = {0.5 * (xyz_i.X() + xyz_j.X()),
184 0.5 * (xyz_i.Y() + xyz_j.Y()),
185 0.5 * (xyz_i.Z() + xyz_j.Z())};
186 double Dir[3] = {0.5 * (xyz_i.X() - xyz_j.X()),
187 0.5 * (xyz_i.Y() - xyz_j.Y()),
188 0.5 * (xyz_i.Z() - xyz_j.Z())};
190 ConnectionPoint1.push_back(i);
191 ConnectionPoint2.push_back(j);
193 SeedsToReturn.push_back(
recob::Seed(Pos, Dir, Err, Err));
201 <<
"Seeds after filter " << SeedsToReturn.size() <<
" seeds" << std::endl;
204 return SeedsToReturn;
210 std::vector<int>& ConnectionPoint1,
211 std::vector<int>& ConnectionPoint2)
214 std::map<int, bool> MarkedForRemoval;
216 std::map<int, std::vector<int>> SeedsSharingPoint;
217 for (
size_t i = 0; i != Seeds.size(); ++i) {
218 SeedsSharingPoint[ConnectionPoint1[i]].push_back(i);
219 SeedsSharingPoint[ConnectionPoint2[i]].push_back(i);
222 for (
size_t s = 0; s != Seeds.size(); ++s) {
224 int StartPt = ConnectionPoint1.at(s);
225 int EndPt = ConnectionPoint2.at(s);
228 for (
size_t SeedsWithThisStart = 0; SeedsWithThisStart != SeedsSharingPoint[StartPt].size();
229 SeedsWithThisStart++) {
230 int i = SeedsSharingPoint[StartPt].at(SeedsWithThisStart);
231 if (ConnectionPoint1.at(i) == StartPt)
232 MidPt = ConnectionPoint2.at(i);
233 else if (ConnectionPoint2.at(i) == StartPt)
234 MidPt = ConnectionPoint1.at(i);
236 for (
size_t SeedsWithThisMid = 0; SeedsWithThisMid != SeedsSharingPoint[MidPt].size();
237 SeedsWithThisMid++) {
238 int j = SeedsSharingPoint[MidPt].at(SeedsWithThisMid);
239 if ((ConnectionPoint1.at(j) == EndPt) || (ConnectionPoint2.at(j) == EndPt)) {
241 double Lengthi = Seeds.at(i).GetLength();
242 double Lengthj = Seeds.at(j).GetLength();
243 double Lengths = Seeds.at(s).GetLength();
245 if ((Lengths > Lengthi) && (Lengths > Lengthj)) {
246 MarkedForRemoval[i] =
true;
247 MarkedForRemoval[j] =
true;
250 if ((Lengthi > Lengths) && (Lengthi > Lengthj)) {
251 MarkedForRemoval[s] =
true;
252 MarkedForRemoval[j] =
true;
254 if ((Lengthj > Lengthi) && (Lengthj > Lengths)) {
255 MarkedForRemoval[s] =
true;
256 MarkedForRemoval[i] =
true;
262 for (std::map<int, bool>::reverse_iterator itrem = MarkedForRemoval.rbegin();
263 itrem != MarkedForRemoval.rend();
265 if (itrem->second ==
true) {
266 Seeds.erase(Seeds.begin() + itrem->first);
267 ConnectionPoint1.erase(ConnectionPoint1.begin() + itrem->first);
268 ConnectionPoint2.erase(ConnectionPoint2.begin() + itrem->first);
277 std::vector<double>& uvw,
278 std::vector<double>& t)
283 unsigned int NPlanes = geo->
TPC(tpcID).
Nplanes();
288 for (
unsigned int plane = 0; plane != NPlanes; plane++) {
299 std::vector<recob::EndPoint2D>
const& EndPoints,
307 itEP != EndPoints.end();
309 int EPMatchCount = 0;
314 if ((itEP->View() == (*itHit)->View()) &&
315 (itEP->WireID().Wire == (*itHit)->WireID().Wire)) {
321 std::vector<recob::SpacePoint> spts;
324 for (
size_t i = 0; i != spts.size(); ++i) {
325 for (
size_t p = 0; p != 3; ++p) {
326 double Closest = 100000;
328 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.
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
The data type to uniquely identify a Plane.
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::ServiceHandle< geo::Geometry const > fGeometryHandle
TPCGeo const & TPC(TPCID const &tpcid=tpc_zero) const
Returns the specified TPC.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void GrabWires(std::vector< recob::Wire > const &wireVec, geo::Geometry 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
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
The data type to uniquely identify a TPC.
std::map< int, std::vector< double > > fEndPointTimes
std::string fHitModuleLabel
std::vector< TrajPoint > seeds
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
WireID NearestWireID(Point_t const &point, PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Contains all timing reference information for the detector.
void GetProjectedEnds(detinfo::DetectorPropertiesData const &detProp, geo::Point_t const &xyz, std::vector< double > &uvw, std::vector< double > &t)
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.
Namespace collecting geometry-related classes utilities.
art framework interface to geometry description
Encapsulate the construction of a single detector plane.
corner::CornerFinderAlg fCorner
FeatureTracker(fhicl::ParameterSet const &pset)