87 fUseVertexAssociation = iConfig.
getParameter<
bool>(
"useVertexAssociation");
88 vertexAssociationQuality_ = iConfig.
getParameter<
int>(
"vertexAssociationQuality");
89 if (fUseVertexAssociation) {
91 tokenVertexAssociationQuality_ =
99 if (iConfig.
exists(
"checkClosestZVertex")) {
100 checkClosestZVertex_ = iConfig.
getParameter<
bool>(
"checkClosestZVertex");
102 checkClosestZVertex_ =
false;
106 pileUpAlgo_.setVerbose(verbose_);
107 pileUpAlgo_.setCheckClosestZVertex(checkClosestZVertex_);
110 produces<PFCollection>();
135 bool getFromFwdPtr = iEvent.
getByToken(tokenPFCandidates_, pfCandidates);
137 pfCandidatesRef = pfCandidates.
product();
146 bool getFromView = iEvent.
getByToken(tokenPFCandidatesView_, pfView);
149 "PFPileUp is misconfigured. This needs to be either vector<FwdPtr<PFCandidate> >, or View<PFCandidate>");
152 viewEnd = pfView->end(),
156 usedIfNoFwdPtrs.push_back(
159 pfCandidatesRef = &usedIfNoFwdPtrs;
162 if (pfCandidatesRef ==
nullptr) {
164 "Something went dreadfully wrong with PFPileUp. pfCandidatesRef should never be zero, so this is a logic "
168 if (fUseVertexAssociation) {
172 for (
auto&
p : (*pfCandidatesRef)) {
174 int quality = associationQuality[
p];
175 if (PVOrig.
isNonnull() && (PVOrig.
key() > 0) && (quality >= vertexAssociationQuality_))
176 pfCandidatesFromPU.push_back(
p);
178 pOutput->insert(pOutput->end(), pfCandidatesFromPU.begin(), pfCandidatesFromPU.end());
180 pileUpAlgo_.process(*pfCandidatesRef, *vertices);
182 pOutput->end(), pileUpAlgo_.getPFCandidatesFromPU().begin(), pileUpAlgo_.getPFCandidatesFromPU().end());
T getUntrackedParameter(std::string const &, T const &) const
int vertexAssociationQuality_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
Identifies pile-up candidates from a collection of PFCandidates, and produces the corresponding colle...
edm::Association< reco::VertexCollection > CandToVertex
edm::EDGetTokenT< reco::VertexCollection > tokenVertices_
vertices
edm::EDGetTokenT< PFView > tokenPFCandidatesView_
fall-back token
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
uint32_t const *__restrict__ Quality * quality
bool exists(std::string const ¶meterName) const
checks if a parameter exists
key_type key() const
Accessor for product key.
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< reco::PFCandidate > PFCollectionByValue
bool get(ProductID const &oid, Handle< PROD > &result) const
edm::EDGetTokenT< PFCollection > tokenPFCandidates_
PFCandidates to be analyzed.
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCollection
edm::EDGetTokenT< CandToVertex > tokenVertexAssociation_
bool enable_
enable PFPileUp selection
bool fUseVertexAssociation
edm::EDGetTokenT< edm::ValueMap< int > > tokenVertexAssociationQuality_
T const * product() const
T getParameter(std::string const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
bool checkClosestZVertex_
use the closest z vertex if a track is not in a vertex
PFPileUp(const edm::ParameterSet &)
edm::View< reco::PFCandidate > PFView