CMS 3D CMS Logo

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

Public Member Functions

 CandPtrProjector (edm::ParameterSet const &iConfig)
 
void produce (edm::StreamID, edm::Event &, edm::EventSetup const &) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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 Attributes

edm::EDGetTokenT< edm::View< reco::Candidate > > candSrcToken_
 
bool useDeltaRforFootprint_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > vetoSrcToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file CandPtrProjector.cc.

Constructor & Destructor Documentation

◆ CandPtrProjector()

CandPtrProjector::CandPtrProjector ( edm::ParameterSet const &  iConfig)
explicit

Definition at line 24 of file CandPtrProjector.cc.

25  : candSrcToken_{consumes<edm::View<reco::Candidate>>(iConfig.getParameter<edm::InputTag>("src"))},
26  vetoSrcToken_{consumes<edm::View<reco::Candidate>>(iConfig.getParameter<edm::InputTag>("veto"))},
27  useDeltaRforFootprint_(iConfig.getParameter<bool>("useDeltaRforFootprint")) {
28  produces<edm::PtrVector<reco::Candidate>>();
29 }

References edm::ParameterSet::getParameter().

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 64 of file CandPtrProjector.cc.

64  {
66  desc.add<edm::InputTag>("src");
67  desc.add<edm::InputTag>("veto");
68  desc.add<bool>("useDeltaRforFootprint", false);
69  descriptions.addWithDefaultLabel(desc);
70 }

References edm::ParameterSetDescription::add(), and edm::ConfigurationDescriptions::addWithDefaultLabel().

◆ produce()

void CandPtrProjector::produce ( edm::StreamID  ,
edm::Event iEvent,
edm::EventSetup const &   
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 31 of file CandPtrProjector.cc.

31  {
32  using namespace edm;
34  iEvent.getByToken(vetoSrcToken_, vetoes);
35 
36  auto result = std::make_unique<PtrVector<reco::Candidate>>();
37  std::set<reco::CandidatePtr> vetoedPtrs;
38  for (auto const& veto : *vetoes) {
39  auto const n = veto.numberOfSourceCandidatePtrs();
40  for (size_t j{}; j < n; ++j) {
41  vetoedPtrs.insert(veto.sourceCandidatePtr(j));
42  }
43  }
44 
46  iEvent.getByToken(candSrcToken_, cands);
47  for (size_t i{}; i < cands->size(); ++i) {
48  auto const c = cands->ptrAt(i);
49  if (vetoedPtrs.find(c) == vetoedPtrs.cend()) {
50  bool addcand = true;
52  for (const auto& it : vetoedPtrs)
53  if (it.isNonnull() && it.isAvailable() && reco::deltaR2(*it, *c) < 0.00000025) {
54  addcand = false;
55  break;
56  }
57  if (addcand)
58  result->push_back(c);
59  }
60  }
61  iEvent.put(std::move(result));
62 }

References HltBtagPostValidation_cff::c, HLT_2018_cff::cands, candSrcToken_, reco::deltaR2(), mps_fire::i, iEvent, dqmiolumiharvest::j, eostools::move(), dqmiodumpmetadata::n, mps_fire::result, useDeltaRforFootprint_, PbPb_ZMuSkimMuonDPG_cff::veto, and vetoSrcToken_.

Member Data Documentation

◆ candSrcToken_

edm::EDGetTokenT<edm::View<reco::Candidate> > CandPtrProjector::candSrcToken_
private

Definition at line 19 of file CandPtrProjector.cc.

Referenced by produce().

◆ useDeltaRforFootprint_

bool CandPtrProjector::useDeltaRforFootprint_
private

Definition at line 21 of file CandPtrProjector.cc.

Referenced by produce().

◆ vetoSrcToken_

edm::EDGetTokenT<edm::View<reco::Candidate> > CandPtrProjector::vetoSrcToken_
private

Definition at line 20 of file CandPtrProjector.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
CandPtrProjector::candSrcToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > candSrcToken_
Definition: CandPtrProjector.cc:19
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle
Definition: AssociativeIterator.h:50
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
iEvent
int iEvent
Definition: GenABIO.cc:224
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
CandPtrProjector::vetoSrcToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > vetoSrcToken_
Definition: CandPtrProjector.cc:20
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
mps_fire.result
result
Definition: mps_fire.py:303
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
PbPb_ZMuSkimMuonDPG_cff.veto
veto
Definition: PbPb_ZMuSkimMuonDPG_cff.py:61
edm::InputTag
Definition: InputTag.h:15
CandPtrProjector::useDeltaRforFootprint_
bool useDeltaRforFootprint_
Definition: CandPtrProjector.cc:21
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87