11 const std::vector<raw::ChannelID_t>& xbad,
12 const std::vector<raw::ChannelID_t>& ubad,
13 const std::vector<raw::ChannelID_t>& vbad,
14 double distThresh,
double distThreshDrift,
16 : geom(
art::ServiceHandle<
geo::Geometry>()->provider()),
17 detprop(
art::ServiceHandle<
detinfo::DetectorPropertiesService>()->provider()),
18 fDistThresh(distThresh),
19 fDistThreshDrift(distThreshDrift),
20 fXHitOffset(xhitOffset)
34 std::map<
geo::TPCID, std::vector<HitOrChan>>& out)
46 out[tpc].emplace_back(
hit.get(), xpos);
50 std::sort(it.second.begin(), it.second.end(),
51 [](
auto a,
auto b){
return a.xpos < b.xpos;});
57 std::map<
geo::TPCID, std::vector<raw::ChannelID_t>>& out)
61 out[tpc].push_back(chan);
71 :
geom(
art::ServiceHandle<
geo::Geometry>()->provider()),
79 const auto key = std::make_pair(a, b);
81 auto it = fMap.find(key);
87 const bool res = ISect(a, b, pt);
88 fMap.insert({key, res});
89 fPtMap.insert({key, pt});
111 std::map<std::pair<raw::ChannelID_t, raw::ChannelID_t>,
bool>
fMap;
127 const TVector3 pa(ra.
y, ra.
z, 0);
128 const TVector3 pb(rb.
y, rb.
z, 0);
150 std::vector<HitTriplet> ret;
155 std::vector<ChannelDoublet> xus =
DoubletsXU(tpc);
156 std::vector<ChannelDoublet> xvs =
DoubletsXV(tpc);
166 auto xvit_begin = xvs.begin();
174 while(xvit_begin != xvs.end() &&
LessThanXHit(*xvit_begin, xu)) ++xvit_begin;
177 for(
auto xvit = xvit_begin; xvit != xvs.end() &&
SameXHit(*xvit, xu); ++xvit){
181 if(!x.
hit && !u.
hit)
continue;
182 if(!x.
hit && !v.
hit)
continue;
183 if(!u.
hit && !v.
hit)
continue;
188 if(!isectUV(u.
chan, v.
chan, ptUV))
continue;
196 if(x.
hit){xavg += x.
xpos; ++nx;}
197 if(u.
hit){xavg += u.
xpos; ++nx;}
198 if(v.
hit){xavg += v.
xpos; ++nx;}
202 (xu.pt.y + xvit->pt.y + ptUV.
y)/3,
203 (xu.pt.z + xvit->pt.z + ptUV.
z)/3};
210 std::cout << tpc <<
" " << xus.size() <<
" XUs and " << xvs.size() <<
" XVs -> " << nxuv <<
" XUVs" << std::endl;
214 std::cout << ret.size() <<
" XUVs total" << std::endl;
222 std::vector<HitTriplet> ret;
227 std::vector<ChannelDoublet> xus =
DoubletsXU(tpc);
233 double xavg = x.
xpos;
235 if(u.
hit){xavg += u.
xpos; ++nx;}
238 const XYZ pt{xavg, xu.pt.y, xu.pt.z};
244 std::cout << ret.size() <<
" XUs total" << std::endl;
256 ret.push_back({it.b, it.a, it.pt});
269 ret.push_back({it.b, it.a, it.pt});
278 const std::vector<HitOrChan>& ahits,
279 const std::vector<HitOrChan>& bhits,
280 const std::vector<raw::ChannelID_t>& bbads)
const 282 std::vector<ChannelDoublet> ret;
286 auto b_begin = bhits.begin();
292 if(isect(a.chan, b, pt)){
293 ret.emplace_back(a, b, pt);
297 while(b_begin != bhits.end() &&
298 b_begin->xpos < a.xpos &&
299 !
CloseDrift(b_begin->xpos, a.xpos)) ++b_begin;
301 for(
auto bit = b_begin; bit != bhits.end(); ++bit){
307 if(!isect(a.chan, b.
chan, pt))
continue;
309 ret.emplace_back(a, b, pt);
bool CloseSpace(geo::WireIDIntersection ra, geo::WireIDIntersection rb) const
std::vector< geo::TPCID > ROPtoTPCs(readout::ROPID const &ropid) const
Returns a list of ID of TPCs the specified ROP spans.
double z
z position of intersection
TripletFinder(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< 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
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
const geo::GeometryCore * geom
const detinfo::DetectorProperties * detprop
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
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
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
void FillHitMap(const std::vector< art::Ptr< recob::Hit >> &hits, std::map< geo::TPCID, std::vector< HitOrChan >> &out)
Helper for constructor.
std::map< geo::TPCID, std::vector< HitOrChan > > fU_by_tpc
const geo::GeometryCore * geom
General LArSoft Utilities.
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.
readout::ROPID ChannelToROP(raw::ChannelID_t channel) const
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, geo::Point_t &intersection) const
Computes the intersection between two wires.
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const =0
std::vector< HitTriplet > TripletsTwoView()
Only search for XU intersections.
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
std::map< geo::TPCID, std::vector< raw::ChannelID_t > > fVbad_by_tpc
Signal from collection planes.