73 std::unique_ptr<PFEGammaFilters>
pfegamma_ =
nullptr;
116 iConfig.getParameter<std::vector<double>>(
"calibHF_eta_step"),
117 iConfig.getParameter<std::vector<double>>(
"calibHF_a_EMonly"),
118 iConfig.getParameter<std::vector<double>>(
"calibHF_b_HADonly"),
119 iConfig.getParameter<std::vector<double>>(
"calibHF_a_EMHAD"),
120 iConfig.getParameter<std::vector<double>>(
"calibHF_b_EMHAD")),
121 pfAlgo_(iConfig.getParameter<
double>(
"pf_nsigma_ECAL"),
122 iConfig.getParameter<
double>(
"pf_nsigma_HCAL"),
123 iConfig.getParameter<
double>(
"pf_nsigma_HFEM"),
124 iConfig.getParameter<
double>(
"pf_nsigma_HFHAD"),
125 iConfig.getParameter<std::vector<double>>(
"resolHF_square"),
133 if (iConfig.existsAs<
bool>(
"useEGammaFilters")) {
143 consumes<reco::GsfElectronCollection>(iConfig.getParameter<
edm::InputTag>(
"egammaElectrons"));
147 produces<reco::PFCandidateCollection>(
"CleanedCosmicsMuons");
148 produces<reco::PFCandidateCollection>(
"CleanedTrackerAndGlobalMuons");
149 produces<reco::PFCandidateCollection>(
"CleanedFakeMuons");
150 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughMuons");
151 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughNeutralHadrons");
152 produces<reco::PFCandidateCollection>(
"AddedMuonsAndHadrons");
159 consumes<edm::View<reco::PFCandidate>>((iConfig.getParameter<
edm::InputTag>(
"PFEGammaCandidates")));
161 consumes<edm::ValueMap<reco::GsfElectronRef>>(iConfig.getParameter<
edm::InputTag>(
"GedElectronValueMap"));
163 consumes<edm::ValueMap<reco::PhotonRef>>(iConfig.getParameter<
edm::InputTag>(
"GedPhotonValueMap"));
164 useProtectionsForJetMET = iConfig.getParameter<
bool>(
"useProtectionsForJetMET");
177 bool usePFDecays = iConfig.getParameter<
bool>(
"usePFDecays");
179 double dptRel_DispVtx = iConfig.getParameter<
double>(
"dptRel_DispVtx");
183 if (useCalibrationsFromDB_)
192 pfegamma_ = std::make_unique<PFEGammaFilters>(pfEGammaFiltersParams);
197 rejectTracks_Bad, rejectTracks_Step45, usePFNuclearInteractions, usePFConversions, usePFDecays, dptRel_DispVtx);
199 if (usePFNuclearInteractions)
210 std::vector<edm::InputTag>
tags = iConfig.getParameter<std::vector<edm::InputTag>>(
"cleanedHF");
211 for (
unsigned int i = 0;
i < tags.size(); ++
i)
218 useHO_ = iConfig.getParameter<
bool>(
"useHO");
221 verbose_ = iConfig.getUntrackedParameter<
bool>(
"verbose",
false);
238 LogDebug(
"PFProducer") <<
"START event: " << iEvent.
id().
event() <<
" in run " << iEvent.
id().
run() << endl;
256 LogDebug(
"PFProducer") <<
"particle flow is starting" << endl;
263 LogInfo(
"PFProducer") << str.str() << endl;
274 for (
unsigned jhf = 0; jhf < (*hfCleaned).size(); ++jhf) {
275 hfCopy.push_back((*hfCleaned)[jhf]);
284 LogDebug(
"PFProducer") <<
"particle flow: putting products in the event";
288 for (
auto const&
cand : pOutputCandidateCollection) {
290 ss <<
" " << nC <<
") pid=" <<
cand.particleId() <<
" pt=" <<
cand.pt() << endl;
292 LogDebug(
"PFProducer") <<
"Here the full list:" << endl << ss.str();
302 iEvent.
put(muAlgo.transferCleanedCosmicCandidates(),
"CleanedCosmicsMuons");
304 iEvent.
put(muAlgo.transferCleanedTrackerAndGlobalCandidates(),
"CleanedTrackerAndGlobalMuons");
306 iEvent.
put(muAlgo.transferCleanedFakeCandidates(),
"CleanedFakeMuons");
308 iEvent.
put(muAlgo.transferPunchThroughCleanedMuonCandidates(),
"CleanedPunchThroughMuons");
310 iEvent.
put(muAlgo.transferPunchThroughCleanedHadronCandidates(),
"CleanedPunchThroughNeutralHadrons");
312 iEvent.
put(muAlgo.transferAddedMuonCandidates(),
"AddedMuonsAndHadrons");
328 desc.
add<
bool>(
"postMuonCleaning",
true);
332 desc.
add<
bool>(
"useVerticesForNeutral",
true);
335 desc.
add<
bool>(
"useHO",
true);
342 desc.
add<
bool>(
"useEGammaElectrons",
true);
345 desc.
add<
bool>(
"useEGammaFilters",
true);
346 desc.
add<
bool>(
"useProtectionsForJetMET",
true);
355 desc.
add<std::vector<double>>(
"muon_HCAL", {3.0, 3.0});
356 desc.
add<std::vector<double>>(
"muon_ECAL", {0.5, 0.5});
357 desc.
add<std::vector<double>>(
"muon_HO", {0.9, 0.9});
366 desc.
add<
bool>(
"rejectTracks_Bad",
true);
367 desc.
add<
bool>(
"rejectTracks_Step45",
true);
369 desc.
add<
bool>(
"usePFNuclearInteractions",
true);
370 desc.
add<
bool>(
"usePFConversions",
true);
371 desc.
add<
bool>(
"usePFDecays",
false);
373 desc.
add<
double>(
"dptRel_DispVtx", 10.0);
381 desc.
add<
double>(
"nsigma_TRACK", 1.0)->
setComment(
"Number of sigmas for fake track detection");
383 desc.
add<
double>(
"pt_Error", 1.0)
384 ->
setComment(
"Absolute pt error to detect fake tracks in the first three iterations");
385 desc.
add<std::vector<double>>(
"factors_45", {10.0, 100.0})
386 ->setComment(
"Factors to be applied in the four and fifth steps to the pt error");
389 desc.
add<
double>(
"goodTrackDeadHcal_ptErrRel", 0.2)->
setComment(
"trackRef->ptError()/trackRef->pt() < X");
390 desc.
add<
double>(
"goodTrackDeadHcal_chi2n", 5)->setComment(
"trackRef->normalizedChi2() < X");
391 desc.
add<
unsigned int>(
"goodTrackDeadHcal_layers", 4)
392 ->setComment(
"trackRef->hitPattern().trackerLayersWithMeasurement() >= X");
393 desc.
add<
double>(
"goodTrackDeadHcal_validFr", 0.5)->
setComment(
"trackRef->validFraction() > X");
394 desc.
add<
double>(
"goodTrackDeadHcal_dxy", 0.5)->
setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm]");
396 desc.
add<
double>(
"goodPixelTrackDeadHcal_minEta", 2.3)->
setComment(
"abs(trackRef->eta()) > X");
397 desc.
add<
double>(
"goodPixelTrackDeadHcal_maxPt", 50.0)->
setComment(
"trackRef->ptError()/trackRef->pt() < X");
398 desc.
add<
double>(
"goodPixelTrackDeadHcal_ptErrRel", 1.0)->
setComment(
"trackRef->ptError()/trackRef->pt() < X");
399 desc.
add<
double>(
"goodPixelTrackDeadHcal_chi2n", 2)->setComment(
"trackRef->normalizedChi2() < X");
400 desc.
add<
int>(
"goodPixelTrackDeadHcal_maxLost3Hit", 0)
402 "max missing outer hits for a track with 3 valid pixel layers (can set to -1 to reject all these tracks)");
403 desc.
add<
int>(
"goodPixelTrackDeadHcal_maxLost4Hit", 1)
404 ->setComment(
"max missing outer hits for a track with >= 4 valid pixel layers");
405 desc.
add<
double>(
"goodPixelTrackDeadHcal_dxy", 0.02)
406 ->
setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm] ");
407 desc.
add<
double>(
"goodPixelTrackDeadHcal_dz", 0.05)
408 ->
setComment(
"abs(trackRef->dz(primaryVertex_.position())) < X [cm]");
411 desc.
add<
double>(
"pf_nsigma_ECAL", 0.0);
412 desc.
add<
double>(
"pf_nsigma_HCAL", 1.0);
413 desc.
add<
double>(
"pf_nsigma_HFEM", 1.0);
414 desc.
add<
double>(
"pf_nsigma_HFHAD", 1.0);
417 desc.
add<
bool>(
"useCalibrationsFromDB",
true);
421 desc.
add<
bool>(
"postHFCleaning",
false);
424 psd_PFHFCleaning.
add<
double>(
"minHFCleaningPt", 5.0)
425 ->
setComment(
"Clean only objects with pt larger than this value");
426 psd_PFHFCleaning.
add<
double>(
"maxSignificance", 2.5)
427 ->
setComment(
"Clean only if the initial MET/sqrt(sumet) is larger than this value");
428 psd_PFHFCleaning.
add<
double>(
"minSignificance", 2.5)
429 ->
setComment(
"Clean only if the final MET/sqrt(sumet) is smaller than this value");
430 psd_PFHFCleaning.
add<
double>(
"minSignificanceReduction", 1.4)
431 ->
setComment(
"Clean only if the significance reduction is larger than this value");
432 psd_PFHFCleaning.
add<
double>(
"maxDeltaPhiPt", 7.0)
433 ->
setComment(
"Clean only if the MET and the to-be-cleaned object satisfy this DeltaPhi * Pt cut");
435 psd_PFHFCleaning.
add<
double>(
"minDeltaMet", 0.4)
437 "Clean only if the MET relative reduction from the to-be-cleaned object is larger than this value");
442 desc.
add<std::vector<edm::InputTag>>(
"cleanedHF",
449 desc.
add<
bool>(
"calibHF_use",
false);
450 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});
451 desc.
add<std::vector<double>>(
"calibHF_a_EMonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
452 desc.
add<std::vector<double>>(
"calibHF_a_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
453 desc.
add<std::vector<double>>(
"calibHF_b_HADonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
454 desc.
add<std::vector<double>>(
"calibHF_b_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
457 desc.
add<std::vector<double>>(
"resolHF_square", {2.799 * 2.799, 0.114 * 0.114, 0.0 * 0.0})
458 ->setComment(
"HF resolution - stochastic, constant, noise term squares");
460 descriptions.
add(
"particleFlow", desc);
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
T getParameter(std::string const &) const
EventNumber_t event() const
void setComment(std::string const &value)
std::string photonExtraOutputCol_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
reco::PFCandidateCollection & getCleanedCandidates()
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
PFEnergyCalibrationHF pfEnergyCalibrationHF_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
std::string calibrationsLabel_
void setMuonHandle(const edm::Handle< reco::MuonCollection > &)
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
bool useCalibrationsFromDB_
edm::EDGetTokenT< reco::VertexCollection > vertices_
void produce(edm::Event &, const edm::EventSetup &) override
void setPFVertexParameters(bool useVertex, reco::VertexCollection const &primaryVertices)
std::unique_ptr< PFEGammaFilters > pfegamma_
void setPostHFCleaningParameters(bool postHFCleaning, const edm::ParameterSet &pfHFCleaningParams)
bool useVerticesForNeutral_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
PFProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
void setEGammaCollections(const edm::View< reco::PFCandidate > &pfEgammaCandidates, const edm::ValueMap< reco::GsfElectronRef > &valueMapGedElectrons, const edm::ValueMap< reco::PhotonRef > &valueMapGedPhotons)
const edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
const edm::EDPutTokenT< reco::PFCandidateCollection > pfCandidatesToken_
bool get(ProductID const &oid, Handle< PROD > &result) const
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
void beginRun(const edm::Run &, const edm::EventSetup &) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::View< reco::PFCandidate > > inputTagPFEGammaCandidates_
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
void reconstructParticles(const reco::PFBlockHandle &blockHandle, PFEGammaFilters const *pfegamma)
reconstruct particles
PFAlgo pfAlgo_
particle flow algorithm
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
std::string electronExtraOutputCol_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< edm::ValueMap< reco::PhotonRef > > inputTagValueMapGedPhotons_
reco::PFCandidateCollection makeConnectedCandidates()
PFMuonAlgo * getPFMuonAlgo()
void setCalibrationFunctions(const PerformancePayloadFromTFormula *thePFCal)
const edm::EDPutTokenT< reco::PFCandidateCollection > pfCleanedCandidatesToken_
T const * product() const
Producer for particle flow reconstructed particles (PFCandidates)
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagEgammaElectrons_
PFEnergyCalibration pfEnergyCalibration_
void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET)
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)