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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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)
 
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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 12 of file CompoundJetProducer.cc.

12  : VirtualJetProducer(conf) {
13  produces<reco::BasicJetCollection>();
14  // the subjet collections are set through the config file in the "jetCollInstanceName" field.
15 }

◆ ~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 17 of file CompoundJetProducer.cc.

17  {
18  fjCompoundJets_.clear();
20 }

References fjCompoundJets_, and VirtualJetProducer::inputTowers().

◆ 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 22 of file CompoundJetProducer.cc.

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

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

◆ 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 45 of file CompoundJetProducer.cc.

45  {
46  // get a list of output jets
47  auto jetCollection = std::make_unique<reco::BasicJetCollection>();
48  // get a list of output subjets
49  auto subjetCollection = std::make_unique<std::vector<T>>();
50 
51  // This will store the handle for the subjets after we write them
52  edm::OrphanHandle<std::vector<T>> subjetHandleAfterPut;
53  // this is the mapping of subjet to hard jet
54  std::vector<std::vector<int>> indices;
55  // this is the list of hardjet 4-momenta
56  std::vector<math::XYZTLorentzVector> p4_hardJets;
57  // this is the hardjet areas
58  std::vector<double> area_hardJets;
59 
60  // Loop over the hard jets
61  std::vector<CompoundPseudoJet>::const_iterator it = fjCompoundJets_.begin(), iEnd = fjCompoundJets_.end(),
62  iBegin = fjCompoundJets_.begin();
63  indices.resize(fjCompoundJets_.size());
64  for (; it != iEnd; ++it) {
65  int jetIndex = it - iBegin;
66  fastjet::PseudoJet localJet = it->hardJet();
67  // Get the 4-vector for the hard jet
68  p4_hardJets.push_back(math::XYZTLorentzVector(localJet.px(), localJet.py(), localJet.pz(), localJet.e()));
69  area_hardJets.push_back(it->hardJetArea());
70 
71  // create the subjet list
72  std::vector<CompoundPseudoSubJet>::const_iterator itSubJetBegin = it->subjets().begin(), itSubJet = itSubJetBegin,
73  itSubJetEnd = it->subjets().end();
74  for (; itSubJet != itSubJetEnd; ++itSubJet) {
75  fastjet::PseudoJet subjet = itSubJet->subjet();
76  math::XYZTLorentzVector p4Subjet(subjet.px(), subjet.py(), subjet.pz(), subjet.e());
78 
79  // This will hold ptr's to the subjets
80  std::vector<reco::CandidatePtr> subjetConstituents;
81 
82  // Get the transient subjet constituents from fastjet
83  std::vector<int> const& subjetFastjetConstituentIndices = itSubJet->constituents();
84  std::vector<int>::const_iterator fastSubIt = subjetFastjetConstituentIndices.begin(),
85  transConstEnd = subjetFastjetConstituentIndices.end();
86  for (; fastSubIt != transConstEnd; ++fastSubIt) {
87  // Add a ptr to this constituent
88  if (*fastSubIt < static_cast<int>(inputs_.size()))
89  subjetConstituents.push_back(inputs_[*fastSubIt]);
90  }
91 
92  // This holds the subjet-to-hardjet mapping
93  indices[jetIndex].push_back(subjetCollection->size());
94 
95  // Add the concrete subjet type to the subjet list to write to event record
96  T jet;
97  reco::writeSpecific(jet, p4Subjet, point, subjetConstituents, iSetup);
98  jet.setJetArea(itSubJet->subjetArea());
99  subjetCollection->push_back(jet);
100  }
101  }
102  // put subjets into event record
103  subjetHandleAfterPut = iEvent.put(std::move(subjetCollection), jetCollInstanceName_);
104 
105  // Now create the hard jets with ptr's to the subjets as constituents
106  std::vector<math::XYZTLorentzVector>::const_iterator ip4 = p4_hardJets.begin(), ip4Begin = p4_hardJets.begin(),
107  ip4End = p4_hardJets.end();
108 
109  for (; ip4 != ip4End; ++ip4) {
110  int p4_index = ip4 - ip4Begin;
111  std::vector<int>& ind = indices[p4_index];
112  std::vector<reco::CandidatePtr> i_hardJetConstituents;
113  // Add the subjets to the hard jet
114  for (std::vector<int>::const_iterator isub = ind.begin(); isub != ind.end(); ++isub) {
115  reco::CandidatePtr candPtr(subjetHandleAfterPut, *isub, false);
116  i_hardJetConstituents.push_back(candPtr);
117  }
118  reco::Particle::Point point(0, 0, 0);
119  reco::BasicJet toput(*ip4, point, i_hardJetConstituents);
120  toput.setJetArea(area_hardJets[ip4 - ip4Begin]);
121  jetCollection->push_back(toput);
122  }
123 
124  // put hard jets into event record
126 }

References fjCompoundJets_, iEvent, bTagCombinedSVVariables_cff::indices, VirtualJetProducer::inputs_, metsig::jet, jetfilter_cfi::jetCollection, VirtualJetProducer::jetCollInstanceName_, eostools::move(), point, reco::Jet::setJetArea(), and reco::writeSpecific().

Member Data Documentation

◆ fjCompoundJets_

std::vector<CompoundPseudoJet> cms::CompoundJetProducer::fjCompoundJets_
protected
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
reco::writeSpecific
void writeSpecific(reco::CaloJet &jet, reco::Particle::LorentzVector const &p4, reco::Particle::Point const &point, std::vector< reco::CandidatePtr > const &constituents, edm::EventSetup const &c)
Definition: JetSpecific.cc:34
VirtualJetProducer::jetTypeE
JetType::Type jetTypeE
Definition: VirtualJetProducer.h:54
VirtualJetProducer::JetType::PFJet
Definition: VirtualJetProducer.h:45
VirtualJetProducer::JetType::BasicJet
Definition: VirtualJetProducer.h:42
VirtualJetProducer::JetType::CaloJet
Definition: VirtualJetProducer.h:44
VirtualJetProducer::VirtualJetProducer
VirtualJetProducer(const edm::ParameterSet &iConfig)
Definition: VirtualJetProducer.cc:113
reco::BasicJet
Jets made from CaloTowers.
Definition: BasicJet.h:19
jetfilter_cfi.jetCollection
jetCollection
Definition: jetfilter_cfi.py:4
VirtualJetProducer::inputs_
std::vector< edm::Ptr< reco::Candidate > > inputs_
Definition: VirtualJetProducer.h:183
iEvent
int iEvent
Definition: GenABIO.cc:224
VirtualJetProducer::inputTowers
virtual void inputTowers()
Definition: VirtualJetProducer.cc:442
VirtualJetProducer::jetCollInstanceName_
std::string jetCollInstanceName_
Definition: VirtualJetProducer.h:199
cms::CompoundJetProducer::fjCompoundJets_
std::vector< CompoundPseudoJet > fjCompoundJets_
Definition: CompoundJetProducer.h:46
edm::Ptr< Candidate >
VirtualJetProducer::JetType::GenJet
Definition: VirtualJetProducer.h:43
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
T
long double T
Definition: Basic3DVectorLD.h:48
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
metsig::jet
Definition: SignAlgoResolutions.h:47
Exception
Definition: hltDiff.cc:246
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
point
*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