BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
FTSegment.cxx
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// Package: MdcFastTrkAlg
4// Module: FTSegment
5//
6// Description: segment class for MdcFastTrkAlg
7//
8
9#include <math.h>
17
18
19int
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}
81
82void
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}
112
113
114int
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}
165
166void
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}
190
191#ifndef OnlineMode
192void
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}
206#endif
int selected
const Int_t n
Double_t x[10]
IMessageSvc * msgSvc()
#define M_PI
Definition: TConstant.h:4
const float r(void) const
returns r form origin
Definition: FTLayer.h:141
double z(const double d) const
returns z for "d" in r-phi plane
Definition: FTLayer.h:169
const int layerId(void) const
returns layer ID
Definition: FTLayer.h:112
const double limit(void) const
returns limit of "d" for stereo layer
Definition: FTLayer.h:162
Definition: FTList.h:16
T & first(void) const
returns the first object in the list
Definition: FTList.h:224
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
int append(const T &x)
append an object into the end of the list
Definition: FTList.h:127
T * firstPtr(void) const
returns the pointer of first object
Definition: FTList.h:231
void printout(void)
Definition: FTSegment.cxx:193
FTList< FTTrack * > * _trackList
Definition: FTSegment.h:129
FTList< float > * _zList
Definition: FTSegment.h:125
void update(void)
update information for axial segment
Definition: FTSegment.cxx:83
void linkStereoSegments(void)
link stereo segments by tanLambda
Definition: FTSegment.cxx:167
FTTrack * track(void) const
returns track
Definition: FTSegment.h:334
float _kappa
Definition: FTSegment.h:124
static MdcParameter * param
Definition: FTSegment.h:114
int update3D(const FTTrack *track)
update information for stereo segment
Definition: FTSegment.cxx:115
int examine(void)
examine segment
Definition: FTSegment.cxx:20
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
const Lpav & lpav(void) const
returns lpav
Definition: FTTrack.h:237
Definition: FTWire.h:43
float phi(void) const
returns phi
Definition: FTWire.h:394
const FTLayer & layer(void) const
returns layer
Definition: FTWire.h:359
virtual double getReferField()=0
int sd(double r, double x, double y, double limit, double &s, double &d) const
static MdcParameter * instance()
Definition: MdcParameter.cxx:6
int t()
Definition: t.c:1