17 const std::vector<raw::ChannelID_t>& xbad,
18 const std::vector<raw::ChannelID_t>& ubad,
19 const std::vector<raw::ChannelID_t>& vbad,
21 double distThreshDrift,
23 : geom(
art::ServiceHandle<
geo::Geometry const>()->provider())
24 , fDistThresh(distThresh)
25 , fDistThreshDrift(distThreshDrift)
26 , fXHitOffset(xhitOffset)
40 std::map<
geo::TPCID, std::vector<HitOrChan>>& out)
52 out[tpc].emplace_back(
hit.get(), xpos);
56 std::sort(it.second.begin(), it.second.end(), [](
auto a,
auto b) {
return a.xpos < b.xpos; });
61 std::map<
geo::TPCID, std::vector<raw::ChannelID_t>>& out)
65 out[tpc].push_back(chan);
74 :
geom(
art::ServiceHandle<
geo::Geometry const>()->provider()), fTPC(tpc)
79 const auto key = std::make_pair(a, b);
81 auto it = fMap.find(key);
82 if (it != fMap.end()) {
87 const bool res = ISect(a, b, pt);
88 fMap.insert({key, res});
89 fPtMap.insert({key, pt});
110 std::map<std::pair<raw::ChannelID_t, raw::ChannelID_t>,
bool>
fMap;
125 const TVector3 pa(ra.
y, ra.
z, 0);
126 const TVector3 pb(rb.
y, rb.
z, 0);
148 std::vector<HitTriplet> ret;
153 std::vector<ChannelDoublet> xus =
DoubletsXU(tpc);
154 std::vector<ChannelDoublet> xvs =
DoubletsXV(tpc);
164 auto xvit_begin = xvs.begin();
172 while (xvit_begin != xvs.end() &&
LessThanXHit(*xvit_begin, xu))
176 for (
auto xvit = xvit_begin; xvit != xvs.end() &&
SameXHit(*xvit, xu); ++xvit) {
180 if (!x.
hit && !u.
hit)
continue;
181 if (!x.
hit && !v.
hit)
continue;
182 if (!u.
hit && !v.
hit)
continue;
187 if (!isectUV(u.
chan, v.
chan, ptUV))
continue;
210 xavg, (xu.pt.y + xvit->pt.y + ptUV.
y) / 3, (xu.pt.z + xvit->pt.z + ptUV.
z) / 3};
217 std::cout << tpc <<
" " << xus.size() <<
" XUs and " << xvs.size() <<
" XVs -> " << nxuv
218 <<
" XUVs" << std::endl;
222 std::cout << ret.size() <<
" XUVs total" << std::endl;
230 std::vector<HitTriplet> ret;
235 std::vector<ChannelDoublet> xus =
DoubletsXU(tpc);
241 double xavg = x.
xpos;
249 const XYZ pt{xavg, xu.pt.y, xu.pt.z};
255 std::cout << ret.size() <<
" XUs total" << std::endl;
263 std::vector<ChannelDoublet> ret =
268 ret.push_back({it.b, it.a, it.pt});
277 std::vector<ChannelDoublet> ret =
282 ret.push_back({it.b, it.a, it.pt});
291 const std::vector<HitOrChan>& ahits,
292 const std::vector<HitOrChan>& bhits,
293 const std::vector<raw::ChannelID_t>& bbads)
const 295 std::vector<ChannelDoublet> ret;
299 auto b_begin = bhits.begin();
305 if (isect(a.chan, b, pt)) { ret.emplace_back(a, b, pt); }
308 while (b_begin != bhits.end() && b_begin->xpos < a.xpos && !
CloseDrift(b_begin->xpos, a.xpos))
311 for (
auto bit = b_begin; bit != bhits.end(); ++bit) {
317 if (!isect(a.chan, b.
chan, pt))
continue;
319 ret.emplace_back(a, b, pt);
bool CloseSpace(geo::WireIDIntersection ra, geo::WireIDIntersection rb) const
double z
z position of intersection
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
std::vector< ChannelDoublet > DoubletHelper(geo::TPCID tpc, const std::vector< HitOrChan > &ahits, const std::vector< HitOrChan > &bhits, const std::vector< raw::ChannelID_t > &bbads) const
IntersectionCache(geo::TPCID tpc)
std::map< std::pair< raw::ChannelID_t, raw::ChannelID_t >, geo::WireIDIntersection > fPtMap
std::map< geo::TPCID, std::vector< HitOrChan > > fX_by_tpc
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, Point_t &intersection) const
Computes the intersection between two wires.
const geo::GeometryCore * geom
std::map< std::pair< raw::ChannelID_t, raw::ChannelID_t >, bool > fMap
std::map< geo::TPCID, std::vector< HitOrChan > > fV_by_tpc
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fXbad_by_tpc
std::vector< TPCID > ROPtoTPCs(readout::ROPID const &ropid) const
Returns a list of ID of TPCs the specified ROP spans.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Access the description of detector geometry.
std::map< geo::TPCID, std::vector< HitOrChan > > fU_by_tpc
const geo::GeometryCore * geom
The data type to uniquely identify a TPC.
Description of geometry of one entire detector.
bool SameXHit(const ChannelDoublet &a, const ChannelDoublet &b)
Detector simulation of raw signals on wires.
double ConvertTicksToX(double ticks, int p, int t, int c) const
readout::ROPID ChannelToROP(raw::ChannelID_t channel) const
TripletFinder(const detinfo::DetectorPropertiesData &detProp, const std::vector< art::Ptr< recob::Hit >> &xhits, const std::vector< art::Ptr< recob::Hit >> &uhits, const std::vector< art::Ptr< recob::Hit >> &vhits, const std::vector< raw::ChannelID_t > &xbad, const std::vector< raw::ChannelID_t > &ubad, const std::vector< raw::ChannelID_t > &vbad, double distThresh, double distThreshDrift, double xhitOffset)
std::vector< HitTriplet > TripletsTwoView()
Only search for XU intersections.
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
std::vector< ChannelDoublet > DoubletsXV(geo::TPCID tpc)
std::vector< ChannelDoublet > DoubletsXU(geo::TPCID tpc)
double y
y position of intersection
bool CloseDrift(double xa, double xb) const
std::vector< HitTriplet > Triplets()
bool LessThanXHit(const ChannelDoublet &a, const ChannelDoublet &b)
unsigned int ChannelID_t
Type representing the ID of a readout channel.
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fUbad_by_tpc
void FillBadMap(const std::vector< raw::ChannelID_t > &bads, std::map< geo::TPCID, std::vector< raw::ChannelID_t >> &out)
Helper for constructor.
bool operator()(raw::ChannelID_t a, raw::ChannelID_t b, geo::WireIDIntersection &pt)
Namespace collecting geometry-related classes utilities.
bool ISect(raw::ChannelID_t chanA, raw::ChannelID_t chanB, geo::WireIDIntersection &pt) const
art framework interface to geometry description
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fVbad_by_tpc
void FillHitMap(const detinfo::DetectorPropertiesData &clockData, const std::vector< art::Ptr< recob::Hit >> &hits, std::map< geo::TPCID, std::vector< HitOrChan >> &out)
Helper for constructor.
Signal from collection planes.