Main Page
Namespaces
Classes
Package Documentation
L1Trigger
L1TMuonEndCap
interface
BestTracks.h
Go to the documentation of this file.
1
/*
2
Takes in the output of Deltas module and sorts to find
3
three best tracks per given sector.
4
5
6
Author: Matthew R. Carver
7
Date: 7/29/13
8
*/
9
10
#ifndef ADD_BESTTRACK
11
#define ADD_BESTTRACK
12
13
14
#include "
L1Trigger/L1TMuonEndCap/interface/EmulatorClasses.h
"
15
16
17
std::vector<BTrack>
BestTracks
(
DeltaOutArr2
Dout){
18
19
bool
verbose
=
false
;
20
21
int
larger[12][12] = {{0},{0}}, kill[12] = {0};
22
int
exists[12] = {0};
23
int
winner[3][12] = {{0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0}};
24
int
phi
[4][3][4],
id
[4][3][4];
25
26
for
(
int
r
=0;
r
<4;
r
++){
27
for
(
int
t
=0;
t
<3;
t
++){
28
for
(
int
d
=0;
d
<4;
d
++){
29
30
phi[
r
][
t
][
d
] = Dout.
x
[
r
][
t
].
GetMatchOut
().
PhiMatch
().
x
[
r
][
t
][
d
].
Phi
();
31
//if(phi[r][t][d] != -999) std::cout<<"phi = "<<phi[r][t][d]<<"\n";
32
id
[
r
][
t
][
d
] = Dout.
x
[
r
][
t
].
GetMatchOut
().
PhiMatch
().
x
[
r
][
t
][
d
].
Id
();
33
}
34
}
35
}
36
37
BTrack
tmp
;
38
std::vector<BTrack>
output
(3,tmp);
39
40
for
(
int
zone=0;zone<4;zone++){
41
for
(
int
winner=0;winner<3;winner++){
42
for
(
int
station
=0;
station
<4;
station
++){
43
44
int
cham
= Dout.
x
[zone][winner].
GetMatchOut
().
PhiMatch
().
x
[zone][winner][
station
].
Id
();
45
//int relst = 0;
46
int
relch = 0;
47
48
if
(
station
== 0){
49
50
//relst = (cham < 3) ? 0 : 1;
51
relch = cham%3;
52
if
(zone == 2)
53
relch += 3;
54
if
(zone == 3)
55
relch += 6;
56
}
57
else
if
(
station
== 1){
58
59
//relst = station + 1;
60
relch =
cham
;
61
if
(zone > 1)
62
relch += 3;
63
}
64
else
{
65
66
//relst = station + 1;
67
relch =
cham
;
68
if
(zone > 0)
69
relch += 3;
70
}
71
72
//phi[zone][winner][relst] = phi[zone][winner][station];
73
//id[zone][winner][relst] = id[zone][winner][station];
74
75
//if(phi[zone][winner][relst] != -999 && verbose)
76
// std::cout<<"st:"<<relst<<"::real phi = "<<phi[zone][winner][relst]<<" and id = "<<id[zone][winner][relst]<<std::endl;
77
}
78
}
79
}
80
82
for
(
int
i
=0;
i
<12;
i
++){
83
84
larger[
i
][
i
] = 1;
//result of comparison with itself
85
int
ranki = Dout.
x
[
i
%4][
i
/4].
GetWinner
().
Rank
();
//the zone loops faster such that each is given equal priority
86
87
for
(
int
j=0;j<12;j++){
88
89
int
rankj = Dout.
x
[j%4][j/4].
GetWinner
().
Rank
();
90
bool
greater = (ranki > rankj);
91
bool
equal
= (ranki == rankj);
92
93
if
(((
i
<j) && (greater ||
equal
)) || ((
i
>j) && greater))
94
larger[
i
][j] = 1;
95
}
96
97
exists[
i
] = (ranki != 0);
98
}
99
100
// ghost cancelltion. only in current BX so far(as in firmware as well)
101
int
vmask[4] = {32,8,2,1};
102
for
(
int
k
=0;
k
<12;
k
++){
103
for
(
int
l
=0;
l
<12;
l
++){
104
int
sh_seg = 0;
105
for
(
int
s
=0;
s
<4;
s
++){
106
107
//if(id[k%4][k/4][s] && (k != l) && ((phi[k%4][k/4][s] != -999) && (phi[l%4][l/4][s] != -999)) && verbose)
108
// std::cout<<"id1 = "<<id[k%4][k/4][s]<<", id2 = "<<id[l%4][l/4][s]<<"\nphi1 = "<<phi[k%4][k/4][s]<<", phi1 = "<<phi[l%4][l/4][s]<<".\n";
109
110
if
((
id
[
k
%4][
k
/4][
s
] ==
id
[
l
%4][
l
/4][
s
])
111
&& ((phi[
k
%4][
k
/4][
s
] != -999) || (phi[
l
%4][
l
/4][
s
] != -999))
112
&& (phi[
k
%4][
k
/4][
s
] == phi[
l
%4][
l
/4][
s
])
113
&& (
k
!=
l
)
114
&& (Dout.
x
[
k
%4][
k
/4].
GetWinner
().
Rank
() & vmask[
s
])
//station from track one is valid after deltas
115
&& (Dout.
x
[
l
%4][
l
/4].
GetWinner
().
Rank
() & vmask[
s
])
//station from track two is valid after deltas
116
){
117
118
sh_seg++;
119
}
120
}
121
122
if
(sh_seg){
123
//kill candidate that has lower rank
124
if
(larger[
k
][
l
]){kill[
l
] = 1;}
125
else
{kill[
k
] = 1;}
126
}
127
}
128
}
129
130
//remove ghosts according to kill array
131
for
(
int
q
=0;
q
<12;
q
++){
132
if
(kill[
q
]){exists[
q
] = 0;}
133
}
134
135
for
(
int
p
=0;
p
<12;
p
++){
136
if
(exists[
p
]){
137
for
(
int
x
=0;
x
<12;
x
++){
138
if
(!exists[
x
]){larger[
p
][
x
] = 1;}
139
}
140
}
141
else
{
142
for
(
int
x
=0;
x
<12;
x
++){
143
larger[
p
][
x
] = 0;
144
}
145
}
146
147
int
sum = 0;
148
for
(
int
j=0;j<12;j++){
149
if
(!larger[p][j]){sum++;}
150
}
151
152
if
(sum < 3){winner[sum][
p
] = 1;}
153
}
154
155
for
(
int
n
=0;
n
<3;
n
++){
156
for
(
int
i
=0;
i
<12;
i
++){
157
if
(winner[
n
][
i
]){
158
159
BTrack
bests;
160
int
mode
= 0;
161
if
(Dout.
x
[i%4][i/4].
GetWinner
().
Rank
() & 32)
162
mode |= 8;
163
if
(Dout.
x
[i%4][i/4].
GetWinner
().
Rank
() & 8)
164
mode |= 4;
165
if
(Dout.
x
[i%4][i/4].
GetWinner
().
Rank
() & 2)
166
mode |= 2;
167
if
(Dout.
x
[i%4][i/4].
GetWinner
().
Rank
() & 1)
168
mode |= 1;
169
170
if
(verbose)
std::cout
<<
"Best Rank "
<<
n
<<
" = "
<<Dout.
x
[i%4][i/4].
GetWinner
().
Rank
()<<
" and mode = "
<<mode<<
"\n\n"
;
171
if
(verbose)
std::cout
<<
"Phi = "
<<Dout.
x
[i%4][i/4].
Phi
()<<
" and Theta = "
<<Dout.
x
[i%4][i/4].
Theta
()<<
"\n\n"
;
172
if
(verbose)
std::cout
<<
"Ph Deltas: "
<<Dout.
x
[i%4][i/4].
Deltas
()[0][0]<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[0][1]<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[0][2]<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[0][3]
173
<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[0][4]<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[0][5]<<
" \nTh Deltas: "
<<Dout.
x
[i%4][i/4].
Deltas
()[1][0]
174
<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[1][1]<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[1][2]<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[1][3]
175
<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[1][4]<<
" "
<<Dout.
x
[i%4][i/4].
Deltas
()[1][5]<<
"\n\n"
;
176
177
bests.
winner
= Dout.
x
[i%4][i/4].
GetWinner
();
178
bests.
phi
= Dout.
x
[i%4][i/4].
Phi
();
179
bests.
theta
= Dout.
x
[i%4][i/4].
Theta
();
180
bests.
deltas
= Dout.
x
[i%4][i/4].
Deltas
();
181
bests.
clctpattern
= Dout.
x
[i%4][i/4].
GetMatchOut
().
PhiMatch
().
x
[i%4][i/4][0].
Pattern
();
182
bests.
AHits
.clear();
183
for
(
int
iPh = 0; iPh < 4; iPh++) {
184
if
( Dout.
x
[i%4][i/4].
GetMatchOut
().
PhiMatch
().
x
[i%4][i/4][iPh].
Theta
() != -999 &&
185
Dout.
x
[i%4][i/4].
GetMatchOut
().
PhiMatch
().
x
[i%4][i/4][iPh].
Phi
() > 0 )
186
bests.
AHits
.push_back( Dout.
x
[i%4][i/4].
GetMatchOut
().
PhiMatch
().
x
[i%4][i/4][iPh] );
187
}
188
189
if
(bests.
phi
!= 0 && bests.
theta
== 0)
190
std::cout
<<
"In BestTracks.h, phi = "
<< bests.
phi
<<
" and theta = "
<< bests.
theta
<< std::endl;
191
192
output[
n
] = bests;
193
194
}
195
}
196
}
197
198
return
output
;
199
200
}
201
202
std::vector<std::vector<BTrack>>
BestTracks_Hold
(
DeltaOutArr3
Dout){
203
204
BTrack
tmp
;
205
std::vector<BTrack>
output
(3,tmp);
206
std::vector<std::vector<BTrack>> full_output (3,output);
207
208
for
(
int
bx=0;bx<3;bx++){
209
DeltaOutArr2
Dout2;
210
for
(
int
zone=0;zone<4;zone++){
211
for
(
int
winner=0;winner<3;winner++){
212
Dout2.
x
[zone][winner] = Dout.
x
[bx][zone][winner];
213
}
214
}
215
full_output[bx] =
BestTracks
(Dout2);
216
}
217
218
return
full_output;
219
220
}
221
222
223
#endif
DeltaOutput::GetMatchOut
MatchingOutput GetMatchOut()
Definition:
EmulatorClasses.h:181
mps_fire.i
i
Definition:
mps_fire.py:156
AlCaHLTBitMon_ParallelJobs.p
p
Definition:
AlCaHLTBitMon_ParallelJobs.py:152
Winner::Rank
int Rank()
Definition:
EmulatorClasses.h:96
DeltaOutArr2
Definition:
EmulatorClasses.h:195
BestTracks
std::vector< BTrack > BestTracks(DeltaOutArr2 Dout)
Definition:
BestTracks.h:17
verbose
Definition:
MagVerbosity.h:13
PhOutput::x
ConvertedHit x[4][3][4]
Definition:
EmulatorClasses.h:135
alignCSCRings.s
s
Definition:
alignCSCRings.py:91
DeltaOutArr3::x
DeltaOutput x[3][4][3]
Definition:
EmulatorClasses.h:196
ConvertedHit::Phi
int Phi()
Definition:
EmulatorClasses.h:45
convertSQLitetoXML_cfg.output
output
Definition:
convertSQLitetoXML_cfg.py:32
BTrack::winner
Winner winner
Definition:
EmulatorClasses.h:202
stringResolutionProvider_cfi.phi
phi
Definition:
stringResolutionProvider_cfi.py:15
cond::serialization::equal
bool equal(const T &first, const T &second)
Definition:
Equal.h:34
BTrack::deltas
std::vector< std::vector< int > > deltas
Definition:
EmulatorClasses.h:206
BTrack::phi
int phi
Definition:
EmulatorClasses.h:203
x
T x() const
Cartesian x coordinate.
Definition:
Basic3DVectorLD.h:127
ConvertedHit::Id
int Id()
Definition:
EmulatorClasses.h:52
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition:
ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
BTrack::AHits
std::vector< ConvertedHit > AHits
Definition:
EmulatorClasses.h:207
DeltaOutput::Theta
int Theta()
Definition:
EmulatorClasses.h:184
ConvertedHit::Theta
int Theta()
Definition:
EmulatorClasses.h:46
EmulatorClasses.h
edmIntegrityCheck.d
d
Definition:
edmIntegrityCheck.py:65
BTrack
Definition:
EmulatorClasses.h:198
DeltaOutput::GetWinner
Winner GetWinner()
Definition:
EmulatorClasses.h:185
gen::k
int k[5][pyjets_maxn]
Definition:
Cascade2Hadronizer.cc:79
BTrack::theta
int theta
Definition:
EmulatorClasses.h:204
alignCSCRings.r
r
Definition:
alignCSCRings.py:92
DeltaOutArr2::x
DeltaOutput x[4][3]
Definition:
EmulatorClasses.h:195
gen::n
int n
Definition:
Cascade2Hadronizer.cc:79
tmp
std::vector< std::vector< double > > tmp
Definition:
MVATrainer.cc:100
checklumidiff.l
l
Definition:
checklumidiff.py:65
MatchingOutput::PhiMatch
PhOutput PhiMatch()
Definition:
EmulatorClasses.h:160
BestTracks_Hold
std::vector< std::vector< BTrack > > BestTracks_Hold(DeltaOutArr3 Dout)
Definition:
BestTracks.h:202
DeltaOutput::Deltas
std::vector< std::vector< int > > Deltas()
Definition:
EmulatorClasses.h:182
lumiQTWidget.t
t
Definition:
lumiQTWidget.py:50
BTrack::clctpattern
int clctpattern
Definition:
EmulatorClasses.h:205
relativeConstraints.cham
cham
Definition:
relativeConstraints.py:68
gather_cfg.cout
cout
Definition:
gather_cfg.py:145
lumiQueryAPI.q
q
Definition:
lumiQueryAPI.py:1839
ConvertedHit::Pattern
int Pattern()
Definition:
EmulatorClasses.h:54
DeltaOutArr3
Definition:
EmulatorClasses.h:196
DeltaOutput::Phi
int Phi()
Definition:
EmulatorClasses.h:183
relativeConstraints.station
station
Definition:
relativeConstraints.py:66
Generated for CMSSW Reference Manual by
1.8.11