195 unsigned int Ucount(0), Vcount(0);
196 for (
size_t h = 0;
h < ChHits.size();
h++) {
198 if (ChHits[
h]->View() ==
geo::kZ)
continue;
201 else if (ChHits[
h]->View() ==
geo::kV)
203 std::vector<geo::WireID> cwids =
geom->ChannelToWire(chit.
Channel());
204 std::pair<double, double> ChanTime((
double)chit.
Channel(),
208 std::vector<const sim::IDE*> ides;
210 ides =
bt_serv->HitToSimIDEs_Ps(clockData, chit);
216 bool hasIDEs = !ides.empty();
226 mf::LogVerbatim(
"DisambigCheat")
229 fHitToWids[ChanTime] = std::vector<geo::WireID>();
237 std::vector<geo::WireID> widsWithIdes;
238 for (
size_t i = 0; i < ides.size(); i++) {
239 const double xyzIde[] = {ides[i]->x, ides[i]->y, ides[i]->z};
245 mf::LogWarning(
"DisambigCheat")
246 <<
"IDE at x = " << xyzIde[0] <<
", y = " << xyzIde[1] <<
", z = " << xyzIde[2]
247 <<
" does not correspond to a TPC.";
250 unsigned int tpc = tpcID.
TPC, cryo = tpcID.
Cryostat;
257 IdeWid =
geom->NearestWireID(xyzIde, cwids[0].
Plane, tpc, cryo);
262 mf::LogError(
"DisambigCheat") <<
"Detected a point out of its wire plane:\n"
263 << e.what() <<
"\nUsing suggested wire " << IdeWid <<
"\n";
266 bool foundmatch(
false);
267 for (
size_t w = 0;
w < cwids.size();
w++) {
268 if (cwids[
w].
TPC != tpc || cwids[
w].Cryostat != cryo)
continue;
269 if ((
unsigned int)
std::abs((
int)(IdeWid.
Wire) - (
int)(cwids[
w].Wire)) <=
271 storethis = cwids[
w];
277 mf::LogWarning(
"DisambigCheat")
278 <<
"IDE NearestWire return more than 1 off from channel wids: wire " << IdeWid.
Wire;
282 bool alreadyStored(
false);
283 for (
size_t wid = 0; wid < widsWithIdes.size(); wid++)
284 if (storethis == widsWithIdes[wid]) alreadyStored =
true;
285 if (!alreadyStored) widsWithIdes.push_back(storethis);
293 mf::LogWarning(
"DisambigCheat")
294 <<
"Nhits mismatch: " <<
fHitToWids.size() <<
" " << Ucount + Vcount;
BEGIN_PROLOG true icarus_rawdigitfilter FilterTools FilterPlane1 Plane
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
std::vector< unsigned int > fMaxWireShift
bool isValid
Whether this ID points to a valid element.
CryostatID_t Cryostat
Index of cryostat.
Planes which measure Z direction.
WireID_t Wire
Index of the wire within its plane.
art::ServiceHandle< geo::Geometry const > geom
unsigned int fBadIDENearestWire
std::map< std::pair< double, double >, std::vector< geo::WireID > > fHitToWids
The data type to uniquely identify a TPC.
float PeakTimeMinusRMS(float sigmas=+1.) const
float PeakTime() const
Time of the signal peak, in tick units.
Exception thrown on invalid wire number.
2D representation of charge deposited in the TDC/wire plane
float PeakTimePlusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
TPCID_t TPC
Index of the TPC within its cryostat.
geo::WireID suggestedWireID() const
Returns a better wire ID.
bool hasSuggestedWire() const
Returns whether we known a better wire number.
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.