CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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
 
- 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 13 of file L1TPFCandMultiMerger.cc.

Constructor & Destructor Documentation

◆ L1TPFCandMultiMerger()

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

Definition at line 28 of file L1TPFCandMultiMerger.cc.

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

29  : instances_(iConfig.getParameter<std::vector<std::string>>("labelsToMerge")),
30  regionalInstances_(iConfig.getParameter<std::vector<std::string>>("regionalLabelsToMerge")) {
31  const std::vector<edm::InputTag>& pfProducers = iConfig.getParameter<std::vector<edm::InputTag>>("pfProducers");
32  tokens_.reserve(instances_.size() * pfProducers.size());
33  for (const std::string& instance : instances_) {
34  for (const edm::InputTag& tag : pfProducers) {
35  tokens_.push_back(consumes<l1t::PFCandidateCollection>(edm::InputTag(tag.label(), instance, tag.process())));
36  }
37  produces<l1t::PFCandidateCollection>(instance);
38  // check if regional output is needed too
40  alsoRegional_.push_back(true);
41  for (const edm::InputTag& tag : pfProducers) {
42  regionalTokens_.push_back(
43  consumes<l1t::PFCandidateRegionalOutput>(edm::InputTag(tag.label(), instance + "Regional", tag.process())));
44  }
45  produces<l1t::PFCandidateRegionalOutput>(instance + "Regional");
46  } else {
47  alsoRegional_.push_back(false);
48  }
49  }
50  // check that regional output is not requested without the standard one
51  for (const std::string& instance : regionalInstances_) {
52  auto match = std::find(instances_.begin(), instances_.end(), instance);
53  if (match == instances_.end()) {
54  throw cms::Exception("Configuration", "The regional label '" + instance + "' is not in labelsToMerge\n");
55  }
56  }
57 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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 59 of file L1TPFCandMultiMerger.cc.

59 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 97 of file L1TPFCandMultiMerger.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

97  {
98  // l1tLayer1
100  desc.add<std::vector<edm::InputTag>>("pfProducers",
101  {
102  edm::InputTag("l1tLayer1Barrel"),
103  edm::InputTag("l1tLayer1HGCal"),
104  edm::InputTag("l1tLayer1HGCalNoTK"),
105  edm::InputTag("l1tLayer1HF"),
106  });
107  desc.add<std::vector<std::string>>("labelsToMerge",
108  {
109  "PF",
110  "Puppi",
111  "Calo",
112  "TK",
113  });
114  desc.add<std::vector<std::string>>("regionalLabelsToMerge",
115  {
116  "Puppi",
117  });
118  descriptions.addWithDefaultLabel(desc);
119 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 61 of file L1TPFCandMultiMerger.cc.

References alsoRegional_, patZpeak::handle, iEvent, cuy::ii, instances_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, relativeConstraints::keys, eostools::move(), HLT_IsoTrack_cff::offset, MillePedeFileConverter_cfg::out, nano_mu_digi_cff::region, regionalTokens_, TrackRefitter_38T_cff::src, and tokens_.

61  {
64  unsigned int ninstances = instances_.size(), nproducers = tokens_.size() / ninstances;
65  std::vector<int> keys;
66  for (unsigned int ii = 0, it = 0, irt = 0; ii < ninstances; ++ii) {
67  auto out = std::make_unique<l1t::PFCandidateCollection>();
68  std::unique_ptr<l1t::PFCandidateRegionalOutput> regout;
69  if (alsoRegional_[ii]) {
70  auto refprod = iEvent.getRefBeforePut<l1t::PFCandidateCollection>(instances_[ii]);
71  regout = std::make_unique<l1t::PFCandidateRegionalOutput>(edm::RefProd<l1t::PFCandidateCollection>(refprod));
72  }
73  for (unsigned int ip = 0; ip < nproducers; ++ip, ++it) {
74  iEvent.getByToken(tokens_[it], handle);
75  unsigned int offset = out->size();
76  out->insert(out->end(), handle->begin(), handle->end());
77  if (alsoRegional_[ii]) {
78  iEvent.getByToken(regionalTokens_[irt++], regionalHandle);
79  const auto& src = *regionalHandle;
80  for (unsigned int ireg = 0, nreg = src.nRegions(); ireg < nreg; ++ireg) {
81  auto region = src.region(ireg);
82  keys.clear();
83  for (auto iter = region.begin(), iend = region.end(); iter != iend; ++iter) {
84  keys.push_back(iter.idx() + offset);
85  }
86  regout->addRegion(keys, src.eta(ireg), src.phi(ireg));
87  }
88  }
89  }
91  if (alsoRegional_[ii]) {
92  iEvent.put(std::move(regout), instances_[ii] + "Regional");
93  }
94  }
95 }
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 23 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger(), and produce().

◆ instances_

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

Definition at line 22 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger(), and produce().

◆ regionalInstances_

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

Definition at line 22 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger().

◆ regionalTokens_

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

Definition at line 25 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger(), and produce().

◆ tokens_

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

Definition at line 24 of file L1TPFCandMultiMerger.cc.

Referenced by L1TPFCandMultiMerger(), and produce().