32 if ( iConfig.
exists(
"checkClosestZVertex") ) {
33 checkClosestZVertex_ = iConfig.
getParameter<
bool>(
"checkClosestZVertex");
35 checkClosestZVertex_ =
false;
39 pileUpAlgo_.setVerbose(verbose_);
40 pileUpAlgo_.setCheckClosestZVertex(checkClosestZVertex_);
43 produces< PFCollection > ();
62 auto_ptr< PFCollection >
65 auto_ptr< PFCollectionByValue >
79 bool getFromFwdPtr = iEvent.
getByToken( tokenPFCandidates_, pfCandidates);
80 if ( getFromFwdPtr ) {
81 pfCandidatesRef = pfCandidates.
product();
90 bool getFromView = iEvent.
getByToken( tokenPFCandidates_, pfView );
91 if ( ! getFromView ) {
92 throw cms::Exception(
"PFPileUp is misconfigured. This needs to be either vector<FwdPtr<PFCandidate> >, or View<PFCandidate>");
95 viewEnd = pfView->end(), iview = viewBegin;
96 iview != viewEnd; ++iview ) {
99 pfCandidatesRef = &usedIfNoFwdPtrs;
102 if ( pfCandidatesRef == 0 ) {
103 throw cms::Exception(
"Something went dreadfully wrong with PFPileUp. pfCandidatesRef should never be zero, so this is a logic error.");
108 pileUpAlgo_.process(*pfCandidatesRef,*vertices);
109 pOutput->insert(pOutput->end(),pileUpAlgo_.getPFCandidatesFromPU().begin(),pileUpAlgo_.getPFCandidatesFromPU().end());
119 iEvent.
put( pOutput );
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
virtual void produce(edm::Event &, const edm::EventSetup &) override
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< reco::PFCandidate > PFCollectionByValue
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCollection
T const * product() const
PFPileUp(const edm::ParameterSet &)