CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
cms::CATopJetProducer Class Reference

#include <CATopJetProducer.h>

Inheritance diagram for cms::CATopJetProducer:
FastjetJetProducer VirtualJetProducer edm::stream::EDProducer<>

Public Member Functions

 CATopJetProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void runAlgorithm (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~CATopJetProducer () override
 
- Public Member Functions inherited from FastjetJetProducer
 FastjetJetProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~FastjetJetProducer () override
 
- Public Member Functions inherited from VirtualJetProducer
std::string jetType () const
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 VirtualJetProducer (const edm::ParameterSet &iConfig)
 
 ~VirtualJetProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from FastjetJetProducer
static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillDescriptionsFromFastJetProducer (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from VirtualJetProducer
static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillDescriptionsFromVirtualJetProducer (edm::ParameterSetDescription &desc)
 

Private Types

enum  tagalgos { CA_TOPTAGGER, FJ_CMS_TOPTAG, FJ_JHU_TOPTAG, FJ_NSUB_TAG }
 

Private Attributes

double centralEtaCut_
 
std::unique_ptr< fastjet::CMSTopTagger > fjCMSTopTagger_
 The algorithm to do the work. More...
 
std::unique_ptr< fastjet::JHTopTagger > fjJHUTopTagger_
 
std::unique_ptr< fastjet::RestFrameNSubjettinessTagger > fjNSUBTagger_
 
std::unique_ptr< CATopJetAlgorithmlegacyCMSTopTagger_
 
double ptMin_
 
int tagAlgo_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from FastjetJetProducer
typedef std::shared_ptr< DynamicRfiltDynamicRfiltPtr
 
typedef fastjet::Transformer transformer
 
typedef std::vector< transformer_ptrtransformer_coll
 
typedef std::unique_ptr< transformertransformer_ptr
 
- Public Types inherited from VirtualJetProducer
typedef std::shared_ptr< fastjet::GhostedAreaSpec > ActiveAreaSpecPtr
 
typedef std::shared_ptr< fastjet::AreaDefinition > AreaDefinitionPtr
 
typedef std::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
 
typedef std::shared_ptr< fastjet::JetDefinition > JetDefPtr
 
typedef std::shared_ptr< fastjet::JetDefinition::Plugin > PluginPtr
 
typedef std::shared_ptr< fastjet::Selector > SelectorPtr
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Member Functions inherited from FastjetJetProducer
virtual void produceTrackJets (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void runAlgorithm (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
- Protected Member Functions inherited from VirtualJetProducer
virtual void addHTTTopJetTagInfoCollection (edm::Event &iEvent, const edm::EventSetup &iSetup, edm::OrphanHandle< reco::BasicJetCollection > &oh)
 
virtual void copyConstituents (const std::vector< fastjet::PseudoJet > &fjConstituents, reco::Jet *jet)
 
virtual std::vector< reco::CandidatePtrgetConstituents (const std::vector< fastjet::PseudoJet > &fjConstituents)
 
CaloGeometry const & getGeometry (edm::EventSetup const &) const
 
HcalTopology const & getTopology (edm::EventSetup const &) const
 
virtual void inputTowers ()
 
virtual bool isAnomalousTower (reco::CandidatePtr input)
 
bool makeBasicJet (const JetType::Type &fTag)
 
bool makeCaloJet (const JetType::Type &fTag)
 
bool makeGenJet (const JetType::Type &fTag)
 
bool makePFClusterJet (const JetType::Type &fTag)
 
bool makePFJet (const JetType::Type &fTag)
 
virtual void makeProduces (std::string s, std::string tag="")
 
bool makeTrackJet (const JetType::Type &fTag)
 
void offsetCorrectJets (std::vector< fastjet::PseudoJet > &orphanInput)
 
virtual void output (edm::Event &iEvent, edm::EventSetup const &iSetup)
 
template<typename T >
void writeCompoundJets (edm::Event &iEvent, edm::EventSetup const &iSetup)
 function template to write out the outputs More...
 
template<typename T >
void writeJets (edm::Event &iEvent, edm::EventSetup const &iSetup)
 
template<typename T >
void writeJetsWithConstituents (edm::Event &iEvent, edm::EventSetup const &iSetup)
 function template to write out the outputs More...
 
- Protected Attributes inherited from VirtualJetProducer
int activeAreaRepeats_
 
bool applyWeight_
 
bool doAreaDiskApprox_
 
bool doAreaFastjet_
 
bool doFastJetNonUniform_
 
bool doPUOffsetCorr_
 
bool doPVCorrection_
 
bool doRhoFastjet_
 
ActiveAreaSpecPtr fjActiveArea_
 
AreaDefinitionPtr fjAreaDefinition_
 
ClusterSequencePtr fjClusterSeq_
 
std::vector< fastjet::PseudoJet > fjInputs_
 
JetDefPtr fjJetDefinition_
 
std::vector< fastjet::PseudoJet > fjJets_
 
PluginPtr fjPlugin_
 
SelectorPtr fjSelector_
 
bool fromHTTTopJetProducer_ = false
 
double ghostArea_
 
double ghostEtaMax_
 
edm::EDGetTokenT< reco::VertexCollectioninput_vertex_token_
 
edm::EDGetTokenT< edm::ValueMap< float > > input_weights_token_
 
double inputEMin_
 
double inputEtMin_
 
std::vector< edm::Ptr< reco::Candidate > > inputs_
 
std::string jetAlgorithm_
 
std::string jetCollInstanceName_
 
double jetPtMin_
 
std::string jetType_
 
JetType::Type jetTypeE
 
unsigned int maxInputs_
 
unsigned int minSeed_
 
std::string moduleLabel_
 
unsigned int nExclude_
 
std::vector< double > puCenters_
 
std::string puSubtractorName_
 
double puWidth_
 
bool restrictInputs_
 
double rhoEtaMax_
 
double rParam_
 
edm::InputTag src_
 
edm::InputTag srcPVs_
 
std::shared_ptr< PileUpSubtractorsubtractor_
 
bool useDeterministicSeed_
 
bool useExplicitGhosts_
 
int verbosity_
 
reco::Particle::Point vertex_
 
double voronoiRfact_
 
edm::ValueMap< float > weights_
 
bool writeCompound_
 
bool writeJetsWithConst_
 

Detailed Description

Definition at line 71 of file CATopJetProducer.h.

Member Enumeration Documentation

◆ tagalgos

Constructor & Destructor Documentation

◆ CATopJetProducer()

CATopJetProducer::CATopJetProducer ( const edm::ParameterSet ps)

Definition at line 13 of file CATopJetProducer.cc.

References CA_TOPTAGGER, FJ_CMS_TOPTAG, FJ_JHU_TOPTAG, FJ_NSUB_TAG, fjCMSTopTagger_, fjJHUTopTagger_, fjNSUBTagger_, edm::ParameterSet::getParameter(), legacyCMSTopTagger_, HLT_2023v12_cff::plugin, VirtualJetProducer::src_, and tagAlgo_.

14  : FastjetJetProducer(conf),
15  tagAlgo_(conf.getParameter<int>("tagAlgo")),
16  ptMin_(conf.getParameter<double>("jetPtMin")),
17  centralEtaCut_(conf.getParameter<double>("centralEtaCut")),
18  verbose_(conf.getParameter<bool>("verbose")) {
19  if (tagAlgo_ == CA_TOPTAGGER) {
20  legacyCMSTopTagger_ = std::make_unique<CATopJetAlgorithm>(
21  src_,
22  conf.getParameter<bool>("verbose"),
23  conf.getParameter<int>("algorithm"), // 0 = KT, 1 = CA, 2 = anti-KT
24  conf.getParameter<int>("useAdjacency"), // choose adjacency requirement:
25  // 0 = no adjacency
26  // 1 = deltar adjacency
27  // 2 = modified adjacency
28  // 3 = calotower neirest neigbor based adjacency (untested)
29  conf.getParameter<double>("centralEtaCut"), // eta for defining "central" jets
30  conf.getParameter<double>("jetPtMin"), // min jet pt
31  conf.getParameter<std::vector<double>>(
32  "sumEtBins"), // sumEt bins over which cuts may vary. vector={bin 0 lower bound, bin 1 lower bound, ...}
33  conf.getParameter<std::vector<double>>("rBins"), // Jet distance paramter R. R values depend on sumEt bins.
34  conf.getParameter<std::vector<double>>("ptFracBins"), // fraction of hard jet pt that subjet must have (deltap)
35  conf.getParameter<std::vector<double>>(
36  "deltarBins"), // Applicable only if useAdjacency=1. deltar adjacency values for each sumEtBin
37  conf.getParameter<std::vector<double>>(
38  "nCellBins"), // Applicable only if useAdjacency=3. number of cells to consider two subjets adjacent
39  conf.getParameter<double>("inputEtMin"), // seed threshold - NOT USED
40  conf.getParameter<bool>(
41  "useMaxTower"), // use max tower as adjacency criterion, otherwise use centroid - NOT USED
42  conf.getParameter<double>("sumEtEtaCut"), // eta for event SumEt - NOT USED
43  conf.getParameter<double>("etFrac") // fraction of event sumEt / 2 for a jet to be considered "hard" -NOT USED
44  );
45  } else if (tagAlgo_ == FJ_CMS_TOPTAG) {
46  fjCMSTopTagger_ = std::make_unique<fastjet::CMSTopTagger>(conf.getParameter<double>("ptFrac"),
47  conf.getParameter<double>("rFrac"),
48  conf.getParameter<double>("adjacencyParam"));
49  } else if (tagAlgo_ == FJ_JHU_TOPTAG) {
50  fjJHUTopTagger_ = std::make_unique<fastjet::JHTopTagger>(conf.getParameter<double>("ptFrac"),
51  conf.getParameter<double>("deltaRCut"),
52  conf.getParameter<double>("cosThetaWMax"));
53  } else if (tagAlgo_ == FJ_NSUB_TAG) {
54  fastjet::JetDefinition::Plugin* plugin = new fastjet::SISConePlugin(0.6, 0.75);
55  fastjet::JetDefinition NsubJetDef(plugin);
56  fjNSUBTagger_ = std::make_unique<fastjet::RestFrameNSubjettinessTagger>(NsubJetDef,
57  conf.getParameter<double>("tau2Cut"),
58  conf.getParameter<double>("cosThetaSCut"),
59  conf.getParameter<bool>("useExclusive"));
60  }
61 }
std::unique_ptr< fastjet::RestFrameNSubjettinessTagger > fjNSUBTagger_
FastjetJetProducer(const edm::ParameterSet &iConfig)
std::unique_ptr< fastjet::JHTopTagger > fjJHUTopTagger_
std::unique_ptr< CATopJetAlgorithm > legacyCMSTopTagger_
std::unique_ptr< fastjet::CMSTopTagger > fjCMSTopTagger_
The algorithm to do the work.

◆ ~CATopJetProducer()

cms::CATopJetProducer::~CATopJetProducer ( )
inlineoverride

Definition at line 75 of file CATopJetProducer.h.

75 {}

Member Function Documentation

◆ fillDescriptions()

void CATopJetProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Cambridge-Aachen top jet producer parameters

Definition at line 120 of file CATopJetProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, FastjetJetProducer::fillDescriptionsFromFastJetProducer(), and VirtualJetProducer::fillDescriptionsFromVirtualJetProducer().

120  {
123  desc.add<int>("tagAlgo", 0); // choice of top tagging algorithm
124  desc.add<double>("centralEtaCut", 2.5); // eta for defining "central" jets
125  desc.add<bool>("verbose", false);
126  desc.add<string>("jetCollInstanceName", "caTopSubJets"); // subjet collection
127  desc.add<int>("algorithm", 1); // 0 = KT, 1 = CA, 2 = anti-KT
128  desc.add<int>("useAdjacency", 2); // veto adjacent subjets:
129  // 0, no adjacency
130  // 1, deltar adjacency
131  // 2, modified adjacency
132  // 3, calotower neirest neigbor based adjacency (untested)
133  vector<double> sumEtBinsDefault = {0., 1600., 2600.};
134  desc.add<vector<double>>(
135  "sumEtBins",
136  sumEtBinsDefault); // sumEt bins over which cuts vary. vector={bin 0 lower bound, bin 1 lower bound, ...}
137  vector<double> rBinsDefault(3, 0.8);
138  desc.add<vector<double>>("rBins", rBinsDefault); // Jet distance paramter R. R values depend on sumEt bins.
139  vector<double> ptFracBinsDefault(3, 0.05);
140  desc.add<vector<double>>("ptFracBins", ptFracBinsDefault); // minimum fraction of central jet pt for subjets (deltap)
141  vector<double> deltarBinsDefault(3, 0.019);
142  desc.add<vector<double>>(
143  "deltarBins", deltarBinsDefault); // Applicable only if useAdjacency=1. deltar adjacency values for each sumEtBin
144  vector<double> nCellBinsDefault(3, 1.9);
145  desc.add<vector<double>>(
146  "nCellBins",
147  nCellBinsDefault); // Applicable only if useAdjacency=3. number of cells apart for two subjets to be considered "independent"
148  desc.add<bool>("useMaxTower", false); // use max tower in adjacency criterion, otherwise use centroid - NOT USED
149  desc.add<double>("sumEtEtaCut", 3.0); // eta for event SumEt - NOT USED
150  desc.add<double>("etFrac", 0.7); // fraction of event sumEt / 2 for a jet to be considered "hard" - NOT USED
151  desc.add<double>("ptFrac", 0.05);
152  desc.add<double>("rFrac", 0.);
153  desc.add<double>("adjacencyParam", 0.);
154  desc.add<double>("deltaRCut", 0.19);
155  desc.add<double>("cosThetaWMax", 0.7);
156  desc.add<double>("tau2Cut", 0.);
157  desc.add<double>("cosThetaSCut", 0.);
158  desc.add<bool>("useExclusive", false);
164  descriptions.add("CATopJetProducer", desc);
165 }
static void fillDescriptionsFromFastJetProducer(edm::ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptionsFromVirtualJetProducer(edm::ParameterSetDescription &desc)

◆ produce()

void CATopJetProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

◆ runAlgorithm()

void CATopJetProducer::runAlgorithm ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements VirtualJetProducer.

Definition at line 65 of file CATopJetProducer.cc.

References CA_TOPTAGGER, centralEtaCut_, gather_cfg::cout, VirtualJetProducer::doAreaFastjet_, VirtualJetProducer::doRhoFastjet_, FJ_CMS_TOPTAG, FJ_JHU_TOPTAG, FJ_NSUB_TAG, VirtualJetProducer::fjAreaDefinition_, VirtualJetProducer::fjClusterSeq_, fjCMSTopTagger_, VirtualJetProducer::fjInputs_, VirtualJetProducer::fjJetDefinition_, VirtualJetProducer::fjJets_, fjJHUTopTagger_, fjNSUBTagger_, mps_fire::i, perp(), ptMin_, tagAlgo_, verbose_, and VirtualJetProducer::voronoiRfact_.

65  {
66  if (!doAreaFastjet_ && !doRhoFastjet_) {
67  fjClusterSeq_ = std::make_shared<fastjet::ClusterSequence>(fjInputs_, *fjJetDefinition_);
68  } else if (voronoiRfact_ <= 0) {
70  ClusterSequencePtr(new fastjet::ClusterSequenceArea(fjInputs_, *fjJetDefinition_, *fjAreaDefinition_));
71  } else {
73  new fastjet::ClusterSequenceVoronoiArea(fjInputs_, *fjJetDefinition_, fastjet::VoronoiAreaSpec(voronoiRfact_)));
74  }
75 
76  if (tagAlgo_ == CA_TOPTAGGER) {
77  (*legacyCMSTopTagger_).run(fjInputs_, fjJets_, fjClusterSeq_);
78 
79  } else {
80  //Run the jet clustering
81  vector<fastjet::PseudoJet> inclusiveJets = fjClusterSeq_->inclusive_jets(ptMin_);
82 
83  if (verbose_)
84  cout << "Getting central jets" << endl;
85  // Find the transient central jets
86  vector<fastjet::PseudoJet> centralJets;
87  for (unsigned int i = 0; i < inclusiveJets.size(); i++) {
88  if (inclusiveJets[i].perp() > ptMin_ && fabs(inclusiveJets[i].rapidity()) < centralEtaCut_) {
89  centralJets.push_back(inclusiveJets[i]);
90  }
91  }
92 
93  fastjet::CMSTopTagger& CMSTagger = *fjCMSTopTagger_;
94  fastjet::JHTopTagger& JHUTagger = *fjJHUTopTagger_;
95  fastjet::RestFrameNSubjettinessTagger& NSUBTagger = *fjNSUBTagger_;
96 
97  vector<fastjet::PseudoJet>::iterator jetIt = centralJets.begin(), centralJetsEnd = centralJets.end();
98  if (verbose_)
99  cout << "Loop over jets" << endl;
100  for (; jetIt != centralJetsEnd; ++jetIt) {
101  if (verbose_)
102  cout << "CMS FJ jet pt: " << (*jetIt).perp() << endl;
103 
104  fastjet::PseudoJet taggedJet;
105  if (tagAlgo_ == FJ_CMS_TOPTAG)
106  taggedJet = CMSTagger.result(*jetIt);
107  else if (tagAlgo_ == FJ_JHU_TOPTAG)
108  taggedJet = JHUTagger.result(*jetIt);
109  else if (tagAlgo_ == FJ_NSUB_TAG)
110  taggedJet = NSUBTagger.result(*jetIt);
111  else
112  cout << "NOT A VALID TAGGING ALGORITHM CHOICE!" << endl;
113 
114  if (taggedJet != 0)
115  fjJets_.push_back(taggedJet);
116  }
117  }
118 }
std::vector< fastjet::PseudoJet > fjJets_
std::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
std::unique_ptr< fastjet::RestFrameNSubjettinessTagger > fjNSUBTagger_
std::unique_ptr< fastjet::JHTopTagger > fjJHUTopTagger_
std::vector< fastjet::PseudoJet > fjInputs_
ClusterSequencePtr fjClusterSeq_
T perp() const
Magnitude of transverse component.
AreaDefinitionPtr fjAreaDefinition_
std::unique_ptr< fastjet::CMSTopTagger > fjCMSTopTagger_
The algorithm to do the work.

Member Data Documentation

◆ centralEtaCut_

double cms::CATopJetProducer::centralEtaCut_
private

Definition at line 90 of file CATopJetProducer.h.

Referenced by runAlgorithm().

◆ fjCMSTopTagger_

std::unique_ptr<fastjet::CMSTopTagger> cms::CATopJetProducer::fjCMSTopTagger_
private

The algorithm to do the work.

Definition at line 84 of file CATopJetProducer.h.

Referenced by CATopJetProducer(), and runAlgorithm().

◆ fjJHUTopTagger_

std::unique_ptr<fastjet::JHTopTagger> cms::CATopJetProducer::fjJHUTopTagger_
private

Definition at line 85 of file CATopJetProducer.h.

Referenced by CATopJetProducer(), and runAlgorithm().

◆ fjNSUBTagger_

std::unique_ptr<fastjet::RestFrameNSubjettinessTagger> cms::CATopJetProducer::fjNSUBTagger_
private

Definition at line 86 of file CATopJetProducer.h.

Referenced by CATopJetProducer(), and runAlgorithm().

◆ legacyCMSTopTagger_

std::unique_ptr<CATopJetAlgorithm> cms::CATopJetProducer::legacyCMSTopTagger_
private

Definition at line 83 of file CATopJetProducer.h.

Referenced by CATopJetProducer().

◆ ptMin_

double cms::CATopJetProducer::ptMin_
private

Definition at line 89 of file CATopJetProducer.h.

Referenced by runAlgorithm().

◆ tagAlgo_

int cms::CATopJetProducer::tagAlgo_
private

Definition at line 88 of file CATopJetProducer.h.

Referenced by CATopJetProducer(), and runAlgorithm().

◆ verbose_

bool cms::CATopJetProducer::verbose_
private

Definition at line 91 of file CATopJetProducer.h.

Referenced by runAlgorithm().