CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
JetConstituentSelector< T, C > Class Template Reference
Inheritance diagram for JetConstituentSelector< T, C >:
edm::stream::EDProducer<>

Public Types

using ConstituentsOutput = C
 
using JetsOutput = std::vector< T >
 
using ValueType = typename C::value_type
 
- 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
 

Public Member Functions

const ConstituentsOutput::value_type initptr (edm::Ptr< reco::Candidate > const &dau) const
 
template<>
const edm::Ptr< pat::PackedCandidateinitptr (edm::Ptr< reco::Candidate > const &dau) const
 
template<>
const edm::Ptr< pat::PackedGenParticleinitptr (edm::Ptr< reco::Candidate > const &dau) const
 
 JetConstituentSelector (edm::ParameterSet const &params)
 
void produce (edm::Event &iEvent, edm::EventSetup const &iSetup) 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)
 

Private Attributes

const StringCutObjectSelector< Tselector_
 
const edm::EDGetTokenT< edm::View< T > > srcToken_
 

Detailed Description

template<class T, typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
class JetConstituentSelector< T, C >

Definition at line 32 of file JetConstituentSelector.cc.

Member Typedef Documentation

◆ ConstituentsOutput

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
using JetConstituentSelector< T, C >::ConstituentsOutput = C

Definition at line 35 of file JetConstituentSelector.cc.

◆ JetsOutput

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
using JetConstituentSelector< T, C >::JetsOutput = std::vector<T>

Definition at line 34 of file JetConstituentSelector.cc.

◆ ValueType

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
using JetConstituentSelector< T, C >::ValueType = typename C::value_type

Definition at line 36 of file JetConstituentSelector.cc.

Constructor & Destructor Documentation

◆ JetConstituentSelector()

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
JetConstituentSelector< T, C >::JetConstituentSelector ( edm::ParameterSet const &  params)
inline

Definition at line 38 of file JetConstituentSelector.cc.

39  : srcToken_{consumes<edm::View<T>>(params.getParameter<edm::InputTag>("src"))},
40  selector_{params.getParameter<std::string>("cut")} {
41  produces<JetsOutput>();
42  produces<ConstituentsOutput>("constituents");
43  }

References CalibrationSummaryClient_cfi::params.

Member Function Documentation

◆ fillDescriptions()

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
static void JetConstituentSelector< T, C >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 45 of file JetConstituentSelector.cc.

45  {
47  desc.add<edm::InputTag>("src")->setComment("InputTag used for retrieving jets in event.");
48  desc.add<std::string>("cut")->setComment(
49  "Cut used by which to select jets. For example:\n"
50  " \"pt > 100.0 && abs(rapidity()) < 2.4\".");
51 
52  // addDefault must be used here instead of add unless this function is specialized
53  // for different sets of template parameter types. Each specialization would need
54  // a different module label. Otherwise the generated cfi filenames will conflict
55  // for the different plugins.
56  descriptions.addDefault(desc);
57  }

References edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ initptr() [1/3]

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
const ConstituentsOutput::value_type JetConstituentSelector< T, C >::initptr ( edm::Ptr< reco::Candidate > const &  dau) const
inline

Definition at line 60 of file JetConstituentSelector.cc.

60  {
61  return typename ConstituentsOutput::value_type(dau, dau);
62  }

Referenced by JetConstituentSelector< T, C >::produce().

◆ initptr() [2/3]

template<>
const edm::Ptr< pat::PackedCandidate > JetConstituentSelector< pat::Jet, std::vector< edm::Ptr< pat::PackedCandidate > > >::initptr ( edm::Ptr< reco::Candidate > const &  dau) const

Definition at line 95 of file JetConstituentSelector.cc.

96  {
98  return retval;
99 }

◆ initptr() [3/3]

template<>
const edm::Ptr< pat::PackedGenParticle > JetConstituentSelector< reco::GenJet, std::vector< edm::Ptr< pat::PackedGenParticle > > >::initptr ( edm::Ptr< reco::Candidate > const &  dau) const

Definition at line 103 of file JetConstituentSelector.cc.

104  {
106  return retval;
107 }

◆ produce()

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
void JetConstituentSelector< T, C >::produce ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
inlineoverride

Definition at line 64 of file JetConstituentSelector.cc.

64  {
65  auto jets = std::make_unique<JetsOutput>();
66  auto candsOut = std::make_unique<ConstituentsOutput>();
67 
69  iEvent.getByToken(srcToken_, h_jets);
70 
71  // Now set the Ptrs with the orphan handles.
72  for (auto const& jet : *h_jets) {
73  // Check the selection
74  if (selector_(jet)) {
75  // Add the jets that pass to the output collection
76  jets->push_back(jet);
77 
78  for (unsigned int ida{}; ida < jet.numberOfDaughters(); ++ida) {
79  candsOut->emplace_back(initptr(jet.daughterPtr(ida)));
80  }
81  }
82  }
83 
84  iEvent.put(std::move(jets));
85  iEvent.put(std::move(candsOut), "constituents");
86  }

References iEvent, JetConstituentSelector< T, C >::initptr(), metsig::jet, singleTopDQM_cfi::jets, eostools::move(), JetConstituentSelector< T, C >::selector_, and JetConstituentSelector< T, C >::srcToken_.

Member Data Documentation

◆ selector_

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
const StringCutObjectSelector<T> JetConstituentSelector< T, C >::selector_
private

Definition at line 90 of file JetConstituentSelector.cc.

Referenced by JetConstituentSelector< T, C >::produce().

◆ srcToken_

template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
const edm::EDGetTokenT<edm::View<T> > JetConstituentSelector< T, C >::srcToken_
private

Definition at line 89 of file JetConstituentSelector.cc.

Referenced by JetConstituentSelector< T, C >::produce().

JetConstituentSelector::srcToken_
const edm::EDGetTokenT< edm::View< T > > srcToken_
Definition: JetConstituentSelector.cc:89
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ptr
Definition: AssociationVector.h:31
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
metsig::jet
Definition: SignAlgoResolutions.h:47
JetConstituentSelector::selector_
const StringCutObjectSelector< T > selector_
Definition: JetConstituentSelector.cc:90
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15
JetConstituentSelector::initptr
const ConstituentsOutput::value_type initptr(edm::Ptr< reco::Candidate > const &dau) const
Definition: JetConstituentSelector.cc:60