Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix of dRNNC2d #166

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 );
}

}