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");
149 if (use_EGammaFilters_) {
150 inputTagPFEGammaCandidates_ =
151 consumes<edm::View<reco::PFCandidate>>((iConfig.getParameter<
edm::InputTag>(
"PFEGammaCandidates")));
152 inputTagValueMapGedElectrons_ =
153 consumes<edm::ValueMap<reco::GsfElectronRef>>(iConfig.getParameter<
edm::InputTag>(
"GedElectronValueMap"));
154 inputTagValueMapGedPhotons_ =
155 consumes<edm::ValueMap<reco::PhotonRef>>(iConfig.getParameter<
edm::InputTag>(
"GedPhotonValueMap"));
160 pfegamma_ = std::make_unique<PFEGammaFilters>(pfEGammaFiltersParams);
176 bool usePFDecays = iConfig.getParameter<
bool>(
"usePFDecays");
178 double dptRel_DispVtx = iConfig.getParameter<
double>(
"dptRel_DispVtx");
180 useCalibrationsFromDB_ = iConfig.getParameter<
bool>(
"useCalibrationsFromDB");
182 if (useCalibrationsFromDB_)
183 calibrationsLabel_ = iConfig.getParameter<
std::string>(
"calibrationsLabel");
186 pfAlgo_.setDisplacedVerticesParameters(
190 pfAlgo_.setCandConnectorParameters(iConfig.getParameter<
edm::ParameterSet>(
"iCfgCandConnector"));
193 postHFCleaning_ = iConfig.getParameter<
bool>(
"postHFCleaning");
197 pfAlgo_.setPostHFCleaningParameters(postHFCleaning_, pfHFCleaningParams);
200 std::vector<edm::InputTag>
tags = iConfig.getParameter<std::vector<edm::InputTag>>(
"cleanedHF");
201 for (
unsigned int i = 0;
i <
tags.size(); ++
i)
202 inputTagCleanedHF_.push_back(consumes<reco::PFRecHitCollection>(
tags[
i]));
204 vertices_ = consumes<reco::VertexCollection>(iConfig.getParameter<
edm::InputTag>(
"vertexCollection"));
205 useVerticesForNeutral_ = iConfig.getParameter<
bool>(
"useVerticesForNeutral");
208 useHO_ = iConfig.getParameter<
bool>(
"useHO");
209 pfAlgo_.setHOTag(useHO_);
211 verbose_ = iConfig.getUntrackedParameter<
bool>(
"verbose",
false);
221 static_cast<const PerformancePayloadFromTFormula*>(perfH.
product());
228 LogDebug(
"PFProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run() << endl;
246 LogDebug(
"PFProducer") <<
"particle flow is starting" << endl;
264 for (
unsigned jhf = 0; jhf < (*hfCleaned).size(); ++jhf) {
265 hfCopy.push_back((*hfCleaned)[jhf]);
274 LogDebug(
"PFProducer") <<
"particle flow: putting products in the event";
278 for (
auto const&
cand : pOutputCandidateCollection) {
280 ss <<
" " << nC <<
") pid=" <<
cand.particleId() <<
" pt=" <<
cand.pt() << endl;
282 LogDebug(
"PFProducer") <<
"Here the full list:" << endl <<
ss.str();
292 iEvent.put(muAlgo.transferCleanedCosmicCandidates(),
"CleanedCosmicsMuons");
294 iEvent.put(muAlgo.transferCleanedTrackerAndGlobalCandidates(),
"CleanedTrackerAndGlobalMuons");
296 iEvent.put(muAlgo.transferCleanedFakeCandidates(),
"CleanedFakeMuons");
298 iEvent.put(muAlgo.transferPunchThroughCleanedMuonCandidates(),
"CleanedPunchThroughMuons");
300 iEvent.put(muAlgo.transferPunchThroughCleanedHadronCandidates(),
"CleanedPunchThroughNeutralHadrons");
302 iEvent.put(muAlgo.transferAddedMuonCandidates(),
"AddedMuonsAndHadrons");
310 desc.addUntracked<
bool>(
"verbose",
false);
311 desc.addUntracked<
bool>(
"debug",
false);
318 desc.add<
bool>(
"postMuonCleaning",
true);
322 desc.add<
bool>(
"useVerticesForNeutral",
true);
325 desc.add<
bool>(
"useHO",
true);
332 desc.add<
bool>(
"useEGammaElectrons",
true);
335 desc.add<
bool>(
"useEGammaFilters",
true);
336 desc.add<
bool>(
"useProtectionsForJetMET",
true);
345 desc.add<std::vector<double>>(
"muon_HCAL", {3.0, 3.0});
346 desc.add<std::vector<double>>(
"muon_ECAL", {0.5, 0.5});
347 desc.add<std::vector<double>>(
"muon_HO", {0.9, 0.9});
356 desc.add<
bool>(
"rejectTracks_Bad",
true);
357 desc.add<
bool>(
"rejectTracks_Step45",
true);
359 desc.add<
bool>(
"usePFNuclearInteractions",
true);
360 desc.add<
bool>(
"usePFConversions",
true);
361 desc.add<
bool>(
"usePFDecays",
false);
363 desc.add<
double>(
"dptRel_DispVtx", 10.0);
371 desc.add<
double>(
"nsigma_TRACK", 1.0)->setComment(
"Number of sigmas for fake track detection");
373 desc.add<
double>(
"pt_Error", 1.0)
374 ->setComment(
"Absolute pt error to detect fake tracks in the first three iterations");
375 desc.add<std::vector<double>>(
"factors_45", {10.0, 100.0})
376 ->setComment(
"Factors to be applied in the four and fifth steps to the pt error");
379 desc.add<
double>(
"goodTrackDeadHcal_ptErrRel", 0.2)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
380 desc.add<
double>(
"goodTrackDeadHcal_chi2n", 5)->setComment(
"trackRef->normalizedChi2() < X");
381 desc.add<
unsigned int>(
"goodTrackDeadHcal_layers", 4)
382 ->setComment(
"trackRef->hitPattern().trackerLayersWithMeasurement() >= X");
383 desc.add<
double>(
"goodTrackDeadHcal_validFr", 0.5)->setComment(
"trackRef->validFraction() > X");
384 desc.add<
double>(
"goodTrackDeadHcal_dxy", 0.5)->setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm]");
386 desc.add<
double>(
"goodPixelTrackDeadHcal_minEta", 2.3)->setComment(
"abs(trackRef->eta()) > X");
387 desc.add<
double>(
"goodPixelTrackDeadHcal_maxPt", 50.0)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
388 desc.add<
double>(
"goodPixelTrackDeadHcal_ptErrRel", 1.0)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
389 desc.add<
double>(
"goodPixelTrackDeadHcal_chi2n", 2)->setComment(
"trackRef->normalizedChi2() < X");
390 desc.add<
int>(
"goodPixelTrackDeadHcal_maxLost3Hit", 0)
392 "max missing outer hits for a track with 3 valid pixel layers (can set to -1 to reject all these tracks)");
393 desc.add<
int>(
"goodPixelTrackDeadHcal_maxLost4Hit", 1)
394 ->setComment(
"max missing outer hits for a track with >= 4 valid pixel layers");
395 desc.add<
double>(
"goodPixelTrackDeadHcal_dxy", 0.02)
396 ->setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm] ");
397 desc.add<
double>(
"goodPixelTrackDeadHcal_dz", 0.05)
398 ->setComment(
"abs(trackRef->dz(primaryVertex_.position())) < X [cm]");
401 desc.add<
double>(
"pf_nsigma_ECAL", 0.0);
402 desc.add<
double>(
"pf_nsigma_HCAL", 1.0);
403 desc.add<
double>(
"pf_nsigma_HFEM", 1.0);
404 desc.add<
double>(
"pf_nsigma_HFHAD", 1.0);
407 desc.add<
bool>(
"useCalibrationsFromDB",
true);
411 desc.add<
bool>(
"postHFCleaning",
false);
414 psd_PFHFCleaning.
add<
double>(
"minHFCleaningPt", 5.0)
415 ->
setComment(
"Clean only objects with pt larger than this value");
416 psd_PFHFCleaning.
add<
double>(
"maxSignificance", 2.5)
417 ->
setComment(
"Clean only if the initial MET/sqrt(sumet) is larger than this value");
418 psd_PFHFCleaning.
add<
double>(
"minSignificance", 2.5)
419 ->
setComment(
"Clean only if the final MET/sqrt(sumet) is smaller than this value");
420 psd_PFHFCleaning.
add<
double>(
"minSignificanceReduction", 1.4)
421 ->
setComment(
"Clean only if the significance reduction is larger than this value");
422 psd_PFHFCleaning.
add<
double>(
"maxDeltaPhiPt", 7.0)
423 ->
setComment(
"Clean only if the MET and the to-be-cleaned object satisfy this DeltaPhi * Pt cut");
425 psd_PFHFCleaning.
add<
double>(
"minDeltaMet", 0.4)
427 "Clean only if the MET relative reduction from the to-be-cleaned object is larger than this value");
432 desc.add<std::vector<edm::InputTag>>(
"cleanedHF",
439 desc.add<
bool>(
"calibHF_use",
false);
440 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});
441 desc.add<std::vector<double>>(
"calibHF_a_EMonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
442 desc.add<std::vector<double>>(
"calibHF_a_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
443 desc.add<std::vector<double>>(
"calibHF_b_HADonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
444 desc.add<std::vector<double>>(
"calibHF_b_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
447 desc.add<std::vector<double>>(
"resolHF_square", {2.799 * 2.799, 0.114 * 0.114, 0.0 * 0.0})
448 ->setComment(
"HF resolution - stochastic, constant, noise term squares");
450 descriptions.
add(
"particleFlow",
desc);