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

#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
 
FTSuperLayersuperLayer (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)
 
FTTracktrack (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
 
FTTracktrack (FTTrack *)
 set track
 

Static Public Attributes

static MdcParameterparam = MdcParameter::instance()
 

Detailed Description

Definition at line 24 of file FTSegment.h.

Constructor & Destructor Documentation

◆ FTSegment()

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

constructors

Definition at line 140 of file FTSegment.h.

141 : _wireHits(hits),
142 _superLayer(*super),
143 _innerBoundHits(*(new FTList<FTWire *>(3))),
144 _outerBoundHits(*(new FTList<FTWire *>(3))),
145 _sList(NULL),
146 _zList(NULL),
147 _track(NULL)
148{
149 StatusCode scmgn = Gaudi::svcLocator()->service("MagneticFieldSvc",m_pmgnIMF);
150 if(scmgn!=StatusCode::SUCCESS) {
151 std::cout<< "Unable to open Magnetic field service"<<std::endl;
152 }
153}
Definition: FTList.h:16
FTList< float > * _zList
Definition: FTSegment.h:125
FTTrack * _track
Definition: FTSegment.h:128

◆ ~FTSegment()

FTSegment::~FTSegment ( )
inline

destructors

Definition at line 156 of file FTSegment.h.

157{
158 delete &_wireHits;
159 delete &_innerBoundHits;
160 delete &_outerBoundHits;
161 if (_sList){
162 delete _sList;
163 delete _zList;
164 delete _trackList;
165 }
166}
FTList< FTTrack * > * _trackList
Definition: FTSegment.h:129

Member Function Documentation

◆ attr_const()

float FTSegment::attr_const ( void  ) const
inline

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

Definition at line 296 of file FTSegment.h.

297{
298 float x_len = _outgoing_x - _incoming_x;
299 float y_len = _outgoing_y - _incoming_y;
300 float phi_l = outgoingPhi() - incomingPhi();
301 return sin(phi_l) / sqrt(x_len*x_len + y_len*y_len);
302}
double sin(const BesAngle a)
Definition: BesAngle.h:210
float incomingPhi(void) const
returns phi of incoming position
Definition: FTSegment.h:264
float outgoingPhi(void) const
returns phi of outgoing position
Definition: FTSegment.h:280

◆ connect_inner() [1/2]

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

Definition at line 180 of file FTSegment.h.

182{
183 _wireHits.append(innerHits);
184 _innerBoundHits.clear();
185 _innerBoundHits.append(innerBound);
186}
void clear(void)
clear lists but the allocated memory remains same
Definition: FTList.h:182
int append(const T &x)
append an object into the end of the list
Definition: FTList.h:127

◆ connect_inner() [2/2]

void FTSegment::connect_inner ( const FTWire h)
inline

connect single hit

Definition at line 199 of file FTSegment.h.

200{
201 _wireHits.append((FTWire *)h);
202 _innerBoundHits.clear();
203 _innerBoundHits.append((FTWire *)h);
204}
Definition: FTWire.h:43

◆ connect_outer() [1/2]

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

connect short segments

Definition at line 170 of file FTSegment.h.

172{
173 _wireHits.append(outerHits);
174 _outerBoundHits.clear();
175 _outerBoundHits.append(outerBound);
176}

◆ connect_outer() [2/2]

void FTSegment::connect_outer ( const FTWire h)
inline

connect single hit

Definition at line 190 of file FTSegment.h.

191{
192 _wireHits.append((FTWire *)h);
193 _outerBoundHits.clear();
194 _outerBoundHits.append((FTWire *)h);
195}

◆ examine()

int FTSegment::examine ( void  )

examine segment

Definition at line 20 of file FTSegment.cxx.

20 {
21 int stat = -1;
22 FTList<FTWire *> wireHitsByLocalLayer[4] = {4,4,4,4};
23
24 register FTWire ** hptr = _wireHits.firstPtr();
25 FTWire ** const last = _wireHits.lastPtr();
26 do{
27 wireHitsByLocalLayer[(**hptr).layer().localLayerId()].append(*hptr);
28 }while((hptr++)!=last);
29 float length_phi = 0.;
30 int innerBoundId = 0;
31 int outerBoundId = 0;
32 int AlreadyFound = 0;
33 //int LocalLayerLength;
34 //int HalfLocalLayerLength;
35 const int nLayer = _superLayer.nLayer();
36 // to look for the innerBound and outBand of the hits
37 for (int i = 0; i^nLayer; i++){
38 int N_wireHits = wireHitsByLocalLayer[i].length();
39 if(N_wireHits){
40 float localPhi_max = 0.;
41 float localPhi_min = 7.;
42 for (int j = 0; j^N_wireHits; j++){
43 float localPhi = wireHitsByLocalLayer[i][j]->phi();
44 //LocalLayerLength = wireHitsByLocalLayer[i][j]->layer().NWire();
45 //HalfLocalLayerLength = LocalLayerLength >> 1;
46 if (localPhi > localPhi_max) localPhi_max = localPhi;
47 if (localPhi < localPhi_min) localPhi_min = localPhi;
48 }
49 float local_length_phi = localPhi_max - localPhi_min;
50 if (local_length_phi > M_PI)
51 local_length_phi = 2*M_PI - local_length_phi;
52 if ( local_length_phi > length_phi ) length_phi = local_length_phi;
53 outerBoundId = i;
54 AlreadyFound = 1;
55 } else if(!AlreadyFound){
56 innerBoundId++;
57 } else {
58 break;
59 }
60 }
61 //length_phi needed to decide more carefully
62 // if (length_phi>0.09){
63 // cout<<length_phi<<" : "<<FTSuperLayer::_maxDphi[_superLayer.superLayerId()]*2*M_PI/180<<endl;
64 if (length_phi>FTSuperLayer::_maxDphi[_superLayer.superLayerId()]*2*M_PI/180){ //by X.-R. Lu
65 stat = 3; // to be divided
66 }else{
67 if (innerBoundId > 0){
68 stat = 2; // outer short
69 }else{
70 if (outerBoundId < nLayer - 1){
71 stat = 1; // inner short
72 }else{
73 stat = 0; // long simple
74 }
75 }
76 }
77 _innerBoundHits.append(wireHitsByLocalLayer[innerBoundId]);
78 _outerBoundHits.append(wireHitsByLocalLayer[outerBoundId]);
79 return stat;
80}
#define M_PI
Definition: TConstant.h:4
T * lastPtr(void) const
returns the pointer of last object
Definition: FTList.h:238
int length(void) const
returns the length of the list
Definition: FTList.h:245
T * firstPtr(void) const
returns the pointer of first object
Definition: FTList.h:231
static const float _maxDphi[11]
Definition: FTSuperLayer.h:116
const int nLayer(void) const
returns number of layers
Definition: FTSuperLayer.h:197
const int superLayerId(void) const
returns super-layer ID
Definition: FTSuperLayer.h:221

◆ incomingPhi()

float FTSegment::incomingPhi ( void  ) const
inline

returns phi of incoming position

Definition at line 264 of file FTSegment.h.

265{
266 if (_innerBoundHits.length() ^ 1) {
267 float phi_1st = _innerBoundHits[0]->phi();
268 float phi_2nd = _innerBoundHits[1]->phi();
269 float phi = 0.5 * (phi_1st + phi_2nd);
270 if (fabs(phi_1st - phi_2nd) > M_PI) {
271 return (phi>M_PI) ? (phi-M_PI) : (phi+M_PI);
272 }
273 return phi;
274 }
275 return _innerBoundHits[0]->phi();
276}

Referenced by attr_const().

◆ incomingX()

float FTSegment::incomingX ( void  ) const
inline

returns x of incoming position

Definition at line 250 of file FTSegment.h.

251{
252 return _incoming_x;
253}

◆ incomingY()

float FTSegment::incomingY ( void  ) const
inline

returns y of incoming position

Definition at line 257 of file FTSegment.h.

258{
259 return _incoming_y;
260}

◆ innerBoundHits()

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

returns innerBoundHits

Definition at line 222 of file FTSegment.h.

223{
224 return _innerBoundHits;
225}

◆ kappa()

float FTSegment::kappa ( void  ) const
inline

returns kappa(axial)

Definition at line 313 of file FTSegment.h.

314{
315 return _kappa;
316}
float _kappa
Definition: FTSegment.h:124

◆ linkStereoSegments()

void FTSegment::linkStereoSegments ( void  )

link stereo segments by tanLambda

Definition at line 167 of file FTSegment.cxx.

167 {
168 float min_D_z = 9999.;
169 float S = 0.;
170 float Z = 0.;
171 FTTrack * selected = NULL;
172 int m = _trackList->length();
173 for (int j = 0; j^m; j++){
174 FTTrack * t = (*_trackList)[j];
175 float z_tmp = (*_zList)[j];
176 float s_tmp = (*_sList)[j];
177 float D_z = fabs(t->d_z(s_tmp,z_tmp));
178 if (D_z < min_D_z){
179 selected = t;
180 min_D_z = D_z;
181 S = s_tmp;
182 Z = z_tmp;
183 }
184 }
185 if (selected){
186 selected->append_stereo(this,S,Z);
187
188 }
189}
int selected
TTree * t
Definition: binning.cxx:23

◆ outerBoundHits()

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

returns outerBoundHits

Definition at line 229 of file FTSegment.h.

230{
231 return _outerBoundHits;
232}

◆ outgoingPhi()

float FTSegment::outgoingPhi ( void  ) const
inline

returns phi of outgoing position

Definition at line 280 of file FTSegment.h.

281{
282 if (_outerBoundHits.length() ^ 1) {
283 float phi_1st = _outerBoundHits[0]->phi();
284 float phi_2nd = _outerBoundHits[1]->phi();
285 float phi = 0.5 * (phi_1st + phi_2nd);
286 if (fabs(phi_1st - phi_2nd) > M_PI) {
287 return (phi>M_PI) ? (phi-M_PI) : (phi+M_PI);
288 }
289 return phi;
290 }
291 return _outerBoundHits[0]->phi();
292}

Referenced by attr_const().

◆ outgoingX()

float FTSegment::outgoingX ( void  ) const
inline

returns x of outgoing position

Definition at line 236 of file FTSegment.h.

237{
238 return _outgoing_x;
239}

◆ outgoingY()

float FTSegment::outgoingY ( void  ) const
inline

returns y of outgoing position

Definition at line 243 of file FTSegment.h.

244{
245 return _outgoing_y;
246}

◆ printout()

void FTSegment::printout ( void  )

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

Definition at line 193 of file FTSegment.cxx.

193 {
194
195 IMessageSvc *msgSvc;
196 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
197
198 MsgStream log(msgSvc, "FTSegment");
199 log << MSG::DEBUG << "pintout of one segment:" << endreq;
200 int n=_wireHits.length();
201 for(int i=0; i^n; i++){
202 FTWire &h = *_wireHits[i];
203 log << MSG::DEBUG << "hit: layer " << h.layer().layerId() << " phi "<< h.phi() << endreq;
204 }
205}
IMessageSvc * msgSvc()
const int layerId(void) const
returns layer ID
Definition: FTLayer.h:112
float phi(void) const
returns phi
Definition: FTWire.h:394
const FTLayer & layer(void) const
returns layer
Definition: FTWire.h:359

◆ r()

float FTSegment::r ( void  ) const
inline

returns r from origin

Definition at line 306 of file FTSegment.h.

307{
308 return _r;
309}

◆ s()

float FTSegment::s ( void  ) const
inline

returns s for matched 2D track

Definition at line 320 of file FTSegment.h.

321{
322 return _sList->first();
323}
T & first(void) const
returns the first object in the list
Definition: FTList.h:224

◆ superLayer()

FTSuperLayer & FTSegment::superLayer ( void  ) const
inline

returns super-layer

Definition at line 208 of file FTSegment.h.

209{
210 return _superLayer;
211}

◆ track() [1/2]

FTTrack * FTSegment::track ( FTTrack src)
inline

set track

Definition at line 341 of file FTSegment.h.

342{
343 return _track = src;
344}

◆ track() [2/2]

FTTrack * FTSegment::track ( void  ) const
inline

returns track

Definition at line 334 of file FTSegment.h.

335{
336 return _track;
337}

Referenced by update3D().

◆ update()

void FTSegment::update ( void  )

update information for axial segment

Definition at line 83 of file FTSegment.cxx.

83 {
84 //static const float alpha(333.564095);
85 //float N_kappa;
86 int n = _innerBoundHits.length();
87 int m = _outerBoundHits.length();
88
89 if (n^1) {
90 _incoming_x = 0.5*(_innerBoundHits[0]->x()+_innerBoundHits[1]->x());
91 _incoming_y = 0.5*(_innerBoundHits[0]->y()+_innerBoundHits[1]->y());
92 } else {
93 _incoming_x = _innerBoundHits[0]->x();
94 _incoming_y = _innerBoundHits[0]->y();
95 }
96 if (m^1) {
97 _outgoing_x = 0.5*(_outerBoundHits[0]->x()+_outerBoundHits[1]->x());
98 _outgoing_y = 0.5*(_outerBoundHits[0]->y()+_outerBoundHits[1]->y());
99 } else {
100 _outgoing_x = _outerBoundHits[0]->x();
101 _outgoing_y = _outerBoundHits[0]->y();
102 }
103 float in_r = _innerBoundHits.first()->layer().r();
104 float out_r = _outerBoundHits.first()->layer().r();
105 float sbX = _incoming_x - _outgoing_x;
106 float sbY = _incoming_y - _outgoing_y;
107 // kappa = -2. * alpha * ((Vin X Vout)_z / |Vin|*|Vout|) / |Vin-Vout|
108 _kappa = 2.*(-1. / 2.99792458 /m_pmgnIMF->getReferField())*(_outgoing_x*_incoming_y - _outgoing_y*_incoming_x) /
109 (in_r*out_r*sqrt(sbX*sbX+sbY*sbY));
110 _r = 0.5*(in_r + out_r);
111}
const float r(void) const
returns r form origin
Definition: FTLayer.h:141
virtual double getReferField()=0

◆ update3D()

int FTSegment::update3D ( const FTTrack track)

update information for stereo segment

Definition at line 115 of file FTSegment.cxx.

115 {
116 IMessageSvc *msgSvc;
117 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
118
119 MsgStream log(msgSvc, "FTFinder");
120
121 /*if (_superLayer.superLayerId() >
122 track->axial_segments().first()->superLayer().superLayerId() + 4) return 0;*/
123 if (!_sList){
124 int n = _innerBoundHits.length();
125 int m = _outerBoundHits.length();
126
127 _incoming_x = (n^1)
128 ? 0.5*(_innerBoundHits[0]->x()+_innerBoundHits[1]->x())
129 : _innerBoundHits[0]->x();
130 _incoming_y = (n^1)
131 ? 0.5*(_innerBoundHits[0]->y()+_innerBoundHits[1]->y())
132 : _innerBoundHits[0]->y();
133 _outgoing_x = (m^1)
134 ? 0.5*(_outerBoundHits[0]->x()+_outerBoundHits[1]->x())
135 : _outerBoundHits[0]->x();
136 _outgoing_y = (m^1)
137 ? 0.5*(_outerBoundHits[0]->y()+_outerBoundHits[1]->y())
138 : _outerBoundHits[0]->y();
139 _sList = new FTList<float>(5);
140 _zList = new FTList<float>(5);
142 }
143 const Lpav & la = track->lpav();
144 double d;
145 double inS;
146 const FTLayer * bound = &_innerBoundHits.first()->layer();
147 log<<MSG::DEBUG<<"started inS calculation with layer limit "<< (double)bound->limit()<<endreq;
148 if (!(la.sd((double)bound->r(),(double)_incoming_x,
149 (double)_incoming_y,(double)bound->limit(), // multiplied with an factor due to bad rphi fit
150 inS,d))) return 0;
151 double inZ = bound->z(d);
152 double outS;
153 bound = &_outerBoundHits.first()->layer();
154 log<<MSG::DEBUG<<"started outS calculation with layer limit "<< (double)bound->limit()<<endreq;
155 if (!(la.sd((double)bound->r(),(double)_outgoing_x,
156 (double)_outgoing_y,(double)bound->limit(), // multiplied with an factor due to bad rphi fit
157 outS,d))) return 0;
158 double outZ = bound->z(d);
159 _sList->append(inS+outS);
160 _zList->append(inZ+outZ);
162 log<<MSG::DEBUG<<"-----> coupled! DONE! "<<endreq;
163 return 1;
164}
double z(const double d) const
returns z for "d" in r-phi plane
Definition: FTLayer.h:169
const double limit(void) const
returns limit of "d" for stereo layer
Definition: FTLayer.h:162
FTTrack * track(void) const
returns track
Definition: FTSegment.h:334
const Lpav & lpav(void) const
returns lpav
Definition: FTTrack.h:237
int sd(double r, double x, double y, double limit, double &s, double &d) const
double y[1000]
double x[1000]

◆ wireHits()

FTList< FTWire * > & FTSegment::wireHits ( void  ) const
inline

returns wire-hit list

Definition at line 215 of file FTSegment.h.

216{
217 return _wireHits;
218}

◆ z()

float FTSegment::z ( void  ) const
inline

returns z for matched 2D track

Definition at line 327 of file FTSegment.h.

328{
329 return _zList->first();
330}

Member Data Documentation

◆ _kappa

float FTSegment::_kappa

Definition at line 124 of file FTSegment.h.

Referenced by kappa(), and update().

◆ _track

FTTrack* FTSegment::_track

Definition at line 128 of file FTSegment.h.

Referenced by track().

◆ _trackList

FTList<FTTrack *>* FTSegment::_trackList

Definition at line 129 of file FTSegment.h.

Referenced by linkStereoSegments(), update3D(), and ~FTSegment().

◆ _zList

FTList<float>* FTSegment::_zList

Definition at line 125 of file FTSegment.h.

Referenced by update3D(), z(), and ~FTSegment().

◆ param

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

Definition at line 114 of file FTSegment.h.


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