From e924784c8927c4a1b5aec3f01c1baa472c91bf39 Mon Sep 17 00:00:00 2001 From: Thomas Strebler Date: Wed, 1 Aug 2018 17:25:33 +0200 Subject: [PATCH 1/7] Fix of L1 HGC clustering --- L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc | 2 +- .../L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc index ff72705402f8c..574a0a7748558 100644 --- a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc +++ b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc @@ -87,7 +87,7 @@ void HGCalClusteringImpl::clusterizeDR( const std::vectorcentreProj() ).mag() ; From d515558a76ae21583164ab78a9b0ed737ab2a94b Mon Sep 17 00:00:00 2001 From: Thomas Strebler Date: Thu, 2 Aug 2018 18:11:43 +0200 Subject: [PATCH 2/7] Reoptimized to avoid 2nd loop over pertinent clusters --- .../src/be_algorithms/HGCalClusteringImpl.cc | 45 ++++++++---------- .../be_algorithms/HGCalMulticlusteringImpl.cc | 46 +++++++++---------- 2 files changed, 41 insertions(+), 50 deletions(-) diff --git a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc index 574a0a7748558..0e0cba35746d3 100644 --- a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc +++ b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc @@ -74,33 +74,28 @@ void HGCalClusteringImpl::clusterizeDR( const std::vector tcPertinentClusters; - for( const auto& clu : clustersTmp){ - if( this->isPertinent(**tc, clu, dr_) ){ - tcPertinentClusters.push_back(iclu); - } - ++iclu; - } - if( tcPertinentClusters.empty() && isSeed[itc] ){ - clustersTmp.emplace_back( *tc ); - } - else if ( !tcPertinentClusters.empty() ){ - - double minDist(300); - unsigned targetClu(0); - - for( int iclu : tcPertinentClusters){ - double d = clustersTmp.at(iclu).distance(**tc); - if( d < minDist ){ - minDist = d; - targetClu = iclu; - } - } - clustersTmp.at(targetClu).addConstituent( *tc ); + HGCalDetId tcDetId( (**tc).detId() ); + int z_side = tcDetId.zside(); + + double minDist = dr_; + int targetClu = -1; + + for(unsigned iclu=0; iclu=0) clustersTmp.at( targetClu ).addConstituent( *tc ); - } } /* store clusters in the persistent collection */ diff --git a/L1Trigger/L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc b/L1Trigger/L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc index 90ad06a7150f0..0fee22759f070 100644 --- a/L1Trigger/L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc +++ b/L1Trigger/L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc @@ -81,32 +81,28 @@ void HGCalMulticlusteringImpl::clusterizeDR( const std::vector>::const_iterator clu = clustersPtrs.begin(); clu != clustersPtrs.end(); ++clu, ++iclu){ - - int imclu=0; - vector tcPertinentMulticlusters; - for( const auto& mclu : multiclustersTmp ){ - if( this->isPertinent(**clu, mclu, dr_) ){ - tcPertinentMulticlusters.push_back(imclu); - } - ++imclu; - } - if( tcPertinentMulticlusters.empty() ){ - multiclustersTmp.emplace_back( *clu ); - } - else{ - double minDist = 1; - unsigned targetMulticlu = 0; - for( int imclu : tcPertinentMulticlusters ){ - double d = ( multiclustersTmp.at(imclu).centreProj() - (*clu)->centreProj() ).mag() ; - if( d < minDist ){ - minDist = d; - targetMulticlu = imclu; - } - } - multiclustersTmp.at( targetMulticlu ).addConstituent( *clu ); - - } + HGCalDetId cluDetId( (**clu).detId() ); + int z_side = cluDetId.zside(); + + double minDist = dr_; + int targetMulticlu = -1; + + for(unsigned imclu=0; imclucentreProj() ).mag() ; + if(d Date: Thu, 26 Jul 2018 11:59:44 +0200 Subject: [PATCH 3/7] fix eta assignment of Trigger Towers --- L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc b/L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc index cab1c73626735..a5fead2dac7a9 100644 --- a/L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc +++ b/L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc @@ -50,7 +50,7 @@ HGCalTriggerTowerGeometryHelper::HGCalTriggerTowerGeometryHelper(const edm::Para for(unsigned int bin2 = 0; bin2 != nBinsPhi_; bin2++) { l1t::HGCalTowerID towerId(zside, bin1, bin2); tower_coords_.emplace_back(towerId.rawId(), - (binsEta_[bin1+1] + binsEta_[bin1])/2, + zside*((binsEta_[bin1+1] + binsEta_[bin1])/2), (binsPhi_[bin2+1] + binsPhi_[bin2])/2); } } From 0efb181c958a74d3eada89c783e48b0857f678ca Mon Sep 17 00:00:00 2001 From: Gianluca Date: Fri, 3 Aug 2018 11:00:28 +0200 Subject: [PATCH 4/7] fix TC to trigger tower assignment --- L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc b/L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc index a5fead2dac7a9..7cbb9fd3d7dac 100644 --- a/L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc +++ b/L1Trigger/L1THGCal/src/HGCalTriggerTowerGeometryHelper.cc @@ -45,6 +45,7 @@ HGCalTriggerTowerGeometryHelper::HGCalTriggerTowerGeometryHelper(const edm::Para } } + for(int zside = -1; zside <= 1; zside+=2) { for(unsigned int bin1 = 0; bin1 != nBinsEta_; bin1++) { for(unsigned int bin2 = 0; bin2 != nBinsPhi_; bin2++) { @@ -109,7 +110,7 @@ unsigned short HGCalTriggerTowerGeometryHelper::getTriggerTowerFromTriggerCell(c edm::LogError("HGCalTriggerTowerGeometryHelper") << " did not manage to map TC " << trigger_cell_id << " (eta: " << eta << ") to any Trigger Tower\n"; } } else { - bin_eta = bin_eta_l - binsEta_.begin(); + bin_eta = bin_eta_l - binsEta_.begin() - 1; } @@ -124,7 +125,7 @@ unsigned short HGCalTriggerTowerGeometryHelper::getTriggerTowerFromTriggerCell(c edm::LogError("HGCalTriggerTowerGeometryHelper") << " did not manage to map TC " << trigger_cell_id << " (phi: " << phi << ") to any Trigger Tower\n"; } } else { - bin_phi = bin_phi_l - binsPhi_.begin(); + bin_phi = bin_phi_l - binsPhi_.begin() - 1; } int zside = eta < 0 ? -1 : 1; return l1t::HGCalTowerID(zside, bin_eta, bin_phi).rawId(); From 4a3a5c10957a262d3c40d5853db3b0d093477293 Mon Sep 17 00:00:00 2001 From: Thomas Strebler Date: Fri, 3 Aug 2018 11:42:48 +0200 Subject: [PATCH 5/7] Fix indentation --- .../src/be_algorithms/HGCalClusteringImpl.cc | 30 +++++++++---------- .../be_algorithms/HGCalMulticlusteringImpl.cc | 30 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc index 0e0cba35746d3..f81e8a6c3aa97 100644 --- a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc +++ b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc @@ -75,26 +75,26 @@ void HGCalClusteringImpl::clusterizeDR( const std::vector=0) clustersTmp.at( targetClu ).addConstituent( *tc ); + if(targetClu<0 && isSeed[itc]) clustersTmp.emplace_back( *tc ); + else if(targetClu>=0) clustersTmp.at( targetClu ).addConstituent( *tc ); } diff --git a/L1Trigger/L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc b/L1Trigger/L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc index 0fee22759f070..f9a549ebbde51 100644 --- a/L1Trigger/L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc +++ b/L1Trigger/L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc @@ -82,26 +82,26 @@ void HGCalMulticlusteringImpl::clusterizeDR( const std::vector>::const_iterator clu = clustersPtrs.begin(); clu != clustersPtrs.end(); ++clu, ++iclu){ - HGCalDetId cluDetId( (**clu).detId() ); - int z_side = cluDetId.zside(); + HGCalDetId cluDetId( (**clu).detId() ); + int z_side = cluDetId.zside(); - double minDist = dr_; - int targetMulticlu = -1; + double minDist = dr_; + int targetMulticlu = -1; - for(unsigned imclu=0; imclucentreProj() ).mag() ; - if(dcentreProj() ).mag() ; + if(d Date: Fri, 3 Aug 2018 11:49:19 +0200 Subject: [PATCH 6/7] Used isPertinent() check --- L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc | 6 +----- .../L1THGCal/src/be_algorithms/HGCalMulticlusteringImpl.cc | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc index f81e8a6c3aa97..a81d2fbba888e 100644 --- a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc +++ b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc @@ -75,16 +75,12 @@ void HGCalClusteringImpl::clusterizeDR( const std::vectorisPertinent(**tc, clustersTmp.at(iclu), dr_)) continue; double d = clustersTmp.at(iclu).distance(**tc); if(d>::const_iterator clu = clustersPtrs.begin(); clu != clustersPtrs.end(); ++clu, ++iclu){ - HGCalDetId cluDetId( (**clu).detId() ); - int z_side = cluDetId.zside(); - double minDist = dr_; int targetMulticlu = -1; for(unsigned imclu=0; imcluisPertinent(**clu, multiclustersTmp.at(imclu), dr_)) continue; double d = ( multiclustersTmp.at(imclu).centreProj() - (*clu)->centreProj() ).mag() ; if(d Date: Fri, 3 Aug 2018 12:10:27 +0200 Subject: [PATCH 7/7] Fix indentation --- .../src/be_algorithms/HGCalClusteringImpl.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc index a81d2fbba888e..5d5e52cc8ae6d 100644 --- a/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc +++ b/L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc @@ -80,13 +80,13 @@ void HGCalClusteringImpl::clusterizeDR( const std::vectorisPertinent(**tc, clustersTmp.at(iclu), dr_)) continue; + if(!this->isPertinent(**tc, clustersTmp.at(iclu), dr_)) continue; - double d = clustersTmp.at(iclu).distance(**tc); - if(d