FTWire Class Reference

#include <FTWire.h>

List of all members.

Public Member Functions

 FTWire (const float x, const float y, const float dx, const float dy, const FTLayer &, const int localID, FTWire *const vt)
 constructors
 FTWire ()
 ~FTWire ()
 destructor
void initNeighbor (void)
 initNeighbor
const float x (void) const
 returns position x
const float y (void) const
 returns position y
float phi (void) const
 returns phi
const int localId (void) const
 returns local ID
const FTLayerlayer (void) const
 returns layer
FTWire ** neighborPtr (void)
 returns pointer of neighbor array
float distance (void) const
 returns drift distance
float distance_z (void) const
 returns z_distance from the center of wire by drift distance
float t0 (void) const
 returns t0 read at begin run
float pedestal (void) const
 returns pedestal read at begin run
unsigned state (void) const
 returns state
unsigned stateAND (const unsigned mask) const
 returns state bit
int z (const Lpav &la, double &z) const
 returns z for track la
float time (void) const
 rerurns TDC time(after t0 subtraction)
float getAdc (void) const
float getChi2 (void) const
void clear (void)
 clear
float distance (const float distance)
 set drift distance
float t0 (const float t0)
 set t0 at begin-run
float pedestal (const float ped)
 set pedestal at begin-run
unsigned state (const unsigned state)
 set state
void stateOR (const unsigned mask)
 set state bit
void stateXOR (const unsigned mask)
 invert state bit
void stateORXOR (const unsigned mask)
 reset state bit
void chk_left_and_right (void)
 check neighbors of phi-side and raise invalid flag if both hits
float time (float t)
 reset time
void wireId (int wireID)
 set wireId
int getWireId (void)
 get wireId
void setAdc (float adc)
 wangdy add:set Adc value
void setChi2 (float chi2)
 set residual fit chi2

Private Member Functions

const FTWireleft (void) const
 returns left wire;
const FTWireright (void) const
 returns left wire;
void getInnerNeighbor (FTWire *const vtWire)
 compute inner Neighbor
void getOuterNeighbor (FTWire *const vtWire)
 compute outer Neighbor
void getMidNeighbor (void)
 compute mid Neighbor

Private Attributes

const float _x
const float _y
const float _dx
const float _dy
const FTLayer_layer
FTWire *const & _wire
const int _localId
const float _phi
int _wireId
float _distance
float _t0
float _time
float _pedestal
unsigned int _state
FTWire_neighbor [6]
float m_posx
float m_posy
float m_posz
float m_adc
float m_chi2


Detailed Description

Definition at line 43 of file FTWire.h.


Constructor & Destructor Documentation

FTWire::FTWire ( const float  x,
const float  y,
const float  dx,
const float  dy,
const FTLayer ,
const int  localID,
FTWire *const   vt 
) [inline]

constructors

Definition at line 199 of file FTWire.h.

References getMidNeighbor().

00202   : _x(x),                      // x position in z = 0;
00203     _y(y),                      // y position in z = 0;
00204     _dx(dx),
00205     _dy(dy),
00206     _layer(layer),
00207     _wire(vt),
00208     _localId(localID),
00209     _phi((const float)2*M_PI*_localId/(float)_layer.NWire()+_layer.offset()),
00210     //_wireId(wireID),
00211     //_hep(NULL),
00212     _distance(0),
00213     _t0(0),
00214     _time(0),
00215     m_adc(0),
00216     _pedestal(0),
00217     _state(FTWireHitInvalid)
00218 {
00219     getMidNeighbor();
00220 }

FTWire::FTWire (  )  [inline]

Definition at line 223 of file FTWire.h.

References _neighbor.

00224   : _x(0),
00225     _y(0),
00226     _dx(0),
00227     _dy(0),
00228     _layer(*(FTLayer *)NULL),
00229     _wire(NULL),
00230     _localId(0),
00231     //_wireId(0),
00232     _phi(0),
00233     _distance(0),
00234     _t0(0),
00235     _time(0),
00236     m_adc(0),
00237     _pedestal(0),
00238     _state(FTWireHitInvalid)
00239 {
00240   _neighbor[0] = NULL;
00241   _neighbor[1] = NULL;
00242   _neighbor[2] = NULL;
00243   _neighbor[3] = NULL;
00244   _neighbor[4] = NULL;
00245   _neighbor[5] = NULL;
00246 }

FTWire::~FTWire (  )  [inline]

destructor

Definition at line 249 of file FTWire.h.

00250 {
00251 }


Member Function Documentation

void FTWire::chk_left_and_right ( void   )  [inline]

check neighbors of phi-side and raise invalid flag if both hits

Definition at line 552 of file FTWire.h.

References _neighbor, _state, FTWireHit, and FTWireHitInvalid.

Referenced by FTSuperLayer::clustering().

00552                               {
00553   if (((**(_neighbor+2))._state&FTWireHit) &&
00554       ((**(_neighbor+3))._state&FTWireHit)){
00555     _state |= FTWireHitInvalid;
00556     (**(_neighbor+2))._state |= FTWireHitInvalid;
00557     (**(_neighbor+3))._state |= FTWireHitInvalid;
00558   }
00559 }

void FTWire::clear ( void   )  [inline]

clear

Definition at line 347 of file FTWire.h.

References _distance, _pedestal, _state, _t0, _time, FTWireHitInvalid, and m_adc.

00348 {
00349   _distance = 0.;
00350   _time = 0.;
00351   _t0 = 0.;
00352   m_adc = 0.0; 
00353   _pedestal = 0.;
00354   _state = FTWireHitInvalid;
00355 }

float FTWire::distance ( const float  distance  )  [inline]

set drift distance

Definition at line 415 of file FTWire.h.

References _distance.

00416 {
00417   return _distance = distance;
00418 }

float FTWire::distance ( void   )  const [inline]

returns drift distance

Definition at line 401 of file FTWire.h.

References _distance.

Referenced by FTTrack::r_phi2Fit(), and FTTrack::r_phi3Fit().

00402 {
00403   return _distance;
00404 }

float FTWire::distance_z ( void   )  const [inline]

returns z_distance from the center of wire by drift distance

Definition at line 408 of file FTWire.h.

References _distance, _layer, and FTLayer::tanSlant().

00409 {
00410   return _distance * std::fabs(_layer.tanSlant());
00411 }

float FTWire::getAdc ( void   )  const [inline]

Definition at line 591 of file FTWire.h.

References m_adc.

00591                                      {
00592   return m_adc;
00593 }

float FTWire::getChi2 ( void   )  const [inline]

Definition at line 600 of file FTWire.h.

References m_chi2.

00600                                       {
00601   return m_chi2;
00602 }

void FTWire::getInnerNeighbor ( FTWire *const   vtWire  )  [inline, private]

compute inner Neighbor

Definition at line 270 of file FTWire.h.

References _layer, _neighbor, localId(), FTLayer::localLayerId(), FTLayer::NWire(), and phi().

Referenced by initNeighbor().

00271 {
00272   if (!_layer.localLayerId()) {
00273         _neighbor[0] = _neighbor[1] = vtWire;
00274         return;
00275   }
00276   float thisPhi = phi();
00277   const FTLayer * pLayer = &_layer;
00278   int n = (*(pLayer-1)).NWire(); 
00279   int low=0, high=n-1, mid = 0;
00280   int innerPosition = 1; 
00281   FTWire * lastInnerPointer = this - localId() - 1;
00282   while (low<=high){
00283     mid=(low+high)/2;
00284     if ((*(lastInnerPointer-mid)).phi() <= thisPhi)
00285       high=mid-1;
00286     else 
00287       low=mid+1;
00288   }
00289   
00290   innerPosition = mid; 
00291   if((*(lastInnerPointer-innerPosition)).phi() <= thisPhi) {
00292       _neighbor[0] = lastInnerPointer-innerPosition;
00293       if(innerPosition == 0) _neighbor[1] = lastInnerPointer-n+1;
00294       else _neighbor[1] = lastInnerPointer-innerPosition+1;
00295   } else {
00296       if((innerPosition+1) == n) _neighbor[0] = lastInnerPointer;
00297       else _neighbor[0] = lastInnerPointer-innerPosition-1;
00298       _neighbor[1] = lastInnerPointer-innerPosition;
00299   }
00300 
00301 }

void FTWire::getMidNeighbor ( void   )  [inline, private]

compute mid Neighbor

Definition at line 339 of file FTWire.h.

References _neighbor, left(), and right().

Referenced by FTWire().

00340 {
00341     _neighbor[2] = (FTWire *) left();
00342     _neighbor[3] = (FTWire *) right();
00343 }

void FTWire::getOuterNeighbor ( FTWire *const   vtWire  )  [inline, private]

compute outer Neighbor

Definition at line 305 of file FTWire.h.

References _layer, _neighbor, FTSuperLayer::layerMaxId(), localId(), FTLayer::localLayerId(), FTLayer::NWire(), phi(), and FTLayer::superLayer().

Referenced by initNeighbor().

00306 {
00307   if (_layer.localLayerId()==_layer.superLayer().layerMaxId()) {
00308         _neighbor[4] = _neighbor[5] = vtWire;
00309         return;
00310   }
00311   float thisPhi = phi();
00312   const FTLayer * pLayer = &_layer;  
00313   int n = (*(pLayer+1)).NWire();
00314   int low=0, high=n-1, mid = 0;
00315   int position;
00316   FTWire * firstPointer = this + _layer.NWire() - localId();
00317   while (low<=high){
00318     mid=(low+high)/2;
00319     if ((*(firstPointer+mid)).phi() > thisPhi)
00320       high=mid-1;
00321     else
00322       low=mid+1;
00323   }
00324  
00325   position = mid; 
00326   if((*(firstPointer+position)).phi() <= thisPhi) {
00327       _neighbor[4] = firstPointer+position;
00328       if((position+1) == n) _neighbor[5] = firstPointer;
00329       else _neighbor[5] = firstPointer+position+1;
00330   } else {
00331       if((position-1) == -1) _neighbor[4] = firstPointer + n - 1;
00332       else _neighbor[4] = firstPointer+position-1;
00333       _neighbor[5] = firstPointer+position;
00334   }
00335 }

int FTWire::getWireId ( void   )  [inline]

get wireId

Definition at line 585 of file FTWire.h.

References _wireId.

00585                                 {
00586   return _wireId;
00587 }

void FTWire::initNeighbor ( void   )  [inline]

initNeighbor

Definition at line 255 of file FTWire.h.

References _wire, getInnerNeighbor(), and getOuterNeighbor().

00256 {
00257   getInnerNeighbor(_wire);
00258   getOuterNeighbor(_wire);
00259   /*cout << "_layer.layerId()::" << _layer.layerId() << endl;
00260   cout << "The WireId ::" << _localId << endl;
00261   cout << "Its neighbor 0 ::" << _neighbor[0]->localId() << endl;
00262   cout << "Its neighbor 1 ::" << _neighbor[1]->localId() << endl;
00263   cout << "Its neighbor 2 ::" << _neighbor[2]->localId() << endl;
00264   cout << "Its neighbor 3 ::" << _neighbor[3]->localId() << endl;
00265   cout << "Its neighbor 4 ::" << _neighbor[4]->localId() << endl;
00266   cout << "Its neighbor 5 ::" << _neighbor[5]->localId() << endl;*/
00267 }

const FTLayer & FTWire::layer ( void   )  const [inline]

returns layer

Definition at line 359 of file FTWire.h.

References _layer.

Referenced by FTSuperLayer::connect_short_segments(), FTSuperLayer::connect_singleHit(), FTFinder::linkAxialSegments(), FTFinder::linkAxialSegments_step(), FTTrack::r_phi2Fit(), FTTrack::r_phi3Fit(), FTSegment::update(), and FTSegment::update3D().

00360 {
00361   return _layer;
00362 }

const FTWire * FTWire::left ( void   )  const [inline, private]

returns left wire;

Definition at line 563 of file FTWire.h.

References _layer, _localId, and FTLayer::NWire().

Referenced by getMidNeighbor().

00563                       {
00564   const FTWire * tmp = this;
00565   if (!_localId) tmp += _layer.NWire();
00566   return --tmp;
00567 }

const int FTWire::localId ( void   )  const [inline]

returns local ID

Definition at line 380 of file FTWire.h.

References _localId.

Referenced by getInnerNeighbor(), and getOuterNeighbor().

00381 {
00382   return _localId;
00383 }

FTWire ** FTWire::neighborPtr ( void   )  [inline]

returns pointer of neighbor array

Definition at line 387 of file FTWire.h.

References _neighbor.

00388 {
00389   return _neighbor;
00390 }

float FTWire::pedestal ( const float  ped  )  [inline]

set pedestal at begin-run

Definition at line 443 of file FTWire.h.

References _pedestal.

00444 {
00445   return _pedestal = ped;
00446 }

float FTWire::pedestal ( void   )  const [inline]

returns pedestal read at begin run

Definition at line 436 of file FTWire.h.

References _pedestal.

00437 {
00438   return _pedestal;
00439 }

float FTWire::phi ( void   )  const [inline]

returns phi

Definition at line 394 of file FTWire.h.

References _phi.

Referenced by getInnerNeighbor(), and getOuterNeighbor().

00395 {
00396   return _phi;
00397 }

const FTWire * FTWire::right ( void   )  const [inline, private]

returns left wire;

Definition at line 571 of file FTWire.h.

References _layer, _localId, and FTLayer::NWire().

Referenced by getMidNeighbor().

00571                        {
00572   const FTWire * tmp = this;
00573   if (_localId == (_layer.NWire()-1)) {
00574     tmp -= _layer.NWire();
00575   }
00576   return ++tmp;
00577 }

void FTWire::setAdc ( float  adc  )  [inline]

wangdy add:set Adc value

Definition at line 595 of file FTWire.h.

References m_adc.

00595                                     {
00596    m_adc = adc;
00597 }

void FTWire::setChi2 ( float  chi2  )  [inline]

set residual fit chi2

Definition at line 604 of file FTWire.h.

References m_chi2.

00604                                       {
00605    m_chi2 = chi2;
00606 }

unsigned FTWire::state ( const unsigned  state  )  [inline]

set state

Definition at line 487 of file FTWire.h.

References _state, and FTWireStateMask.

00488 {
00489   return _state = (_state&FTWireStateMask)|state;
00490 }

unsigned FTWire::state ( void   )  const [inline]

returns state

Definition at line 480 of file FTWire.h.

References _state.

Referenced by FTSuperLayer::clear().

00481 {
00482   return _state;
00483 }

unsigned FTWire::stateAND ( const unsigned  mask  )  const [inline]

returns state bit

Definition at line 494 of file FTWire.h.

References _state.

00495 {
00496   return _state&mask;
00497 }

void FTWire::stateOR ( const unsigned  mask  )  [inline]

set state bit

Definition at line 501 of file FTWire.h.

References _state.

Referenced by FTTrack::r_phi2Fit(), and FTTrack::r_phi3Fit().

00502 {
00503   _state|=mask;
00504 }

void FTWire::stateORXOR ( const unsigned  mask  )  [inline]

reset state bit

Definition at line 515 of file FTWire.h.

References _state.

00516 {
00517   _state=(_state|mask)^mask;
00518 }

void FTWire::stateXOR ( const unsigned  mask  )  [inline]

invert state bit

Definition at line 508 of file FTWire.h.

References _state.

00509 {
00510   _state^=mask;
00511 }

float FTWire::t0 ( const float  t0  )  [inline]

set t0 at begin-run

Definition at line 429 of file FTWire.h.

References _t0.

00430 {
00431   return _t0 = t0;
00432 }

float FTWire::t0 ( void   )  const [inline]

returns t0 read at begin run

Definition at line 422 of file FTWire.h.

References _t0.

00423 {
00424   return _t0;
00425 }

float FTWire::time ( float  t  )  [inline]

reset time

Definition at line 450 of file FTWire.h.

References _time.

00451 {
00452   return _time = t;
00453 }

float FTWire::time ( void   )  const [inline]

rerurns TDC time(after t0 subtraction)

Definition at line 457 of file FTWire.h.

References _time.

Referenced by FTTrack::r_phi2Fit(), and FTTrack::r_phi3Fit().

00458 {
00459   return _time;
00460 }

void FTWire::wireId ( int  wireID  )  [inline]

set wireId

Definition at line 580 of file FTWire.h.

References _wireId.

00580                                     {
00581   _wireId = wireID;
00582 }

const float FTWire::x ( void   )  const [inline]

returns position x

Definition at line 366 of file FTWire.h.

References _x.

Referenced by FTTrack::r_phi2Fit(), and FTTrack::r_phi3Fit().

00367 {
00368   return _x;
00369 }

const float FTWire::y ( void   )  const [inline]

returns position y

Definition at line 373 of file FTWire.h.

References _y.

Referenced by FTTrack::r_phi2Fit(), and FTTrack::r_phi3Fit().

00374 {
00375   return _y;
00376 }

int FTWire::z ( const Lpav la,
double &  z 
) const [inline]

returns z for track la

Definition at line 522 of file FTWire.h.

References _dx, _dy, _layer, _x, _y, Lpar::center(), Lpar::radius(), FTLayer::zb(), and FTLayer::zf().

00522                                            {
00523   HepVector center = la.center();
00524   double rho = la.radius();
00525   double dx2 = center(1) - _x;
00526   double dy2 = center(2) - _y;
00527   double par1 = _dx*_dx + _dy*_dy;
00528   double par2 = (_dx*dx2 + _dy*dy2)/par1;
00529   double par3 = _dx*dy2 - _dy*dx2;
00530   double par4 = rho*rho*par1 -  par3*par3;
00531   if (par4<0.) return 0;
00532   par4 = std::sqrt(par4)/par1;
00533   double delta = par2 + par4;
00534   //double delta = 0.5;
00535   if (delta>=0. && delta<1.){
00536     //z = _layer.zb()+delta*(_layer.zf()-_layer.zb());
00537     z = _layer.zf()+delta*(_layer.zb()-_layer.zf());
00538     return 1;
00539   }else{
00540     delta = par2 - par4;
00541     if (delta>=0. && delta<1.){
00542       //z = _layer.zb()+delta*(_layer.zf()-_layer.zb());
00543       z = _layer.zf()+delta*(_layer.zb()-_layer.zf());
00544       return 1;
00545     }
00546   }
00547   return 0;
00548 }


Member Data Documentation

float FTWire::_distance [private]

Definition at line 175 of file FTWire.h.

Referenced by clear(), distance(), and distance_z().

const float FTWire::_dx [private]

Definition at line 168 of file FTWire.h.

Referenced by z().

const float FTWire::_dy [private]

Definition at line 169 of file FTWire.h.

Referenced by z().

const FTLayer& FTWire::_layer [private]

Definition at line 170 of file FTWire.h.

Referenced by distance_z(), getInnerNeighbor(), getOuterNeighbor(), layer(), left(), right(), and z().

const int FTWire::_localId [private]

Definition at line 172 of file FTWire.h.

Referenced by left(), localId(), and right().

FTWire* FTWire::_neighbor[6] [private]

Definition at line 180 of file FTWire.h.

Referenced by chk_left_and_right(), FTWire(), getInnerNeighbor(), getMidNeighbor(), getOuterNeighbor(), and neighborPtr().

float FTWire::_pedestal [private]

Definition at line 178 of file FTWire.h.

Referenced by clear(), and pedestal().

const float FTWire::_phi [private]

Definition at line 173 of file FTWire.h.

Referenced by phi().

unsigned int FTWire::_state [private]

Definition at line 179 of file FTWire.h.

Referenced by chk_left_and_right(), clear(), state(), stateAND(), stateOR(), stateORXOR(), and stateXOR().

float FTWire::_t0 [private]

Definition at line 176 of file FTWire.h.

Referenced by clear(), and t0().

float FTWire::_time [private]

Definition at line 177 of file FTWire.h.

Referenced by clear(), and time().

FTWire* const& FTWire::_wire [private]

Definition at line 171 of file FTWire.h.

Referenced by initNeighbor().

int FTWire::_wireId [private]

Definition at line 174 of file FTWire.h.

Referenced by getWireId(), and wireId().

const float FTWire::_x [private]

Definition at line 166 of file FTWire.h.

Referenced by x(), and z().

const float FTWire::_y [private]

Definition at line 167 of file FTWire.h.

Referenced by y(), and z().

float FTWire::m_adc [private]

Definition at line 184 of file FTWire.h.

Referenced by clear(), getAdc(), and setAdc().

float FTWire::m_chi2 [private]

Definition at line 185 of file FTWire.h.

Referenced by getChi2(), and setChi2().

float FTWire::m_posx [private]

Definition at line 181 of file FTWire.h.

float FTWire::m_posy [private]

Definition at line 182 of file FTWire.h.

float FTWire::m_posz [private]

Definition at line 183 of file FTWire.h.


Generated on Tue Nov 29 23:19:36 2016 for BOSS_7.0.2 by  doxygen 1.4.7