Skip to content

Commit

Permalink
Merge pull request #11286 from rappoccio/rappoccio_fastjetshape_75x
Browse files Browse the repository at this point in the history
Adding fastjet shape correction for analysis in 75x (port of #11285)
  • Loading branch information
cmsbuild committed Sep 23, 2015
2 parents 4fd9033 + fa97fcf commit 2d7dad7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
28 changes: 27 additions & 1 deletion RecoJets/JetProducers/plugins/FastjetJetProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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),
Expand All @@ -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") )
Expand Down Expand Up @@ -214,6 +219,13 @@ FastjetJetProducer::FastjetJetProducer(const edm::ParameterSet& iConfig)

}

if ( iConfig.exists("correctShape") ) {
correctShape_ = iConfig.getParameter<bool>("correctShape");
gridMaxRapidity_ = iConfig.getParameter<double>("gridMaxRapidity");
gridSpacing_ = iConfig.getParameter<double>("gridSpacing");
useExplicitGhosts_ = true;
}

input_chrefcand_token_ = consumes<edm::View<reco::RecoChargedRefCandidate> >(src_);

}
Expand Down Expand Up @@ -473,6 +485,16 @@ void FastjetJetProducer::runAlgorithm( edm::Event & iEvent, edm::EventSetup cons
transformers.push_back( transformer_ptr(sd) );
}

unique_ptr<fastjet::Subtractor> subtractor;
unique_ptr<fastjet::GridMedianBackgroundEstimator> bge_rho_grid;
if ( correctShape_ ) {
bge_rho_grid = unique_ptr<fastjet::GridMedianBackgroundEstimator> (new fastjet::GridMedianBackgroundEstimator(gridMaxRapidity_, gridSpacing_) );
bge_rho_grid->set_particles(fjInputs_);
subtractor = unique_ptr<fastjet::Subtractor>( new fastjet::Subtractor( bge_rho_grid.get()) );
subtractor->set_use_rho_m();
//subtractor->use_common_bge_for_rho_and_rhom(true);
}


for ( std::vector<fastjet::PseudoJet>::const_iterator ijet = tempJets.begin(),
ijetEnd = tempJets.end(); ijet != ijetEnd; ++ijet ) {
Expand All @@ -488,6 +510,10 @@ void FastjetJetProducer::runAlgorithm( edm::Event & iEvent, edm::EventSetup cons
}
}

if ( correctShape_ ) {
transformedJet = (*subtractor)(transformedJet);
}

if ( passed ) {
fjJets_.push_back( transformedJet );
}
Expand Down
3 changes: 3 additions & 0 deletions RecoJets/JetProducers/plugins/FastjetJetProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2d7dad7

Please sign in to comment.