CMS 3D CMS Logo

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

Public Member Functions

 pfTracksProducer (const edm::ParameterSet &iConfig)
 
 ~pfTracksProducer () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 

Private Attributes

const bool HighPurity_
 
edm::EDGetToken LostTracks_
 
edm::EDGetToken PFCands_
 
const StringCutObjectSelector< pat::PackedCandidatetrkSelection_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
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
 

Detailed Description

Definition at line 20 of file pfTracksProducer.cc.

Constructor & Destructor Documentation

◆ pfTracksProducer()

pfTracksProducer::pfTracksProducer ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 22 of file pfTracksProducer.cc.

23  : PFCands_(consumes<std::vector<pat::PackedCandidate>>(iConfig.getParameter<edm::InputTag>("PFCands"))),
24  LostTracks_(consumes<std::vector<pat::PackedCandidate>>(iConfig.getParameter<edm::InputTag>("lostTracks"))),
25  trkSelection_(iConfig.getParameter<std::string>("trkSelection")),
26  HighPurity_(iConfig.getParameter<bool>("TrkHPurity")) {
27  produces<reco::TrackCollection>();
28  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetToken LostTracks_
const StringCutObjectSelector< pat::PackedCandidate > trkSelection_
edm::EDGetToken PFCands_
const bool HighPurity_

◆ ~pfTracksProducer()

pfTracksProducer::~pfTracksProducer ( )
inlineoverride

Definition at line 29 of file pfTracksProducer.cc.

29 {}

Member Function Documentation

◆ produce()

void pfTracksProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 40 of file pfTracksProducer.cc.

References HighPurity_, iEvent, isotracks_cff::lostTracks, LostTracks_, eostools::move(), HLT_2023v12_cff::pfcands, PFCands_, DiMuonV_cfg::tracks, and trkSelection_.

40  {
42  iEvent.getByToken(PFCands_, pfcands);
43 
45  iEvent.getByToken(LostTracks_, lostTracks);
46 
47  std::unique_ptr<std::vector<reco::Track>> tracks(new std::vector<reco::Track>());
48  tracks->reserve(pfcands->size() + lostTracks->size());
49 
50  for (const auto& container : {pfcands, lostTracks}) {
51  for (const pat::PackedCandidate& trk : *container) {
52  if (!trk.hasTrackDetails())
53  continue;
54  if (!trkSelection_(trk))
55  continue;
56  if (HighPurity_ && !trk.trackHighPurity())
57  continue;
58  tracks->emplace_back(*trk.bestTrack());
59  }
60  }
61 
62  iEvent.put(std::move(tracks));
63 }
edm::EDGetToken LostTracks_
int iEvent
Definition: GenABIO.cc:224
const StringCutObjectSelector< pat::PackedCandidate > trkSelection_
edm::EDGetToken PFCands_
const bool HighPurity_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ HighPurity_

const bool pfTracksProducer::HighPurity_
private

Definition at line 37 of file pfTracksProducer.cc.

Referenced by produce().

◆ LostTracks_

edm::EDGetToken pfTracksProducer::LostTracks_
private

Definition at line 35 of file pfTracksProducer.cc.

Referenced by produce().

◆ PFCands_

edm::EDGetToken pfTracksProducer::PFCands_
private

Definition at line 34 of file pfTracksProducer.cc.

Referenced by produce().

◆ trkSelection_

const StringCutObjectSelector<pat::PackedCandidate> pfTracksProducer::trkSelection_
private

Definition at line 36 of file pfTracksProducer.cc.

Referenced by produce().