68 std::unique_ptr<PFEGammaFilters>
pfegamma_ =
nullptr;
107 : pfCandidatesToken_{produces<reco::PFCandidateCollection>()},
108 pfCleanedCandidatesToken_{produces<reco::PFCandidateCollection>(
"CleanedHF")},
109 inputTagBlocks_(consumes<reco::PFBlockCollection>(iConfig.getParameter<
InputTag>(
"blocks"))),
110 pfEnergyCalibrationHF_(iConfig.getParameter<
bool>(
"calibHF_use"),
111 iConfig.getParameter<std::vector<double>>(
"calibHF_eta_step"),
112 iConfig.getParameter<std::vector<double>>(
"calibHF_a_EMonly"),
113 iConfig.getParameter<std::vector<double>>(
"calibHF_b_HADonly"),
114 iConfig.getParameter<std::vector<double>>(
"calibHF_a_EMHAD"),
115 iConfig.getParameter<std::vector<double>>(
"calibHF_b_EMHAD")),
116 pfAlgo_(iConfig.getParameter<
double>(
"pf_nsigma_ECAL"),
117 iConfig.getParameter<
double>(
"pf_nsigma_HCAL"),
118 iConfig.getParameter<
double>(
"pf_nsigma_HFEM"),
119 iConfig.getParameter<
double>(
"pf_nsigma_HFHAD"),
120 iConfig.getParameter<std::vector<double>>(
"resolHF_square"),
121 pfEnergyCalibration_,
122 pfEnergyCalibrationHF_,
125 inputTagMuons_ = consumes<reco::MuonCollection>(iConfig.getParameter<
InputTag>(
"muons"));
126 postMuonCleaning_ = iConfig.getParameter<
bool>(
"postMuonCleaning");
127 vetoEndcap_ = iConfig.getParameter<
bool>(
"vetoEndcap");
129 inputTagVetoes_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<
edm::InputTag>(
"vetoes"));
131 if (iConfig.existsAs<
bool>(
"useEGammaFilters")) {
132 use_EGammaFilters_ = iConfig.getParameter<
bool>(
"useEGammaFilters");
134 use_EGammaFilters_ =
false;
137 useEGammaElectrons_ = iConfig.getParameter<
bool>(
"useEGammaElectrons");
139 if (useEGammaElectrons_) {
140 inputTagEgammaElectrons_ =
141 consumes<reco::GsfElectronCollection>(iConfig.getParameter<
edm::InputTag>(
"egammaElectrons"));
145 produces<reco::PFCandidateCollection>(
"CleanedCosmicsMuons");
146 produces<reco::PFCandidateCollection>(
"CleanedTrackerAndGlobalMuons");
147 produces<reco::PFCandidateCollection>(
"CleanedFakeMuons");
148 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughMuons");
149 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughNeutralHadrons");
150 produces<reco::PFCandidateCollection>(
"AddedMuonsAndHadrons");
156 if (use_EGammaFilters_) {
157 inputTagPFEGammaCandidates_ =
158 consumes<edm::View<reco::PFCandidate>>((iConfig.getParameter<
edm::InputTag>(
"PFEGammaCandidates")));
159 inputTagValueMapGedElectrons_ =
160 consumes<edm::ValueMap<reco::GsfElectronRef>>(iConfig.getParameter<
edm::InputTag>(
"GedElectronValueMap"));
161 inputTagValueMapGedPhotons_ =
162 consumes<edm::ValueMap<reco::PhotonRef>>(iConfig.getParameter<
edm::InputTag>(
"GedPhotonValueMap"));
167 pfegamma_ = std::make_unique<PFEGammaFilters>(pfEGammaFiltersParams);
183 bool usePFDecays = iConfig.getParameter<
bool>(
"usePFDecays");
185 double dptRel_DispVtx = iConfig.getParameter<
double>(
"dptRel_DispVtx");
187 useCalibrationsFromDB_ = iConfig.getParameter<
bool>(
"useCalibrationsFromDB");
189 if (useCalibrationsFromDB_)
190 calibrationsLabel_ = iConfig.getParameter<
std::string>(
"calibrationsLabel");
193 pfAlgo_.setDisplacedVerticesParameters(
197 pfAlgo_.setCandConnectorParameters(iConfig.getParameter<
edm::ParameterSet>(
"iCfgCandConnector"));
200 postHFCleaning_ = iConfig.getParameter<
bool>(
"postHFCleaning");
204 pfAlgo_.setPostHFCleaningParameters(postHFCleaning_, pfHFCleaningParams);
207 std::vector<edm::InputTag>
tags = iConfig.getParameter<std::vector<edm::InputTag>>(
"cleanedHF");
208 for (
unsigned int i = 0;
i <
tags.size(); ++
i)
209 inputTagCleanedHF_.push_back(consumes<reco::PFRecHitCollection>(
tags[
i]));
211 vertices_ = consumes<reco::VertexCollection>(iConfig.getParameter<
edm::InputTag>(
"vertexCollection"));
212 useVerticesForNeutral_ = iConfig.getParameter<
bool>(
"useVerticesForNeutral");
215 useHO_ = iConfig.getParameter<
bool>(
"useHO");
216 pfAlgo_.setHOTag(useHO_);
218 verbose_ = iConfig.getUntrackedParameter<
bool>(
"verbose",
false);
228 static_cast<const PerformancePayloadFromTFormula*>(perfH.
product());
235 LogDebug(
"PFProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run() << endl;
258 LogDebug(
"PFProducer") <<
"particle flow is starting" << endl;
276 for (
unsigned jhf = 0; jhf < (*hfCleaned).size(); ++jhf) {
277 hfCopy.push_back((*hfCleaned)[jhf]);
286 LogDebug(
"PFProducer") <<
"particle flow: putting products in the event";
290 for (
auto const&
cand : pOutputCandidateCollection) {
292 ss <<
" " << nC <<
") pid=" <<
cand.particleId() <<
" pt=" <<
cand.pt() << endl;
294 LogDebug(
"PFProducer") <<
"Here the full list:" << endl <<
ss.str();
304 iEvent.put(muAlgo.transferCleanedCosmicCandidates(),
"CleanedCosmicsMuons");
306 iEvent.put(muAlgo.transferCleanedTrackerAndGlobalCandidates(),
"CleanedTrackerAndGlobalMuons");
308 iEvent.put(muAlgo.transferCleanedFakeCandidates(),
"CleanedFakeMuons");
310 iEvent.put(muAlgo.transferPunchThroughCleanedMuonCandidates(),
"CleanedPunchThroughMuons");
312 iEvent.put(muAlgo.transferPunchThroughCleanedHadronCandidates(),
"CleanedPunchThroughNeutralHadrons");
314 iEvent.put(muAlgo.transferAddedMuonCandidates(),
"AddedMuonsAndHadrons");
322 desc.addUntracked<
bool>(
"verbose",
false);
323 desc.addUntracked<
bool>(
"debug",
false);
330 desc.add<
bool>(
"postMuonCleaning",
true);
340 desc.add<
bool>(
"useVerticesForNeutral",
true);
343 desc.add<
bool>(
"useHO",
true);
350 desc.add<
bool>(
"useEGammaElectrons",
true);
353 desc.add<
bool>(
"useEGammaFilters",
true);
354 desc.add<
bool>(
"useProtectionsForJetMET",
true);
363 desc.add<std::vector<double>>(
"muon_HCAL", {3.0, 3.0});
364 desc.add<std::vector<double>>(
"muon_ECAL", {0.5, 0.5});
365 desc.add<std::vector<double>>(
"muon_HO", {0.9, 0.9});
374 desc.add<
bool>(
"rejectTracks_Bad",
true);
375 desc.add<
bool>(
"rejectTracks_Step45",
true);
377 desc.add<
bool>(
"usePFNuclearInteractions",
true);
378 desc.add<
bool>(
"usePFConversions",
true);
379 desc.add<
bool>(
"usePFDecays",
false);
381 desc.add<
double>(
"dptRel_DispVtx", 10.0);
389 desc.add<
double>(
"nsigma_TRACK", 1.0)->setComment(
"Number of sigmas for fake track detection");
391 desc.add<
double>(
"pt_Error", 1.0)
392 ->setComment(
"Absolute pt error to detect fake tracks in the first three iterations");
393 desc.add<std::vector<double>>(
"factors_45", {10.0, 100.0})
394 ->setComment(
"Factors to be applied in the four and fifth steps to the pt error");
397 desc.add<
double>(
"goodTrackDeadHcal_ptErrRel", 0.2)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
398 desc.add<
double>(
"goodTrackDeadHcal_chi2n", 5)->setComment(
"trackRef->normalizedChi2() < X");
399 desc.add<
unsigned int>(
"goodTrackDeadHcal_layers", 4)
400 ->setComment(
"trackRef->hitPattern().trackerLayersWithMeasurement() >= X");
401 desc.add<
double>(
"goodTrackDeadHcal_validFr", 0.5)->setComment(
"trackRef->validFraction() > X");
402 desc.add<
double>(
"goodTrackDeadHcal_dxy", 0.5)->setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm]");
404 desc.add<
double>(
"goodPixelTrackDeadHcal_minEta", 2.3)->setComment(
"abs(trackRef->eta()) > X");
405 desc.add<
double>(
"goodPixelTrackDeadHcal_maxPt", 50.0)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
406 desc.add<
double>(
"goodPixelTrackDeadHcal_ptErrRel", 1.0)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
407 desc.add<
double>(
"goodPixelTrackDeadHcal_chi2n", 2)->setComment(
"trackRef->normalizedChi2() < X");
408 desc.add<
int>(
"goodPixelTrackDeadHcal_maxLost3Hit", 0)
410 "max missing outer hits for a track with 3 valid pixel layers (can set to -1 to reject all these tracks)");
411 desc.add<
int>(
"goodPixelTrackDeadHcal_maxLost4Hit", 1)
412 ->setComment(
"max missing outer hits for a track with >= 4 valid pixel layers");
413 desc.add<
double>(
"goodPixelTrackDeadHcal_dxy", 0.02)
414 ->setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm] ");
415 desc.add<
double>(
"goodPixelTrackDeadHcal_dz", 0.05)
416 ->setComment(
"abs(trackRef->dz(primaryVertex_.position())) < X [cm]");
419 desc.add<
double>(
"pf_nsigma_ECAL", 0.0);
420 desc.add<
double>(
"pf_nsigma_HCAL", 1.0);
421 desc.add<
double>(
"pf_nsigma_HFEM", 1.0);
422 desc.add<
double>(
"pf_nsigma_HFHAD", 1.0);
425 desc.add<
bool>(
"useCalibrationsFromDB",
true);
429 desc.add<
bool>(
"postHFCleaning",
false);
432 psd_PFHFCleaning.
add<
double>(
"minHFCleaningPt", 5.0)
433 ->
setComment(
"Clean only objects with pt larger than this value");
434 psd_PFHFCleaning.
add<
double>(
"maxSignificance", 2.5)
435 ->
setComment(
"Clean only if the initial MET/sqrt(sumet) is larger than this value");
436 psd_PFHFCleaning.
add<
double>(
"minSignificance", 2.5)
437 ->
setComment(
"Clean only if the final MET/sqrt(sumet) is smaller than this value");
438 psd_PFHFCleaning.
add<
double>(
"minSignificanceReduction", 1.4)
439 ->
setComment(
"Clean only if the significance reduction is larger than this value");
440 psd_PFHFCleaning.
add<
double>(
"maxDeltaPhiPt", 7.0)
441 ->
setComment(
"Clean only if the MET and the to-be-cleaned object satisfy this DeltaPhi * Pt cut");
443 psd_PFHFCleaning.
add<
double>(
"minDeltaMet", 0.4)
445 "Clean only if the MET relative reduction from the to-be-cleaned object is larger than this value");
450 desc.add<std::vector<edm::InputTag>>(
"cleanedHF",
457 desc.add<
bool>(
"calibHF_use",
false);
458 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});
459 desc.add<std::vector<double>>(
"calibHF_a_EMonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
460 desc.add<std::vector<double>>(
"calibHF_a_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
461 desc.add<std::vector<double>>(
"calibHF_b_HADonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
462 desc.add<std::vector<double>>(
"calibHF_b_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
465 desc.add<std::vector<double>>(
"resolHF_square", {2.799 * 2.799, 0.114 * 0.114, 0.0 * 0.0})
466 ->setComment(
"HF resolution - stochastic, constant, noise term squares");
468 descriptions.
add(
"particleFlow",
desc);