12 int CalcTrackTheta(
const int th1,
const int th2,
const int th3,
const int th4,
13 const int st1_ring2,
const int mode,
const bool BIT_COMP ) {
17 if ( (mode % 8) / 4 > 0 )
19 else if ( (mode % 4) / 2 > 0 )
21 else if ( (mode % 2) > 0 )
28 int nBits = (mode == 15 ? 4 : 5);
29 theta = ENG.
getTheta(theta, st1_ring2, nBits);
36 void CalcDeltaPhis(
int& dPh12,
int& dPh13,
int& dPh14,
int& dPh23,
int& dPh24,
int& dPh34,
int& dPhSign,
37 int& dPhSum4,
int& dPhSum4A,
int& dPhSum3,
int& dPhSum3A,
int& outStPh,
38 const int ph1,
const int ph2,
const int ph3,
const int ph4,
const int mode,
const bool BIT_COMP ) {
49 if ( (mode % 8) / 4 > 0 )
50 dPhSign = (dPh12 >= 0 ? +1 : -1);
51 else if ( (mode % 4) / 2 > 0 )
52 dPhSign = (dPh13 >= 0 ? +1 : -1);
53 else if ( (mode % 2) > 0 )
54 dPhSign = (dPh14 >= 0 ? +1 : -1);
55 }
else if ( (mode % 8) / 4 > 0 ) {
56 if ( (mode % 4) / 2 > 0 )
57 dPhSign = (dPh23 >= 0 ? +1 : -1);
58 else if ( (mode % 2) > 0 )
59 dPhSign = (dPh24 >= 0 ? +1 : -1);
60 }
else if ( (mode % 4) / 2 > 0 ) {
62 dPhSign = (dPh34 >= 0 ? +1 : -1);
65 if (not(dPhSign != 0))
83 if (mode == 7 || mode == 11 || mode > 12) {
106 case 15: dPh13 = dPh12 + dPh23; dPh14 = dPh13 + dPh34; dPh24 = dPh23 + dPh34;
break;
107 case 14: dPh13 = dPh12 + dPh23;
break;
108 case 13: dPh14 = dPh12 + dPh24;
break;
109 case 11: dPh14 = dPh13 + dPh34;
break;
110 case 7: dPh24 = dPh23 + dPh34;
break;
118 if (mode == 15)
CalcDeltaPhiSums( dPhSum4, dPhSum4A, dPhSum3, dPhSum3A, outStPh,
119 dPh12, dPh13, dPh14, dPh23, dPh24, dPh34 );
125 void CalcDeltaThetas(
int& dTh12,
int& dTh13,
int& dTh14,
int& dTh23,
int& dTh24,
int& dTh34,
126 const int th1,
const int th2,
const int th3,
const int th4,
const int mode,
const bool BIT_COMP ) {
136 int nBits = (mode == 15 ? 2 : 3);
150 void CalcBends(
int& bend1,
int& bend2,
int& bend3,
int& bend4,
151 const int pat1,
const int pat2,
const int pat3,
const int pat4,
152 const int dPhSign,
const int endcap,
const int mode,
const bool BIT_COMP ) {
161 if (mode == 7 || mode == 11 || mode > 12)
165 bend1 = ENG.
getCLCT( pat1, endcap, dPhSign, nBits );
166 if ( (mode % 8) / 4 > 0 )
167 bend2 = ENG.
getCLCT( pat2, endcap, dPhSign, nBits );
168 if ( (mode % 4) / 2 > 0 )
169 bend3 = ENG.
getCLCT( pat3, endcap, dPhSign, nBits );
170 if ( (mode % 2) > 0 )
171 bend4 = ENG.
getCLCT( pat4, endcap, dPhSign, nBits );
176 void CalcRPCs(
int& RPC1,
int& RPC2,
int& RPC3,
int& RPC4,
const int mode,
177 const int st1_ring2,
const int theta,
const bool BIT_COMP ) {
183 if (mode == 15 && !st1_ring2) {
192 int nRPC = (RPC1 == 1) + (RPC2 == 1) + (RPC3 == 1) + (RPC4 == 1);
198 if (RPC1 == 1 && RPC2 == 1) {
201 }
else if (RPC1 == 1 && RPC3 == 1) {
203 }
else if (RPC4 == 1 && RPC2 == 1) {
205 }
else if (RPC3 == 1 && RPC4 == 1 && !st1_ring2) {
208 }
else if (mode == 14) {
212 }
else if (RPC3 == 1) {
215 }
else if (mode == 13) {
219 }
else if (RPC4 == 1) {
222 }
else if (mode == 11) {
226 }
else if (RPC4 == 1) {
229 }
else if (mode == 7) {
233 }
else if (RPC4 == 1) {
252 else if ( (pattern % 2) == 0 )
254 else if ( (pattern % 2) == 1 )
255 bend = -1 * (11 - pattern) / 2;
261 if (not( bend != -99 ))
267 void CalcDeltaPhiSums(
int& dPhSum4,
int& dPhSum4A,
int& dPhSum3,
int& dPhSum3A,
int& outStPh,
268 const int dPh12,
const int dPh13,
const int dPh14,
const int dPh23,
const int dPh24,
const int dPh34 ) {
270 dPhSum4 = dPh12 + dPh13 + dPh14 + dPh23 + dPh24 + dPh34;
271 dPhSum4A =
abs(dPh12) +
abs(dPh13) +
abs(dPh14) +
abs(dPh23) +
abs(dPh24) +
abs(dPh34);
272 int devSt1 =
abs(dPh12) +
abs(dPh13) +
abs(dPh14);
273 int devSt2 =
abs(dPh12) +
abs(dPh23) +
abs(dPh24);
274 int devSt3 =
abs(dPh13) +
abs(dPh23) +
abs(dPh34);
275 int devSt4 =
abs(dPh14) +
abs(dPh24) +
abs(dPh34);
277 if (devSt4 > devSt3 && devSt4 > devSt2 && devSt4 > devSt1) outStPh = 4;
278 else if (devSt3 > devSt4 && devSt3 > devSt2 && devSt3 > devSt1) outStPh = 3;
279 else if (devSt2 > devSt4 && devSt2 > devSt3 && devSt2 > devSt1) outStPh = 2;
280 else if (devSt1 > devSt4 && devSt1 > devSt3 && devSt1 > devSt2) outStPh = 1;
284 dPhSum3 = dPh12 + dPh13 + dPh23;
285 dPhSum3A =
abs(dPh12) +
abs(dPh13) +
abs(dPh23);
286 }
else if (outStPh == 3) {
287 dPhSum3 = dPh12 + dPh14 + dPh24;
288 dPhSum3A =
abs(dPh12) +
abs(dPh14) +
abs(dPh24);
289 }
else if (outStPh == 2) {
290 dPhSum3 = dPh13 + dPh14 + dPh34;
291 dPhSum3A =
abs(dPh13) +
abs(dPh14) +
abs(dPh34);
293 dPhSum3 = dPh23 + dPh24 + dPh34;
294 dPhSum3A =
abs(dPh23) +
abs(dPh24) +
abs(dPh34);
int getTheta(int theta, int ring2, int bits=5) const
void CalcBends(int &bend1, int &bend2, int &bend3, int &bend4, const int pat1, const int pat2, const int pat3, const int pat4, const int dPhSign, const int endcap, const int mode, const bool BIT_COMP)
Geom::Theta< T > theta() const
int CalcTrackTheta(const int th1, const int th2, const int th3, const int th4, const int st1_ring2, const int mode, const bool BIT_COMP)
int CalcBendFromPattern(const int pattern, const int endcap)
void CalcDeltaPhis(int &dPh12, int &dPh13, int &dPh14, int &dPh23, int &dPh24, int &dPh34, int &dPhSign, int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP)
void CalcDeltaPhiSums(int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34)
int getNLBdPhi(int dPhi, int bits=7, int max=512) const
Abs< T >::type abs(const T &t)
int getCLCT(int clct, int endcap, int dPhiSign, int bits=3) const
void CalcDeltaThetas(int &dTh12, int &dTh13, int &dTh14, int &dTh23, int &dTh24, int &dTh34, const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP)
void CalcRPCs(int &RPC1, int &RPC2, int &RPC3, int &RPC4, const int mode, const int st1_ring2, const int theta, const bool BIT_COMP)
int getdTheta(int dTheta, int bits=3) const
PtAssignmentEngineAux2017 ENG