CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
cms::CompoundJetProducer Class Reference

#include <CompoundJetProducer.h>

Inheritance diagram for cms::CompoundJetProducer:
VirtualJetProducer edm::stream::EDProducer<> cms::SubJetProducer

Public Member Functions

 CompoundJetProducer (const edm::ParameterSet &ps)
 
 ~CompoundJetProducer () 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
 

Protected Member Functions

void inputTowers () override
 compound fastjet::PseudoJets More...
 
void output (edm::Event &iEvent, edm::EventSetup const &iSetup) override
 
template<typename T >
void writeCompoundJets (edm::Event &iEvent, edm::EventSetup const &iSetup)
 function template to write out the outputs More...
 
- 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 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 runAlgorithm (edm::Event &iEvent, const edm::EventSetup &iSetup)=0
 
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

std::vector< CompoundPseudoJetfjCompoundJets_
 
- 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_
 

Additional Inherited Members

- 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
 
- Static Public Member Functions inherited from VirtualJetProducer
static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillDescriptionsFromVirtualJetProducer (edm::ParameterSetDescription &desc)
 

Detailed Description

Definition at line 39 of file CompoundJetProducer.h.

Constructor & Destructor Documentation

◆ CompoundJetProducer()

CompoundJetProducer::CompoundJetProducer ( const edm::ParameterSet ps)

Definition at line 14 of file CompoundJetProducer.cc.

14  : VirtualJetProducer(conf) {
15  produces<reco::BasicJetCollection>();
16  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
17 }
VirtualJetProducer(const edm::ParameterSet &iConfig)

◆ ~CompoundJetProducer()

cms::CompoundJetProducer::~CompoundJetProducer ( )
inlineoverride

Definition at line 43 of file CompoundJetProducer.h.

43 {}

Member Function Documentation

◆ inputTowers()

void CompoundJetProducer::inputTowers ( )
overrideprotectedvirtual

compound fastjet::PseudoJets

Reimplemented from VirtualJetProducer.

Definition at line 19 of file CompoundJetProducer.cc.

References fjCompoundJets_, and VirtualJetProducer::inputTowers().

19  {
20  fjCompoundJets_.clear();
22 }
virtual void inputTowers()
std::vector< CompoundPseudoJet > fjCompoundJets_

◆ output()

void CompoundJetProducer::output ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Overridden output method. For the compound jet producer, this will call the "writeCompoundJets" function template.

Reimplemented from VirtualJetProducer.

Definition at line 24 of file CompoundJetProducer.cc.

References VirtualJetProducer::JetType::BasicJet, VirtualJetProducer::JetType::CaloJet, Exception, VirtualJetProducer::JetType::GenJet, iEvent, VirtualJetProducer::jetTypeE, and VirtualJetProducer::JetType::PFJet.

24  {
25  // Write jets and constitutents. Will use fjJets_.
26  switch (jetTypeE) {
27  case JetType::CaloJet:
28  writeCompoundJets<reco::CaloJet>(iEvent, iSetup);
29  break;
30  case JetType::PFJet:
31  writeCompoundJets<reco::PFJet>(iEvent, iSetup);
32  break;
33  case JetType::GenJet:
34  writeCompoundJets<reco::GenJet>(iEvent, iSetup);
35  break;
36  case JetType::BasicJet:
37  writeCompoundJets<reco::BasicJet>(iEvent, iSetup);
38  break;
39  default:
40  throw cms::Exception("InvalidInput") << "invalid jet type in CompoundJetProducer\n";
41  break;
42  };
43 }
JetType::Type jetTypeE
int iEvent
Definition: GenABIO.cc:224

◆ writeCompoundJets()

template<class T >
void CompoundJetProducer::writeCompoundJets ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
protected

function template to write out the outputs

Definition at line 47 of file CompoundJetProducer.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), fjCompoundJets_, VirtualJetProducer::getGeometry(), VirtualJetProducer::getTopology(), iEvent, dqmdumpme::indices, VirtualJetProducer::inputs_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, metsig::jet, jetfilter_cfi::jetCollection, VirtualJetProducer::jetCollInstanceName_, eostools::move(), point, reco::Jet::setJetArea(), and reco::writeSpecific().

47  {
48  // get a list of output jets
49  auto jetCollection = std::make_unique<reco::BasicJetCollection>();
50  // get a list of output subjets
51  auto subjetCollection = std::make_unique<std::vector<T>>();
52 
53  // This will store the handle for the subjets after we write them
54  edm::OrphanHandle<std::vector<T>> subjetHandleAfterPut;
55  // this is the mapping of subjet to hard jet
56  std::vector<std::vector<int>> indices;
57  // this is the list of hardjet 4-momenta
58  std::vector<math::XYZTLorentzVector> p4_hardJets;
59  // this is the hardjet areas
60  std::vector<double> area_hardJets;
61 
62  [[maybe_unused]] const CaloGeometry* pGeometry = nullptr;
63  [[maybe_unused]] const HcalTopology* pTopology = nullptr;
64  if constexpr (std::is_same_v<T, reco::CaloJet>) {
65  pGeometry = &getGeometry(iSetup);
66  pTopology = &getTopology(iSetup);
67  }
68 
69  // Loop over the hard jets
70  std::vector<CompoundPseudoJet>::const_iterator it = fjCompoundJets_.begin(), iEnd = fjCompoundJets_.end(),
71  iBegin = fjCompoundJets_.begin();
72  indices.resize(fjCompoundJets_.size());
73  for (; it != iEnd; ++it) {
74  int jetIndex = it - iBegin;
75  fastjet::PseudoJet localJet = it->hardJet();
76  // Get the 4-vector for the hard jet
77  p4_hardJets.push_back(math::XYZTLorentzVector(localJet.px(), localJet.py(), localJet.pz(), localJet.e()));
78  area_hardJets.push_back(it->hardJetArea());
79 
80  // create the subjet list
81  std::vector<CompoundPseudoSubJet>::const_iterator itSubJetBegin = it->subjets().begin(), itSubJet = itSubJetBegin,
82  itSubJetEnd = it->subjets().end();
83  for (; itSubJet != itSubJetEnd; ++itSubJet) {
84  fastjet::PseudoJet subjet = itSubJet->subjet();
85  math::XYZTLorentzVector p4Subjet(subjet.px(), subjet.py(), subjet.pz(), subjet.e());
87 
88  // This will hold ptr's to the subjets
89  std::vector<reco::CandidatePtr> subjetConstituents;
90 
91  // Get the transient subjet constituents from fastjet
92  std::vector<int> const& subjetFastjetConstituentIndices = itSubJet->constituents();
93  std::vector<int>::const_iterator fastSubIt = subjetFastjetConstituentIndices.begin(),
94  transConstEnd = subjetFastjetConstituentIndices.end();
95  for (; fastSubIt != transConstEnd; ++fastSubIt) {
96  // Add a ptr to this constituent
97  if (*fastSubIt < static_cast<int>(inputs_.size()))
98  subjetConstituents.push_back(inputs_[*fastSubIt]);
99  }
100 
101  // This holds the subjet-to-hardjet mapping
102  indices[jetIndex].push_back(subjetCollection->size());
103 
104  // Add the concrete subjet type to the subjet list to write to event record
105  T jet;
106  if constexpr (std::is_same_v<T, reco::CaloJet>) {
107  reco::writeSpecific(jet, p4Subjet, point, subjetConstituents, *pGeometry, *pTopology);
108  } else {
109  reco::writeSpecific(jet, p4Subjet, point, subjetConstituents);
110  }
111  jet.setJetArea(itSubJet->subjetArea());
112  subjetCollection->push_back(jet);
113  }
114  }
115  // put subjets into event record
116  subjetHandleAfterPut = iEvent.put(std::move(subjetCollection), jetCollInstanceName_);
117 
118  // Now create the hard jets with ptr's to the subjets as constituents
119  std::vector<math::XYZTLorentzVector>::const_iterator ip4 = p4_hardJets.begin(), ip4Begin = p4_hardJets.begin(),
120  ip4End = p4_hardJets.end();
121 
122  for (; ip4 != ip4End; ++ip4) {
123  int p4_index = ip4 - ip4Begin;
124  std::vector<int>& ind = indices[p4_index];
125  std::vector<reco::CandidatePtr> i_hardJetConstituents;
126  // Add the subjets to the hard jet
127  for (std::vector<int>::const_iterator isub = ind.begin(); isub != ind.end(); ++isub) {
128  reco::CandidatePtr candPtr(subjetHandleAfterPut, *isub, false);
129  i_hardJetConstituents.push_back(candPtr);
130  }
131  reco::Particle::Point point(0, 0, 0);
132  reco::BasicJet toput(*ip4, point, i_hardJetConstituents);
133  toput.setJetArea(area_hardJets[ip4 - ip4Begin]);
134  jetCollection->push_back(toput);
135  }
136 
137  // put hard jets into event record
139 }
HcalTopology const & getTopology(edm::EventSetup const &) const
void writeSpecific(reco::CaloJet &jet, reco::Particle::LorentzVector const &p4, reco::Particle::Point const &point, std::vector< reco::CandidatePtr > const &constituents, CaloGeometry const &geometry, HcalTopology const &topology)
Definition: JetSpecific.cc:32
Jets made from CaloTowers.
Definition: BasicJet.h:19
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int iEvent
Definition: GenABIO.cc:224
std::string jetCollInstanceName_
std::vector< edm::Ptr< reco::Candidate > > inputs_
math::XYZPoint Point
point in the space
Definition: Particle.h:25
CaloGeometry const & getGeometry(edm::EventSetup const &) const
std::vector< CompoundPseudoJet > fjCompoundJets_
long double T
def move(src, dest)
Definition: eostools.py:511
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

Member Data Documentation

◆ fjCompoundJets_

std::vector<CompoundPseudoJet> cms::CompoundJetProducer::fjCompoundJets_
protected