3 #include "art/Framework/Services/Registry/ServiceHandle.h"
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)
41 std::map<
geo::TPCID, std::vector<HitOrChan>>& out)
43 for (
const art::Ptr<recob::Hit>&
hit : hits) {
53 out[tpc].emplace_back(
hit.get(), xpos);
57 std::sort(it.second.begin(), it.second.end(), [](
auto a,
auto b) {
return a.xpos < b.xpos; });
63 std::map<
geo::TPCID, std::vector<raw::ChannelID_t>>& out)
67 out[tpc].push_back(chan);
76 :
geom(art::ServiceHandle<geo::Geometry
const>()->provider()),
fTPC(tpc)
82 const auto key = std::make_pair(a, b);
84 auto it =
fMap.find(key);
85 if (it !=
fMap.end()) {
90 const bool res =
ISect(a, b, pt);
91 fMap.insert({key, res});
114 std::map<std::pair<raw::ChannelID_t, raw::ChannelID_t>,
bool>
fMap;
131 const TVector3 pa(ra.
y, ra.
z, 0);
132 const TVector3 pb(rb.
y, rb.
z, 0);
154 std::vector<HitTriplet>
157 std::vector<HitTriplet> ret;
162 std::vector<ChannelDoublet> xus =
DoubletsXU(tpc);
163 std::vector<ChannelDoublet> xvs =
DoubletsXV(tpc);
173 auto xvit_begin = xvs.begin();
181 while (xvit_begin != xvs.end() &&
LessThanXHit(*xvit_begin, xu))
185 for (
auto xvit = xvit_begin; xvit != xvs.end() &&
SameXHit(*xvit, xu); ++xvit) {
189 if (!x.
hit && !u.
hit)
continue;
190 if (!x.
hit && !v.
hit)
continue;
191 if (!u.
hit && !v.
hit)
continue;
196 if (!isectUV(u.
chan, v.
chan, ptUV))
continue;
219 xavg, (xu.pt.y + xvit->pt.y + ptUV.
y) / 3, (xu.pt.z + xvit->pt.z + ptUV.
z) / 3};
226 std::cout << tpc <<
" " << xus.size() <<
" XUs and " << xvs.size() <<
" XVs -> " << nxuv
227 <<
" XUVs" << std::endl;
231 std::cout << ret.size() <<
" XUVs total" << std::endl;
237 std::vector<HitTriplet>
240 std::vector<HitTriplet> ret;
245 std::vector<ChannelDoublet> xus =
DoubletsXU(tpc);
251 double xavg = x.
xpos;
259 const XYZ pt{xavg, xu.pt.
y, xu.pt.z};
265 std::cout << ret.size() <<
" XUs total" << std::endl;
271 std::vector<ChannelDoublet>
274 std::vector<ChannelDoublet> ret =
279 ret.push_back({it.b, it.a, it.pt});
286 std::vector<ChannelDoublet>
289 std::vector<ChannelDoublet> ret =
294 ret.push_back({it.b, it.a, it.pt});
301 std::vector<ChannelDoublet>
303 const std::vector<HitOrChan>& ahits,
304 const std::vector<HitOrChan>& bhits,
305 const std::vector<raw::ChannelID_t>& bbads)
const
307 std::vector<ChannelDoublet> ret;
311 auto b_begin = bhits.begin();
317 if (isect(
a.chan, b, pt)) { ret.emplace_back(
a, b, pt); }
320 while (b_begin != bhits.end() && b_begin->xpos <
a.xpos && !
CloseDrift(b_begin->xpos,
a.xpos))
323 for (
auto bit = b_begin; bit != bhits.end(); ++bit) {
329 if (!isect(
a.chan, b.
chan, pt))
continue;
331 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
process_name opflash particleana ie x
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
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.
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)
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)
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, geo::Point_t &intersection) const
Computes the intersection between two wires.
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)
bool ISect(raw::ChannelID_t chanA, raw::ChannelID_t chanB, geo::WireIDIntersection &pt) const
art framework interface to geometry description
BEGIN_PROLOG could also be cout
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.