From 75bf485359da904c9f404ed0d40c26c0af562e00 Mon Sep 17 00:00:00 2001 From: Salvatore Rappoccio Date: Wed, 16 Sep 2015 10:25:12 -0500 Subject: [PATCH 1/3] Adding capability for on-the-fly fastjet area corrections --- .../plugins/FastjetJetProducer.cc | 27 ++++++++++++++++++- .../JetProducers/plugins/FastjetJetProducer.h | 3 +++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc index 84d5cdd46384b..9a90b42c89b08 100644 --- a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc +++ b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc @@ -35,6 +35,8 @@ #include "fastjet/tools/MassDropTagger.hh" #include "fastjet/contrib/SoftDrop.hh" #include "fastjet/tools/JetMedianBackgroundEstimator.hh" +#include "fastjet/tools/GridMedianBackgroundEstimator.hh" +#include "fastjet/tools/Subtractor.hh" #include "fastjet/contrib/ConstituentSubtractor.hh" #include "RecoJets/JetAlgorithms/interface/CMSBoostedTauSeedingAlgorithm.h" @@ -65,6 +67,7 @@ FastjetJetProducer::FastjetJetProducer(const edm::ParameterSet& iConfig) useKtPruning_(false), useConstituentSubtraction_(false), useSoftDrop_(false), + correctShape_(false), muCut_(-1.0), yCut_(-1.0), rFilt_(-1.0), @@ -76,7 +79,9 @@ FastjetJetProducer::FastjetJetProducer(const edm::ParameterSet& iConfig) csRho_EtaMax_(-1.0), csRParam_(-1.0), beta_(-1.0), - R0_(-1.0) + R0_(-1.0), + gridMaxRapidity_(-1.0), // For fixed-grid rho + gridSpacing_(-1.0) // For fixed-grid rho { if ( iConfig.exists("UseOnlyVertexTracks") ) @@ -214,6 +219,13 @@ FastjetJetProducer::FastjetJetProducer(const edm::ParameterSet& iConfig) } + if ( iConfig.exists("correctShape") ) { + correctShape_ = iConfig.getParameter("correctShape"); + gridMaxRapidity_ = iConfig.getParameter("gridMaxRapidity"); + gridSpacing_ = iConfig.getParameter("gridSpacing"); + useExplicitGhosts_ = true; + } + input_chrefcand_token_ = consumes >(src_); } @@ -473,6 +485,15 @@ void FastjetJetProducer::runAlgorithm( edm::Event & iEvent, edm::EventSetup cons transformers.push_back( transformer_ptr(sd) ); } + unique_ptr subtractor; + unique_ptr bge_rho_grid; + if ( correctShape_ ) { + bge_rho_grid = unique_ptr (new fastjet::GridMedianBackgroundEstimator(gridMaxRapidity_, gridSpacing_) ); + bge_rho_grid->set_particles(fjInputs_); + subtractor = unique_ptr( new fastjet::Subtractor( bge_rho_grid.get()) ); + subtractor->set_use_rho_m(); + } + for ( std::vector::const_iterator ijet = tempJets.begin(), ijetEnd = tempJets.end(); ijet != ijetEnd; ++ijet ) { @@ -488,6 +509,10 @@ void FastjetJetProducer::runAlgorithm( edm::Event & iEvent, edm::EventSetup cons } } + if ( correctShape_ ) { + transformedJet = (*subtractor)(transformedJet); + } + if ( passed ) { fjJets_.push_back( transformedJet ); } diff --git a/RecoJets/JetProducers/plugins/FastjetJetProducer.h b/RecoJets/JetProducers/plugins/FastjetJetProducer.h index 964dcf12dfe52..52e39a95293b5 100644 --- a/RecoJets/JetProducers/plugins/FastjetJetProducer.h +++ b/RecoJets/JetProducers/plugins/FastjetJetProducer.h @@ -84,6 +84,7 @@ class FastjetJetProducer : public VirtualJetProducer bool useKtPruning_; /// Use Kt clustering algorithm for pruning (default is Cambridge/Aachen) bool useConstituentSubtraction_; /// constituent subtraction technique bool useSoftDrop_; /// Soft drop + bool correctShape_; /// Correct the shape of the jets double muCut_; /// for mass-drop tagging, m0/mjet (m0 = mass of highest mass subjet) double yCut_; /// for mass-drop tagging, symmetry cut: min(pt1^2,pt2^2) * dR(1,2) / mjet > ycut double rFilt_; /// for filtering, trimming: dR scale of sub-clustering @@ -97,6 +98,8 @@ class FastjetJetProducer : public VirtualJetProducer double csRParam_; /// for constituent subtraction : R parameter for KT alg in jet median background estimator double beta_; /// for soft drop : beta (angular exponent) double R0_; /// for soft drop : R0 (angular distance normalization - should be set to jet radius in most cases) + double gridMaxRapidity_; /// for shape subtraction, get the fixed-grid rho + double gridSpacing_; /// for shape subtraction, get the grid spacing double subjetPtMin_; /// for CMSBoostedTauSeedingAlgorithm : subjet pt min From e28c0a4dd5bb24f0359a8260814d2d52d7f0c9cb Mon Sep 17 00:00:00 2001 From: Salvatore Rappoccio Date: Wed, 16 Sep 2015 10:28:33 -0500 Subject: [PATCH 2/3] Adding correct statement for common background estimate for rho and rhom from fastjet authors --- RecoJets/JetProducers/plugins/FastjetJetProducer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc index 9a90b42c89b08..b4f12c67bb97e 100644 --- a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc +++ b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc @@ -492,6 +492,7 @@ void FastjetJetProducer::runAlgorithm( edm::Event & iEvent, edm::EventSetup cons bge_rho_grid->set_particles(fjInputs_); subtractor = unique_ptr( new fastjet::Subtractor( bge_rho_grid.get()) ); subtractor->set_use_rho_m(); + subtractor->use_common_bge_for_rho_and_rhom(true); } From fa97fcfd2b0582eff8b12f92af6854fff2eba813 Mon Sep 17 00:00:00 2001 From: Salvatore Rappoccio Date: Wed, 16 Sep 2015 11:44:52 -0500 Subject: [PATCH 3/3] commenting out future features of fastjet --- RecoJets/JetProducers/plugins/FastjetJetProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc index b4f12c67bb97e..ce5be7846e4cb 100644 --- a/RecoJets/JetProducers/plugins/FastjetJetProducer.cc +++ b/RecoJets/JetProducers/plugins/FastjetJetProducer.cc @@ -492,7 +492,7 @@ void FastjetJetProducer::runAlgorithm( edm::Event & iEvent, edm::EventSetup cons bge_rho_grid->set_particles(fjInputs_); subtractor = unique_ptr( new fastjet::Subtractor( bge_rho_grid.get()) ); subtractor->set_use_rho_m(); - subtractor->use_common_bge_for_rho_and_rhom(true); + //subtractor->use_common_bge_for_rho_and_rhom(true); }