CMS 3D CMS Logo

TrackFromPackedCandidateProducer.cc
Go to the documentation of this file.
1 
5 //
6 // Original Author: Olga Kodolova,40 R-A12,+41227671273,
7 // Created: Fri Feb 19 10:14:02 CET 2010
8 //
9 //
10 
11 // system include files
12 #include <memory>
13 // user include files
25 
27 public:
29  explicit TrackFromPackedCandidateProducer(const edm::ParameterSet& iConfig);
30 
32  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
33 
35  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
36 
37 private:
39 };
40 
42  : tokenPFCandidates_(
43  consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("PFCandidates"))) {
44  produces<reco::TrackCollection>();
45 }
46 
49  desc.add<edm::InputTag>("PFCandidates");
50  iDescriptions.addWithDefaultLabel(desc);
51 }
52 
54  edm::Event& theEvent,
55  const edm::EventSetup& setup) const {
56  //
57  // create empty output collections
58  //
59  auto outputTColl = std::make_unique<reco::TrackCollection>();
60  auto const pfCandidates = theEvent.get(tokenPFCandidates_);
61  outputTColl->reserve(pfCandidates.size());
62 
63  for (auto const& pf : pfCandidates) {
64  if (pf.hasTrackDetails()) {
65  const reco::Track& mytrack = pf.pseudoTrack();
66  using namespace edm;
67  if (isNotFinite(mytrack.pt()) || isNotFinite(mytrack.eta()) || isNotFinite(mytrack.phi()))
68  continue;
69  outputTColl->push_back(mytrack);
70  }
71  }
72  //put everything in the event
73  theEvent.put(std::move(outputTColl));
74 }
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
zmumugammaAnalyzer_cfi.pfCandidates
pfCandidates
Definition: zmumugammaAnalyzer_cfi.py:11
TrackFromPackedCandidateProducer
Definition: TrackFromPackedCandidateProducer.cc:26
TrackFromPackedCandidateProducer::TrackFromPackedCandidateProducer
TrackFromPackedCandidateProducer(const edm::ParameterSet &iConfig)
Constructor.
Definition: TrackFromPackedCandidateProducer.cc:41
MessageLogger.h
TrackFromPackedCandidateProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Implementation of produce method.
Definition: TrackFromPackedCandidateProducer.cc:53
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TrackFromPackedCandidateProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
fill descriptions
Definition: TrackFromPackedCandidateProducer.cc:47
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition: TrackBase.h:637
MakerMacros.h
Track.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
reco::Track
Definition: Track.h:27
reco::TrackBase::phi
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
PackedCandidate.h
reco::TrackBase::eta
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EventSetup
Definition: EventSetup.h:58
pat
Definition: HeavyIon.h:7
TrackFromPackedCandidateProducer::tokenPFCandidates_
const edm::EDGetTokenT< std::vector< pat::PackedCandidate > > tokenPFCandidates_
Definition: TrackFromPackedCandidateProducer.cc:38
pat::PackedCandidateCollection
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: PackedCandidate.h:1131
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
isFinite.h
Frameworkfwd.h
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
EventSetup.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87