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 &)
 
 ~TestBXVectorRefProducer () 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginStream (edm::StreamID) override
 
void endStream () override
 
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<>
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
 

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 73 of file TestBXVectorRefProducer.cc.

73  {
74  //now do what ever other initialization is needed
75  src_ = iConfig.getParameter<edm::InputTag>("src");
76  doRefs_ = iConfig.getParameter<bool>("doRefs");
77  token_ = consumes<l1t::JetBxCollection>(src_);
78 
79  //register your products
80  produces<vector<int>>("jetPt").setBranchAlias("jetPt");
81 
82  if (doRefs_) {
83  produces<l1t::JetRefVector>("l1tJetRef").setBranchAlias("l1tJetRef");
84  }
85 }

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

◆ ~TestBXVectorRefProducer()

TestBXVectorRefProducer::~TestBXVectorRefProducer ( )
override

Definition at line 87 of file TestBXVectorRefProducer.cc.

87  {
88  // do anything here that needs to be done at destruction time
89  // (e.g. close files, deallocate resources etc.)
90 }

Member Function Documentation

◆ beginStream()

void TestBXVectorRefProducer::beginStream ( edm::StreamID  )
overrideprivate

Definition at line 131 of file TestBXVectorRefProducer.cc.

131 {}

◆ endStream()

void TestBXVectorRefProducer::endStream ( )
overrideprivate

Definition at line 134 of file TestBXVectorRefProducer.cc.

134 {}

◆ fillDescriptions()

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

Definition at line 169 of file TestBXVectorRefProducer.cc.

169  {
170  //The following says we do not know what parameters are allowed so do no validation
171  // Please change this to state exactly what you do use, even if it is no parameters
173  desc.setUnknown();
174  descriptions.addDefault(desc);
175 }

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

◆ produce()

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

Definition at line 97 of file TestBXVectorRefProducer.cc.

97  {
98  using namespace edm;
99 
100  unique_ptr<vector<int>> jetMom(new vector<int>);
101  unique_ptr<l1t::JetRefVector> jetRef(new l1t::JetRefVector);
102 
103  // retrieve the tracks
105  iEvent.getByToken(token_, jets);
106  if (!jets.isValid())
107  return;
108 
109  const int size = jets->size();
110  jetMom->reserve(size);
111 
113 
114  for (iter = jets->begin(0); iter != jets->end(0); ++iter) {
115  jetMom->push_back(iter->pt());
116 
117  l1t::JetRef myref(jets, jets->key(iter));
118  jetRef->push_back(myref);
119 
120  } // end for
121 
122  iEvent.put(std::move(jetMom), "jetPt");
123 
124  if (doRefs_)
125  iEvent.put(std::move(jetRef), "l1tJetRef");
126 
127  return;
128 }

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

Member Data Documentation

◆ doRefs_

bool TestBXVectorRefProducer::doRefs_
private

Definition at line 57 of file TestBXVectorRefProducer.cc.

Referenced by produce(), and TestBXVectorRefProducer().

◆ src_

edm::InputTag TestBXVectorRefProducer::src_
private

Definition at line 58 of file TestBXVectorRefProducer.cc.

Referenced by TestBXVectorRefProducer().

◆ token_

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

Definition at line 59 of file TestBXVectorRefProducer.cc.

Referenced by produce(), and TestBXVectorRefProducer().

BXVector::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::RefVector
Definition: EDProductfwd.h:27
TestBXVectorRefProducer::src_
edm::InputTag src_
Definition: TestBXVectorRefProducer.cc:58
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
TestBXVectorRefProducer::token_
edm::EDGetTokenT< l1t::JetBxCollection > token_
Definition: TestBXVectorRefProducer.cc:59
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
TestBXVectorRefProducer::doRefs_
bool doRefs_
Definition: TestBXVectorRefProducer.cc:57
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443