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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TestBXVectorRefProducer (const edm::ParameterSet &)
 
 ~TestBXVectorRefProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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

Constructor & Destructor Documentation

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

Definition at line 75 of file TestBXVectorRefProducer.cc.

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

76 {
77 
78  //now do what ever other initialization is needed
79  src_ = iConfig.getParameter<edm::InputTag>( "src" );
80  doRefs_ = iConfig.getParameter<bool>("doRefs");
81  token_ = consumes<l1t::JetBxCollection>(src_);
82 
83  //register your products
84  produces<vector<int>>( "jetPt" ).setBranchAlias( "jetPt");
85 
86  if(doRefs_) {
87 
88  produces<l1t::JetRefVector>( "l1tJetRef" ).setBranchAlias( "l1tJetRef");
89 
90  }
91 
92 }
T getParameter(std::string const &) const
edm::EDGetTokenT< l1t::JetBxCollection > token_
TestBXVectorRefProducer::~TestBXVectorRefProducer ( )
override

Definition at line 95 of file TestBXVectorRefProducer.cc.

96 {
97 
98  // do anything here that needs to be done at destruction time
99  // (e.g. close files, deallocate resources etc.)
100 
101 }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 147 of file TestBXVectorRefProducer.cc.

148 {
149 }
void TestBXVectorRefProducer::endStream ( )
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 153 of file TestBXVectorRefProducer.cc.

153  {
154 }
void TestBXVectorRefProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 190 of file TestBXVectorRefProducer.cc.

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

190  {
191  //The following says we do not know what parameters are allowed so do no validation
192  // Please change this to state exactly what you do use, even if it is no parameters
194  desc.setUnknown();
195  descriptions.addDefault(desc);
196 }
void addDefault(ParameterSetDescription const &psetDescription)
void TestBXVectorRefProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 110 of file TestBXVectorRefProducer.cc.

References BXVector< T >::begin(), doRefs_, BXVector< T >::end(), edm::Event::getByToken(), edm::HandleBase::isValid(), fwrapper::jets, BXVector< T >::key(), eostools::move(), edm::Event::put(), BXVector< T >::size(), findQualityFiles::size, and token_.

111 {
112  using namespace edm;
113 
114  unique_ptr<vector<int>> jetMom ( new vector<int> );
115  unique_ptr<l1t::JetRefVector> jetRef ( new l1t::JetRefVector );
116 
117  // retrieve the tracks
119  iEvent.getByToken( token_, jets );
120  if(!jets.isValid()) return;
121 
122  const int size = jets->size();
123  jetMom->reserve( size );
124 
126 
127  for (iter = jets->begin(0); iter != jets->end(0); ++iter){
128 
129  jetMom->push_back(iter->pt());
130 
131  l1t::JetRef myref(jets, jets->key(iter ));
132  jetRef->push_back(myref);
133 
134 
135  } // end for
136 
137  iEvent.put(std::move(jetMom),"jetPt");
138 
139  if (doRefs_) iEvent.put(std::move(jetRef),"l1tJetRef");
140 
141  return;
142 
143 }
size
Write out results.
const_iterator end(int bx) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
unsigned size(int bx) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
unsigned int key(const_iterator &iter) const
Definition: BXVector.h:104
vector< PseudoJet > jets
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< l1t::JetBxCollection > token_
HLT enums.
const_iterator begin(int bx) const
def move(src, dest)
Definition: eostools.py:510
std::vector< Jet >::const_iterator const_iterator
Definition: BXVector.h:20

Member Data Documentation

bool TestBXVectorRefProducer::doRefs_
private

Definition at line 58 of file TestBXVectorRefProducer.cc.

Referenced by produce(), and TestBXVectorRefProducer().

edm::InputTag TestBXVectorRefProducer::src_
private

Definition at line 59 of file TestBXVectorRefProducer.cc.

Referenced by TestBXVectorRefProducer().

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

Definition at line 60 of file TestBXVectorRefProducer.cc.

Referenced by produce(), and TestBXVectorRefProducer().