Find the center of the 3 intersections, choose best if multiple.
364 std::vector< geo::WireIDIntersection > UVIntersects;
366 std::vector< double > UVzToZ(UVIntersects.size());
368 unsigned int cryo = Zwid.Cryostat;
369 unsigned int tpc = Zwid.TPC;
372 std::vector<geo::WireID> UwidsInTPC, VwidsInTPC;
373 for(
size_t i=0; i<Uwids.size(); i++)
if( Uwids[i].
TPC==tpc ) UwidsInTPC.push_back(Uwids[i]);
374 for(
size_t i=0; i<Vwids.size(); i++)
if( Vwids[i].
TPC==tpc ) VwidsInTPC.push_back(Vwids[i]);
375 double Zcent[3] = {0.};
378 std::cout <<
"Zcent = " << Zcent[2] <<
", UVintersects zpos = ";
379 for(
size_t uv=0; uv<UVIntersects.size(); uv++){
380 std::cout << UVIntersects[uv].z <<
", ";
389 if( UVIntersects.size() == 0 ){
390 if( UwidsInTPC.size() > 1 || VwidsInTPC.size() > 1 )
391 throw cet::exception(
"ThreeChanPos") <<
"U/V channels don't intersect, bad return.\n";
394 mf::LogWarning(
"ThreeChanPos") <<
"No U/V intersect, exceptional channels. See if U or V intersects Z\n";
395 std::vector<double> yzCenter(2,0.);
401 if( !checkUZ && !checkVZ )
402 throw cet::exception(
"NoChanIntersect") <<
"No channels intersect, bad return.\n";
403 if( checkUZ && !checkVZ ){ yzCenter[0] = UZInt.
y; yzCenter[1] = UZInt.
z; }
404 if( checkVZ && !checkUZ ){ yzCenter[0] = VZInt.
y; yzCenter[1] = VZInt.
z; }
405 if( checkUZ && checkVZ ){ yzCenter[0] = (VZInt.
y+UZInt.
y)/2; yzCenter[1] = (VZInt.
z+UZInt.
z)/2; }
415 std::cout <<
"UVzToZ = ";
416 for(
size_t widI = 0; widI < UVIntersects.size(); widI++ ){
417 UVzToZ[widI] =
std::abs( UVIntersects[widI].
z - Zcent[2] );
418 std::cout << UVzToZ[widI] <<
", ";
422 unsigned int bestWidI = 0;
424 for(
unsigned int widI = 0; widI < UVIntersects.size(); widI++ ){
428 if( UVIntersects[widI].
TPC == tpc && UVzToZ[widI] < minZdiff ){
429 minZdiff = UVzToZ[widI];
437 double UVInt[3] = {0.};
438 UVInt[1] = ChosenUVInt.
y; UVInt[2] = ChosenUVInt.
z;
445 std::cout <<
"UZint.z = " << UZInt.
z <<
" (" << checkUZ <<
"), VZint.z = " << VZInt.
z <<
" (" << checkVZ <<
")\n";
448 std::vector<double> yzCenter(2,0.);
451 if( !checkUZ || !checkVZ ){
454 std::cout <<
"ChosenUVint.y = " << ChosenUVInt.
y <<
"ChosenUVint.z = " << ChosenUVInt.
z <<
std::endl;
457 yzCenter[0] = ChosenUVInt.
y;
458 yzCenter[1] = ChosenUVInt.
z;
463 yzCenter[0] = (ChosenUVInt.
y + UZInt.
y + VZInt.
y)/3;
464 yzCenter[1] = (ChosenUVInt.
z + UZInt.
z + VZInt.
z)/3;
double z
z position of intersection
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
bool APAChannelsIntersect(uint32_t chan1, uint32_t chan2, std::vector< geo::WireIDIntersection > &IntersectVector) const
If the channels intersect, get all intersections.
double Length() const
Length is associated with z coordinate [cm].
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, geo::Point_t &intersection) const
Computes the intersection between two wires.
art::ServiceHandle< geo::Geometry const > fGeom
geo::WireID NearestWireIDOnChan(const double WorldLoc[3], uint32_t chan, unsigned int const plane, unsigned int const tpc=0, unsigned int const cstat=0) const
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
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