248 for (
int phibin = 0; phibin < phiBins_; ++phibin) {
249 if (L1clusters[phibin].
empty())
253 sort(L1clusters[phibin].
begin(), L1clusters[phibin].
end(), [](
T &
a,
T &
b) {
return a.pTtot >
b.pTtot; });
255 for (
unsigned int imax = 0; imax < L1clusters[phibin].size(); ++imax) {
256 if (L1clusters[phibin][imax].used)
258 Pt pt_current = L1clusters[phibin][imax].pTtot;
265 std::vector<unsigned int> trkidx1;
266 std::vector<unsigned int> trkidx2;
267 clusters.push_back(L1clusters[phibin][imax]);
269 L1clusters[phibin][imax].used =
true;
272 if (phibin == phiBins_ - 1)
275 std::vector<unsigned int> used_already;
276 for (
unsigned int icluster = 0; icluster < L1clusters[phibin + 1].size(); ++icluster) {
277 if (L1clusters[phibin + 1][icluster].used)
280 if (((L1clusters[phibin + 1][icluster].
eta - L1clusters[phibin][imax].
eta) > (3 * etaStep_) / 2) ||
281 ((L1clusters[phibin + 1][icluster].eta - L1clusters[phibin][imax].eta) < -(3 * etaStep_) / 2))
284 pt_next += L1clusters[phibin + 1][icluster].pTtot;
285 trk1 += L1clusters[phibin + 1][icluster].ntracks;
286 tdtrk1 += L1clusters[phibin + 1][icluster].nxtracks;
288 for (
unsigned int itrk = 0; itrk < L1clusters[phibin + 1][icluster].trackidx.size(); itrk++)
289 trkidx1.push_back(L1clusters[phibin + 1][icluster].trackidx[itrk]);
290 used_already.push_back(icluster);
293 if (pt_next < pt_current) {
294 Fill_L2Cluster<T, Pt>(
clusters[
clusters.size() - 1], pt_next, trk1, tdtrk1, trkidx1);
295 for (
unsigned int iused : used_already)
296 L1clusters[phibin + 1][iused].used =
true;
300 if (phibin == phiBins_ - 2) {
301 Fill_L2Cluster<T, Pt>(
clusters[
clusters.size() - 1], pt_next, trk1, tdtrk1, trkidx1);
302 clusters[
clusters.size() - 1].phi = L1clusters[phibin + 1][used_already[0]].phi;
303 for (
unsigned int iused : used_already)
304 L1clusters[phibin + 1][iused].used =
true;
307 std::vector<int> used_already2;
308 for (
unsigned int icluster = 0; icluster < L1clusters[phibin + 2].size(); ++icluster) {
309 if (L1clusters[phibin + 2][icluster].used)
311 if (((L1clusters[phibin + 2][icluster].
eta - L1clusters[phibin][imax].
eta) > (3 * etaStep_) / 2) ||
312 ((L1clusters[phibin + 2][icluster].eta - L1clusters[phibin][imax].eta) < -(3 * etaStep_) / 2))
314 pt_next2 += L1clusters[phibin + 2][icluster].pTtot;
315 trk2 += L1clusters[phibin + 2][icluster].ntracks;
316 tdtrk2 += L1clusters[phibin + 2][icluster].nxtracks;
318 for (
unsigned int itrk = 0; itrk < L1clusters[phibin + 2][icluster].trackidx.size(); itrk++)
319 trkidx2.push_back(L1clusters[phibin + 2][icluster].trackidx[itrk]);
320 used_already2.push_back(icluster);
322 if (pt_next2 < pt_next) {
323 std::vector<unsigned int> trkidx_both;
324 trkidx_both.reserve(trkidx1.size() + trkidx2.size());
325 trkidx_both.insert(trkidx_both.end(), trkidx1.begin(), trkidx1.end());
326 trkidx_both.insert(trkidx_both.end(), trkidx2.begin(), trkidx2.end());
327 Fill_L2Cluster<T, Pt>(
328 clusters[
clusters.size() - 1], pt_next + pt_next2, trk1 + trk2, tdtrk1 + tdtrk2, trkidx_both);
329 clusters[
clusters.size() - 1].phi = L1clusters[phibin + 1][used_already[0]].phi;
330 for (
unsigned int iused : used_already)
331 L1clusters[phibin + 1][iused].used =
true;
332 for (
unsigned int iused : used_already2)
333 L1clusters[phibin + 2][iused].used =
true;
353 for (
unsigned int itrk = 0; itrk <
clusters[
n].trackidx.size(); itrk++)
float DPhi(float phi1, float phi2)