Skip to content

Commit

Permalink
Merge pull request cms-sw#166 from tstreble/dRNNC2d_update
Browse files Browse the repository at this point in the history
Fix of dRNNC2d
  • Loading branch information
jbsauvan authored Jan 15, 2018
2 parents d4d3974 + df242f2 commit 8edfa4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"


bool distanceSorter (pair<int,float> i,pair<int,float> j) { return (i.second<j.second); }
bool distanceSorter (pair<edm::Ptr<l1t::HGCalTriggerCell>,float> i,pair<edm::Ptr<l1t::HGCalTriggerCell>,float> j) { return (i.second<j.second); }


class HGCalClusteringImpl{
Expand Down
15 changes: 8 additions & 7 deletions L1Trigger/L1THGCal/src/be_algorithms/HGCalClusteringImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ void HGCalClusteringImpl::clusterizeDRNN( const std::vector<edm::Ptr<l1t::HGCalT

/* continue if not passing the threshold */
if( (*tc)->mipPt() < threshold ) continue;
if( isSeed[itc] ) continue; //No sharing of seeds between clusters (TBC)

/* searching for TC near the centre of the cluster */
std::vector<unsigned> tcPertinentClusters;
Expand Down Expand Up @@ -393,12 +394,12 @@ void HGCalClusteringImpl::removeUnconnectedTCinCluster( l1t::HGCalCluster & clus
Basic3DVector<float> seedCentre( constituents[0]->position() );

/* distances from the seed */
vector<pair<unsigned,float>> distances;
for( unsigned itc=1; itc<constituents.size(); itc++ )
vector<pair<edm::Ptr<l1t::HGCalTriggerCell>,float>> distances;
for( const auto & tc : constituents )
{
Basic3DVector<float> tcCentre( constituents[itc]->position() );
Basic3DVector<float> tcCentre( tc->position() );
float distance = ( seedCentre - tcCentre ).mag();
distances.push_back( pair<unsigned,float>( itc-1, distance ) );
distances.push_back( pair<edm::Ptr<l1t::HGCalTriggerCell>,float>( tc, distance ) );
}

/* sorting (needed in order to be sure that we are skipping any tc) */
Expand All @@ -413,12 +414,12 @@ void HGCalClusteringImpl::removeUnconnectedTCinCluster( l1t::HGCalCluster & clus

/* get the tc under study */
toRemove[itc] = true;
const edm::Ptr<l1t::HGCalTriggerCell>& tcToStudy = constituents[itc];
const edm::Ptr<l1t::HGCalTriggerCell>& tcToStudy = distances[itc].first;

/* compare with the tc in the cluster */
for( unsigned itc_ref=1; itc_ref<itc; itc_ref++ ){
if( !toRemove[itc_ref] ) {
if( areTCneighbour( tcToStudy->detId(), constituents[distances.at( itc_ref ).first]->detId(), triggerGeometry ) ) {
if( areTCneighbour( tcToStudy->detId(), distances.at( itc_ref ).first->detId(), triggerGeometry ) ) {
toRemove[itc] = false;
break;
}
Expand All @@ -430,7 +431,7 @@ void HGCalClusteringImpl::removeUnconnectedTCinCluster( l1t::HGCalCluster & clus

/* remove the unconnected TCs */
for( unsigned i=0; i<distances.size(); i++){
if( toRemove[i] ) cluster.removeConstituent( constituents[distances.at( i ).first] );
if( toRemove[i] ) cluster.removeConstituent( distances.at( i ).first );
}

}

0 comments on commit 8edfa4e

Please sign in to comment.