11 std::vector<l1t::KMTFTrack> pretracksP2;
12 std::vector<l1t::KMTFTrack> pretracksP3;
13 std::vector<l1t::KMTFTrack> pretracksP4;
14 std::vector<l1t::KMTFTrack> pretracksD2;
15 std::vector<l1t::KMTFTrack> pretracksD3;
16 std::vector<l1t::KMTFTrack> pretracksD4;
27 for (
const auto& stub : stubsAll) {
28 if (stub->bxNum() !=
bx || stub->id() > 3)
30 if (!stub->isBarrel())
33 if (stub->depthRegion() == 4) {
35 stubs4.push_back(stub);
39 if (stub->depthRegion() == 3) {
41 stubs3.push_back(stub);
45 if (stub->depthRegion() == 2) {
47 stubs2.push_back(stub);
51 if (stub->depthRegion() == 1) {
53 stubs1.push_back(stub);
61 if (stubs4.size() > 1) {
64 if (stubs3.size() > 1) {
67 if (stubs2.size() > 1) {
70 if (stubs1.size() > 1) {
74 bool pre_patterns = (
verbose_ > 1) && ((Nstubs4 + Nstubs3 + Nstubs2 + Nstubs1) > 2);
77 for (
unsigned int i = 0;
i < 32; ++
i) {
80 bool patterns = pre_patterns && ((
i < Nstubs4) || (
i < Nstubs3) || (
i << Nstubs2));
85 edm::LogInfo(
"KMTF") << stubs4[0]->coord1() <<
" " << stubs4[0]->coord2() <<
" " << stubs4[0]->quality() <<
" " 86 <<
" 1 " << stubs4[0]->kmtf_address() <<
" 0 " << std::flush;
91 for (
const auto&
s : stubs3) {
92 edm::LogInfo(
"KMTF") <<
"" <<
s->coord1() <<
" " <<
s->coord2() <<
" " <<
s->quality() <<
" 1 " 93 <<
s->kmtf_address() <<
" 0 " << std::flush;
96 for (
unsigned int j = stubs3.size();
j < 32; ++
j) {
100 for (
unsigned int j = stubs3.size();
j < 32; ++
j) {
103 for (
const auto&
s : stubs3) {
104 edm::LogInfo(
"KMTF") <<
"" <<
s->coord1() <<
" " <<
s->coord2() <<
" " <<
s->quality() <<
" 1 " 105 <<
s->kmtf_address() <<
" 0 " << std::flush;
110 for (
const auto&
s : stubs2) {
111 edm::LogInfo(
"KMTF") <<
"" <<
s->coord1() <<
" " <<
s->coord2() <<
" " <<
s->quality() <<
" 1 " 112 <<
s->kmtf_address() <<
" 0 " << std::flush;
115 for (
unsigned int j = stubs2.size();
j < 32; ++
j) {
119 for (
unsigned int j = stubs2.size();
j < 32; ++
j) {
122 for (
const auto&
s : stubs2) {
123 edm::LogInfo(
"KMTF") <<
s->coord1() <<
" " <<
s->coord2() <<
" " <<
s->quality() <<
" 1 " <<
s->kmtf_address()
124 <<
" 0 " << std::flush;
128 for (
const auto&
s : stubs1) {
129 edm::LogInfo(
"KMTF") <<
s->coord1() <<
" " <<
s->coord2() <<
" " <<
s->quality() <<
" 1 " <<
s->kmtf_address()
130 <<
" 0 " << std::flush;
133 for (
unsigned int j = stubs1.size();
j < 32; ++
j) {
137 for (
unsigned int j = stubs1.size();
j < 32; ++
j) {
140 for (
const auto&
s : stubs1) {
141 edm::LogInfo(
"KMTF") <<
s->coord1() <<
" " <<
s->coord2() <<
" " <<
s->quality() <<
" 1 " <<
s->kmtf_address()
142 <<
" 0 " << std::flush;
151 stubs_proc.insert(stubs_proc.end(), stubs3.begin(), stubs3.end());
153 stubs_proc.insert(stubs_proc.end(), stubs2.begin(), stubs2.end());
155 stubs_proc.insert(stubs_proc.end(), stubs1.begin(), stubs1.end());
156 std::pair<l1t::KMTFTrack, l1t::KMTFTrack>
tracks =
trackMaker_->chain(stubs4[0], stubs_proc);
157 if (
tracks.first.id() & 0x1)
158 pretracksP4.push_back(
tracks.first);
159 if (
tracks.second.id() & 0x2)
160 pretracksD4.push_back(
tracks.second);
162 if (
tracks.first.id() & 0x1)
164 <<
tracks.first.ptPrompt() <<
" " <<
tracks.first.phiAtMuon() / (1 << 5) <<
" " 165 <<
tracks.first.coarseEta() <<
" " <<
int(
tracks.first.dxy() * ap_ufixed<8, 1>(1.606))
166 <<
" " <<
tracks.first.rankPrompt() <<
" " << std::flush;
170 if (
tracks.second.id() & 0x2)
171 edm::LogInfo(
"KMTF") <<
"1 " << (
tracks.second.curvatureAtVertex() < 0 ? 1 : 0) <<
" " 172 <<
tracks.second.ptDisplaced() <<
" " <<
tracks.second.phiAtMuon() / (1 << 5) <<
" " 173 <<
tracks.second.coarseEta() <<
" " <<
int(
tracks.second.dxy() * ap_ufixed<8, 1>(1.606))
174 <<
" " <<
tracks.second.rankDisp() <<
" " << std::flush;
179 }
else if (patterns) {
187 stubs_proc.insert(stubs_proc.end(), stubs2.begin(), stubs2.end());
189 stubs_proc.insert(stubs_proc.end(), stubs1.begin(), stubs1.end());
190 std::pair<l1t::KMTFTrack, l1t::KMTFTrack>
tracks =
trackMaker_->chain(stubs3[0], stubs_proc);
191 if (
tracks.first.id() & 0x1)
192 pretracksP3.push_back(
tracks.first);
193 if (
tracks.second.id() & 0x2)
194 pretracksD3.push_back(
tracks.second);
196 if (
tracks.first.id() & 0x1)
198 <<
tracks.first.ptPrompt() <<
" " <<
tracks.first.phiAtMuon() / (1 << 5) <<
" " 199 <<
tracks.first.coarseEta() <<
" " <<
int(
tracks.first.dxy() * ap_ufixed<8, 1>(1.606))
200 <<
" " <<
tracks.first.rankPrompt() <<
" " << std::flush;
204 if (
tracks.second.id() & 0x2)
205 edm::LogInfo(
"KMTF") <<
"1 " << (
tracks.second.curvatureAtVertex() < 0 ? 1 : 0) <<
" " 206 <<
tracks.second.ptDisplaced() <<
" " <<
tracks.second.phiAtMuon() / (1 << 5) <<
" " 207 <<
tracks.second.coarseEta() <<
" " <<
int(
tracks.second.dxy() * ap_ufixed<8, 1>(1.606))
208 <<
" " <<
tracks.second.rankDisp() <<
" " << std::flush;
213 }
else if (patterns) {
220 stubs_proc.insert(stubs_proc.end(), stubs1.begin(), stubs1.end());
221 std::pair<l1t::KMTFTrack, l1t::KMTFTrack>
tracks =
trackMaker_->chain(stubs2[0], stubs_proc);
222 if (
tracks.first.id() & 0x1)
223 pretracksP2.push_back(
tracks.first);
224 if (
tracks.second.id() & 0x2)
225 pretracksD2.push_back(
tracks.second);
227 if (
tracks.first.id() & 0x1)
229 <<
tracks.first.ptPrompt() <<
" " <<
tracks.first.phiAtMuon() / (1 << 5) <<
" " 230 <<
tracks.first.coarseEta() <<
" " <<
int(
tracks.first.dxy() * ap_ufixed<8, 1>(1.606))
231 <<
" " <<
tracks.first.rankPrompt() <<
" " << std::flush;
235 if (
tracks.second.id() & 0x2)
236 edm::LogInfo(
"KMTF") <<
"1 " << (
tracks.second.curvatureAtVertex() < 0 ? 1 : 0) <<
" " 237 <<
tracks.second.ptDisplaced() <<
" " <<
tracks.second.phiAtMuon() / (1 << 5) <<
" " 238 <<
tracks.second.coarseEta() <<
" " <<
int(
tracks.second.dxy() * ap_ufixed<8, 1>(1.606))
239 <<
" " <<
tracks.second.rankDisp();
243 }
else if (patterns) {
248 if (stubs4.size() > 1) {
250 stubs4.erase(stubs4.begin(), stubs4.begin() + 1);
251 stubs4.push_back(
s4);
253 if (stubs3.size() > 1) {
255 stubs3.erase(stubs3.begin(), stubs3.begin() + 1);
256 stubs3.push_back(s3);
258 if (stubs2.size() > 1) {
260 stubs2.erase(stubs2.begin(), stubs2.begin() + 1);
261 stubs2.push_back(s2);
263 if (stubs1.size() > 1) {
265 stubs1.erase(stubs1.begin(), stubs1.begin() + 1);
266 stubs1.push_back(s1);
270 std::vector<l1t::KMTFTrack> cleanedPrompt =
cleanRegion(pretracksP2, pretracksP3, pretracksP4,
true);
271 std::vector<l1t::KMTFTrack> cleanedDisp =
cleanRegion(pretracksD2, pretracksD3, pretracksD4,
false);
273 edm::LogInfo(
"KMTF") <<
"Prompt pretracks 2=" <<
int(pretracksP2.size()) <<
" 3=" <<
int(pretracksP3.size())
274 <<
" 4=" <<
int(pretracksP4.size());
275 edm::LogInfo(
"KMTF") <<
"Cleaned Tracks Prompt=" << (
int)cleanedPrompt.size()
276 <<
" Displaced=" << (
int)cleanedDisp.size();
279 if (
verbose_ && !cleanedPrompt.empty())
280 for (
const auto&
t : cleanedPrompt)
282 edm::LogInfo(
"KMTF") <<
"final cleaned sector track from all chains track pt=" <<
t.ptPrompt()
283 <<
" pattern=" <<
t.hitPattern() <<
" rank=" <<
t.rankPrompt();
285 sort(cleanedPrompt,
true);
286 sort(cleanedDisp,
false);
288 if (
verbose_ && !cleanedPrompt.empty())
289 for (
const auto&
t : cleanedPrompt)
291 edm::LogInfo(
"KMTF") <<
"final sorted sector track from all chains track pt=" <<
t.ptPrompt()
292 <<
" pattern=" <<
t.hitPattern() <<
" rank=" <<
t.rankPrompt();
294 return std::make_pair(cleanedPrompt, cleanedDisp);
void sort(std::vector< l1t::KMTFTrack > &in, bool vertex)
std::unique_ptr< KMTFCore > trackMaker_
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
Log< level::Info, false > LogInfo
std::vector< l1t::KMTFTrack > cleanRegion(const std::vector< l1t::KMTFTrack > &tracks2, const std::vector< l1t::KMTFTrack > &tracks3, const std::vector< l1t::KMTFTrack > &tracks4, bool vertex)