CMS 3D CMS Logo

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

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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
 

Detailed Description

Definition at line 12 of file IsolatedTrackCleaner.cc.

Constructor & Destructor Documentation

◆ IsolatedTrackCleaner()

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

Definition at line 14 of file IsolatedTrackCleaner.cc.

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

References leptons_, CalibrationSummaryClient_cfi::params, and GlobalPosition_Frontier_DevDB_cff::tag.

◆ ~IsolatedTrackCleaner()

IsolatedTrackCleaner::~IsolatedTrackCleaner ( )
inlineoverride

Definition at line 23 of file IsolatedTrackCleaner.cc.

23 {}

Member Function Documentation

◆ produce()

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

Definition at line 25 of file IsolatedTrackCleaner.cc.

25  {
26  auto out = std::make_unique<std::vector<pat::IsolatedTrack>>();
27 
28  std::vector<reco::CandidatePtr> leptonPfCands;
30  for (const auto& token : leptons_) {
31  iEvent.getByToken(token, leptons);
32  for (const auto& lep : *leptons) {
33  for (unsigned int i = 0, n = lep.numberOfSourceCandidatePtrs(); i < n; ++i) {
34  auto ptr = lep.sourceCandidatePtr(i);
35  if (ptr.isNonnull())
36  leptonPfCands.push_back(ptr);
37  }
38  }
39  }
40  std::sort(leptonPfCands.begin(), leptonPfCands.end());
41 
43  iEvent.getByToken(tracks_, tracks);
44  for (const auto& track : *tracks) {
45  if (!cut_(track))
46  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  }

References cut_, mps_fire::i, iEvent, HLT_FULL_cff::leptons, leptons_, eostools::move(), dqmiodumpmetadata::n, MillePedeFileConverter_cfg::out, edm::refToPtr(), jetUpdater_cfi::sort, unpackBuffers-CaloStage2::token, HLT_FULL_cff::track, tracks, and tracks_.

Member Data Documentation

◆ cut_

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

Definition at line 61 of file IsolatedTrackCleaner.cc.

Referenced by produce().

◆ leptons_

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

Definition at line 62 of file IsolatedTrackCleaner.cc.

Referenced by IsolatedTrackCleaner(), and produce().

◆ tracks_

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

Definition at line 60 of file IsolatedTrackCleaner.cc.

Referenced by produce().

mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HLT_FULL_cff.leptons
leptons
Definition: HLT_FULL_cff.py:26277
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm::Handle
Definition: AssociativeIterator.h:50
edm::refToPtr
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
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::Ptr< Candidate >
IsolatedTrackCleaner::leptons_
std::vector< edm::EDGetTokenT< reco::CandidateView > > leptons_
Definition: IsolatedTrackCleaner.cc:62
eostools.move
def move(src, dest)
Definition: eostools.py:511
IsolatedTrackCleaner::cut_
StringCutObjectSelector< pat::IsolatedTrack > cut_
Definition: IsolatedTrackCleaner.cc:61
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
IsolatedTrackCleaner::tracks_
edm::EDGetTokenT< std::vector< pat::IsolatedTrack > > tracks_
Definition: IsolatedTrackCleaner.cc:60
edm::InputTag
Definition: InputTag.h:15
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316