CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TestBXVectorRefProducer Class Reference

#include <HLTrigger/TestBXVectorRefProducer/plugins/TestBXVectorRefProducer.cc>

Inheritance diagram for TestBXVectorRefProducer:
edm::stream::EDProducer<>

Public Member Functions

 TestBXVectorRefProducer (const edm::ParameterSet &)
 
- 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 Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

bool doRefs_
 
edm::InputTag src_
 
edm::EDGetTokenT< l1t::JetBxCollectiontoken_
 

Additional Inherited Members

- 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
 

Detailed Description

Description: Simple testing producer to test storing of Ref<BXVector> (example of <l1t::JetRef>) in the Event.

Implementation: Pick up the BXVector<l1t::Jet> from the event and try to store the Refs back into the Event.

Definition at line 39 of file TestBXVectorRefProducer.cc.

Constructor & Destructor Documentation

◆ TestBXVectorRefProducer()

TestBXVectorRefProducer::TestBXVectorRefProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 65 of file TestBXVectorRefProducer.cc.

References doRefs_, edm::ParameterSet::getParameter(), src_, and token_.

65  {
66  //now do what ever other initialization is needed
67  src_ = iConfig.getParameter<edm::InputTag>("src");
68  doRefs_ = iConfig.getParameter<bool>("doRefs");
69  token_ = consumes<l1t::JetBxCollection>(src_);
70 
71  //register your products
72  produces<vector<int>>("jetPt").setBranchAlias("jetPt");
73 
74  if (doRefs_) {
75  produces<l1t::JetRefVector>("l1tJetRef").setBranchAlias("l1tJetRef");
76  }
77 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< l1t::JetBxCollection > token_

Member Function Documentation

◆ fillDescriptions()

void TestBXVectorRefProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 118 of file TestBXVectorRefProducer.cc.

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

118  {
119  //The following says we do not know what parameters are allowed so do no validation
120  // Please change this to state exactly what you do use, even if it is no parameters
122  desc.setUnknown();
123  descriptions.addDefault(desc);
124 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void TestBXVectorRefProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 84 of file TestBXVectorRefProducer.cc.

References doRefs_, iEvent, PDWG_EXODelayedJetMET_cff::jets, eostools::move(), findQualityFiles::size, and token_.

84  {
85  using namespace edm;
86 
87  unique_ptr<vector<int>> jetMom(new vector<int>);
88  unique_ptr<l1t::JetRefVector> jetRef(new l1t::JetRefVector);
89 
90  // retrieve the tracks
92  iEvent.getByToken(token_, jets);
93  if (!jets.isValid())
94  return;
95 
96  const int size = jets->size();
97  jetMom->reserve(size);
98 
100 
101  for (iter = jets->begin(0); iter != jets->end(0); ++iter) {
102  jetMom->push_back(iter->pt());
103 
104  l1t::JetRef myref(jets, jets->key(iter));
105  jetRef->push_back(myref);
106 
107  } // end for
108 
109  iEvent.put(std::move(jetMom), "jetPt");
110 
111  if (doRefs_)
112  iEvent.put(std::move(jetRef), "l1tJetRef");
113 
114  return;
115 }
size
Write out results.
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:18
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< l1t::JetBxCollection > token_
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ doRefs_

bool TestBXVectorRefProducer::doRefs_
private

Definition at line 49 of file TestBXVectorRefProducer.cc.

Referenced by produce(), and TestBXVectorRefProducer().

◆ src_

edm::InputTag TestBXVectorRefProducer::src_
private

Definition at line 50 of file TestBXVectorRefProducer.cc.

Referenced by TestBXVectorRefProducer().

◆ token_

edm::EDGetTokenT<l1t::JetBxCollection> TestBXVectorRefProducer::token_
private

Definition at line 51 of file TestBXVectorRefProducer.cc.

Referenced by produce(), and TestBXVectorRefProducer().