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<>
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
 

Public Member Functions

ConstituentsOutput::value_type const initptr (edm::Ptr< reco::Candidate > const &dau) const
 
template<>
edm::Ptr< pat::PackedCandidate > const initptr (edm::Ptr< reco::Candidate > const &dau) const
 
template<>
edm::Ptr< pat::PackedGenParticle > const initptr (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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

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

Detailed Description

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

Definition at line 35 of file JetConstituentSelector.cc.

Member Typedef Documentation

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

Definition at line 39 of file JetConstituentSelector.cc.

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

Definition at line 38 of file JetConstituentSelector.cc.

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

Definition at line 40 of file JetConstituentSelector.cc.

Constructor & Destructor Documentation

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

Definition at line 42 of file JetConstituentSelector.cc.

References edm::ParameterSet::getParameter(), JetConstituentSelector< T, C >::selector_, and AlCaHLTBitMon_QueryRunRegistry::string.

42  :
43  srcToken_{consumes<edm::View<T>>(params.getParameter<edm::InputTag>("src"))},
44  selector_{params.getParameter<std::string>("cut")}
45  {
46  produces<JetsOutput>();
47  produces<ConstituentsOutput>("constituents");
48  }
StringCutObjectSelector< T > const selector_
edm::EDGetTokenT< edm::View< T > > const srcToken_

Member Function Documentation

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

Definition at line 50 of file JetConstituentSelector.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), and AlCaHLTBitMon_QueryRunRegistry::string.

51  {
53  desc.add<edm::InputTag>("src")->setComment("InputTag used for retrieving jets in event.");
54  desc.add<std::string>("cut")->setComment("Cut used by which to select jets. For example:\n"
55  " \"pt > 100.0 && abs(rapidity()) < 2.4\".");
56 
57  // addDefault must be used here instead of add unless this function is specialized
58  // for different sets of template parameter types. Each specialization would need
59  // a different module label. Otherwise the generated cfi filenames will conflict
60  // for the different plugins.
61  descriptions.addDefault(desc);
62  }
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
template<class T , typename C = std::vector<typename T::ConstituentTypeFwdPtr>>
ConstituentsOutput::value_type const JetConstituentSelector< T, C >::initptr ( edm::Ptr< reco::Candidate > const &  dau) const
inline

Definition at line 65 of file JetConstituentSelector.cc.

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

65  {
66  return typename ConstituentsOutput::value_type( dau, dau );
67  }
template<>
edm::Ptr< pat::PackedCandidate > const JetConstituentSelector< pat::Jet, std::vector< edm::Ptr< pat::PackedCandidate > > >::initptr ( edm::Ptr< reco::Candidate > const &  dau) const

Definition at line 102 of file JetConstituentSelector.cc.

102  {
103  edm::Ptr<pat::PackedCandidate> retval( dau );
104  return retval;
105 }
template<>
edm::Ptr< pat::PackedGenParticle > const JetConstituentSelector< reco::GenJet, std::vector< edm::Ptr< pat::PackedGenParticle > > >::initptr ( edm::Ptr< reco::Candidate > const &  dau) const

Definition at line 109 of file JetConstituentSelector.cc.

109  {
110  edm::Ptr<pat::PackedGenParticle> retval( dau );
111  return retval;
112 }
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 69 of file JetConstituentSelector.cc.

References edm::Event::getByToken(), JetConstituentSelector< T, C >::initptr(), metsig::jet, fwrapper::jets, eostools::move(), edm::Event::put(), JetConstituentSelector< T, C >::selector_, and JetConstituentSelector< T, C >::srcToken_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

70  {
71  auto jets = std::make_unique<JetsOutput>();
72  auto candsOut = std::make_unique<ConstituentsOutput>();
73 
75  iEvent.getByToken(srcToken_, h_jets);
76 
77 
78  // Now set the Ptrs with the orphan handles.
79  for (auto const& jet : *h_jets) {
80  // Check the selection
81  if (selector_(jet)) {
82  // Add the jets that pass to the output collection
83  jets->push_back(jet);
84 
85  for (unsigned int ida {}; ida < jet.numberOfDaughters(); ++ida) {
86  candsOut->emplace_back( initptr(jet.daughterPtr(ida)) );
87  }
88  }
89  }
90 
91  iEvent.put(std::move(jets));
92  iEvent.put(std::move(candsOut), "constituents");
93  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
StringCutObjectSelector< T > const selector_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
vector< PseudoJet > jets
edm::EDGetTokenT< edm::View< T > > const srcToken_
def move(src, dest)
Definition: eostools.py:510
ConstituentsOutput::value_type const initptr(edm::Ptr< reco::Candidate > const &dau) const

Member Data Documentation

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

Definition at line 96 of file JetConstituentSelector.cc.

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