Skip to content

Commit

Permalink
Move to simple adjacency criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
Salvatore Rappoccio committed Nov 11, 2009
1 parent 655c768 commit 87ef88f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
8 changes: 4 additions & 4 deletions RecoJets/JetAlgorithms/interface/CATopJetAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CATopJetAlgorithm{
const std::vector<double> & ptBins,
const std::vector<double> & rBins,
const std::vector<double> & ptFracBins,
const std::vector<int> & nCellBins) :
const std::vector<double> & nCellBins) :
mSrc_ (mSrc ),
algorithm_ (algorithm ),
seedThreshold_ (seedThreshold ),
Expand Down Expand Up @@ -94,7 +94,7 @@ class CATopJetAlgorithm{
std::vector<double> ptBins_; //<! pt bins over which cuts vary
std::vector<double> rBins_; //<! cone size bins
std::vector<double> ptFracBins_; //<! fraction of full jet pt for a subjet to be consider "hard"
std::vector<int> nCellBins_; //<! number of cells apart for two subjets to be considered "independent"
std::vector<double> nCellBins_; //<! number of cells apart for two subjets to be considered "independent"
std::string jetType_; //<! CaloJets or GenJets

// Decide if the two jets are in adjacent cells
Expand All @@ -103,7 +103,7 @@ class CATopJetAlgorithm{
const std::vector<fastjet::PseudoJet> & cell_particles,
const CaloSubdetectorGeometry * fTowerGeometry,
const fastjet::ClusterSequence & theClusterSequence,
int nCellMin ) const;
double nCellMin ) const;


// Get maximum pt tower
Expand All @@ -130,7 +130,7 @@ class CATopJetAlgorithm{
const fastjet::ClusterSequence & theClusterSequence,
const std::vector<fastjet::PseudoJet> & cell_particles,
const CaloSubdetectorGeometry * fTowerGeometry,
double ptHard, int nCellMin,
double ptHard, double nCellMin,
fastjet::PseudoJet & ja, fastjet::PseudoJet & jb,
std::vector<fastjet::PseudoJet> & leftovers) const;

Expand Down
40 changes: 25 additions & 15 deletions RecoJets/JetAlgorithms/src/CATopJetAlgorithm.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Original author: Brock Tweedie (JHU)
// Ported to CMSSW by: Sal Rappoccio (JHU)
// $Id: CATopJetAlgorithm.cc,v 1.3 2009/02/23 21:45:50 srappocc Exp $
// $Id: CATopJetAlgorithm.cc,v 1.4 2009/08/27 20:26:29 srappocc Exp $

#include "RecoJets/JetAlgorithms/interface/CATopJetAlgorithm.h"
#include "FWCore/Framework/interface/ESHandle.h"
Expand Down Expand Up @@ -65,7 +65,7 @@ void CATopJetAlgorithm::run( const vector<fastjet::PseudoJet> & cell_particles,
const fastjet::PseudoJet blankJet = blankJetA;


int nCellMin = nCellBins_[iPt];
double nCellMin = nCellBins_[iPt];

if ( verbose ) cout << "Using nCellMin = " << nCellMin << endl;

Expand Down Expand Up @@ -228,18 +228,29 @@ bool CATopJetAlgorithm::adjacentCells(const fastjet::PseudoJet & jet1, const fas
const vector<fastjet::PseudoJet> & cell_particles,
const CaloSubdetectorGeometry * fTowerGeometry,
const fastjet::ClusterSequence & theClusterSequence,
int nCellMin ) const {
double nCellMin ) const {

// Get each tower (depending on user input, can be either max pt tower, or centroid).
CaloTowerDetId tower1 = getCaloTower( jet1, cell_particles, fTowerGeometry, theClusterSequence );
CaloTowerDetId tower2 = getCaloTower( jet2, cell_particles, fTowerGeometry, theClusterSequence );

// Get the number of calo towers away that the two towers are.
// Can be non-integral fraction if "centroid" case is chosen.
int distance = getDistance( tower1, tower2, fTowerGeometry );
double eta1 = jet1.rapidity();
double phi1 = jet1.phi();
double eta2 = jet2.rapidity();
double phi2 = jet2.phi();

if ( distance <= nCellMin ) return true;
else return false;
double deta = abs(eta2 - eta1) / 0.087;
double dphi = fabs( reco::deltaPhi(phi2,phi1) ) / 0.087;

return ( ( deta + dphi ) <= nCellMin );

// // Get each tower (depending on user input, can be either max pt tower, or centroid).
// CaloTowerDetId tower1 = getCaloTower( jet1, cell_particles, fTowerGeometry, theClusterSequence );
// CaloTowerDetId tower2 = getCaloTower( jet2, cell_particles, fTowerGeometry, theClusterSequence );

// // Get the number of calo towers away that the two towers are.
// // Can be non-integral fraction if "centroid" case is chosen.
// double distance = getDistance( tower1, tower2, fTowerGeometry );

// if ( distance <= nCellMin ) return true;
// else return false;
}

//-------------------------------------------------------------------------
Expand Down Expand Up @@ -307,18 +318,17 @@ CaloTowerDetId CATopJetAlgorithm::getCaloTower( const fastjet::PseudoJet & jet,
int CATopJetAlgorithm::getDistance ( CaloTowerDetId const & t1, CaloTowerDetId const & t2,
const CaloSubdetectorGeometry * fTowerGeometry ) const
{

int ieta1 = t1.ieta();
int iphi1 = t1.iphi();
int ieta2 = t2.ieta();
int iphi2 = t2.iphi();

int deta = abs(ieta2 - ieta1);
int dphi = abs(iphi2 - iphi1);

while ( dphi >= CaloTowerDetId::kMaxIEta ) dphi -= CaloTowerDetId::kMaxIEta;
while ( dphi <= 0 ) dphi += CaloTowerDetId::kMaxIEta;

return deta + dphi;
}

Expand All @@ -329,7 +339,7 @@ bool CATopJetAlgorithm::decomposeJet(const fastjet::PseudoJet & theJet,
const fastjet::ClusterSequence & theClusterSequence,
const vector<fastjet::PseudoJet> & cell_particles,
const CaloSubdetectorGeometry * fTowerGeometry,
double ptHard, int nCellMin,
double ptHard, double nCellMin,
fastjet::PseudoJet & ja, fastjet::PseudoJet & jb,
vector<fastjet::PseudoJet> & leftovers) const {

Expand Down
2 changes: 1 addition & 1 deletion RecoJets/JetProducers/plugins/CATopJetProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CATopJetProducer::CATopJetProducer(edm::ParameterSet const& conf):
conf.getParameter<std::vector<double> > ("ptBins"), // pt bins over which cuts may vary
conf.getParameter<std::vector<double> >("rBins"), // cone size bins,
conf.getParameter<std::vector<double> >("ptFracBins"), // fraction of hard jet that subjet must have
conf.getParameter<std::vector<int> >("nCellBins") // number of cells to consider two subjets adjacent
conf.getParameter<std::vector<double> >("nCellBins") // number of cells to consider two subjets adjacent
)
{}

Expand Down
2 changes: 1 addition & 1 deletion RecoJets/JetProducers/python/CATopJetParameters_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ptBins = cms.vdouble(0, 10e9), # pt bins over which cuts vary
rBins = cms.vdouble(0.8,0.8), # cone size bins
ptFracBins = cms.vdouble(0.05,0.05), # minimum fraction of central jet pt for subjets
nCellBins = cms.vint32(1,1) , # number of cells apart for two subjets to be considered "adjacent"
nCellBins = cms.vdouble(1.9,1.9) , # number of cells apart for two subjets to be considered "adjacent"
debugLevel = cms.untracked.int32(0) # debug level
)

0 comments on commit 87ef88f

Please sign in to comment.