CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1TPFCandMultiMerger Class Reference
Inheritance diagram for L1TPFCandMultiMerger:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L1TPFCandMultiMerger (const edm::ParameterSet &)
 
 ~L1TPFCandMultiMerger () override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

std::vector< bool > alsoRegional_
 
std::vector< std::string > instances_
 
std::vector< std::string > regionalInstances_
 
std::vector< edm::EDGetTokenT< l1t::PFCandidateRegionalOutput > > regionalTokens_
 
std::vector< edm::EDGetTokenT< l1t::PFCandidateCollection > > tokens_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 11 of file L1TPFCandMultiMerger.cc.

Constructor & Destructor Documentation

◆ L1TPFCandMultiMerger()

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

Definition at line 25 of file L1TPFCandMultiMerger.cc.

References alsoRegional_, Exception, spr::find(), edm::ParameterSet::getParameter(), instance, instances_, match(), l1pfCandidates_cfi::pfProducers, regionalInstances_, regionalTokens_, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, and tokens_.

26  : instances_(iConfig.getParameter<std::vector<std::string>>("labelsToMerge")),
27  regionalInstances_(iConfig.getParameter<std::vector<std::string>>("regionalLabelsToMerge")) {
28  const std::vector<edm::InputTag>& pfProducers = iConfig.getParameter<std::vector<edm::InputTag>>("pfProducers");
29  tokens_.reserve(instances_.size() * pfProducers.size());
30  for (const std::string& instance : instances_) {
31  for (const edm::InputTag& tag : pfProducers) {
32  tokens_.push_back(consumes<l1t::PFCandidateCollection>(edm::InputTag(tag.label(), instance, tag.process())));
33  }
34  produces<l1t::PFCandidateCollection>(instance);
35  // check if regional output is needed too
37  alsoRegional_.push_back(true);
38  for (const edm::InputTag& tag : pfProducers) {
39  regionalTokens_.push_back(
40  consumes<l1t::PFCandidateRegionalOutput>(edm::InputTag(tag.label(), instance + "Regional", tag.process())));
41  }
42  produces<l1t::PFCandidateRegionalOutput>(instance + "Regional");
43  } else {
44  alsoRegional_.push_back(false);
45  }
46  }
47  // check that regional output is not requested without the standard one
48  for (const std::string& instance : regionalInstances_) {
49  auto match = std::find(instances_.begin(), instances_.end(), instance);
50  if (match == instances_.end()) {
51  throw cms::Exception("Configuration", "The regional label '" + instance + "' is not in labelsToMerge\n");
52  }
53  }
54 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static PFTauRenderPlugin instance
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< bool > alsoRegional_
std::vector< edm::EDGetTokenT< l1t::PFCandidateCollection > > tokens_
std::vector< std::string > instances_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::vector< edm::EDGetTokenT< l1t::PFCandidateRegionalOutput > > regionalTokens_
std::vector< std::string > regionalInstances_

◆ ~L1TPFCandMultiMerger()

L1TPFCandMultiMerger::~L1TPFCandMultiMerger ( )
override

Definition at line 56 of file L1TPFCandMultiMerger.cc.

56 {}

Member Function Documentation

◆ produce()

void L1TPFCandMultiMerger::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup  
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 58 of file L1TPFCandMultiMerger.cc.

References alsoRegional_, patZpeak::handle, iEvent, cuy::ii, instances_, relativeConstraints::keys, eostools::move(), hltrates_dqm_sourceclient-live_cfg::offset, MillePedeFileConverter_cfg::out, nano_mu_digi_cff::region, regionalTokens_, TrackRefitter_38T_cff::src, and tokens_.

58  {
61  unsigned int ninstances = instances_.size(), nproducers = tokens_.size() / ninstances;
62  std::vector<int> keys;
63  for (unsigned int ii = 0, it = 0, irt = 0; ii < ninstances; ++ii) {
64  auto out = std::make_unique<l1t::PFCandidateCollection>();
65  std::unique_ptr<l1t::PFCandidateRegionalOutput> regout;
66  if (alsoRegional_[ii]) {
67  auto refprod = iEvent.getRefBeforePut<l1t::PFCandidateCollection>(instances_[ii]);
68  regout = std::make_unique<l1t::PFCandidateRegionalOutput>(edm::RefProd<l1t::PFCandidateCollection>(refprod));
69  }
70  for (unsigned int ip = 0; ip < nproducers; ++ip, ++it) {
71  iEvent.getByToken(tokens_[it], handle);
72  unsigned int offset = out->size();
73  out->insert(out->end(), handle->begin(), handle->end());
74  if (alsoRegional_[ii]) {
75  iEvent.getByToken(regionalTokens_[irt++], regionalHandle);
76  const auto& src = *regionalHandle;
77  for (unsigned int ireg = 0, nreg = src.nRegions(); ireg < nreg; ++ireg) {
78  auto region = src.region(ireg);
79  keys.clear();
80  for (auto iter = region.begin(), iend = region.end(); iter != iend; ++iter) {
81  keys.push_back(iter.idx() + offset);
82  }
83  regout->addRegion(keys, src.eta(ireg), src.phi(ireg));
84  }
85  }
86  }
88  if (alsoRegional_[ii]) {
89  iEvent.put(std::move(regout), instances_[ii] + "Regional");
90  }
91  }
92 }
std::vector< l1t::PFCandidate > PFCandidateCollection
Definition: PFCandidate.h:86
int iEvent
Definition: GenABIO.cc:224
std::vector< bool > alsoRegional_
ii
Definition: cuy.py:589
std::vector< edm::EDGetTokenT< l1t::PFCandidateCollection > > tokens_
std::vector< std::string > instances_
std::vector< edm::EDGetTokenT< l1t::PFCandidateRegionalOutput > > regionalTokens_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ alsoRegional_

std::vector<bool> L1TPFCandMultiMerger::alsoRegional_
private

Definition at line 20 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger(), and produce().

◆ instances_

std::vector<std::string> L1TPFCandMultiMerger::instances_
private

Definition at line 19 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger(), and produce().

◆ regionalInstances_

std::vector<std::string> L1TPFCandMultiMerger::regionalInstances_
private

Definition at line 19 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger().

◆ regionalTokens_

std::vector<edm::EDGetTokenT<l1t::PFCandidateRegionalOutput> > L1TPFCandMultiMerger::regionalTokens_
private

Definition at line 22 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger(), and produce().

◆ tokens_

std::vector<edm::EDGetTokenT<l1t::PFCandidateCollection> > L1TPFCandMultiMerger::tokens_
private

Definition at line 21 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger(), and produce().