Run disambiguation as currently configured.
73 size_t napas = geo->
NTPC()/2;
90 std::vector<art::Ptr<recob::Hit> > hitsUV[2];
91 std::vector<art::Ptr<recob::Hit> > hitsZ;
95 for (
size_t i = 0; i<OrigHits.size(); ++i)
97 unsigned int hitapa(0), hitcryo(0);
103 switch (OrigHits[i]->
View())
106 hitsUV[0].push_back(OrigHits[i]);
116 hitsUV[1].push_back(OrigHits[i]);
125 hitsZ.push_back(OrigHits[i]);
134 throw cet::exception(
"DisambigAlgProtoDUNESP") <<
": hit view unkonwn. \n";
144 size_t zsize = hitsZ.size();
149 for (
size_t uv=0; uv<2; uv++)
152 size_t uvsize = hitsUV[uv].size();
153 size_t othersize = hitsUV[
other].size();
155 for (
size_t iuv = 0; iuv < uvsize; ++iuv)
161 double tuv = hitsUV[uv][iuv]->PeakTime()
162 - detProp.GetXTicksOffset(hitsUV[uv][iuv]->
WireID().
Plane,tpc,cryostat);
164 std::vector<size_t> zmatches;
165 std::vector<size_t> othermatches;
166 for (
size_t z = 0;
z < zsize;
z++)
168 double tz = hitsZ[
z]->PeakTime()
169 - detProp.GetXTicksOffset(hitsZ[
z]->
WireID().
Plane,tpc,cryostat);
177 zmatches.push_back(
z);
180 for (
size_t iother = 0; iother < othersize; iother++)
182 double tother = hitsUV[
other][iother]->PeakTime()
183 - detProp.GetXTicksOffset(hitsUV[other][iother]->
WireID().
Plane,tpc,cryostat);
186 othermatches.push_back(iother);
193 if (zmatches.size() == 0 && othermatches.size() == 0)
continue;
198 std::vector< double > zmatchz;
199 std::vector< double > zmatchy;
200 std::vector< double > othermatchz;
201 std::vector< double > othermatchy;
203 std::vector<geo::WireID> wires = geo->
ChannelToWire(hitsUV[uv][iuv]->Channel());
204 size_t wsize = wires.size();
205 std::vector<size_t> ndoublets(wsize,0);
206 std::vector<size_t> ntriplets(wsize,0);
208 for (
size_t w=0;
w<wsize;
w++)
215 for (
size_t z=0;
z<zmatches.size();
z++)
223 zmatchz.push_back(isect.
z);
224 zmatchy.push_back(isect.
y);
229 for (
size_t iother=0; iother<othermatches.size(); iother++)
231 std::vector<geo::WireID> otherwires = geo->
ChannelToWire(hitsUV[other][othermatches[iother]]->Channel());
232 for (
size_t otherw = 0; otherw < otherwires.size(); otherw++)
240 othermatchz.push_back(isect.
z);
241 othermatchy.push_back(isect.
y);
248 for (
size_t izmatch=0;izmatch<zmatchz.size();izmatch++)
250 bool found_triplet =
false;
251 for (
size_t iothermatch=0;iothermatch<othermatchz.size();iothermatch++)
253 double disz = zmatchz[izmatch]-othermatchz[iothermatch];
254 double disy = zmatchy[izmatch]-othermatchy[iothermatch];
255 if ( disz*disz + disy*disy <
fDcut2 )
258 found_triplet =
true;
261 if (!found_triplet) ndoublets[
w] ++;
263 for (
size_t iothermatch=0;iothermatch<othermatchz.size();iothermatch++)
265 bool found_triplet =
false;
266 for (
size_t izmatch=0;izmatch<zmatchz.size();izmatch++)
268 double disz = zmatchz[izmatch]-othermatchz[iothermatch];
269 double disy = zmatchy[izmatch]-othermatchy[iothermatch];
270 if ( disz*disz + disy*disy <
fDcut2 )
272 found_triplet =
true;
275 if (!found_triplet) ndoublets[
w] ++;
280 bool found_disambig =
false;
282 for (
size_t w=0;
w<wsize;
w++)
284 if (!found_disambig && (ntriplets[
w]>0 || ndoublets[
w] > 0))
287 found_disambig =
true;
289 if (ntriplets[
w] > ntriplets[bestwire])
292 found_disambig =
true;
294 if ( (ntriplets[
w] == ntriplets[bestwire]) && (ndoublets[
w] > ndoublets[bestwire]))
297 found_disambig =
true;
double z
z position of intersection
AdcChannelData::View View
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
Planes which measure Z direction.
std::vector< std::pair< art::Ptr< recob::Hit >, geo::WireID > > fDisambigHits
The final list of hits to pass back to be made.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
unsigned int ChannelToAPA(uint32_t chan)
Get number of the APA containing the given channel.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
bool notOuterWire(geo::WireID wireid)
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, geo::Point_t &intersection) const
Computes the intersection between two wires.
double y
y position of intersection
dune::apa::APAGeometryAlg fAPAGeo
recob::tracking::Plane Plane
LArSoft geometry interface.
cet::coded_exception< error, detail::translate > exception