CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
IsolatedTrackCleaner Class Reference
Inheritance diagram for IsolatedTrackCleaner:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 IsolatedTrackCleaner (edm::ParameterSet const &params)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~IsolatedTrackCleaner () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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
 
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)
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Attributes

StringCutObjectSelector< pat::IsolatedTrackcut_
 
std::vector< edm::EDGetTokenT< reco::CandidateView > > leptons_
 
edm::EDGetTokenT< std::vector< pat::IsolatedTrack > > tracks_
 

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
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::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Definition at line 13 of file IsolatedTrackCleaner.cc.

Constructor & Destructor Documentation

IsolatedTrackCleaner::IsolatedTrackCleaner ( edm::ParameterSet const &  params)
inline

Definition at line 15 of file IsolatedTrackCleaner.cc.

References edm::ParameterSet::getParameter(), leptons_, and GlobalPosition_Frontier_DevDB_cff::tag.

15  :
16  tracks_(consumes<std::vector<pat::IsolatedTrack>>(params.getParameter<edm::InputTag>("tracks"))),
17  cut_(params.getParameter<std::string>("cut"))
18  {
19  for (const edm::InputTag & tag : params.getParameter<std::vector<edm::InputTag>>("finalLeptons")) {
20  leptons_.push_back(consumes<reco::CandidateView>(tag));
21  }
22  produces<std::vector<pat::IsolatedTrack>>();
23  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< pat::IsolatedTrack > > tracks_
StringCutObjectSelector< pat::IsolatedTrack > cut_
std::vector< edm::EDGetTokenT< reco::CandidateView > > leptons_
IsolatedTrackCleaner::~IsolatedTrackCleaner ( )
inlineoverride

Definition at line 25 of file IsolatedTrackCleaner.cc.

25 {}

Member Function Documentation

void IsolatedTrackCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverride

Definition at line 27 of file IsolatedTrackCleaner.cc.

References cut_, edm::Event::getByToken(), mps_fire::i, AK4GenJetFlavourInfos_cfi::leptons, leptons_, eostools::move(), gen::n, MillePedeFileConverter_cfg::out, edm::Event::put(), edm::refToPtr(), HiIsolationCommonParameters_cff::track, l1t::tracks, and tracks_.

27  {
28  auto out = std::make_unique<std::vector<pat::IsolatedTrack>>();
29 
30  std::vector<reco::CandidatePtr> leptonPfCands;
32  for (const auto & token : leptons_) {
33  iEvent.getByToken(token, leptons);
34  for (const auto & lep : *leptons) {
35  for (unsigned int i = 0, n = lep.numberOfSourceCandidatePtrs(); i < n; ++i) {
36  auto ptr = lep.sourceCandidatePtr(i);
37  if (ptr.isNonnull()) leptonPfCands.push_back(ptr);
38  }
39  }
40  }
41  std::sort(leptonPfCands.begin(), leptonPfCands.end());
42 
44  iEvent.getByToken(tracks_, tracks);
45  for (const auto & track : *tracks) {
46  if (!cut_(track)) continue;
47  if (track.packedCandRef().isNonnull()) {
48  reco::CandidatePtr pfCand(edm::refToPtr(track.packedCandRef()));
49  if (std::binary_search(leptonPfCands.begin(), leptonPfCands.end(), pfCand)) {
50  continue;
51  }
52  }
53  out->push_back(track);
54  }
55 
56  iEvent.put(std::move(out));
57  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
edm::EDGetTokenT< std::vector< pat::IsolatedTrack > > tracks_
StringCutObjectSelector< pat::IsolatedTrack > cut_
def move(src, dest)
Definition: eostools.py:510
std::vector< edm::EDGetTokenT< reco::CandidateView > > leptons_

Member Data Documentation

StringCutObjectSelector<pat::IsolatedTrack> IsolatedTrackCleaner::cut_
protected

Definition at line 61 of file IsolatedTrackCleaner.cc.

Referenced by produce().

std::vector<edm::EDGetTokenT<reco::CandidateView> > IsolatedTrackCleaner::leptons_
protected

Definition at line 62 of file IsolatedTrackCleaner.cc.

Referenced by IsolatedTrackCleaner(), and produce().

edm::EDGetTokenT<std::vector<pat::IsolatedTrack> > IsolatedTrackCleaner::tracks_
protected

Definition at line 60 of file IsolatedTrackCleaner.cc.

Referenced by produce().