25 int dphi[6] = {-999,-999,-999,-999,-999,-999};
26 int dtmp2[6] = {-999,-999,-999,-999,-999,-999};
27 int dtmp2_ths[6][2] = {{-999,-999},{-999,-999},{-999,-999},{-999,-999},{-999,-999},{-999,-999}};
30 for(
int s1=0;s1<3;s1++){
32 for(
int s2=s1+1;
s2<4;
s2++){
38 if((s1 == 0) && (phmatch.
x[zone][winner][s1].
Phi() != -999) && (phmatch.
x[zone][winner][
s2].
Phi() != -999)){
40 dphi[
s2-1] = phmatch.
x[zone][winner][s1].
Phi() - phmatch.
x[zone][winner][
s2].
Phi();
42 else if((s1 != 0) && (phmatch.
x[zone][winner][s1].
Phi() != -999) && (phmatch.
x[zone][winner][
s2].
Phi() != -999)){
44 dphi[s1+
s2] = phmatch.
x[zone][winner][s1].
Phi() - phmatch.
x[zone][winner][
s2].
Phi();
52 for(
unsigned int t1=0;t1<phmatch.
x[zone][winner][s1].
AllThetas().size();t1++){
59 if(dtmp2[
s2-1] == -999){
60 dtmp2[
s2-1] = dth_tmp;
61 dtmp2_ths[
s2-1][0] = phmatch.
x[zone][winner][s1].
AllThetas()[t1];
64 else if(
abs(dth_tmp) <
abs(dtmp2[
s2-1])){
65 dtmp2[
s2-1] = dth_tmp;
66 dtmp2_ths[
s2-1][0] = phmatch.
x[zone][winner][s1].
AllThetas()[t1];
73 if(dtmp2[
s2+s1] == -999){
74 dtmp2[
s2+s1] = dth_tmp;
75 dtmp2_ths[s1+
s2][0] = phmatch.
x[zone][winner][s1].
AllThetas()[t1];
78 else if(
abs(dth_tmp) <
abs(dtmp2[
s2+s1])){
79 dtmp2[
s2+s1] = dth_tmp;
80 dtmp2_ths[s1+
s2][0] = phmatch.
x[zone][winner][s1].
AllThetas()[t1];
91 int vmask[3] = {0,0,0};
92 const unsigned int mask[6] = {0x3,0x5,0x9,0x6,0xa,0xc};
105 const unsigned int mindex[6] = {0,0,0,1,1,2};
107 for(
int p=0;
p<6;
p++){
109 if((
abs(dtmp2[
p]) <= 4) && (dtmp2[p] != -999)){
110 vmask[mindex[
p]] |= mask[
p];
114 unsigned int vstat = vmask[0];
116 if( !vstat || (vstat & vmask[1])){vstat |= vmask[1];}
117 if( !vstat || (vstat & vmask[2])){vstat |= vmask[2];}
142 std::vector<int>
d (6,-999);
143 std::vector<std::vector<int>>
deltas (2,d);
145 for(
int i=0;
i<6;
i++){
147 deltas[0][
i] = dphi[
i];
148 deltas[1][
i] = dtmp2[
i];
156 phi = phmatch.
x[zone][winner][1].
Phi();
159 if(dtmp2[0] != -999){
160 theta = dtmp2_ths[0][1];
162 else if(dtmp2[3] != -999){
163 theta = dtmp2_ths[3][0];
165 else if(dtmp2[4] != -999){
166 theta = dtmp2_ths[4][0];
172 phi = phmatch.
x[zone][winner][2].
Phi();
173 if(dtmp2[1] != -999){
174 theta = dtmp2_ths[1][1];
176 else if(dtmp2[5] != -999){
177 theta = dtmp2_ths[5][0];
181 phi = phmatch.
x[zone][winner][3].
Phi();
182 if(dtmp2[2] != -999){
183 theta = dtmp2_ths[2][1];
189 int rank = (Mout.
Winners()[zone][winner].Rank()<<1);
193 if(vstat & 8){rank |= 1;}
else{rank &= 0x7e;}
194 if(vstat & 4){rank |= 2;}
else{rank &= 0x7d;}
195 if(vstat & 2){rank |= 8;}
else{rank &= 0x77;}
196 if(vstat & 1){rank |= 32;}
else{rank &= 0x5f;}
197 if(vstat == 0 || vstat == 1 || vstat == 2 || vstat == 4 || vstat == 8){rank = 0;}
213 std::vector<DeltaOutput>
o (3,output);
214 std::vector<std::vector<DeltaOutput>>
out (4,o);
216 for(
int zone=0;zone<4;zone++){
217 for(
int winner=0;winner<3;winner++){
218 out[zone][winner] =
Deltas(Mout, zone, winner);
231 for(
int bx=0;bx<3;bx++){
232 for(
int zone=0;zone<4;zone++){
233 for(
int winner=0;winner<3;winner++){
234 Output.
x[bx][zone][winner] =
Deltas(Mout[bx], zone, winner);
DeltaOutput Deltas(MatchingOutput Mout, int zone, int winner)
void SetPhOut(PhOutput ph_output)
std::vector< std::vector< Winner > > Winners()
DeltaOutArr3 CalcDeltas_Hold(const std::vector< MatchingOutput > &Mout)
Geom::Theta< T > theta() const
auto const T2 &decltype(t1.eta()) t2
Abs< T >::type abs(const T &t)
std::vector< int > AllThetas()
void SetValues(MatchingOutput Mout, std::vector< std::vector< int >> Deltas, int Phi, int Theta, Winner winner)
std::vector< std::vector< DeltaOutput > > CalcDeltas(MatchingOutput Mout)