BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
L1Algo.cxx
Go to the documentation of this file.
1#include "L1Algo.h"
2
3void L1Algo::Init(const fscal geo[])
4{
5 int ind = 0;
6 {
7 L1FieldValue B[3];
8 fvec z[3];
9 for (int i = 0; i < 3; i++) {
10 z[i] = geo[ind++];
11 B[i].x = geo[ind++];
12 B[i].y = geo[ind++];
13 B[i].z = geo[ind++];
14#ifndef TBB2
15 // std::cout<<"L1Algo Input Magnetic field:"<<z[i][0]<<" "<<B[i].x[0]<<" "<<B[i].y[0]<<"
16 // "<<B[i].z[0]<<std::endl;
17#endif // TBB2
18 }
19 vtxFieldRegion.Set(B[0], z[0], B[1], z[1], B[2], z[2]);
20 vtxFieldValue = B[0];
21 }
22 // vStations.clear();
23 NStations = static_cast<int>(geo[ind++]);
24 NMvdStations = static_cast<int>(geo[ind++]);
25
26 // cout << "N MVD & STS stations: " << NMvdStations << " " << NStations-NMvdStations << endl;
27#ifndef TBB2
28 // std::cout<<"L1Algo Input "<<NStations<<" Stations:"<<std::endl;
29#endif // TBB2
30 for (int i = 0; i < NStations; i++) {
31 L1Station& st = vStations[i];
32 st.z = geo[ind++];
33 st.materialInfo.thick = geo[ind++];
34 st.Rmin = geo[ind++];
35 st.Rmax = geo[ind++];
36 st.materialInfo.RL = geo[ind++];
39
40 double f_phi = geo[ind++];
41 double f_sigma = geo[ind++];
42 // f_sigma = 0.008; //AZ
43 double b_phi = geo[ind++];
44 double b_sigma = geo[ind++];
45 // b_sigma = 0.008; //AZ
46 double c_f = cos(f_phi);
47 double s_f = sin(f_phi);
48 double c_b = cos(b_phi);
49 double s_b = sin(b_phi);
50
51 st.frontInfo.cos_phi = c_f;
52 st.frontInfo.sin_phi = s_f;
53 st.frontInfo.sigma2 = f_sigma * f_sigma;
54
55 st.backInfo.cos_phi = c_b;
56 st.backInfo.sin_phi = s_b;
57 st.backInfo.sigma2 = b_sigma * b_sigma;
58 // cout << " Sigmas: " << f_sigma << " " << b_sigma << endl; //AZ
59
60 if (fabs(b_phi - f_phi) < .1) {
61 double th = b_phi - f_phi;
62 double det = cos(th);
63 det *= det;
64 st.XYInfo.C00 = (s_b * s_b * f_sigma * f_sigma + s_f * s_f * b_sigma * b_sigma) / det;
65 st.XYInfo.C10 = -(s_b * c_b * f_sigma * f_sigma + s_f * c_f * b_sigma * b_sigma) / det;
66 st.XYInfo.C11 = (c_b * c_b * f_sigma * f_sigma + c_f * c_f * b_sigma * b_sigma) / det;
67 // std::cout << "!!! det "<< det<<std::endl;
68 // cout << " Here1 " << st.XYInfo.C11 << endl; //AZ
69 } else {
70 double det = c_f * s_b - s_f * c_b;
71 det *= det;
72 st.XYInfo.C00 = (s_b * s_b * f_sigma * f_sigma + s_f * s_f * b_sigma * b_sigma) / det;
73 st.XYInfo.C10 = -(s_b * c_b * f_sigma * f_sigma + s_f * c_f * b_sigma * b_sigma) / det;
74 st.XYInfo.C11 = (c_b * c_b * f_sigma * f_sigma + c_f * c_f * b_sigma * b_sigma) / det;
75 // cout << " Here2 " << st.XYInfo.C11 << endl; //AZ
76 // cout << " Cos_phi: " << st.frontInfo.cos_phi << endl; //AZ
77 // std::cout << "!!! det "<< det<<std::endl;
78 }
79 // std::cout.precision(10);
80 // std::cout << "Station "<<i<<" " << st.XYInfo.C00[0]<<" "<<st.XYInfo.C11[0]<<"
81 // "<<st.XYInfo.C10[0]<<std::endl; std::cout << " "<< i<<" fsigma " << f_sigma<<" bsigma
82 // "<<b_sigma<<std::endl;
83
84 // st.xInfo.cos_phi = c_f/(c_f*s_b - c_b*s_f);
85 // st.xInfo.sin_phi =-c_b/(c_f*s_b - c_b*s_f);
86 st.xInfo.cos_phi = -s_f / (c_f * s_b - c_b * s_f);
87 st.xInfo.sin_phi = s_b / (c_f * s_b - c_b * s_f);
88 st.xInfo.sigma2 = st.XYInfo.C00;
89
90 st.yInfo.cos_phi = c_b / (c_b * s_f - c_f * s_b);
91 st.yInfo.sin_phi = -c_f / (c_b * s_f - c_f * s_b);
92 st.yInfo.sigma2 = st.XYInfo.C11;
93 // std::cout << "st.xInfo.cos_phi "<<st.xInfo.cos_phi<< " st.yInfo.cos_phi " << st.yInfo.cos_phi << std::endl;
94 // std::cout << "st.xInfo.sin_phi "<<st.xInfo.sin_phi<< " st.yInfo.sin_phi " << st.yInfo.sin_phi << std::endl;
95
96 // std::cout << "cos_b "<<c_b<< " sin_b " << s_b << std::endl;
97 // std::cout << "cos_f "<<c_f<< " sin_f " << s_f << std::endl;
98
99 int N = static_cast<int>(geo[ind++]);
100 for (int iC = 0; iC < N; iC++)
101 st.fieldSlice.cx[iC] = geo[ind++];
102 for (int iC = 0; iC < N; iC++)
103 st.fieldSlice.cy[iC] = geo[ind++];
104 for (int iC = 0; iC < N; iC++)
105 st.fieldSlice.cz[iC] = geo[ind++];
106#ifndef TBB2
107 // std::cout<<" "<<st.z[0] <<" "<<st.materialInfo.thick[0]<<" "<<st.materialInfo.RL[0]<<", "
108 // <<N<<" field coeff."<<std::endl;
109 // std::cout<<" "<<f_phi<<" "<<f_sigma <<" "<<b_phi<<" "<<b_sigma <<std::endl;
110#endif // TBB2
111 }
112
113 fTrackingLevel = static_cast<int>(geo[ind++]);
114 fMomentumCutOff = geo[ind++];
115 fGhostSuppression = static_cast<int>(geo[ind++]);
116
117 {
118 // fvec By0 = vStations[NStations-1].fieldSlice.cy[0];
119 fvec z0 = vStations[NStations - 1].z;
120 fvec sy = 0., Sy = 0.;
121 for (int i = NStations - 1; i >= 0; i--) {
122 L1Station& st = vStations[i];
123 fvec dz = st.z - z0;
124 fvec By = vStations[i].fieldSlice.cy[0];
125 Sy += dz * sy + dz * dz * By / 2.;
126 sy += dz * By;
127 st.Sy = Sy;
128 z0 = st.z;
129 }
130 }
131#ifndef TBB2
132 // std::cout<<"L1Algo initialized"<<std::endl;
133#endif // TBB2
134}
135
136#ifdef TBB2
137void L1Algo::SetData(const vector<L1StsHit>& StsHits_,
138 const vector<L1Strip>& StsStrips_,
139 const vector<L1Strip>& StsStripsB_,
140 const vector<fscal>& StsZPos_,
141 const vector<unsigned char>& SFlag_,
142 const vector<unsigned char>& SFlagB_,
143 const THitI* StsHitsStartIndex_,
144 const THitI* StsHitsStopIndex_)
145{
146 vStsHits.resize(StsHits_.size());
147 vStsStrips.resize(StsStrips_.size());
148 vStsStripsB.resize(StsStripsB_.size());
149 vStsZPos.resize(StsZPos_.size());
150 vSFlag.resize(SFlag_.size());
151 vSFlagB.resize(SFlagB_.size());
152
153 for (unsigned int i = 0; i < StsHits_.size(); ++i)
154 vStsHits[i] = StsHits_[i];
155 for (unsigned int i = 0; i < StsStrips_.size(); ++i)
156 vStsStrips[i] = StsStrips_[i];
157 for (unsigned int i = 0; i < StsStripsB_.size(); ++i)
158 vStsStripsB[i] = StsStripsB_[i];
159 for (unsigned int i = 0; i < StsZPos_.size(); ++i)
160 vStsZPos[i] = StsZPos_[i];
161 for (unsigned int i = 0; i < SFlag_.size(); ++i)
162 vSFlag[i] = SFlag_[i];
163 for (unsigned int i = 0; i < SFlagB_.size(); ++i)
164 vSFlagB[i] = SFlagB_[i];
165
166 for (unsigned int i = 0; i < MaxNStations + 1; ++i)
167 StsHitsStartIndex[i] = StsHitsStartIndex_[i];
168 for (unsigned int i = 0; i < MaxNStations + 1; ++i)
169 StsHitsStopIndex[i] = StsHitsStopIndex_[i];
170}
171#endif
172
173void L1Algo::GetHitCoor(const L1StsHit& _h, fscal& _x, fscal& _y, fscal& _z, const L1Station& sta)
174{
175 fscal u = vStsStrips[_h.f];
176 fscal v = vStsStripsB[_h.b];
177 fscal x, y;
178 StripsToCoor(u, v, x, y, sta);
179 _x = x;
180 _y = y;
181 _z = vStsZPos[_h.iz];
182}
183
184/// convert strip positions to coordinates
185void L1Algo::StripsToCoor(const fscal& u, const fscal& v, fscal& _x, fscal& _y, const L1Station& sta)
186 const // TODO: Actually sta.yInfo.sin_phi is same for all stations, so ...
187{
188 fvec x, y;
189 StripsToCoor(u, v, x, y, sta);
190 _x = x[0];
191 _y = y[0];
192}
193
194void L1Algo::StripsToCoor(const fvec& u, const fvec& v, fvec& x, fvec& y, const L1Station& sta)
195 const // TODO: Actually sta.yInfo.sin_phi is same for all stations, so ...
196{
197 // only for same-z
198 // x = u;
199 // y = (sta.yInfo.cos_phi*u + sta.yInfo.sin_phi*v);
200 x = sta.xInfo.sin_phi * u + sta.xInfo.cos_phi * v;
201 y = sta.yInfo.cos_phi * u + sta.yInfo.sin_phi * v;
202 // cout << sta.xInfo.sin_phi << " " << sta.xInfo.cos_phi << endl; //AZ
203 // cout << " y " << sta.yInfo.sin_phi << " " << sta.yInfo.cos_phi << endl; //AZ
204 // cout << x << " " << y << " " << sta.z << endl; //AZ
205 // cout << sta.XYInfo.C00 << " " << sta.XYInfo.C10 << " " << sta.XYInfo.C11 << endl; //AZ
206}
207
208/// full the hit point by hit information.
210{
211 L1Station& sta = vStations[int(ista)];
212 L1Strip& u = vStsStrips[hit.f];
213 L1Strip& v = vStsStripsB[hit.b];
214 fscal x, y;
215 StripsToCoor(u, v, x, y, sta);
216 fscal z = vStsZPos[hit.iz];
217
218 // return L1HitPoint(x,y,z,v,u,hit.n);
219 fscal du = u.errf(), dv = v.errf(); // AZ
220 return L1HitPoint(x, y, z, v, u, dv, du, hit.n); // AZ - with errors
221}
const int MaxNStations
unsigned int THitI
Definition L1StsHit.h:6
float fscal
Definition P4_F32vec4.h:232
friend F32vec4 fabs(const F32vec4 &a)
Definition P4_F32vec4.h:52
__m128 v
Definition P4_F32vec4.h:1
int i
Definition P4_F32vec4.h:22
F32vec4 fvec
Definition P4_F32vec4.h:231
float fMomentumCutOff
Definition L1Algo.h:565
void StripsToCoor(const fscal &u, const fscal &v, fscal &x, fscal &y, const L1Station &sta) const
convert strip positions to coordinates
Definition L1Algo.cxx:185
vector< L1StsHit > vStsHits
Definition L1Algo.h:162
L1HitPoint CreateHitPoint(const L1StsHit &hit, char ista)
full the hit point by hit information.
Definition L1Algo.cxx:209
int NStations
Definition L1Algo.h:153
THitI StsHitsStopIndex[MaxNStations+1]
Definition L1Algo.h:167
vector< fscal > vStsZPos
Definition L1Algo.h:161
vector< L1Strip > vStsStripsB
Definition L1Algo.h:160
vector< unsigned char > vSFlagB
Definition L1Algo.h:165
vector< unsigned char > vSFlag
Definition L1Algo.h:164
THitI StsHitsStartIndex[MaxNStations+1]
Definition L1Algo.h:166
int fGhostSuppression
Definition L1Algo.h:564
int NMvdStations
Definition L1Algo.h:154
vector< L1Strip > vStsStrips
Definition L1Algo.h:159
int fTrackingLevel
Definition L1Algo.h:564
void GetHitCoor(const L1StsHit &_h, fscal &_x, fscal &_y, fscal &_z, const L1Station &sta)
--— Hit-point-strips conversion routines ---—
Definition L1Algo.cxx:173
void Init(const fscal geo[])
Definition L1Algo.cxx:3
fvec cy[21]
Definition L1Field.h:39
fvec cx[21]
Definition L1Field.h:39
fvec cz[21]
Definition L1Field.h:39
L1XYMeasurementInfo XYInfo
Definition L1Station.h:31
fvec Rmin
Definition L1Station.h:27
L1UMeasurementInfo backInfo
Definition L1Station.h:30
L1UMeasurementInfo xInfo
Definition L1Station.h:30
L1UMeasurementInfo yInfo
Definition L1Station.h:30
fvec Rmax
Definition L1Station.h:27
L1FieldSlice fieldSlice
Definition L1Station.h:29
L1MaterialInfo materialInfo
Definition L1Station.h:28
L1UMeasurementInfo frontInfo
Definition L1Station.h:30
fvec Sy
Definition L1Station.h:27
TZPosI iz
Definition L1StsHit.h:13
unsigned short int n
Definition L1StsHit.h:15
TStripI f
Definition L1StsHit.h:12
TStripI b
Definition L1StsHit.h:12
RVec< PromoteType< T > > cos(const RVec< T > &v)
RVec< PromoteType< T > > log(const RVec< T > &v)
RVec< PromoteType< T > > sin(const RVec< T > &v)
contain strips positions and coordinates of hit
Definition L1HitPoint.h:9
fscal errf()
Definition L1Strip.h:22