23 _neighbor.fill(
nullptr );
39 _neighbor.fill(
nullptr );
54void FTWire::getInnerNeighbor() {
58 _neighbor[0] = _neighbor[1] = geom->getVirtualWire();
62 float thisPhi =
phi();
64 int innerLayer_id = _layer->layerId() - 1;
65 int n = geom->layer2nWires( innerLayer_id );
66 int low = 0, high =
n - 1, mid = 0;
67 int innerPosition = 1;
69 const int lastInnerId = geom->layer2wireEnd( innerLayer_id );
73 mid = ( low + high ) / 2;
74 if ( geom->getWire( lastInnerId - mid )->phi() <= thisPhi ) high = mid - 1;
80 if ( geom->getWire( lastInnerId - innerPosition )->phi() <= thisPhi )
82 _neighbor[0] = geom->getWire( lastInnerId - innerPosition );
83 if ( innerPosition == 0 ) _neighbor[1] = geom->getWire( lastInnerId -
n + 1 );
84 else _neighbor[1] = geom->getWire( lastInnerId - innerPosition + 1 );
88 if ( ( innerPosition + 1 ) ==
n ) _neighbor[0] = geom->getWire( lastInnerId );
89 else _neighbor[0] = geom->getWire( lastInnerId - innerPosition - 1 );
90 _neighbor[1] = geom->getWire( lastInnerId - innerPosition );
94void FTWire::getOuterNeighbor() {
97 std::cout <<
"this: " <<
this <<
"FTWire::getOuterNeighbor: _layer is nullptr"
103 int superLayer_id = geom->wire2superLayer( _wireId );
104 int layerMaxId = geom->superLayer2nLayers( superLayer_id ) - 1;
106 if ( _layer->localLayerId() == layerMaxId )
108 _neighbor[4] = _neighbor[5] = geom->getVirtualWire();
112 float thisPhi =
phi();
114 int outerLayer_id = _layer->layerId() + 1;
115 int n = geom->layer2nWires( outerLayer_id );
116 int low = 0, high =
n - 1, mid = 0;
119 const int firstOuterId = geom->layer2wireStart( outerLayer_id );
121 while ( low <= high )
123 mid = ( low + high ) / 2;
124 if ( geom->getWire( firstOuterId + mid )->phi() > thisPhi ) high = mid - 1;
129 if ( geom->getWire( firstOuterId + position )->phi() <= thisPhi )
131 _neighbor[4] = geom->getWire( firstOuterId + position );
132 if ( ( position + 1 ) ==
n ) _neighbor[5] = geom->getWire( firstOuterId );
133 else _neighbor[5] = geom->getWire( firstOuterId + position + 1 );
137 if ( ( position - 1 ) == -1 ) _neighbor[4] = geom->getWire( firstOuterId +
n - 1 );
138 else _neighbor[4] = geom->getWire( firstOuterId + position - 1 );
139 _neighbor[5] = geom->getWire( firstOuterId + position );
143void FTWire::getMidNeighbor() {
144 _neighbor[2] = (
FTWire*)left();
145 _neighbor[3] = (
FTWire*)right();
158 HepVector center = la.
center();
160 double dx2 = center( 1 ) - _x;
161 double dy2 = center( 2 ) - _y;
162 double par1 = _dx * _dx + _dy * _dy;
163 double par2 = ( _dx * dx2 + _dy * dy2 ) / par1;
164 double par3 = _dx * dy2 - _dy * dx2;
165 double par4 = rho * rho * par1 - par3 * par3;
167 if ( par4 < 0. )
return 0;
169 par4 = std::sqrt( par4 ) / par1;
170 double delta = par2 + par4;
172 if ( delta >= 0. && delta < 1. )
174 z = _layer->zf() + delta * ( _layer->zb() - _layer->zf() );
180 if ( delta >= 0. && delta < 1. )
182 z = _layer->zf() + delta * ( _layer->zb() - _layer->zf() );
198const FTWire* FTWire::left()
const {
200 if ( _wireId == geom->wire2wireStartLayer( _wireId ) )
201 return geom->getWire( geom->wire2wireEndLayer( _wireId ) );
202 else return geom->getWire( _wireId - 1 );
205const FTWire* FTWire::right()
const {
207 if ( _wireId == geom->wire2wireEndLayer( _wireId ) )
208 return geom->getWire( geom->wire2wireStartLayer( _wireId ) );
209 else return geom->getWire( _wireId + 1 );
215Gen_hepevt* FTWire::hep()
const {
return _hep; }
static FTGeom * instance()
const int wire2wireIndexLayer(const int wire_id)
const int localLayerId() const
returns local-layer ID
const int localId() const
returns local ID
void initNeighbor()
initNeighbor
int z(const Lpav &la, double &z) const
returns z for track la
void chk_left_and_right()
check neighbors of phi-side and raise invalid flag if both hits
FTLayer * layer() const
returns layer
FTWire(const float x, const float y, const float dx, const float dy, const int wireId, FTLayer *layer, const float phi)
constructors
void wireId(int wireID)
set wireId
float distance_z() const
returns z_distance from the center of wire by drift distance
const float x() const
returns position x
unsigned state() const
returns state
float phi() const
returns phi
const float y() const
returns position y