22 tokenPFCandidatesView_
34 if ( iConfig.
exists(
"checkClosestZVertex") ) {
35 checkClosestZVertex_ = iConfig.
getParameter<
bool>(
"checkClosestZVertex");
37 checkClosestZVertex_ =
false;
41 pileUpAlgo_.setVerbose(verbose_);
42 pileUpAlgo_.setCheckClosestZVertex(checkClosestZVertex_);
45 produces< PFCollection > ();
64 unique_ptr< PFCollection >
67 unique_ptr< PFCollectionByValue >
81 bool getFromFwdPtr = iEvent.
getByToken( tokenPFCandidates_, pfCandidates);
82 if ( getFromFwdPtr ) {
83 pfCandidatesRef = pfCandidates.
product();
92 bool getFromView = iEvent.
getByToken( tokenPFCandidatesView_, pfView );
93 if ( ! getFromView ) {
94 throw cms::Exception(
"PFPileUp is misconfigured. This needs to be either vector<FwdPtr<PFCandidate> >, or View<PFCandidate>");
97 viewEnd = pfView->end(), iview = viewBegin;
98 iview != viewEnd; ++iview ) {
101 pfCandidatesRef = &usedIfNoFwdPtrs;
104 if ( pfCandidatesRef ==
nullptr ) {
105 throw cms::Exception(
"Something went dreadfully wrong with PFPileUp. pfCandidatesRef should never be zero, so this is a logic error.");
110 pileUpAlgo_.process(*pfCandidatesRef,*vertices);
111 pOutput->insert(pOutput->end(),pileUpAlgo_.getPFCandidatesFromPU().begin(),pileUpAlgo_.getPFCandidatesFromPU().end());
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< reco::PFCandidate > PFCollectionByValue
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCollection
T const * product() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
PFPileUp(const edm::ParameterSet &)