CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
ObjectViewCleaner< T > Class Template Reference
Inheritance diagram for ObjectViewCleaner< T >:
edm::stream::EDProducer< edm::GlobalCache< Counters > > edm::global::EDProducer< edm::StreamCache< ovc::StreamCache< T > > > edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

std::unique_ptr< ovc::StreamCache< T > > beginStream (edm::StreamID) const override
 
void endJob () override
 
 ObjectViewCleaner (const edm::ParameterSet &iConfig)
 
void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
 ~ObjectViewCleaner () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< Counters > >
 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
 
const EDProduceroperator= (const EDProducer &)=delete
 
- Public Member Functions inherited from edm::global::EDProducer< edm::StreamCache< ovc::StreamCache< T > > >
 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::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

const double deltaRMin_
 
const std::string keep_
 
const std::string moduleLabel_
 
std::atomic< unsigned int > nObjectsClean_
 
std::atomic< unsigned int > nObjectsTot_
 
const std::string remove_
 
const edm::EDGetTokenT< edm::View< T > > srcCandsToken_
 
const std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > srcObjectsTokens_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< Counters > >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- 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<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 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)
 
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

template<typename T>
class ObjectViewCleaner< T >

Definition at line 65 of file ObjectViewCleaner.cc.

Constructor & Destructor Documentation

◆ ObjectViewCleaner()

template<typename T >
ObjectViewCleaner< T >::ObjectViewCleaner ( const edm::ParameterSet iConfig)

Definition at line 100 of file ObjectViewCleaner.cc.

References makeGlobalPositionRcd_cfg::tag.

101  : srcCandsToken_(this->consumes(iConfig.getParameter<edm::InputTag>("srcObject"))),
103  iConfig.getParameter<vector<edm::InputTag>>("srcObjectsToRemove"),
104  [this](edm::InputTag const& tag) { return this->template consumes<edm::View<reco::Candidate>>(tag); })),
105  deltaRMin_(iConfig.getParameter<double>("deltaRMin")),
106  moduleLabel_(iConfig.getParameter<string>("@module_label")),
107  keep_(iConfig.getParameter<std::string>("srcObjectSelection")),
108  remove_(iConfig.getParameter<std::string>("srcObjectsToRemoveSelection")),
109  nObjectsTot_(0),
110  nObjectsClean_(0) {
111  this->template produces<edm::RefToBaseVector<T>>();
112 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::atomic< unsigned int > nObjectsTot_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
const std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > srcObjectsTokens_
std::atomic< unsigned int > nObjectsClean_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const double deltaRMin_
const std::string remove_
const edm::EDGetTokenT< edm::View< T > > srcCandsToken_
const std::string keep_
const std::string moduleLabel_

◆ ~ObjectViewCleaner()

template<typename T >
ObjectViewCleaner< T >::~ObjectViewCleaner ( )
override

Definition at line 116 of file ObjectViewCleaner.cc.

116 {}

Member Function Documentation

◆ beginStream()

template<typename T >
std::unique_ptr< ovc::StreamCache< T > > ObjectViewCleaner< T >::beginStream ( edm::StreamID  ) const
override

Definition at line 123 of file ObjectViewCleaner.cc.

123  {
124  return std::make_unique<ovc::StreamCache<T>>(keep_, remove_);
125 }
const std::string remove_
const std::string keep_

◆ endJob()

template<typename T >
void ObjectViewCleaner< T >::endJob ( void  )
overridevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 174 of file ObjectViewCleaner.cc.

References contentValuesCheck::ss.

174  {
175  stringstream ss;
176  ss << "nObjectsTot=" << nObjectsTot_ << " nObjectsClean=" << nObjectsClean_
177  << " fObjectsClean=" << 100. * (nObjectsClean_ / (double)nObjectsTot_) << "%\n";
178  edm::LogInfo("ObjectViewCleaner") << "++++++++++++++++++++++++++++++++++++++++++++++++++"
179  << "\n"
180  << moduleLabel_ << "(ObjectViewCleaner) SUMMARY:\n"
181  << ss.str() << "++++++++++++++++++++++++++++++++++++++++++++++++++";
182 }
std::atomic< unsigned int > nObjectsTot_
std::atomic< unsigned int > nObjectsClean_
Log< level::Info, false > LogInfo
const std::string moduleLabel_

◆ fillDescriptions()

template<typename T >
void ObjectViewCleaner< T >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 185 of file ObjectViewCleaner.cc.

References submitPVResolutionJobs::desc, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

185  {
187  pset.add<edm::InputTag>("srcObject");
188  pset.add<std::vector<edm::InputTag>>("srcObjectsToRemove");
189  pset.add<double>("deltaRMin");
190  pset.add<std::string>("srcObjectSelection", "");
191  pset.add<std::string>("srcObjectsToRemoveSelection", "");
192  desc.addDefault(pset);
193 }

◆ produce()

template<typename T >
void ObjectViewCleaner< T >::produce ( edm::StreamID  streamID,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 128 of file ObjectViewCleaner.cc.

References HLT_2022v12_cff::candidates, reco::deltaR(), PbPb_ZMuSkimMuonDPG_cff::deltaR, iEvent, eostools::move(), getGTfromDQMFile::obj, and L1TPhase2Offline_cfi::objects.

128  {
129  auto cleanObjects = std::make_unique<edm::RefToBaseVector<T>>();
130 
132  iEvent.getByToken(srcCandsToken_, candidates);
133 
134  bool* isClean = new bool[candidates->size()];
135  for (unsigned int iObject = 0; iObject < candidates->size(); iObject++)
136  isClean[iObject] = true;
137 
138  auto& objKeepCut = this->streamCache(streamID)->objKeepCut_;
139  auto& objRemoveCut = this->streamCache(streamID)->objRemoveCut_;
140  for (unsigned int iSrc = 0; iSrc < srcObjectsTokens_.size(); iSrc++) {
142  iEvent.getByToken(srcObjectsTokens_[iSrc], objects);
143 
144  for (unsigned int iObject = 0; iObject < candidates->size(); iObject++) {
145  const T& candidate = candidates->at(iObject);
146  if (!objKeepCut(candidate))
147  isClean[iObject] = false;
148 
149  for (unsigned int iObj = 0; iObj < objects->size(); iObj++) {
150  const reco::Candidate& obj = objects->at(iObj);
151  if (!objRemoveCut(obj))
152  continue;
153 
154  double deltaR = reco::deltaR(candidate, obj);
155  if (deltaR < deltaRMin_)
156  isClean[iObject] = false;
157  }
158  }
159  }
160 
161  for (unsigned int iObject = 0; iObject < candidates->size(); iObject++)
162  if (isClean[iObject])
163  cleanObjects->push_back(candidates->refAt(iObject));
164 
165  nObjectsTot_ += candidates->size();
166  nObjectsClean_ += cleanObjects->size();
167 
168  delete[] isClean;
169  iEvent.put(std::move(cleanObjects));
170 }
std::atomic< unsigned int > nObjectsTot_
const std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > srcObjectsTokens_
std::atomic< unsigned int > nObjectsClean_
const double deltaRMin_
int iEvent
Definition: GenABIO.cc:224
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
const edm::EDGetTokenT< edm::View< T > > srcCandsToken_
long double T
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ deltaRMin_

template<typename T >
const double ObjectViewCleaner< T >::deltaRMin_
private

Definition at line 82 of file ObjectViewCleaner.cc.

◆ keep_

template<typename T >
const std::string ObjectViewCleaner< T >::keep_
private

Definition at line 85 of file ObjectViewCleaner.cc.

◆ moduleLabel_

template<typename T >
const std::string ObjectViewCleaner< T >::moduleLabel_
private

◆ nObjectsClean_

template<typename T >
std::atomic<unsigned int> ObjectViewCleaner< T >::nObjectsClean_
mutableprivate

Definition at line 89 of file ObjectViewCleaner.cc.

◆ nObjectsTot_

template<typename T >
std::atomic<unsigned int> ObjectViewCleaner< T >::nObjectsTot_
mutableprivate

Definition at line 88 of file ObjectViewCleaner.cc.

◆ remove_

template<typename T >
const std::string ObjectViewCleaner< T >::remove_
private

Definition at line 86 of file ObjectViewCleaner.cc.

◆ srcCandsToken_

template<typename T >
const edm::EDGetTokenT<edm::View<T> > ObjectViewCleaner< T >::srcCandsToken_
private

Definition at line 80 of file ObjectViewCleaner.cc.

◆ srcObjectsTokens_

template<typename T >
const std::vector<edm::EDGetTokenT<edm::View<reco::Candidate> > > ObjectViewCleaner< T >::srcObjectsTokens_
private

Definition at line 81 of file ObjectViewCleaner.cc.