Find the center of the 3 intersections, choose best if multiple.
377 std::vector< geo::WireIDIntersection > UVIntersects;
379 std::vector< double > UVzToZ(UVIntersects.size());
381 unsigned int cryo = Zwid.Cryostat;
382 unsigned int tpc = Zwid.TPC;
385 std::vector<geo::WireID> UwidsInTPC, VwidsInTPC;
386 for(
size_t i=0; i<Uwids.size(); i++)
if( Uwids[i].
TPC==tpc ) UwidsInTPC.push_back(Uwids[i]);
387 for(
size_t i=0; i<Vwids.size(); i++)
if( Vwids[i].
TPC==tpc ) VwidsInTPC.push_back(Vwids[i]);
388 double Zcent[3] = {0.};
391 std::cout <<
"Zcent = " << Zcent[2] <<
", UVintersects zpos = ";
392 for(
size_t uv=0; uv<UVIntersects.size(); uv++){
393 std::cout << UVIntersects[uv].z <<
", ";
402 if( UVIntersects.size() == 0 ){
403 if( UwidsInTPC.size() > 1 || VwidsInTPC.size() > 1 )
404 throw cet::exception(
"ThreeChanPos") <<
"U/V channels don't intersect, bad return.\n";
407 mf::LogWarning(
"ThreeChanPos") <<
"No U/V intersect, exceptional channels. See if U or V intersects Z\n";
408 std::vector<double> yzCenter(2,0.);
414 if( !checkUZ && !checkVZ )
415 throw cet::exception(
"NoChanIntersect") <<
"No channels intersect, bad return.\n";
416 if( checkUZ && !checkVZ ){ yzCenter[0] = UZInt.
y; yzCenter[1] = UZInt.
z; }
417 if( checkVZ && !checkUZ ){ yzCenter[0] = VZInt.
y; yzCenter[1] = VZInt.
z; }
418 if( checkUZ && checkVZ ){ yzCenter[0] = (VZInt.
y+UZInt.
y)/2; yzCenter[1] = (VZInt.
z+UZInt.
z)/2; }
428 std::cout <<
"UVzToZ = ";
429 for(
size_t widI = 0; widI < UVIntersects.size(); widI++ ){
430 UVzToZ[widI] =
std::abs( UVIntersects[widI].
z - Zcent[2] );
431 std::cout << UVzToZ[widI] <<
", ";
435 unsigned int bestWidI = 0;
437 for(
unsigned int widI = 0; widI < UVIntersects.size(); widI++ ){
441 if( UVIntersects[widI].
TPC == tpc && UVzToZ[widI] < minZdiff ){
442 minZdiff = UVzToZ[widI];
450 double UVInt[3] = {0.};
451 UVInt[1] = ChosenUVInt.
y; UVInt[2] = ChosenUVInt.
z;
458 std::cout <<
"UZint.z = " << UZInt.
z <<
" (" << checkUZ <<
"), VZint.z = " << VZInt.
z <<
" (" << checkVZ <<
")\n";
461 std::vector<double> yzCenter(2,0.);
464 if( !checkUZ || !checkVZ ){
467 std::cout <<
"ChosenUVint.y = " << ChosenUVInt.
y <<
"ChosenUVint.z = " << ChosenUVInt.
z <<
std::endl;
470 yzCenter[0] = ChosenUVInt.
y;
471 yzCenter[1] = ChosenUVInt.
z;
476 yzCenter[0] = (ChosenUVInt.
y + UZInt.
y + VZInt.
y)/3;
477 yzCenter[1] = (ChosenUVInt.
z + UZInt.
z + VZInt.
z)/3;
double z
z position of intersection
geo::WireID NearestWireIDOnChan(const double WorldLoc[3], uint32_t chan, unsigned int const plane, unsigned int const tpc=0, unsigned int const cstat=0)
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
double Length() const
Length is associated with z coordinate [cm].
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
art::ServiceHandle< geo::Geometry > fGeom
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, geo::Point_t &intersection) const
Computes the intersection between two wires.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
double y
y position of intersection
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
bool APAChannelsIntersect(uint32_t chan1, uint32_t chan2, std::vector< geo::WireIDIntersection > &IntersectVector)
If the channels intersect, get all intersections.
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
WireGeo const & WireIDToWireGeo(geo::WireID const &wireid) const