test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
#include "
L1Trigger/L1TMuonEndCap/interface/EmulatorClasses.h
"
11
12
13
std::vector<BTrack>
BestTracks
(std::vector<std::vector<DeltaOutput>> Dout){
14
15
//bool verbose = false;
16
17
int
larger[12][12] = {{0},{0}}, kill[12] = {0};
18
int
exists[12] = {0};
19
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}};
20
int
phi
[4][3][4],
id
[4][3][4];
21
22
for
(
int
r
=0;
r
<4;
r
++){
23
for
(
int
t
=0;
t
<3;
t
++){
24
for
(
int
d
=0;
d
<4;
d
++){
25
26
phi[
r
][
t
][
d
] = Dout[
r
][
t
].GetMatchOut().PhiMatch()[
r
][
t
][
d
].Phi();
27
id
[
r
][
t
][
d
] = Dout[
r
][
t
].GetMatchOut().PhiMatch()[
r
][
t
][
d
].Id();
28
}
29
}
30
}
31
32
BTrack
tmp
;
33
std::vector<BTrack>
output
(3,tmp);
34
35
36
37
for
(
int
zone=0;zone<4;zone++){
38
39
for
(
int
winner=0;winner<3;winner++){
40
41
for
(
int
station
=0;
station
<4;
station
++){
42
43
44
int
cham
= Dout[zone][winner].GetMatchOut().PhiMatch()[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
}
81
82
83
85
for
(
int
i
=0;
i
<12;
i
++){
86
87
larger[
i
][
i
] = 1;
//result of comparison with itself
88
int
ranki = Dout[
i
%4][
i
/4].GetWinner().Rank();
//the zone loops faster such that each is given equal priority
89
90
91
for
(
int
j
=0;
j
<12;
j
++){
92
93
int
rankj = Dout[
j
%4][
j
/4].GetWinner().Rank();
94
bool
greater = (ranki > rankj);
95
bool
equal
= (ranki == rankj);
96
97
if
(((
i
<
j
) && (greater ||
equal
)) || ((
i
>
j
) && greater))
98
larger[
i
][
j
] = 1;
99
}
100
101
exists[
i
] = (ranki != 0);
102
}
103
104
105
106
// ghost cancelltion. only in current BX so far(as in firmware as well)
107
for
(
int
k
=0;
k
<12;
k
++){
108
109
for
(
int
l
=0;
l
<12;
l
++){
110
111
int
sh_seg = 0;
112
113
114
for
(
int
s
=0;
s
<4;
s
++){
115
116
//if(id[k%4][k/4][s] && (k != l) && ((phi[k%4][k/4][s] != -999) && (phi[l%4][l/4][s] != -999)) && verbose)
117
// 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";
118
119
if
((
id
[
k
%4][
k
/4][
s
] ==
id
[
l
%4][
l
/4][
s
])
120
&& ((phi[
k
%4][
k
/4][
s
] != -999) || (phi[
l
%4][
l
/4][
s
] != -999))
121
&& (phi[
k
%4][
k
/4][
s
] == phi[
l
%4][
l
/4][
s
])
122
&& (
k
!=
l
)
123
){
124
125
sh_seg++;
126
}
127
128
129
}
130
131
if
(sh_seg){
132
133
//kill candidate that has lower rank
134
//if(verbose) std::cout<<"\nsh_seg != 0\nk = "<<k<<" and l = "<<l<<"\n";
135
if
(larger[
k
][
l
]){kill[
l
] = 1;}
136
else
{kill[
k
] = 1;}
137
}
138
139
}
140
}
141
142
143
//remove ghosts according to kill array
144
for
(
int
q
=0;
q
<12;
q
++){
145
146
if
(kill[
q
]){exists[
q
] = 0;}
147
}
148
149
150
for
(
int
p
=0;
p
<12;
p
++){
151
152
if
(exists[
p
]){
153
154
for
(
int
x
=0;
x
<12;
x
++){
155
156
if
(!exists[
x
]){larger[
p
][
x
] = 1;}
157
}
158
}
159
else
{
160
161
for
(
int
x
=0;
x
<12;
x
++){
162
163
larger[
p
][
x
] = 0;
164
}
165
}
166
167
int
sum = 0;
168
for
(
int
j
=0;
j
<12;
j
++){
169
170
if
(!larger[p][
j
]){sum++;}
171
}
172
173
if
(sum < 3){winner[sum][
p
] = 1;}
174
}
175
176
for
(
int
n
=0;
n
<3;
n
++){
177
178
for
(
int
i
=0;
i
<12;
i
++){
179
180
if
(winner[
n
][
i
]){
181
182
BTrack
bests;
183
184
//if(verbose) std::cout<<"Best Rank "<<n<<" = "<<Dout[i%4][i/4].GetWinner().Rank()<<"\n\n";
185
//if(verbose) std::cout<<"Phi = "<<Dout[i%4][i/4].Phi()<<" and Theta = "<<Dout[i%4][i/4].Theta()<<"\n\n";
186
//if(verbose) std::cout<<"Ph Deltas: "<<Dout[i%4][i/4].Deltas()[0][0]<<" "<<Dout[i%4][i/4].Deltas()[0][1]<<" Th Deltas: "<<Dout[i%4][i/4].Deltas()[1][0]
187
// <<" "<<Dout[i%4][i/4].Deltas()[1][1]<<"\n\n";
188
189
bests.
winner
= Dout[i%4][i/4].GetWinner();
190
bests.
phi
= Dout[i%4][i/4].Phi();
191
bests.
theta
= Dout[i%4][i/4].Theta();
192
bests.
deltas
= Dout[i%4][i/4].Deltas();
193
bests.
clctpattern
= Dout[i%4][i/4].GetMatchOut().PhiMatch()[i%4][i/4][0].Pattern();
194
bests.
AHits
= Dout[i%4][i/4].GetMatchOut().PhiMatch()[i%4][i/4];
195
196
output[
n
] = bests;
197
198
}
199
}
200
}
201
202
203
204
205
206
return
output
;
207
208
209
}
i
int i
Definition:
DBlmapReader.cc:9
lumiQTWidget.t
tuple t
Definition:
lumiQTWidget.py:50
relval_2017.k
list k
Definition:
relval_2017.py:23
lumiQueryAPI.q
tuple q
Definition:
lumiQueryAPI.py:1839
BTrack::winner
Winner winner
Definition:
EmulatorClasses.h:234
cmsLHEtoEOSManager.l
tuple l
Definition:
cmsLHEtoEOSManager.py:192
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:238
ztail.d
tuple d
Definition:
ztail.py:151
BTrack::phi
int phi
Definition:
EmulatorClasses.h:235
x
T x() const
Cartesian x coordinate.
Definition:
Basic3DVectorLD.h:127
relativeConstraints.station
tuple station
Definition:
relativeConstraints.py:66
BTrack::AHits
std::vector< ConvertedHit > AHits
Definition:
EmulatorClasses.h:239
j
int j
Definition:
DBlmapReader.cc:9
EmulatorClasses.h
BTrack
Definition:
EmulatorClasses.h:230
BTrack::theta
int theta
Definition:
EmulatorClasses.h:236
convertSQLitetoXML_cfg.output
tuple output
Definition:
convertSQLitetoXML_cfg.py:32
relativeConstraints.cham
tuple cham
Definition:
relativeConstraints.py:68
alignCSCRings.s
list s
Definition:
alignCSCRings.py:91
gen::n
int n
Definition:
Cascade2Hadronizer.cc:79
phi
Geom::Phi< T > phi() const
Definition:
Basic3DVectorLD.h:163
AlCaHLTBitMon_ParallelJobs.p
tuple p
Definition:
AlCaHLTBitMon_ParallelJobs.py:152
tmp
std::vector< std::vector< double > > tmp
Definition:
MVATrainer.cc:100
BestTracks
std::vector< BTrack > BestTracks(std::vector< std::vector< DeltaOutput >> Dout)
Definition:
BestTracks.h:13
alignCSCRings.r
list r
Definition:
alignCSCRings.py:92
BTrack::clctpattern
int clctpattern
Definition:
EmulatorClasses.h:237
Generated for CMSSW Reference Manual by
1.8.5