64 std::unique_ptr<PFEGammaFilters>
pfegamma_ =
nullptr;
103 : pfCandidatesToken_{produces<reco::PFCandidateCollection>()},
104 pfCleanedCandidatesToken_{produces<reco::PFCandidateCollection>(
"CleanedHF")},
105 inputTagBlocks_(consumes<reco::PFBlockCollection>(iConfig.getParameter<
InputTag>(
"blocks"))),
106 pfEnergyCalibrationHF_(iConfig.getParameter<
bool>(
"calibHF_use"),
107 iConfig.getParameter<std::vector<double>>(
"calibHF_eta_step"),
108 iConfig.getParameter<std::vector<double>>(
"calibHF_a_EMonly"),
109 iConfig.getParameter<std::vector<double>>(
"calibHF_b_HADonly"),
110 iConfig.getParameter<std::vector<double>>(
"calibHF_a_EMHAD"),
111 iConfig.getParameter<std::vector<double>>(
"calibHF_b_EMHAD")),
112 pfAlgo_(iConfig.getParameter<
double>(
"pf_nsigma_ECAL"),
113 iConfig.getParameter<
double>(
"pf_nsigma_HCAL"),
114 iConfig.getParameter<
double>(
"pf_nsigma_HFEM"),
115 iConfig.getParameter<
double>(
"pf_nsigma_HFHAD"),
116 iConfig.getParameter<std::vector<double>>(
"resolHF_square"),
117 pfEnergyCalibration_,
118 pfEnergyCalibrationHF_,
121 inputTagMuons_ = consumes<reco::MuonCollection>(iConfig.getParameter<
InputTag>(
"muons"));
122 postMuonCleaning_ = iConfig.getParameter<
bool>(
"postMuonCleaning");
124 if (iConfig.existsAs<
bool>(
"useEGammaFilters")) {
125 use_EGammaFilters_ = iConfig.getParameter<
bool>(
"useEGammaFilters");
127 use_EGammaFilters_ =
false;
130 useEGammaElectrons_ = iConfig.getParameter<
bool>(
"useEGammaElectrons");
132 if (useEGammaElectrons_) {
133 inputTagEgammaElectrons_ =
134 consumes<reco::GsfElectronCollection>(iConfig.getParameter<
edm::InputTag>(
"egammaElectrons"));
138 produces<reco::PFCandidateCollection>(
"CleanedCosmicsMuons");
139 produces<reco::PFCandidateCollection>(
"CleanedTrackerAndGlobalMuons");
140 produces<reco::PFCandidateCollection>(
"CleanedFakeMuons");
141 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughMuons");
142 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughNeutralHadrons");
143 produces<reco::PFCandidateCollection>(
"AddedMuonsAndHadrons");
148 if (use_EGammaFilters_) {
149 inputTagPFEGammaCandidates_ =
150 consumes<edm::View<reco::PFCandidate>>((iConfig.getParameter<
edm::InputTag>(
"PFEGammaCandidates")));
151 inputTagValueMapGedElectrons_ =
152 consumes<edm::ValueMap<reco::GsfElectronRef>>(iConfig.getParameter<
edm::InputTag>(
"GedElectronValueMap"));
153 inputTagValueMapGedPhotons_ =
154 consumes<edm::ValueMap<reco::PhotonRef>>(iConfig.getParameter<
edm::InputTag>(
"GedPhotonValueMap"));
168 bool usePFDecays = iConfig.getParameter<
bool>(
"usePFDecays");
170 double dptRel_DispVtx = iConfig.getParameter<
double>(
"dptRel_DispVtx");
172 useCalibrationsFromDB_ = iConfig.getParameter<
bool>(
"useCalibrationsFromDB");
174 if (useCalibrationsFromDB_)
175 calibrationsLabel_ = iConfig.getParameter<
std::string>(
"calibrationsLabel");
180 if (use_EGammaFilters_) {
183 pfegamma_ = std::make_unique<PFEGammaFilters>(pfEGammaFiltersParams);
187 pfAlgo_.setDisplacedVerticesParameters(
191 pfAlgo_.setCandConnectorParameters(iConfig.getParameter<
edm::ParameterSet>(
"iCfgCandConnector"));
194 postHFCleaning_ = iConfig.getParameter<
bool>(
"postHFCleaning");
198 pfAlgo_.setPostHFCleaningParameters(postHFCleaning_, pfHFCleaningParams);
201 std::vector<edm::InputTag>
tags = iConfig.getParameter<std::vector<edm::InputTag>>(
"cleanedHF");
202 for (
unsigned int i = 0;
i <
tags.size(); ++
i)
203 inputTagCleanedHF_.push_back(consumes<reco::PFRecHitCollection>(
tags[
i]));
205 vertices_ = consumes<reco::VertexCollection>(iConfig.getParameter<
edm::InputTag>(
"vertexCollection"));
206 useVerticesForNeutral_ = iConfig.getParameter<
bool>(
"useVerticesForNeutral");
209 useHO_ = iConfig.getParameter<
bool>(
"useHO");
210 pfAlgo_.setHOTag(useHO_);
212 verbose_ = iConfig.getUntrackedParameter<
bool>(
"verbose",
false);
222 static_cast<const PerformancePayloadFromTFormula*>(perfH.
product());
229 LogDebug(
"PFProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run() << endl;
247 LogDebug(
"PFProducer") <<
"particle flow is starting" << endl;
265 for (
unsigned jhf = 0; jhf < (*hfCleaned).size(); ++jhf) {
266 hfCopy.push_back((*hfCleaned)[jhf]);
275 LogDebug(
"PFProducer") <<
"particle flow: putting products in the event";
279 for (
auto const&
cand : pOutputCandidateCollection) {
281 ss <<
" " << nC <<
") pid=" <<
cand.particleId() <<
" pt=" <<
cand.pt() << endl;
283 LogDebug(
"PFProducer") <<
"Here the full list:" << endl <<
ss.str();
293 iEvent.put(muAlgo.transferCleanedCosmicCandidates(),
"CleanedCosmicsMuons");
295 iEvent.put(muAlgo.transferCleanedTrackerAndGlobalCandidates(),
"CleanedTrackerAndGlobalMuons");
297 iEvent.put(muAlgo.transferCleanedFakeCandidates(),
"CleanedFakeMuons");
299 iEvent.put(muAlgo.transferPunchThroughCleanedMuonCandidates(),
"CleanedPunchThroughMuons");
301 iEvent.put(muAlgo.transferPunchThroughCleanedHadronCandidates(),
"CleanedPunchThroughNeutralHadrons");
303 iEvent.put(muAlgo.transferAddedMuonCandidates(),
"AddedMuonsAndHadrons");
319 desc.
add<
bool>(
"postMuonCleaning",
true);
323 desc.
add<
bool>(
"useVerticesForNeutral",
true);
326 desc.
add<
bool>(
"useHO",
true);
330 desc.
add<
edm::InputTag>(
"GedElectronValueMap", {
"gedGsfElectronValueMapsTmp"});
333 desc.
add<
bool>(
"useEGammaElectrons",
true);
336 desc.
add<
bool>(
"useEGammaFilters",
true);
337 desc.
add<
bool>(
"useProtectionsForJetMET",
true);
346 desc.
add<std::vector<double>>(
"muon_HCAL", {3.0, 3.0});
347 desc.
add<std::vector<double>>(
"muon_ECAL", {0.5, 0.5});
348 desc.
add<std::vector<double>>(
"muon_HO", {0.9, 0.9});
357 desc.
add<
bool>(
"rejectTracks_Bad",
true);
358 desc.
add<
bool>(
"rejectTracks_Step45",
true);
360 desc.
add<
bool>(
"usePFNuclearInteractions",
true);
361 desc.
add<
bool>(
"usePFConversions",
true);
362 desc.
add<
bool>(
"usePFDecays",
false);
364 desc.
add<
double>(
"dptRel_DispVtx", 10.0);
372 desc.
add<
double>(
"nsigma_TRACK", 1.0)->
setComment(
"Number of sigmas for fake track detection");
374 desc.
add<
double>(
"pt_Error", 1.0)
375 ->
setComment(
"Absolute pt error to detect fake tracks in the first three iterations");
376 desc.
add<std::vector<double>>(
"factors_45", {10.0, 100.0})
377 ->setComment(
"Factors to be applied in the four and fifth steps to the pt error");
380 desc.
add<
double>(
"goodTrackDeadHcal_ptErrRel", 0.2)->
setComment(
"trackRef->ptError()/trackRef->pt() < X");
381 desc.
add<
double>(
"goodTrackDeadHcal_chi2n", 5)->setComment(
"trackRef->normalizedChi2() < X");
382 desc.
add<
unsigned int>(
"goodTrackDeadHcal_layers", 4)
383 ->setComment(
"trackRef->hitPattern().trackerLayersWithMeasurement() >= X");
384 desc.
add<
double>(
"goodTrackDeadHcal_validFr", 0.5)->
setComment(
"trackRef->validFraction() > X");
385 desc.
add<
double>(
"goodTrackDeadHcal_dxy", 0.5)->
setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm]");
387 desc.
add<
double>(
"goodPixelTrackDeadHcal_minEta", 2.3)->
setComment(
"abs(trackRef->eta()) > X");
388 desc.
add<
double>(
"goodPixelTrackDeadHcal_maxPt", 50.0)->
setComment(
"trackRef->ptError()/trackRef->pt() < X");
389 desc.
add<
double>(
"goodPixelTrackDeadHcal_ptErrRel", 1.0)->
setComment(
"trackRef->ptError()/trackRef->pt() < X");
390 desc.
add<
double>(
"goodPixelTrackDeadHcal_chi2n", 2)->setComment(
"trackRef->normalizedChi2() < X");
391 desc.
add<
int>(
"goodPixelTrackDeadHcal_maxLost3Hit", 0)
393 "max missing outer hits for a track with 3 valid pixel layers (can set to -1 to reject all these tracks)");
394 desc.
add<
int>(
"goodPixelTrackDeadHcal_maxLost4Hit", 1)
395 ->setComment(
"max missing outer hits for a track with >= 4 valid pixel layers");
396 desc.
add<
double>(
"goodPixelTrackDeadHcal_dxy", 0.02)
397 ->
setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm] ");
398 desc.
add<
double>(
"goodPixelTrackDeadHcal_dz", 0.05)
399 ->
setComment(
"abs(trackRef->dz(primaryVertex_.position())) < X [cm]");
402 desc.
add<
double>(
"pf_nsigma_ECAL", 0.0);
403 desc.
add<
double>(
"pf_nsigma_HCAL", 1.0);
404 desc.
add<
double>(
"pf_nsigma_HFEM", 1.0);
405 desc.
add<
double>(
"pf_nsigma_HFHAD", 1.0);
408 desc.
add<
bool>(
"useCalibrationsFromDB",
true);
412 desc.
add<
bool>(
"postHFCleaning",
false);
415 psd_PFHFCleaning.
add<
double>(
"minHFCleaningPt", 5.0)
416 ->
setComment(
"Clean only objects with pt larger than this value");
417 psd_PFHFCleaning.
add<
double>(
"maxSignificance", 2.5)
418 ->
setComment(
"Clean only if the initial MET/sqrt(sumet) is larger than this value");
419 psd_PFHFCleaning.
add<
double>(
"minSignificance", 2.5)
420 ->
setComment(
"Clean only if the final MET/sqrt(sumet) is smaller than this value");
421 psd_PFHFCleaning.
add<
double>(
"minSignificanceReduction", 1.4)
422 ->
setComment(
"Clean only if the significance reduction is larger than this value");
423 psd_PFHFCleaning.
add<
double>(
"maxDeltaPhiPt", 7.0)
424 ->
setComment(
"Clean only if the MET and the to-be-cleaned object satisfy this DeltaPhi * Pt cut");
426 psd_PFHFCleaning.
add<
double>(
"minDeltaMet", 0.4)
428 "Clean only if the MET relative reduction from the to-be-cleaned object is larger than this value");
433 desc.
add<std::vector<edm::InputTag>>(
"cleanedHF",
440 desc.
add<
bool>(
"calibHF_use",
false);
441 desc.
add<std::vector<double>>(
"calibHF_eta_step", {0.0, 2.9, 3.0, 3.2, 4.2, 4.4, 4.6, 4.8, 5.2, 5.4});
442 desc.
add<std::vector<double>>(
"calibHF_a_EMonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
443 desc.
add<std::vector<double>>(
"calibHF_a_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
444 desc.
add<std::vector<double>>(
"calibHF_b_HADonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
445 desc.
add<std::vector<double>>(
"calibHF_b_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
448 desc.
add<std::vector<double>>(
"resolHF_square", {2.799 * 2.799, 0.114 * 0.114, 0.0 * 0.0})
449 ->setComment(
"HF resolution - stochastic, constant, noise term squares");
451 descriptions.
add(
"particleFlow", desc);