21 int dphi[6] = {-999,-999,-999,-999,-999,-999};
22 int dtmp2[6] = {-999,-999,-999,-999,-999,-999};
23 int dtmp2_ths[6][2] = {{-999,-999},{-999,-999},{-999,-999},{-999,-999},{-999,-999},{-999,-999}};
26 for(
int s1=0;s1<3;s1++){
28 for(
int s2=s1+1;
s2<4;
s2++){
34 if((s1 == 0) && (phmatch.
x[zone][winner][s1].
Phi() != -999) && (phmatch.
x[zone][winner][
s2].
Phi() != -999)){
36 dphi[
s2-1] = phmatch.
x[zone][winner][s1].
Phi() - phmatch.
x[zone][winner][
s2].
Phi();
38 else if((s1 != 0) && (phmatch.
x[zone][winner][s1].
Phi() != -999) && (phmatch.
x[zone][winner][
s2].
Phi() != -999)){
40 dphi[s1+
s2] = phmatch.
x[zone][winner][s1].
Phi() - phmatch.
x[zone][winner][
s2].
Phi();
48 for(
unsigned int t1=0;t1<phmatch.
x[zone][winner][s1].
AllThetas().size();t1++){
55 if(dtmp2[
s2-1] == -999){
56 dtmp2[
s2-1] = dth_tmp;
57 dtmp2_ths[
s2-1][0] = phmatch.
x[zone][winner][s1].
AllThetas()[t1];
60 else if(
abs(dth_tmp) <
abs(dtmp2[
s2-1])){
61 dtmp2[
s2-1] = dth_tmp;
62 dtmp2_ths[
s2-1][0] = phmatch.
x[zone][winner][s1].
AllThetas()[t1];
69 if(dtmp2[
s2+s1] == -999){
70 dtmp2[
s2+s1] = dth_tmp;
71 dtmp2_ths[s1+
s2][0] = phmatch.
x[zone][winner][s1].
AllThetas()[t1];
74 else if(
abs(dth_tmp) <
abs(dtmp2[
s2+s1])){
75 dtmp2[
s2+s1] = dth_tmp;
76 dtmp2_ths[s1+
s2][0] = phmatch.
x[zone][winner][s1].
AllThetas()[t1];
87 int vmask[3] = {0,0,0};
88 const unsigned int mask[6] = {0x3,0x5,0x9,0x6,0xa,0xc};
101 const unsigned int mindex[6] = {0,0,0,1,1,2};
103 for(
int p=0;
p<6;
p++){
105 if((
abs(dtmp2[
p]) <= 4) && (dtmp2[p] != -999)){
106 vmask[mindex[
p]] |= mask[
p];
110 unsigned int vstat = vmask[0];
112 if( !vstat || (vstat & vmask[1])){vstat |= vmask[1];}
113 if( !vstat || (vstat & vmask[2])){vstat |= vmask[2];}
138 std::vector<int>
d (6,-999);
139 std::vector<std::vector<int>>
deltas (2,d);
141 for(
int i=0;
i<6;
i++){
143 deltas[0][
i] = dphi[
i];
144 deltas[1][
i] = dtmp2[
i];
152 phi = phmatch.
x[zone][winner][1].
Phi();
155 if(dtmp2[0] != -999){
156 theta = dtmp2_ths[0][1];
158 else if(dtmp2[3] != -999){
159 theta = dtmp2_ths[3][0];
161 else if(dtmp2[4] != -999){
162 theta = dtmp2_ths[4][0];
168 phi = phmatch.
x[zone][winner][2].
Phi();
169 if(dtmp2[1] != -999){
170 theta = dtmp2_ths[1][1];
172 else if(dtmp2[5] != -999){
173 theta = dtmp2_ths[5][0];
177 phi = phmatch.
x[zone][winner][3].
Phi();
178 if(dtmp2[2] != -999){
179 theta = dtmp2_ths[2][1];
185 int rank = (Mout.
Winners()[zone][winner].Rank()<<1);
189 if(vstat & 8){rank |= 1;}
else{rank &= 0x7e;}
190 if(vstat & 4){rank |= 2;}
else{rank &= 0x7d;}
191 if(vstat & 2){rank |= 8;}
else{rank &= 0x77;}
192 if(vstat & 1){rank |= 32;}
else{rank &= 0x5f;}
193 if(vstat == 0 || vstat == 1 || vstat == 2 || vstat == 4 || vstat == 8){rank = 0;}
209 std::vector<DeltaOutput>
o (3,output);
210 std::vector<std::vector<DeltaOutput>>
out (4,o);
212 for(
int zone=0;zone<4;zone++){
213 for(
int winner=0;winner<3;winner++){
214 out[zone][winner] =
Deltas(Mout, zone, winner);
227 for(
int bx=0;bx<3;bx++){
228 for(
int zone=0;zone<4;zone++){
229 for(
int winner=0;winner<3;winner++){
230 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)
Geom::Phi< T > phi() const
std::vector< std::vector< DeltaOutput > > CalcDeltas(MatchingOutput Mout)