CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
heppy::ReclusterJets Class Reference

#include <ReclusterJets.h>

Public Types

typedef math::XYZTLorentzVector LorentzVector
 

Public Member Functions

std::vector< LorentzVectorgetGrouping (double ptMin=0.0)
 get grouping (inclusive jets) More...
 
std::vector< LorentzVectorgetGroupingExclusive (int njets)
 get grouping (exclusive jets, until n are left) More...
 
std::vector< LorentzVectorgetGroupingExclusive (double dcut)
 get grouping (exclusive jets, up to cut dcut) More...
 
LorentzVector getPruned (double zcut, double rcutFactor)
 get pruned 4-vector More...
 
LorentzVector getPrunedSubjetExclusive (unsigned int isubjet, double zcut, double rcutFactor)
 get pruned 4-vector for a given subject (must be called after getGroupingExclusive) More...
 
LorentzVector getPrunedSubjetInclusive (unsigned int isubjet, double zcut, double rcutFactor)
 get pruned 4-vector for a given subject (must be called after getGroupingInclusive) More...
 
 ReclusterJets (const std::vector< LorentzVector > &objects, double ktpower, double rparam)
 

Private Types

typedef std::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
 fastjet outputs More...
 

Private Member Functions

LorentzVector getPruned (const fastjet::PseudoJet &jet, double zcut, double rcutFactor)
 
std::vector< LorentzVectormakeP4s (const std::vector< fastjet::PseudoJet > &jets)
 

Private Attributes

std::vector< fastjet::PseudoJet > exclusiveJets_
 
ClusterSequencePtr fjClusterSeq_
 
std::vector< fastjet::PseudoJet > fjInputs_
 
std::vector< fastjet::PseudoJet > inclusiveJets_
 
double ktpower_
 
double rparam_
 

Detailed Description

Definition at line 19 of file ReclusterJets.h.

Member Typedef Documentation

◆ ClusterSequencePtr

typedef std::shared_ptr<fastjet::ClusterSequence> heppy::ReclusterJets::ClusterSequencePtr
private

fastjet outputs

Definition at line 57 of file ReclusterJets.h.

◆ LorentzVector

Definition at line 21 of file ReclusterJets.h.

Constructor & Destructor Documentation

◆ ReclusterJets()

heppy::ReclusterJets::ReclusterJets ( const std::vector< LorentzVector > &  objects,
double  ktpower,
double  rparam 
)

Definition at line 14 of file ReclusterJets.cc.

References Exception, fjClusterSeq_, fjInputs_, dqmiolumiharvest::j, ktpower_, EcalTangentSkim_cfg::o, and rparam_.

15  : ktpower_(ktpower), rparam_(rparam) {
16  // define jet inputs
17  fjInputs_.clear();
18  int index = 0;
19  for (const LorentzVector &o : objects) {
20  fastjet::PseudoJet j(o.Px(), o.Py(), o.Pz(), o.E());
21  j.set_user_index(index);
22  index++; // in case we want to know which piece ended where
23  fjInputs_.push_back(j);
24  }
25 
26  // choose a jet definition
27  fastjet::JetDefinition jet_def;
28 
29  // prepare jet def
30  if (ktpower_ == 1.0) {
31  jet_def = JetDefinition(kt_algorithm, rparam_);
32  } else if (ktpower_ == 0.0) {
33  jet_def = JetDefinition(cambridge_algorithm, rparam_);
34  } else if (ktpower_ == -1.0) {
35  jet_def = JetDefinition(antikt_algorithm, rparam_);
36  } else {
37  throw cms::Exception("InvalidArgument", "Unsupported ktpower value");
38  }
39 
40  // print out some infos
41  // cout << "Clustering with " << jet_def.description() << endl;
43  // define jet clustering sequence
44  fjClusterSeq_ = std::make_shared<fastjet::ClusterSequence>(fjInputs_, jet_def);
45  }
std::vector< fastjet::PseudoJet > fjInputs_
Definition: ReclusterJets.h:51
ClusterSequencePtr fjClusterSeq_
Definition: ReclusterJets.h:58
math::XYZTLorentzVector LorentzVector

Member Function Documentation

◆ getGrouping()

std::vector< math::XYZTLorentzVector > heppy::ReclusterJets::getGrouping ( double  ptMin = 0.0)

get grouping (inclusive jets)

Definition at line 55 of file ReclusterJets.cc.

References fjClusterSeq_, inclusiveJets_, makeP4s(), and ptMin.

55  {
56  // recluster jet
57  inclusiveJets_ = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(ptMin));
58  // return
59  return makeP4s(inclusiveJets_);
60  }
constexpr float ptMin
ClusterSequencePtr fjClusterSeq_
Definition: ReclusterJets.h:58
std::vector< fastjet::PseudoJet > inclusiveJets_
Definition: ReclusterJets.h:59
std::vector< LorentzVector > makeP4s(const std::vector< fastjet::PseudoJet > &jets)

◆ getGroupingExclusive() [1/2]

std::vector< math::XYZTLorentzVector > heppy::ReclusterJets::getGroupingExclusive ( int  njets)

get grouping (exclusive jets, until n are left)

Definition at line 69 of file ReclusterJets.cc.

References exclusiveJets_, fjClusterSeq_, makeP4s(), and BTaggingMonitoring_cff::njets.

69  {
70  // recluster jet
71  exclusiveJets_ = fastjet::sorted_by_pt(fjClusterSeq_->exclusive_jets(njets));
72  // return
73  return makeP4s(exclusiveJets_);
74  }
std::vector< fastjet::PseudoJet > exclusiveJets_
Definition: ReclusterJets.h:60
ClusterSequencePtr fjClusterSeq_
Definition: ReclusterJets.h:58
std::vector< LorentzVector > makeP4s(const std::vector< fastjet::PseudoJet > &jets)

◆ getGroupingExclusive() [2/2]

std::vector< math::XYZTLorentzVector > heppy::ReclusterJets::getGroupingExclusive ( double  dcut)

get grouping (exclusive jets, up to cut dcut)

Definition at line 62 of file ReclusterJets.cc.

References exclusiveJets_, fjClusterSeq_, and makeP4s().

62  {
63  // recluster jet
64  exclusiveJets_ = fastjet::sorted_by_pt(fjClusterSeq_->exclusive_jets(dcut));
65  // return
66  return makeP4s(exclusiveJets_);
67  }
std::vector< fastjet::PseudoJet > exclusiveJets_
Definition: ReclusterJets.h:60
ClusterSequencePtr fjClusterSeq_
Definition: ReclusterJets.h:58
std::vector< LorentzVector > makeP4s(const std::vector< fastjet::PseudoJet > &jets)

◆ getPruned() [1/2]

math::XYZTLorentzVector heppy::ReclusterJets::getPruned ( double  zcut,
double  rcutFactor 
)

get pruned 4-vector

Definition at line 76 of file ReclusterJets.cc.

References exclusiveJets_, fjClusterSeq_, getPrunedSubjetExclusive(), and HLT_2023v12_cff::zcut.

Referenced by getPrunedSubjetExclusive(), and getPrunedSubjetInclusive().

76  {
77  // cluster everything first
78  exclusiveJets_ = fastjet::sorted_by_pt(fjClusterSeq_->exclusive_jets(1));
79  // get pruned exclusive
80  return getPrunedSubjetExclusive(0, zcut, rcutFactor);
81  }
std::vector< fastjet::PseudoJet > exclusiveJets_
Definition: ReclusterJets.h:60
ClusterSequencePtr fjClusterSeq_
Definition: ReclusterJets.h:58
LorentzVector getPrunedSubjetExclusive(unsigned int isubjet, double zcut, double rcutFactor)
get pruned 4-vector for a given subject (must be called after getGroupingExclusive) ...

◆ getPruned() [2/2]

math::XYZTLorentzVector heppy::ReclusterJets::getPruned ( const fastjet::PseudoJet &  jet,
double  zcut,
double  rcutFactor 
)
private

Definition at line 100 of file ReclusterJets.cc.

References metsig::jet, and HLT_2023v12_cff::zcut.

100  {
101  // create pruner
102  fastjet::Pruner pruner(fastjet::cambridge_algorithm, zcut, rcutFactor);
103  // Prune the jet
104  fastjet::PseudoJet pruned_jet = pruner(jet);
105  return LorentzVector(pruned_jet.px(), pruned_jet.py(), pruned_jet.pz(), pruned_jet.e());
106  }
math::XYZTLorentzVector LorentzVector
Definition: ReclusterJets.h:21

◆ getPrunedSubjetExclusive()

math::XYZTLorentzVector heppy::ReclusterJets::getPrunedSubjetExclusive ( unsigned int  isubjet,
double  zcut,
double  rcutFactor 
)

get pruned 4-vector for a given subject (must be called after getGroupingExclusive)

Definition at line 83 of file ReclusterJets.cc.

References Exception, exclusiveJets_, getPruned(), and HLT_2023v12_cff::zcut.

Referenced by getPruned().

85  {
86  if (isubjet >= exclusiveJets_.size()) {
87  throw cms::Exception("InvalidArgument", "getPrunedSubjetExclusive called for non-existing exclusive subjet");
88  }
89  return getPruned(exclusiveJets_[isubjet], zcut, rcutFactor);
90  }
std::vector< fastjet::PseudoJet > exclusiveJets_
Definition: ReclusterJets.h:60
LorentzVector getPruned(double zcut, double rcutFactor)
get pruned 4-vector

◆ getPrunedSubjetInclusive()

math::XYZTLorentzVector heppy::ReclusterJets::getPrunedSubjetInclusive ( unsigned int  isubjet,
double  zcut,
double  rcutFactor 
)

get pruned 4-vector for a given subject (must be called after getGroupingInclusive)

Definition at line 91 of file ReclusterJets.cc.

References Exception, getPruned(), inclusiveJets_, and HLT_2023v12_cff::zcut.

93  {
94  if (isubjet >= inclusiveJets_.size()) {
95  throw cms::Exception("InvalidArgument", "getPrunedSubjetInclusive called for non-existing inclusive subjet");
96  }
97  return getPruned(inclusiveJets_[isubjet], zcut, rcutFactor);
98  }
LorentzVector getPruned(double zcut, double rcutFactor)
get pruned 4-vector
std::vector< fastjet::PseudoJet > inclusiveJets_
Definition: ReclusterJets.h:59

◆ makeP4s()

std::vector< math::XYZTLorentzVector > heppy::ReclusterJets::makeP4s ( const std::vector< fastjet::PseudoJet > &  jets)
private

Definition at line 47 of file ReclusterJets.cc.

References PDWG_EXODelayedJetMET_cff::jets.

Referenced by getGrouping(), and getGroupingExclusive().

47  {
48  std::vector<math::XYZTLorentzVector> JetObjectsAll;
49  JetObjectsAll.reserve(jets.size());
50  for (const fastjet::PseudoJet &pj : jets) {
51  JetObjectsAll.push_back(LorentzVector(pj.px(), pj.py(), pj.pz(), pj.e()));
52  }
53  return JetObjectsAll;
54  }
math::XYZTLorentzVector LorentzVector
Definition: ReclusterJets.h:21

Member Data Documentation

◆ exclusiveJets_

std::vector<fastjet::PseudoJet> heppy::ReclusterJets::exclusiveJets_
private

Definition at line 60 of file ReclusterJets.h.

Referenced by getGroupingExclusive(), getPruned(), and getPrunedSubjetExclusive().

◆ fjClusterSeq_

ClusterSequencePtr heppy::ReclusterJets::fjClusterSeq_
private

Definition at line 58 of file ReclusterJets.h.

Referenced by getGrouping(), getGroupingExclusive(), getPruned(), and ReclusterJets().

◆ fjInputs_

std::vector<fastjet::PseudoJet> heppy::ReclusterJets::fjInputs_
private

Definition at line 51 of file ReclusterJets.h.

Referenced by ReclusterJets().

◆ inclusiveJets_

std::vector<fastjet::PseudoJet> heppy::ReclusterJets::inclusiveJets_
private

Definition at line 59 of file ReclusterJets.h.

Referenced by getGrouping(), and getPrunedSubjetInclusive().

◆ ktpower_

double heppy::ReclusterJets::ktpower_
private

Definition at line 53 of file ReclusterJets.h.

Referenced by ReclusterJets().

◆ rparam_

double heppy::ReclusterJets::rparam_
private

Definition at line 54 of file ReclusterJets.h.

Referenced by ReclusterJets().