69 std::unique_ptr<PFEGammaFilters>
pfegamma_ =
nullptr;
108 : pfCandidatesToken_{produces<reco::PFCandidateCollection>()},
109 pfCleanedCandidatesToken_{produces<reco::PFCandidateCollection>(
"CleanedHF")},
110 inputTagBlocks_(consumes<reco::PFBlockCollection>(iConfig.getParameter<
InputTag>(
"blocks"))),
111 pfEnergyCalibrationHF_(iConfig.getParameter<
bool>(
"calibHF_use"),
112 iConfig.getParameter<std::vector<double>>(
"calibHF_eta_step"),
113 iConfig.getParameter<std::vector<double>>(
"calibHF_a_EMonly"),
114 iConfig.getParameter<std::vector<double>>(
"calibHF_b_HADonly"),
115 iConfig.getParameter<std::vector<double>>(
"calibHF_a_EMHAD"),
116 iConfig.getParameter<std::vector<double>>(
"calibHF_b_EMHAD")),
117 pfAlgo_(iConfig.getParameter<
double>(
"pf_nsigma_ECAL"),
118 iConfig.getParameter<
double>(
"pf_nsigma_HCAL"),
119 iConfig.getParameter<
double>(
"pf_nsigma_HFEM"),
120 iConfig.getParameter<
double>(
"pf_nsigma_HFHAD"),
121 iConfig.getParameter<std::vector<double>>(
"resolHF_square"),
122 pfEnergyCalibration_,
123 pfEnergyCalibrationHF_,
126 inputTagMuons_ = consumes<reco::MuonCollection>(iConfig.getParameter<
InputTag>(
"muons"));
127 postMuonCleaning_ = iConfig.getParameter<
bool>(
"postMuonCleaning");
128 vetoEndcap_ = iConfig.getParameter<
bool>(
"vetoEndcap");
130 inputTagVetoes_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<
edm::InputTag>(
"vetoes"));
132 use_EGammaFilters_ = iConfig.getParameter<
bool>(
"useEGammaFilters");
133 useEGammaElectrons_ = iConfig.getParameter<
bool>(
"useEGammaElectrons");
135 if (useEGammaElectrons_) {
136 inputTagEgammaElectrons_ =
137 consumes<reco::GsfElectronCollection>(iConfig.getParameter<
edm::InputTag>(
"egammaElectrons"));
141 produces<reco::PFCandidateCollection>(
"CleanedCosmicsMuons");
142 produces<reco::PFCandidateCollection>(
"CleanedTrackerAndGlobalMuons");
143 produces<reco::PFCandidateCollection>(
"CleanedFakeMuons");
144 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughMuons");
145 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughNeutralHadrons");
146 produces<reco::PFCandidateCollection>(
"AddedMuonsAndHadrons");
152 if (use_EGammaFilters_) {
153 inputTagPFEGammaCandidates_ =
154 consumes<edm::View<reco::PFCandidate>>((iConfig.getParameter<
edm::InputTag>(
"PFEGammaCandidates")));
155 inputTagValueMapGedElectrons_ =
156 consumes<edm::ValueMap<reco::GsfElectronRef>>(iConfig.getParameter<
edm::InputTag>(
"GedElectronValueMap"));
157 inputTagValueMapGedPhotons_ =
158 consumes<edm::ValueMap<reco::PhotonRef>>(iConfig.getParameter<
edm::InputTag>(
"GedPhotonValueMap"));
163 pfegamma_ = std::make_unique<PFEGammaFilters>(pfEGammaFiltersParams);
179 bool usePFDecays = iConfig.getParameter<
bool>(
"usePFDecays");
181 double dptRel_DispVtx = iConfig.getParameter<
double>(
"dptRel_DispVtx");
183 useCalibrationsFromDB_ = iConfig.getParameter<
bool>(
"useCalibrationsFromDB");
185 if (useCalibrationsFromDB_) {
186 calibrationsLabel_ = iConfig.getParameter<
std::string>(
"calibrationsLabel");
187 perfToken_ = esConsumes<edm::Transition::BeginRun>(
edm::ESInputTag(
"", calibrationsLabel_));
190 pfAlgo_.setDisplacedVerticesParameters(
194 pfAlgo_.setCandConnectorParameters(iConfig.getParameter<
edm::ParameterSet>(
"iCfgCandConnector"));
197 postHFCleaning_ = iConfig.getParameter<
bool>(
"postHFCleaning");
201 pfAlgo_.setPostHFCleaningParameters(postHFCleaning_, pfHFCleaningParams);
204 std::vector<edm::InputTag>
tags = iConfig.getParameter<std::vector<edm::InputTag>>(
"cleanedHF");
205 for (
unsigned int i = 0;
i <
tags.size(); ++
i)
206 inputTagCleanedHF_.push_back(consumes<reco::PFRecHitCollection>(
tags[
i]));
208 vertices_ = consumes<reco::VertexCollection>(iConfig.getParameter<
edm::InputTag>(
"vertexCollection"));
209 useVerticesForNeutral_ = iConfig.getParameter<
bool>(
"useVerticesForNeutral");
212 useHO_ = iConfig.getParameter<
bool>(
"useHO");
213 pfAlgo_.setHOTag(useHO_);
215 verbose_ = iConfig.getUntrackedParameter<
bool>(
"verbose",
false);
231 LogDebug(
"PFProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run() << endl;
254 LogDebug(
"PFProducer") <<
"particle flow is starting" << endl;
272 for (
unsigned jhf = 0; jhf < (*hfCleaned).size(); ++jhf) {
273 hfCopy.push_back((*hfCleaned)[jhf]);
282 LogDebug(
"PFProducer") <<
"particle flow: putting products in the event";
286 for (
auto const&
cand : pOutputCandidateCollection) {
288 ss <<
" " << nC <<
") pid=" <<
cand.particleId() <<
" pt=" <<
cand.pt() << endl;
290 LogDebug(
"PFProducer") <<
"Here the full list:" << endl <<
ss.str();
300 iEvent.put(muAlgo.transferCleanedCosmicCandidates(),
"CleanedCosmicsMuons");
302 iEvent.put(muAlgo.transferCleanedTrackerAndGlobalCandidates(),
"CleanedTrackerAndGlobalMuons");
304 iEvent.put(muAlgo.transferCleanedFakeCandidates(),
"CleanedFakeMuons");
306 iEvent.put(muAlgo.transferPunchThroughCleanedMuonCandidates(),
"CleanedPunchThroughMuons");
308 iEvent.put(muAlgo.transferPunchThroughCleanedHadronCandidates(),
"CleanedPunchThroughNeutralHadrons");
310 iEvent.put(muAlgo.transferAddedMuonCandidates(),
"AddedMuonsAndHadrons");
318 desc.addUntracked<
bool>(
"verbose",
false);
319 desc.addUntracked<
bool>(
"debug",
false);
326 desc.add<
bool>(
"postMuonCleaning",
true);
336 desc.add<
bool>(
"useVerticesForNeutral",
true);
339 desc.add<
bool>(
"useHO",
true);
346 desc.add<
bool>(
"useEGammaElectrons",
true);
349 desc.add<
bool>(
"useEGammaFilters",
true);
350 desc.add<
bool>(
"useProtectionsForJetMET",
true);
359 desc.add<std::vector<double>>(
"muon_HCAL", {3.0, 3.0});
360 desc.add<std::vector<double>>(
"muon_ECAL", {0.5, 0.5});
361 desc.add<std::vector<double>>(
"muon_HO", {0.9, 0.9});
370 desc.add<
bool>(
"rejectTracks_Bad",
true);
371 desc.add<
bool>(
"rejectTracks_Step45",
true);
373 desc.add<
bool>(
"usePFNuclearInteractions",
true);
374 desc.add<
bool>(
"usePFConversions",
true);
375 desc.add<
bool>(
"usePFDecays",
false);
377 desc.add<
double>(
"dptRel_DispVtx", 10.0);
385 desc.add<
double>(
"nsigma_TRACK", 1.0)->setComment(
"Number of sigmas for fake track detection");
387 desc.add<
double>(
"pt_Error", 1.0)
388 ->setComment(
"Absolute pt error to detect fake tracks in the first three iterations");
389 desc.add<std::vector<double>>(
"factors_45", {10.0, 100.0})
390 ->setComment(
"Factors to be applied in the four and fifth steps to the pt error");
393 desc.add<
double>(
"goodTrackDeadHcal_ptErrRel", 0.2)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
394 desc.add<
double>(
"goodTrackDeadHcal_chi2n", 5)->setComment(
"trackRef->normalizedChi2() < X");
395 desc.add<
unsigned int>(
"goodTrackDeadHcal_layers", 4)
396 ->setComment(
"trackRef->hitPattern().trackerLayersWithMeasurement() >= X");
397 desc.add<
double>(
"goodTrackDeadHcal_validFr", 0.5)->setComment(
"trackRef->validFraction() > X");
398 desc.add<
double>(
"goodTrackDeadHcal_dxy", 0.5)->setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm]");
400 desc.add<
double>(
"goodPixelTrackDeadHcal_minEta", 2.3)->setComment(
"abs(trackRef->eta()) > X");
401 desc.add<
double>(
"goodPixelTrackDeadHcal_maxPt", 50.0)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
402 desc.add<
double>(
"goodPixelTrackDeadHcal_ptErrRel", 1.0)->setComment(
"trackRef->ptError()/trackRef->pt() < X");
403 desc.add<
double>(
"goodPixelTrackDeadHcal_chi2n", 2)->setComment(
"trackRef->normalizedChi2() < X");
404 desc.add<
int>(
"goodPixelTrackDeadHcal_maxLost3Hit", 0)
406 "max missing outer hits for a track with 3 valid pixel layers (can set to -1 to reject all these tracks)");
407 desc.add<
int>(
"goodPixelTrackDeadHcal_maxLost4Hit", 1)
408 ->setComment(
"max missing outer hits for a track with >= 4 valid pixel layers");
409 desc.add<
double>(
"goodPixelTrackDeadHcal_dxy", 0.02)
410 ->setComment(
"abs(trackRef->dxy(primaryVertex_.position())) < X [cm] ");
411 desc.add<
double>(
"goodPixelTrackDeadHcal_dz", 0.05)
412 ->setComment(
"abs(trackRef->dz(primaryVertex_.position())) < X [cm]");
415 desc.add<
double>(
"pf_nsigma_ECAL", 0.0);
416 desc.add<
double>(
"pf_nsigma_HCAL", 1.0);
417 desc.add<
double>(
"pf_nsigma_HFEM", 1.0);
418 desc.add<
double>(
"pf_nsigma_HFHAD", 1.0);
421 desc.add<
bool>(
"useCalibrationsFromDB",
true);
425 desc.add<
bool>(
"postHFCleaning",
false);
428 psd_PFHFCleaning.
add<
double>(
"minHFCleaningPt", 5.0)
429 ->
setComment(
"Clean only objects with pt larger than this value");
430 psd_PFHFCleaning.
add<
double>(
"maxSignificance", 2.5)
431 ->
setComment(
"Clean only if the initial MET/sqrt(sumet) is larger than this value");
432 psd_PFHFCleaning.
add<
double>(
"minSignificance", 2.5)
433 ->
setComment(
"Clean only if the final MET/sqrt(sumet) is smaller than this value");
434 psd_PFHFCleaning.
add<
double>(
"minSignificanceReduction", 1.4)
435 ->
setComment(
"Clean only if the significance reduction is larger than this value");
436 psd_PFHFCleaning.
add<
double>(
"maxDeltaPhiPt", 7.0)
437 ->
setComment(
"Clean only if the MET and the to-be-cleaned object satisfy this DeltaPhi * Pt cut");
439 psd_PFHFCleaning.
add<
double>(
"minDeltaMet", 0.4)
441 "Clean only if the MET relative reduction from the to-be-cleaned object is larger than this value");
446 desc.add<std::vector<edm::InputTag>>(
"cleanedHF",
453 desc.add<
bool>(
"calibHF_use",
false);
454 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});
455 desc.add<std::vector<double>>(
"calibHF_a_EMonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
456 desc.add<std::vector<double>>(
"calibHF_a_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
457 desc.add<std::vector<double>>(
"calibHF_b_HADonly", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
458 desc.add<std::vector<double>>(
"calibHF_b_EMHAD", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
461 desc.add<std::vector<double>>(
"resolHF_square", {2.799 * 2.799, 0.114 * 0.114, 0.0 * 0.0})
462 ->setComment(
"HF resolution - stochastic, constant, noise term squares");
464 descriptions.
add(
"particleFlow",
desc);
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
void setComment(std::string const &value)
std::string photonExtraOutputCol_
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
reco::PFCandidateCollection & getCleanedCandidates()
PFEnergyCalibrationHF pfEnergyCalibrationHF_
edm::EDGetTokenT< reco::PFCandidateCollection > inputTagVetoes_
std::string calibrationsLabel_
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
void setVetoes(const reco::PFCandidateCollection &vetoes)
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_
edm::ESGetToken< PerformancePayload, PFCalibrationRcd > perfToken_
bool useVerticesForNeutral_
PFProducer(const edm::ParameterSet &)
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_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
#define DEFINE_FWK_MODULE(type)
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_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
void setMuonHandle(const edm::Handle< reco::MuonCollection > &muons)
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
void reconstructParticles(const reco::PFBlockHandle &blockHandle, PFEGammaFilters const *pfegamma)
reconstruct particles
Log< level::Info, false > LogInfo
PFAlgo pfAlgo_
particle flow algorithm
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
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_
Producer for particle flow reconstructed particles (PFCandidates)
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagEgammaElectrons_
PFEnergyCalibration pfEnergyCalibration_
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)