#include <FTSegment.h>
Public Member Functions | |
FTSegment (FTSuperLayer *super, FTList< FTWire * > &hits) | |
constructors | |
~FTSegment () | |
destructors | |
int | examine (void) |
examine segment | |
void | printout (void) |
void | update (void) |
update information for axial segment | |
int | update3D (const FTTrack *track) |
update information for stereo segment | |
void | linkStereoSegments (void) |
link stereo segments by tanLambda | |
void | connect_outer (const FTList< FTWire * > &, const FTList< FTWire * > &) |
connect short segments | |
void | connect_inner (const FTList< FTWire * > &, const FTList< FTWire * > &) |
void | connect_outer (const FTWire *) |
connect single hit | |
void | connect_inner (const FTWire *) |
connect single hit | |
FTList< FTWire * > & | wireHits (void) const |
returns wire-hit list | |
FTSuperLayer & | superLayer (void) const |
returns super-layer | |
FTList< FTWire * > & | innerBoundHits (void) const |
returns innerBoundHits | |
FTList< FTWire * > & | outerBoundHits (void) const |
returns outerBoundHits | |
float | outgoingX (void) const |
returns x of outgoing position | |
float | outgoingY (void) const |
returns y of outgoing position | |
float | incomingX (void) const |
returns x of incoming position | |
float | incomingY (void) const |
returns y of incoming position | |
float | incomingPhi (void) const |
returns phi of incoming position | |
float | outgoingPhi (void) const |
returns phi of outgoing position | |
float | attr_const (void) const |
returns the sin(dphi)/MOD(r_out-r_in) | |
FTTrack * | track (void) const |
returns track | |
float | kappa (void) const |
returns kappa(axial) | |
float | r (void) const |
returns r from origin | |
float | s (void) const |
returns s for matched 2D track | |
float | z (void) const |
returns z for matched 2D track | |
FTTrack * | track (FTTrack *) |
set track | |
Static Public Attributes | |
static MdcParameter * | param = MdcParameter::instance() |
Private Attributes | |
IMagneticFieldSvc * | m_pmgnIMF |
FTList< FTWire * > & | _wireHits |
FTSuperLayer & | _superLayer |
FTList< FTWire * > & | _innerBoundHits |
FTList< FTWire * > & | _outerBoundHits |
FTList< float > * | _sList |
union { | |
float _kappa | |
FTList< float > * _zList | |
}; | |
union { | |
FTTrack * _track | |
FTList< FTTrack * > * _trackList | |
}; | |
float | _r |
float | _outgoing_x |
float | _outgoing_y |
float | _incoming_x |
float | _incoming_y |
Definition at line 24 of file FTSegment.h.
FTSegment::FTSegment | ( | FTSuperLayer * | super, | |
FTList< FTWire * > & | hits | |||
) | [inline] |
constructors
Definition at line 140 of file FTSegment.h.
References m_pmgnIMF.
00141 : _wireHits(hits), 00142 _superLayer(*super), 00143 _innerBoundHits(*(new FTList<FTWire *>(3))), 00144 _outerBoundHits(*(new FTList<FTWire *>(3))), 00145 _sList(NULL), 00146 _zList(NULL), 00147 _track(NULL) 00148 { 00149 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF); 00150 if(scmgn!=StatusCode::SUCCESS) { 00151 std::cout<< "Unable to open Magnetic field service"<<std::endl; 00152 } 00153 }
FTSegment::~FTSegment | ( | ) | [inline] |
destructors
Definition at line 156 of file FTSegment.h.
References _innerBoundHits, _outerBoundHits, _sList, _trackList, _wireHits, and _zList.
00157 { 00158 delete &_wireHits; 00159 delete &_innerBoundHits; 00160 delete &_outerBoundHits; 00161 if (_sList){ 00162 delete _sList; 00163 delete _zList; 00164 delete _trackList; 00165 } 00166 }
float FTSegment::attr_const | ( | void | ) | const [inline] |
returns the sin(dphi)/MOD(r_out-r_in)
Definition at line 296 of file FTSegment.h.
References _incoming_x, _incoming_y, _outgoing_x, _outgoing_y, incomingPhi(), outgoingPhi(), and sin().
00297 { 00298 float x_len = _outgoing_x - _incoming_x; 00299 float y_len = _outgoing_y - _incoming_y; 00300 float phi_l = outgoingPhi() - incomingPhi(); 00301 return sin(phi_l) / sqrt(x_len*x_len + y_len*y_len); 00302 }
void FTSegment::connect_inner | ( | const FTWire * | ) | [inline] |
connect single hit
Definition at line 199 of file FTSegment.h.
References _innerBoundHits, _wireHits, FTList< T >::append(), and FTList< T >::clear().
00200 { 00201 _wireHits.append((FTWire *)h); 00202 _innerBoundHits.clear(); 00203 _innerBoundHits.append((FTWire *)h); 00204 }
Definition at line 180 of file FTSegment.h.
References _innerBoundHits, _wireHits, FTList< T >::append(), and FTList< T >::clear().
00182 { 00183 _wireHits.append(innerHits); 00184 _innerBoundHits.clear(); 00185 _innerBoundHits.append(innerBound); 00186 }
void FTSegment::connect_outer | ( | const FTWire * | ) | [inline] |
connect single hit
Definition at line 190 of file FTSegment.h.
References _outerBoundHits, _wireHits, FTList< T >::append(), and FTList< T >::clear().
00191 { 00192 _wireHits.append((FTWire *)h); 00193 _outerBoundHits.clear(); 00194 _outerBoundHits.append((FTWire *)h); 00195 }
connect short segments
Definition at line 170 of file FTSegment.h.
References _outerBoundHits, _wireHits, FTList< T >::append(), and FTList< T >::clear().
00172 { 00173 _wireHits.append(outerHits); 00174 _outerBoundHits.clear(); 00175 _outerBoundHits.append(outerBound); 00176 }
int FTSegment::examine | ( | void | ) |
examine segment
Definition at line 20 of file FTSegment.cxx.
References _innerBoundHits, FTSuperLayer::_maxDphi, _outerBoundHits, _superLayer, _wireHits, FTList< T >::append(), FTList< T >::firstPtr(), genRecEmupikp::i, ganga-rec::j, FTList< T >::lastPtr(), M_PI, FTSuperLayer::nLayer(), and FTSuperLayer::superLayerId().
00020 { 00021 int stat = -1; 00022 FTList<FTWire *> wireHitsByLocalLayer[4] = {4,4,4,4}; 00023 00024 register FTWire ** hptr = _wireHits.firstPtr(); 00025 FTWire ** const last = _wireHits.lastPtr(); 00026 do{ 00027 wireHitsByLocalLayer[(**hptr).layer().localLayerId()].append(*hptr); 00028 }while((hptr++)!=last); 00029 float length_phi = 0.; 00030 int innerBoundId = 0; 00031 int outerBoundId = 0; 00032 int AlreadyFound = 0; 00033 //int LocalLayerLength; 00034 //int HalfLocalLayerLength; 00035 const int nLayer = _superLayer.nLayer(); 00036 // to look for the innerBound and outBand of the hits 00037 for (int i = 0; i^nLayer; i++){ 00038 int N_wireHits = wireHitsByLocalLayer[i].length(); 00039 if(N_wireHits){ 00040 float localPhi_max = 0.; 00041 float localPhi_min = 7.; 00042 for (int j = 0; j^N_wireHits; j++){ 00043 float localPhi = wireHitsByLocalLayer[i][j]->phi(); 00044 //LocalLayerLength = wireHitsByLocalLayer[i][j]->layer().NWire(); 00045 //HalfLocalLayerLength = LocalLayerLength >> 1; 00046 if (localPhi > localPhi_max) localPhi_max = localPhi; 00047 if (localPhi < localPhi_min) localPhi_min = localPhi; 00048 } 00049 float local_length_phi = localPhi_max - localPhi_min; 00050 if (local_length_phi > M_PI) 00051 local_length_phi = 2*M_PI - local_length_phi; 00052 if ( local_length_phi > length_phi ) length_phi = local_length_phi; 00053 outerBoundId = i; 00054 AlreadyFound = 1; 00055 } else if(!AlreadyFound){ 00056 innerBoundId++; 00057 } else { 00058 break; 00059 } 00060 } 00061 //length_phi needed to decide more carefully 00062 // if (length_phi>0.09){ 00063 // cout<<length_phi<<" : "<<FTSuperLayer::_maxDphi[_superLayer.superLayerId()]*2*M_PI/180<<endl; 00064 if (length_phi>FTSuperLayer::_maxDphi[_superLayer.superLayerId()]*2*M_PI/180){ //by X.-R. Lu 00065 stat = 3; // to be divided 00066 }else{ 00067 if (innerBoundId > 0){ 00068 stat = 2; // outer short 00069 }else{ 00070 if (outerBoundId < nLayer - 1){ 00071 stat = 1; // inner short 00072 }else{ 00073 stat = 0; // long simple 00074 } 00075 } 00076 } 00077 _innerBoundHits.append(wireHitsByLocalLayer[innerBoundId]); 00078 _outerBoundHits.append(wireHitsByLocalLayer[outerBoundId]); 00079 return stat; 00080 }
float FTSegment::incomingPhi | ( | void | ) | const [inline] |
returns phi of incoming position
Definition at line 264 of file FTSegment.h.
References _innerBoundHits, FTList< T >::length(), and M_PI.
Referenced by attr_const().
00265 { 00266 if (_innerBoundHits.length() ^ 1) { 00267 float phi_1st = _innerBoundHits[0]->phi(); 00268 float phi_2nd = _innerBoundHits[1]->phi(); 00269 float phi = 0.5 * (phi_1st + phi_2nd); 00270 if (fabs(phi_1st - phi_2nd) > M_PI) { 00271 return (phi>M_PI) ? (phi-M_PI) : (phi+M_PI); 00272 } 00273 return phi; 00274 } 00275 return _innerBoundHits[0]->phi(); 00276 }
float FTSegment::incomingX | ( | void | ) | const [inline] |
returns x of incoming position
Definition at line 250 of file FTSegment.h.
References _incoming_x.
00251 { 00252 return _incoming_x; 00253 }
float FTSegment::incomingY | ( | void | ) | const [inline] |
returns y of incoming position
Definition at line 257 of file FTSegment.h.
References _incoming_y.
00258 { 00259 return _incoming_y; 00260 }
returns innerBoundHits
Definition at line 222 of file FTSegment.h.
References _innerBoundHits.
Referenced by FTFinder::linkAxialSegments_step().
00223 { 00224 return _innerBoundHits; 00225 }
float FTSegment::kappa | ( | void | ) | const [inline] |
returns kappa(axial)
Definition at line 313 of file FTSegment.h.
References _kappa.
00314 { 00315 return _kappa; 00316 }
void FTSegment::linkStereoSegments | ( | void | ) |
link stereo segments by tanLambda
Definition at line 167 of file FTSegment.cxx.
References _trackList, ganga-rec::j, FTList< T >::length(), selected, and t().
00167 { 00168 float min_D_z = 9999.; 00169 float S = 0.; 00170 float Z = 0.; 00171 FTTrack * selected = NULL; 00172 int m = _trackList->length(); 00173 for (int j = 0; j^m; j++){ 00174 FTTrack * t = (*_trackList)[j]; 00175 float z_tmp = (*_zList)[j]; 00176 float s_tmp = (*_sList)[j]; 00177 float D_z = fabs(t->d_z(s_tmp,z_tmp)); 00178 if (D_z < min_D_z){ 00179 selected = t; 00180 min_D_z = D_z; 00181 S = s_tmp; 00182 Z = z_tmp; 00183 } 00184 } 00185 if (selected){ 00186 selected->append_stereo(this,S,Z); 00187 00188 } 00189 }
returns outerBoundHits
Definition at line 229 of file FTSegment.h.
References _outerBoundHits.
Referenced by FTSuperLayer::connect_short_segments(), and FTFinder::linkAxialSegments_step().
00230 { 00231 return _outerBoundHits; 00232 }
float FTSegment::outgoingPhi | ( | void | ) | const [inline] |
returns phi of outgoing position
Definition at line 280 of file FTSegment.h.
References _outerBoundHits, FTList< T >::length(), and M_PI.
Referenced by attr_const().
00281 { 00282 if (_outerBoundHits.length() ^ 1) { 00283 float phi_1st = _outerBoundHits[0]->phi(); 00284 float phi_2nd = _outerBoundHits[1]->phi(); 00285 float phi = 0.5 * (phi_1st + phi_2nd); 00286 if (fabs(phi_1st - phi_2nd) > M_PI) { 00287 return (phi>M_PI) ? (phi-M_PI) : (phi+M_PI); 00288 } 00289 return phi; 00290 } 00291 return _outerBoundHits[0]->phi(); 00292 }
float FTSegment::outgoingX | ( | void | ) | const [inline] |
returns x of outgoing position
Definition at line 236 of file FTSegment.h.
References _outgoing_x.
00237 { 00238 return _outgoing_x; 00239 }
float FTSegment::outgoingY | ( | void | ) | const [inline] |
returns y of outgoing position
Definition at line 243 of file FTSegment.h.
References _outgoing_y.
00244 { 00245 return _outgoing_y; 00246 }
void FTSegment::printout | ( | void | ) |
printout of the wireHits info. added by X.-R. Lu
Definition at line 193 of file FTSegment.cxx.
References _wireHits, Bes_Common::DEBUG, genRecEmupikp::i, FTList< T >::length(), and msgSvc().
Referenced by FTFinder::mkTrackList().
00193 { 00194 00195 IMessageSvc *msgSvc; 00196 Gaudi::svcLocator()->service("MessageSvc", msgSvc); 00197 00198 MsgStream log(msgSvc, "FTSegment"); 00199 log << MSG::DEBUG << "pintout of one segment:" << endreq; 00200 int n=_wireHits.length(); 00201 for(int i=0; i^n; i++){ 00202 FTWire &h = *_wireHits[i]; 00203 log << MSG::DEBUG << "hit: layer " << h.layer().layerId() << " phi "<< h.phi() << endreq; 00204 } 00205 }
float FTSegment::r | ( | void | ) | const [inline] |
returns r from origin
Definition at line 306 of file FTSegment.h.
References _r.
00307 { 00308 return _r; 00309 }
float FTSegment::s | ( | void | ) | const [inline] |
returns s for matched 2D track
Definition at line 320 of file FTSegment.h.
References _sList, and FTList< T >::first().
FTSuperLayer & FTSegment::superLayer | ( | void | ) | const [inline] |
returns super-layer
Definition at line 208 of file FTSegment.h.
References _superLayer.
00209 { 00210 return _superLayer; 00211 }
set track
Definition at line 341 of file FTSegment.h.
References _track.
00342 { 00343 return _track = src; 00344 }
FTTrack * FTSegment::track | ( | void | ) | const [inline] |
returns track
Definition at line 334 of file FTSegment.h.
References _track.
Referenced by update3D().
00335 { 00336 return _track; 00337 }
void FTSegment::update | ( | void | ) |
update information for axial segment
Definition at line 83 of file FTSegment.cxx.
References _incoming_x, _incoming_y, _innerBoundHits, _kappa, _outerBoundHits, _outgoing_x, _outgoing_y, _r, FTList< T >::first(), IMagneticFieldSvc::getReferField(), FTWire::layer(), FTList< T >::length(), m_pmgnIMF, and FTLayer::r().
00083 { 00084 //static const float alpha(333.564095); 00085 //float N_kappa; 00086 int n = _innerBoundHits.length(); 00087 int m = _outerBoundHits.length(); 00088 00089 if (n^1) { 00090 _incoming_x = 0.5*(_innerBoundHits[0]->x()+_innerBoundHits[1]->x()); 00091 _incoming_y = 0.5*(_innerBoundHits[0]->y()+_innerBoundHits[1]->y()); 00092 } else { 00093 _incoming_x = _innerBoundHits[0]->x(); 00094 _incoming_y = _innerBoundHits[0]->y(); 00095 } 00096 if (m^1) { 00097 _outgoing_x = 0.5*(_outerBoundHits[0]->x()+_outerBoundHits[1]->x()); 00098 _outgoing_y = 0.5*(_outerBoundHits[0]->y()+_outerBoundHits[1]->y()); 00099 } else { 00100 _outgoing_x = _outerBoundHits[0]->x(); 00101 _outgoing_y = _outerBoundHits[0]->y(); 00102 } 00103 float in_r = _innerBoundHits.first()->layer().r(); 00104 float out_r = _outerBoundHits.first()->layer().r(); 00105 float sbX = _incoming_x - _outgoing_x; 00106 float sbY = _incoming_y - _outgoing_y; 00107 // kappa = -2. * alpha * ((Vin X Vout)_z / |Vin|*|Vout|) / |Vin-Vout| 00108 _kappa = 2.*(-1. / 2.99792458 /m_pmgnIMF->getReferField())*(_outgoing_x*_incoming_y - _outgoing_y*_incoming_x) / 00109 (in_r*out_r*sqrt(sbX*sbX+sbY*sbY)); 00110 _r = 0.5*(in_r + out_r); 00111 }
int FTSegment::update3D | ( | const FTTrack * | track | ) |
update information for stereo segment
Definition at line 115 of file FTSegment.cxx.
References _incoming_x, _incoming_y, _innerBoundHits, _outerBoundHits, _outgoing_x, _outgoing_y, _sList, _trackList, _zList, FTList< T >::append(), Bes_Common::DEBUG, FTList< T >::first(), FTWire::layer(), FTList< T >::length(), FTLayer::limit(), FTTrack::lpav(), msgSvc(), FTLayer::r(), track(), x, and FTLayer::z().
00115 { 00116 IMessageSvc *msgSvc; 00117 Gaudi::svcLocator()->service("MessageSvc", msgSvc); 00118 00119 MsgStream log(msgSvc, "FTFinder"); 00120 00121 /*if (_superLayer.superLayerId() > 00122 track->axial_segments().first()->superLayer().superLayerId() + 4) return 0;*/ 00123 if (!_sList){ 00124 int n = _innerBoundHits.length(); 00125 int m = _outerBoundHits.length(); 00126 00127 _incoming_x = (n^1) 00128 ? 0.5*(_innerBoundHits[0]->x()+_innerBoundHits[1]->x()) 00129 : _innerBoundHits[0]->x(); 00130 _incoming_y = (n^1) 00131 ? 0.5*(_innerBoundHits[0]->y()+_innerBoundHits[1]->y()) 00132 : _innerBoundHits[0]->y(); 00133 _outgoing_x = (m^1) 00134 ? 0.5*(_outerBoundHits[0]->x()+_outerBoundHits[1]->x()) 00135 : _outerBoundHits[0]->x(); 00136 _outgoing_y = (m^1) 00137 ? 0.5*(_outerBoundHits[0]->y()+_outerBoundHits[1]->y()) 00138 : _outerBoundHits[0]->y(); 00139 _sList = new FTList<float>(5); 00140 _zList = new FTList<float>(5); 00141 _trackList = new FTList<FTTrack *>(5); 00142 } 00143 const Lpav & la = track->lpav(); 00144 double d; 00145 double inS; 00146 const FTLayer * bound = &_innerBoundHits.first()->layer(); 00147 log<<MSG::DEBUG<<"started inS calculation with layer limit "<< (double)bound->limit()<<endreq; 00148 if (!(la.sd((double)bound->r(),(double)_incoming_x, 00149 (double)_incoming_y,(double)bound->limit(), // multiplied with an factor due to bad rphi fit 00150 inS,d))) return 0; 00151 double inZ = bound->z(d); 00152 double outS; 00153 bound = &_outerBoundHits.first()->layer(); 00154 log<<MSG::DEBUG<<"started outS calculation with layer limit "<< (double)bound->limit()<<endreq; 00155 if (!(la.sd((double)bound->r(),(double)_outgoing_x, 00156 (double)_outgoing_y,(double)bound->limit(), // multiplied with an factor due to bad rphi fit 00157 outS,d))) return 0; 00158 double outZ = bound->z(d); 00159 _sList->append(inS+outS); 00160 _zList->append(inZ+outZ); 00161 _trackList->append((FTTrack *)track); 00162 log<<MSG::DEBUG<<"-----> coupled! DONE! "<<endreq; 00163 return 1; 00164 }
returns wire-hit list
Definition at line 215 of file FTSegment.h.
References _wireHits.
Referenced by FTSuperLayer::connect_short_segments(), and FTFinder::linkAxialSegments_step().
00216 { 00217 return _wireHits; 00218 }
float FTSegment::z | ( | void | ) | const [inline] |
returns z for matched 2D track
Definition at line 327 of file FTSegment.h.
References _zList, and FTList< T >::first().
union { ... } [private] |
union { ... } [private] |
float FTSegment::_incoming_x [private] |
Definition at line 134 of file FTSegment.h.
Referenced by attr_const(), incomingX(), update(), and update3D().
float FTSegment::_incoming_y [private] |
Definition at line 135 of file FTSegment.h.
Referenced by attr_const(), incomingY(), update(), and update3D().
FTList<FTWire *>& FTSegment::_innerBoundHits [private] |
Definition at line 120 of file FTSegment.h.
Referenced by connect_inner(), examine(), incomingPhi(), innerBoundHits(), update(), update3D(), and ~FTSegment().
float FTSegment::_kappa [private] |
FTList<FTWire *>& FTSegment::_outerBoundHits [private] |
Definition at line 121 of file FTSegment.h.
Referenced by connect_outer(), examine(), outerBoundHits(), outgoingPhi(), update(), update3D(), and ~FTSegment().
float FTSegment::_outgoing_x [private] |
Definition at line 132 of file FTSegment.h.
Referenced by attr_const(), outgoingX(), update(), and update3D().
float FTSegment::_outgoing_y [private] |
Definition at line 133 of file FTSegment.h.
Referenced by attr_const(), outgoingY(), update(), and update3D().
float FTSegment::_r [private] |
FTList<float>* FTSegment::_sList [private] |
FTSuperLayer& FTSegment::_superLayer [private] |
FTTrack* FTSegment::_track [private] |
FTList<FTTrack *>* FTSegment::_trackList [private] |
Definition at line 129 of file FTSegment.h.
Referenced by linkStereoSegments(), update3D(), and ~FTSegment().
FTList<FTWire *>& FTSegment::_wireHits [private] |
Definition at line 118 of file FTSegment.h.
Referenced by connect_inner(), connect_outer(), examine(), printout(), wireHits(), and ~FTSegment().
FTList<float>* FTSegment::_zList [private] |
IMagneticFieldSvc* FTSegment::m_pmgnIMF [private] |
MdcParameter * FTSegment::param = MdcParameter::instance() [static] |
Definition at line 114 of file FTSegment.h.