BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
FTSegment Class Reference

#include <FTSegment.h>

Public Member Functions

 FTSegment (FTSuperLayer *super, FTList< FTWire * > &hits)
 ~FTSegment ()
 destructors
int examine ()
 examine segment
void printout ()
void update ()
 update information for axial segment
int update3D (FTTrack *track)
 update information for stereo segment
void linkStereoSegments ()
 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 (FTWire *)
 connect single hit
void connect_inner (FTWire *)
 connect single hit
FTList< FTWire * > & wireHits ()
 returns wire-hit FTList
FTSuperLayersuperLayer () const
 returns super-layer
const FTList< FTWire * > & innerBoundHits ()
 returns innerBoundHits
const FTList< FTWire * > & outerBoundHits ()
 returns outerBoundHits
float outgoingX () const
 returns x of outgoing position
float outgoingY () const
 returns y of outgoing position
float incomingX () const
 returns x of incoming position
float incomingY () const
 returns y of incoming position
float incomingPhi () const
 returns phi of incoming position
float outgoingPhi () const
 returns phi of outgoing position
float attr_const () const
 returns the sin(dphi)/MOD(r_out-r_in)
FTTracktrack () const
 returns track
float kappa () const
 returns kappa(axial)
float r () const
 returns r from origin
float s () const
 returns s for matched 2D track
float z () const
 returns z for matched 2D track
FTTracktrack (FTTrack *)
 set track

Static Public Attributes

static MdcParameterparam = MdcParameter::instance()

Detailed Description

Definition at line 18 of file FTSegment.h.

Constructor & Destructor Documentation

◆ FTSegment()

FTSegment::FTSegment ( FTSuperLayer * super,
FTList< FTWire * > & hits )

Definition at line 12 of file FTSegment.cxx.

13 : _wireHits( hits )
14 , _superLayer( super )
15 , _innerBoundHits( 0 )
16 , _outerBoundHits( 0 )
17 , _firstCallUpdate3D( true )
18 , _sList( 0 )
19 , _zList( 0 ) {
20 StatusCode scmgn = Gaudi::svcLocator()->service( "MagneticFieldSvc", m_pmgnIMF );
21 if ( scmgn != StatusCode::SUCCESS )
22 { std::cout << "Unable to open Magnetic field service" << std::endl; }
23}

◆ ~FTSegment()

FTSegment::~FTSegment ( )
inline

destructors

Definition at line 23 of file FTSegment.h.

23{} // don't delete this definition, since it is used in FTFinder

Member Function Documentation

◆ attr_const()

float FTSegment::attr_const ( ) const

returns the sin(dphi)/MOD(r_out-r_in)

Definition at line 122 of file FTSegment.cxx.

122 {
123 float x_len = _outgoing_x - _incoming_x;
124 float y_len = _outgoing_y - _incoming_y;
125 float phi_l = outgoingPhi() - incomingPhi();
126 return sin( phi_l ) / sqrt( x_len * x_len + y_len * y_len );
127}
float incomingPhi() const
returns phi of incoming position
Definition FTSegment.cxx:92
float outgoingPhi() const
returns phi of outgoing position

◆ connect_inner() [1/2]

void FTSegment::connect_inner ( const FTList< FTWire * > & innerHits,
const FTList< FTWire * > & innerBound )

Definition at line 32 of file FTSegment.cxx.

33 {
34 _wireHits.insert( _wireHits.end(), innerHits.begin(), innerHits.end() );
35 _innerBoundHits.clear();
36 _innerBoundHits.insert( _innerBoundHits.end(), innerBound.begin(), innerBound.end() );
37}

◆ connect_inner() [2/2]

void FTSegment::connect_inner ( FTWire * h)

connect single hit

Definition at line 45 of file FTSegment.cxx.

45 {
46 _wireHits.push_back( h );
47 _innerBoundHits.clear();
48 _innerBoundHits.push_back( h );
49}

◆ connect_outer() [1/2]

void FTSegment::connect_outer ( const FTList< FTWire * > & outerHits,
const FTList< FTWire * > & outerBound )

connect short segments

Definition at line 25 of file FTSegment.cxx.

26 {
27 _wireHits.insert( _wireHits.end(), outerHits.begin(), outerHits.end() );
28 _outerBoundHits.clear();
29 _outerBoundHits.insert( _outerBoundHits.end(), outerBound.begin(), outerBound.end() );
30}

◆ connect_outer() [2/2]

void FTSegment::connect_outer ( FTWire * h)

connect single hit

Definition at line 39 of file FTSegment.cxx.

39 {
40 _wireHits.push_back( h );
41 _outerBoundHits.clear();
42 _outerBoundHits.push_back( h );
43}

◆ examine()

int FTSegment::examine ( )

examine segment

Definition at line 131 of file FTSegment.cxx.

131 {
132 int stat = -1;
133
134 array<FTList<FTWire*>, 4> wireHitsByLocalLayer;
135
136 for ( auto& hptr : _wireHits )
137 { wireHitsByLocalLayer[hptr->layer()->localLayerId()].push_back( hptr ); }
138
139 float length_phi = 0;
140 int innerBoundId = 0;
141 int outerBoundId = 0;
142 int AlreadyFound = 0;
143
144 const int nLayer = _superLayer->nLayer();
145
146 // to look for the innerBound and outBand of the hits
147 for ( int i = 0; i != nLayer; i++ )
148 {
149 int N_wireHits = wireHitsByLocalLayer[i].size();
150 if ( N_wireHits )
151 {
152 float localPhi_max = 0.;
153 float localPhi_min = 7.;
154
155 for ( int j = 0; j != N_wireHits; j++ )
156 {
157 float localPhi = wireHitsByLocalLayer[i][j]->phi();
158 if ( localPhi > localPhi_max ) localPhi_max = localPhi;
159 if ( localPhi < localPhi_min ) localPhi_min = localPhi;
160 }
161
162 float local_length_phi = localPhi_max - localPhi_min;
163 if ( local_length_phi > M_PI ) local_length_phi = 2 * M_PI - local_length_phi;
164 if ( local_length_phi > length_phi ) length_phi = local_length_phi;
165 outerBoundId = i;
166 AlreadyFound = 1;
167 }
168 else if ( !AlreadyFound ) { innerBoundId++; }
169 else { break; }
170 }
171
172 // length_phi needed to decide more carefully
173 if ( length_phi > FTSuperLayer::_maxDphi[_superLayer->superLayerId()] * 2 * M_PI / 180 )
174 { // by X.-R. Lu
175 stat = 3; // to be divided
176 }
177 else
178 {
179 if ( innerBoundId > 0 )
180 {
181 stat = 2; // outer short
182 }
183 else
184 {
185 if ( outerBoundId < nLayer - 1 )
186 {
187 stat = 1; // inner short
188 }
189 else
190 {
191 stat = 0; // long simple
192 }
193 }
194 }
195 _innerBoundHits.insert( _innerBoundHits.end(), wireHitsByLocalLayer[innerBoundId].begin(),
196 wireHitsByLocalLayer[innerBoundId].end() );
197 _outerBoundHits.insert( _outerBoundHits.end(), wireHitsByLocalLayer[outerBoundId].begin(),
198 wireHitsByLocalLayer[outerBoundId].end() );
199 return stat;
200}
#define M_PI
Definition TConstant.h:4
static const std::array< float, 11 > _maxDphi

◆ incomingPhi()

float FTSegment::incomingPhi ( ) const

returns phi of incoming position

Definition at line 92 of file FTSegment.cxx.

92 {
93 if ( _innerBoundHits.size() > 1 )
94 {
95 auto it = _innerBoundHits.begin();
96 float phi_1st = ( *it )->phi();
97 it++;
98 float phi_2nd = ( *it )->phi();
99 float phi = 0.5 * ( phi_1st + phi_2nd );
100 if ( fabs( phi_1st - phi_2nd ) > M_PI )
101 { return ( phi > M_PI ) ? ( phi - M_PI ) : ( phi + M_PI ); }
102 return phi;
103 }
104 else return _innerBoundHits.front()->phi();
105}

Referenced by attr_const().

◆ incomingX()

float FTSegment::incomingX ( ) const

returns x of incoming position

Definition at line 57 of file FTSegment.cxx.

57{ return _incoming_x; }

◆ incomingY()

float FTSegment::incomingY ( ) const

returns y of incoming position

Definition at line 58 of file FTSegment.cxx.

58{ return _incoming_y; }

◆ innerBoundHits()

const FTList< FTWire * > & FTSegment::innerBoundHits ( )

returns innerBoundHits

Definition at line 53 of file FTSegment.cxx.

53{ return _innerBoundHits; }

◆ kappa()

float FTSegment::kappa ( ) const

returns kappa(axial)

Definition at line 79 of file FTSegment.cxx.

79{ return _kappa; }

◆ linkStereoSegments()

void FTSegment::linkStereoSegments ( )

link stereo segments by tanLambda

Definition at line 262 of file FTSegment.cxx.

262 {
263 float min_D_z = 9999.;
264 float S = 0.;
265 float Z = 0.;
266 FTTrack* selected = nullptr;
267
268 int j = 0;
269 for ( auto t : _trackList )
270 {
271 float z_tmp = _zList[j];
272 float s_tmp = _sList[j];
273 float D_z = fabs( t->d_z( s_tmp, z_tmp ) );
274 if ( D_z < min_D_z )
275 {
276 selected = t;
277 min_D_z = D_z;
278 S = s_tmp;
279 Z = z_tmp;
280 }
281 j++;
282 }
283 if ( selected ) { selected->append_stereo( this, S, Z ); }
284}
int selected
int t()
Definition t.c:1

◆ outerBoundHits()

const FTList< FTWire * > & FTSegment::outerBoundHits ( )

returns outerBoundHits

Definition at line 54 of file FTSegment.cxx.

54{ return _outerBoundHits; }

◆ outgoingPhi()

float FTSegment::outgoingPhi ( ) const

returns phi of outgoing position

Definition at line 107 of file FTSegment.cxx.

107 {
108 if ( _outerBoundHits.size() > 1 )
109 {
110 auto it = _outerBoundHits.begin();
111 float phi_1st = ( *it )->phi();
112 it++;
113 float phi_2nd = ( *it )->phi();
114 float phi = 0.5 * ( phi_1st + phi_2nd );
115 if ( fabs( phi_1st - phi_2nd ) > M_PI )
116 { return ( phi > M_PI ) ? ( phi - M_PI ) : ( phi + M_PI ); }
117 return phi;
118 }
119 else return _outerBoundHits.front()->phi();
120}

Referenced by attr_const().

◆ outgoingX()

float FTSegment::outgoingX ( ) const

returns x of outgoing position

Definition at line 55 of file FTSegment.cxx.

55{ return _outgoing_x; }

◆ outgoingY()

float FTSegment::outgoingY ( ) const

returns y of outgoing position

Definition at line 56 of file FTSegment.cxx.

56{ return _outgoing_y; }

◆ printout()

void FTSegment::printout ( void )

printout of the wireHits info. added by X.-R. Lu

Definition at line 287 of file FTSegment.cxx.

287 {
288
289 IMessageSvc* msgSvc;
290 Gaudi::svcLocator()->service( "MessageSvc", msgSvc );
291
292 MsgStream log( msgSvc, "FTSegment" );
293 log << MSG::DEBUG << "pintout of one segment:" << endmsg;
294
295 for ( auto h : _wireHits )
296 {
297 log << MSG::DEBUG << "hit: layer " << h->layer()->layerId() << " phi " << h->phi()
298 << endmsg;
299 }
300}
IMessageSvc * msgSvc()

◆ r()

float FTSegment::r ( ) const

returns r from origin

Definition at line 59 of file FTSegment.cxx.

59{ return _r; }

◆ s()

float FTSegment::s ( ) const

returns s for matched 2D track

Definition at line 61 of file FTSegment.cxx.

61 {
62 if ( _sList.size() ) return _sList[0];
63 else
64 {
65 std::cout << "FTSegment::s() _sList.size() = 0 ! this = " << this << std::endl;
66 return 0;
67 }
68}

◆ superLayer()

FTSuperLayer * FTSegment::superLayer ( ) const

returns super-layer

Definition at line 51 of file FTSegment.cxx.

51{ return _superLayer; }

◆ track() [1/2]

FTTrack * FTSegment::track ( ) const

returns track

Definition at line 81 of file FTSegment.cxx.

81 {
82 if ( _trackList.size() ) return _trackList.front();
83 else return nullptr;
84}

Referenced by update3D().

◆ track() [2/2]

FTTrack * FTSegment::track ( FTTrack * src)

set track

Definition at line 86 of file FTSegment.cxx.

86 {
87 if ( _trackList.size() ) _trackList.front() = src;
88 else _trackList.push_back( src );
89 return _trackList.front();
90}

◆ update()

void FTSegment::update ( )

update information for axial segment

Definition at line 202 of file FTSegment.cxx.

202 {
203
204 updateInOutXY();
205
206 float in_r = _innerBoundHits.front()->layer()->r();
207 float out_r = _outerBoundHits.front()->layer()->r();
208 float sbX = _incoming_x - _outgoing_x;
209 float sbY = _incoming_y - _outgoing_y;
210
211 _kappa = 2. * ( -1. / 2.99792458 / m_pmgnIMF->getReferField() ) *
212 ( _outgoing_x * _incoming_y - _outgoing_y * _incoming_x ) /
213 ( in_r * out_r * sqrt( sbX * sbX + sbY * sbY ) );
214
215 _r = 0.5 * ( in_r + out_r );
216}

◆ update3D()

int FTSegment::update3D ( FTTrack * track)

update information for stereo segment

Definition at line 218 of file FTSegment.cxx.

218 {
219 IMessageSvc* msgSvc;
220 Gaudi::svcLocator()->service( "MessageSvc", msgSvc ).ignore();
221
222 MsgStream log( msgSvc, "FTFinder" );
223
224 if ( _firstCallUpdate3D )
225 {
226 updateInOutXY();
227 _firstCallUpdate3D = false;
228 }
229
230 const Lpav& la = track->lpav();
231 double d;
232 double inS;
233
234 const FTLayer* bound = _innerBoundHits.front()->layer();
235
236 log << MSG::DEBUG << "started inS calculation with layer limit " << bound->limit() << endmsg;
237 if ( !( la.sd( (double)bound->r(), (double)_incoming_x, (double)_incoming_y,
238 (double)bound->limit(), // multiplied with an factor due to bad rphi fit
239 inS, d ) ) )
240 return 0;
241
242 double inZ = bound->z( d );
243 double outS;
244
245 bound = _outerBoundHits.front()->layer();
246 log << MSG::DEBUG << "started outS calculation with layer limit " << bound->limit()
247 << endmsg;
248 if ( !( la.sd( (double)bound->r(), (double)_outgoing_x, (double)_outgoing_y,
249 (double)bound->limit(), // multiplied with an factor due to bad rphi fit
250 outS, d ) ) )
251 return 0;
252
253 double outZ = bound->z( d );
254 _sList.push_back( inS + outS );
255 _zList.push_back( inZ + outZ );
256 _trackList.push_back( track );
257 log << MSG::DEBUG << "-----> coupled! DONE! " << endmsg;
258
259 return 1;
260}
const float r() const
returns r form origin
Definition FTLayer.h:35
double z(const double d) const
returns z for "d" in r-phi plane
Definition FTLayer.h:50
const double limit() const
returns limit of "d" for stereo layer
Definition FTLayer.h:47
FTTrack * track() const
returns track
Definition FTSegment.cxx:81
int sd(double r, double x, double y, double limit, double &s, double &d) const

◆ wireHits()

FTList< FTWire * > & FTSegment::wireHits ( )

returns wire-hit FTList

Definition at line 52 of file FTSegment.cxx.

52{ return _wireHits; }

◆ z()

float FTSegment::z ( ) const

returns z for matched 2D track

Definition at line 70 of file FTSegment.cxx.

70 {
71 if ( _zList.size() ) return _zList[0];
72 else
73 {
74 std::cout << "FTSegment::s() _zList.size() = 0 ! this = " << this << std::endl;
75 return 0;
76 }
77}

Member Data Documentation

◆ param

MdcParameter * FTSegment::param = MdcParameter::instance()
static

Definition at line 106 of file FTSegment.h.


The documentation for this class was generated from the following files: