CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PFProducer Class Reference

Producer for particle flow reconstructed particles (PFCandidates) More...

Inheritance diagram for PFProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 PFProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

std::string calibrationsLabel_
 
std::string electronExtraOutputCol_
 
const edm::EDGetTokenT< reco::PFBlockCollectioninputTagBlocks_
 
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
 
edm::EDGetTokenT< reco::GsfElectronCollectioninputTagEgammaElectrons_
 
edm::EDGetTokenT< reco::MuonCollectioninputTagMuons_
 
edm::EDGetTokenT< edm::View< reco::PFCandidate > > inputTagPFEGammaCandidates_
 
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
 
edm::EDGetTokenT< edm::ValueMap< reco::PhotonRef > > inputTagValueMapGedPhotons_
 
PFAlgo pfAlgo_
 particle flow algorithm More...
 
const edm::EDPutTokenT< reco::PFCandidateCollectionpfCandidatesToken_
 
const edm::EDPutTokenT< reco::PFCandidateCollectionpfCleanedCandidatesToken_
 
std::unique_ptr< PFEGammaFilterspfegamma_ = 0
 
PFEnergyCalibration pfEnergyCalibration_
 
PFEnergyCalibrationHF pfEnergyCalibrationHF_
 
std::string photonExtraOutputCol_
 
bool postHFCleaning_
 
bool postMuonCleaning_
 
bool use_EGammaFilters_
 
bool useCalibrationsFromDB_
 
bool useEGammaElectrons_
 
bool useHO_
 
bool useVerticesForNeutral_
 
bool verbose_
 verbose ? More...
 
edm::EDGetTokenT< reco::VertexCollectionvertices_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Producer for particle flow reconstructed particles (PFCandidates)

This producer makes use of PFAlgo, the particle flow algorithm.

Author
Colin Bernet
Date
July 2006

Definition at line 45 of file PFProducer.cc.

Constructor & Destructor Documentation

PFProducer::PFProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 111 of file PFProducer.cc.

References calibrationsLabel_, HLT_2018_cff::dptRel_DispVtx, edm::ParameterSet::getParameter(), mps_fire::i, inputTagBlocks_, inputTagCleanedHF_, inputTagEgammaElectrons_, inputTagMuons_, inputTagPFEGammaCandidates_, inputTagValueMapGedElectrons_, inputTagValueMapGedPhotons_, pfAlgo_, pfCleanedCandidatesToken_, pfegamma_, pfEnergyCalibration_, pfEnergyCalibrationHF_, postHFCleaning_, postMuonCleaning_, HLT_2018_cff::rejectTracks_Bad, HLT_2018_cff::rejectTracks_Step45, PFAlgo::setCandConnectorParameters(), PFAlgo::setDisplacedVerticesParameters(), PFAlgo::setEGammaParameters(), PFAlgo::setHOTag(), PFAlgo::setPostHFCleaningParameters(), AlCaHLTBitMon_QueryRunRegistry::string, triggerMatcherToHLTDebug_cfi::tags, use_EGammaFilters_, useCalibrationsFromDB_, useEGammaElectrons_, useHO_, HLT_2018_cff::usePFConversions, HLT_2018_cff::usePFDecays, HLT_2018_cff::usePFNuclearInteractions, HLT_2018_cff::useProtectionsForJetMET, useVerticesForNeutral_, verbose_, and vertices_.

112  : pfCandidatesToken_{produces<reco::PFCandidateCollection>()},
113  pfCleanedCandidatesToken_{produces<reco::PFCandidateCollection>("CleanedHF")},
114  inputTagBlocks_(consumes<reco::PFBlockCollection>(iConfig.getParameter<InputTag>("blocks"))),
115  pfEnergyCalibrationHF_(iConfig.getParameter<bool>("calibHF_use"),
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"),
128  iConfig) {
129  //Post cleaning of the muons
130  inputTagMuons_ = consumes<reco::MuonCollection>(iConfig.getParameter<InputTag>("muons"));
131  postMuonCleaning_ = iConfig.getParameter<bool>("postMuonCleaning");
132 
133  if (iConfig.existsAs<bool>("useEGammaFilters")) {
134  use_EGammaFilters_ = iConfig.getParameter<bool>("useEGammaFilters");
135  } else {
136  use_EGammaFilters_ = false;
137  }
138 
139  useEGammaElectrons_ = iConfig.getParameter<bool>("useEGammaElectrons");
140 
141  if (useEGammaElectrons_) {
143  consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("egammaElectrons"));
144  }
145 
146  // register products
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");
153 
154  // Reading new EGamma selection cuts
155  bool useProtectionsForJetMET(false);
156  // Reading new EGamma ubiased collections and value maps
157  if (use_EGammaFilters_) {
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");
165  }
166 
167  //Secondary tracks and displaced vertices parameters
168 
169  bool rejectTracks_Bad = iConfig.getParameter<bool>("rejectTracks_Bad");
170 
171  bool rejectTracks_Step45 = iConfig.getParameter<bool>("rejectTracks_Step45");
172 
173  bool usePFNuclearInteractions = iConfig.getParameter<bool>("usePFNuclearInteractions");
174 
175  bool usePFConversions = iConfig.getParameter<bool>("usePFConversions");
176 
177  bool usePFDecays = iConfig.getParameter<bool>("usePFDecays");
178 
179  double dptRel_DispVtx = iConfig.getParameter<double>("dptRel_DispVtx");
180 
181  useCalibrationsFromDB_ = iConfig.getParameter<bool>("useCalibrationsFromDB");
182 
184  calibrationsLabel_ = iConfig.getParameter<std::string>("calibrationsLabel");
185 
186  // EGamma filters
188 
189  if (use_EGammaFilters_) {
190  const edm::ParameterSet pfEGammaFiltersParams =
191  iConfig.getParameter<edm::ParameterSet>("PFEGammaFiltersParameters");
192  pfegamma_ = std::make_unique<PFEGammaFilters>(pfEGammaFiltersParams);
193  }
194 
195  // Secondary tracks and displaced vertices parameters
198 
200  pfAlgo_.setCandConnectorParameters(iConfig.getParameter<edm::ParameterSet>("iCfgCandConnector"));
201 
202  // Post cleaning of the HF
203  postHFCleaning_ = iConfig.getParameter<bool>("postHFCleaning");
204  const edm::ParameterSet pfHFCleaningParams = iConfig.getParameter<edm::ParameterSet>("PFHFCleaningParameters");
205 
206  // Set post HF cleaning muon parameters
208 
209  // Input tags for HF cleaned rechits
210  std::vector<edm::InputTag> tags = iConfig.getParameter<std::vector<edm::InputTag>>("cleanedHF");
211  for (unsigned int i = 0; i < tags.size(); ++i)
212  inputTagCleanedHF_.push_back(consumes<reco::PFRecHitCollection>(tags[i]));
213  //MIKE: Vertex Parameters
214  vertices_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"));
215  useVerticesForNeutral_ = iConfig.getParameter<bool>("useVerticesForNeutral");
216 
217  // Use HO clusters and links in the PF reconstruction
218  useHO_ = iConfig.getParameter<bool>("useHO");
219  pfAlgo_.setHOTag(useHO_);
220 
221  verbose_ = iConfig.getUntrackedParameter<bool>("verbose", false);
222 }
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
Definition: PFProducer.cc:63
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
Definition: PFProducer.cc:59
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
PFEnergyCalibrationHF pfEnergyCalibrationHF_
Definition: PFProducer.cc:100
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
Definition: PFAlgo.h:68
std::string calibrationsLabel_
Definition: PFProducer.cc:92
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
Definition: PFAlgo.cc:98
bool useCalibrationsFromDB_
Definition: PFProducer.cc:91
bool use_EGammaFilters_
Definition: PFProducer.cc:72
edm::EDGetTokenT< reco::VertexCollection > vertices_
Definition: PFProducer.cc:60
std::unique_ptr< PFEGammaFilters > pfegamma_
Definition: PFProducer.cc:73
void setPostHFCleaningParameters(bool postHFCleaning, const edm::ParameterSet &pfHFCleaningParams)
Definition: PFAlgo.cc:88
bool useVerticesForNeutral_
Definition: PFProducer.cc:88
const edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
Definition: PFProducer.cc:58
bool postHFCleaning_
Definition: PFProducer.cc:94
bool postMuonCleaning_
Definition: PFProducer.cc:82
const edm::EDPutTokenT< reco::PFCandidateCollection > pfCandidatesToken_
Definition: PFProducer.cc:55
edm::EDGetTokenT< edm::View< reco::PFCandidate > > inputTagPFEGammaCandidates_
Definition: PFProducer.cc:70
void setHOTag(bool ho)
Definition: PFAlgo.h:65
bool useHO_
Definition: PFProducer.cc:76
PFAlgo pfAlgo_
particle flow algorithm
Definition: PFProducer.cc:103
bool verbose_
verbose ?
Definition: PFProducer.cc:79
bool useEGammaElectrons_
Definition: PFProducer.cc:85
edm::EDGetTokenT< edm::ValueMap< reco::PhotonRef > > inputTagValueMapGedPhotons_
Definition: PFProducer.cc:69
const edm::EDPutTokenT< reco::PFCandidateCollection > pfCleanedCandidatesToken_
Definition: PFProducer.cc:56
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagEgammaElectrons_
Definition: PFProducer.cc:61
PFEnergyCalibration pfEnergyCalibration_
Definition: PFProducer.cc:99
void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET)
Definition: PFAlgo.cc:68
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
Definition: PFProducer.cc:68

Member Function Documentation

void PFProducer::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
override

Definition at line 224 of file PFProducer.cc.

References calibrationsLabel_, edm::EventSetup::get(), pfEnergyCalibration_, edm::ESHandle< T >::product(), PFEnergyCalibration::setCalibrationFunctions(), and useCalibrationsFromDB_.

224  {
226  // read the PFCalibration functions from the global tags
228  es.get<PFCalibrationRcd>().get(calibrationsLabel_, perfH);
229 
230  PerformancePayloadFromTFormula const* pfCalibrations =
231  static_cast<const PerformancePayloadFromTFormula*>(perfH.product());
232 
234  }
235 }
std::string calibrationsLabel_
Definition: PFProducer.cc:92
bool useCalibrationsFromDB_
Definition: PFProducer.cc:91
T get() const
Definition: EventSetup.h:73
void setCalibrationFunctions(const PerformancePayloadFromTFormula *thePFCal)
T const * product() const
Definition: ESHandle.h:86
PFEnergyCalibration pfEnergyCalibration_
Definition: PFProducer.cc:99
void PFProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 316 of file PFProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), PFEGammaFilters::fillPSetDescription(), PFCandConnector::fillPSetDescription(), HLT_2018_cff::InputTag, edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

316  {
318 
319  // Verbosity and debug flags
320  desc.addUntracked<bool>("verbose", false);
321  desc.addUntracked<bool>("debug", false);
322 
323  // PF Blocks label
324  desc.add<edm::InputTag>("blocks", edm::InputTag("particleFlowBlock"));
325 
326  // reco::muons label and Post Muon cleaning
327  desc.add<edm::InputTag>("muons", edm::InputTag("muons1stStep"));
328  desc.add<bool>("postMuonCleaning", true);
329 
330  // Vertices label
331  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("offlinePrimaryVertices"));
332  desc.add<bool>("useVerticesForNeutral", true);
333 
334  // Use HO clusters in PF hadron reconstruction
335  desc.add<bool>("useHO", true);
336 
337  // EGamma-related
338  desc.add<edm::InputTag>("PFEGammaCandidates", edm::InputTag("particleFlowEGamma"));
339  desc.add<edm::InputTag>("GedElectronValueMap", edm::InputTag("gedGsfElectronsTmp"));
340  desc.add<edm::InputTag>("GedPhotonValueMap", edm::InputTag("gedPhotonsTmp", "valMapPFEgammaCandToPhoton"));
341 
342  desc.add<bool>("useEGammaElectrons", true);
343  desc.add<edm::InputTag>("egammaElectrons", edm::InputTag("mvaElectrons"));
344 
345  desc.add<bool>("useEGammaFilters", true);
346  desc.add<bool>("useProtectionsForJetMET", true); // Propagated to PFEGammaFilters
347 
348  // For PFEGammaFilters
349  edm::ParameterSetDescription psd_PFEGammaFilters;
350  PFEGammaFilters::fillPSetDescription(psd_PFEGammaFilters);
351  desc.add<edm::ParameterSetDescription>("PFEGammaFiltersParameters", psd_PFEGammaFilters);
352 
353  // Treatment of muons :
354  // Expected energy in ECAL and HCAL, and RMS
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});
358 
359  // For PFMuonAlgo
360  edm::ParameterSetDescription psd_PFMuonAlgo;
361  PFEGammaFilters::fillPSetDescription(psd_PFMuonAlgo);
362  desc.add<edm::ParameterSetDescription>("PFMuonAlgoParameters", psd_PFMuonAlgo);
363 
364  // Input displaced vertices
365  // It is strongly adviced to keep usePFNuclearInteractions = bCorrect
366  desc.add<bool>("rejectTracks_Bad", true);
367  desc.add<bool>("rejectTracks_Step45", true);
368 
369  desc.add<bool>("usePFNuclearInteractions", true);
370  desc.add<bool>("usePFConversions", true);
371  desc.add<bool>("usePFDecays", false);
372 
373  desc.add<double>("dptRel_DispVtx", 10.0);
374 
375  // PFCandConnector
376  edm::ParameterSetDescription psd_CandConnector;
377  PFCandConnector::fillPSetDescription(psd_CandConnector);
378  desc.add<edm::ParameterSetDescription>("iCfgCandConnector", psd_CandConnector);
379 
380  // Treatment of potential fake tracks
381  desc.add<double>("nsigma_TRACK", 1.0)->setComment("Number of sigmas for fake track detection");
382  // pt_Error: dont forget to modify also ptErrorSecondary if you modify this parameter
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");
387 
388  // Treatment of tracks in region of bad HCal
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]");
395 
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)
401  ->setComment(
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]");
409 
410  // number of sigmas for neutral energy detection
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);
415 
416  // ECAL/HCAL PF cluster calibration : take it from global tag ?
417  desc.add<bool>("useCalibrationsFromDB", true);
418  desc.add<std::string>("calibrationsLabel", "");
419 
420  // Post HF cleaning
421  desc.add<bool>("postHFCleaning", false);
422  {
423  edm::ParameterSetDescription psd_PFHFCleaning;
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");
434  // (the MET angular resoution is in 1/MET)
435  psd_PFHFCleaning.add<double>("minDeltaMet", 0.4)
436  ->setComment(
437  "Clean only if the MET relative reduction from the to-be-cleaned object is larger than this value");
438  desc.add<edm::ParameterSetDescription>("PFHFCleaningParameters", psd_PFHFCleaning);
439  }
440 
441  // Check HF cleaning
442  desc.add<std::vector<edm::InputTag>>("cleanedHF",
443  {
444  edm::InputTag("particleFlowRecHitHF", "Cleaned"),
445  edm::InputTag("particleFlowClusterHF", "Cleaned"),
446  });
447 
448  // calibration parameters for HF:
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.});
455 
456  // resolution parameters for HF: EPJC 53(2008)139, doi:10.1140/epjc/s10052-007-0459-4
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");
459 
460  descriptions.add("particleFlow", desc);
461 }
void setComment(std::string const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 237 of file PFProducer.cc.

References gather_cfg::blocks, PFAlgo::checkCleaning(), edm::Event::emplace(), edm::EventID::event(), edm::Event::get(), edm::Event::getByToken(), PFAlgo::getCleanedCandidates(), edm::Event::getHandle(), PFAlgo::getPFMuonAlgo(), edm::EventBase::id(), ihf, inputTagBlocks_, inputTagCleanedHF_, inputTagMuons_, inputTagPFEGammaCandidates_, inputTagValueMapGedElectrons_, inputTagValueMapGedPhotons_, LogDebug, PFAlgo::makeConnectedCandidates(), pfAlgo_, pfCandidatesToken_, pfCleanedCandidatesToken_, pfegamma_, postHFCleaning_, postMuonCleaning_, edm::Event::put(), PFAlgo::reconstructParticles(), edm::EventID::run(), PFAlgo::setEGammaCollections(), PFAlgo::setMuonHandle(), PFAlgo::setPFVertexParameters(), contentValuesCheck::ss, str, use_EGammaFilters_, useVerticesForNeutral_, verbose_, and vertices_.

237  {
238  LogDebug("PFProducer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run() << endl;
239 
240  //Assign the PFAlgo Parameters
242 
243  // get the collection of blocks
244  auto blocks = iEvent.getHandle(inputTagBlocks_);
245  assert(blocks.isValid());
246 
247  // get the collection of muons
248  if (postMuonCleaning_)
250 
251  if (use_EGammaFilters_)
255 
256  LogDebug("PFProducer") << "particle flow is starting" << endl;
257 
259 
260  if (verbose_) {
261  ostringstream str;
262  str << pfAlgo_ << endl;
263  LogInfo("PFProducer") << str.str() << endl;
264  }
265 
266  // Check HF overcleaning
267  if (postHFCleaning_) {
269  for (unsigned ihf = 0; ihf < inputTagCleanedHF_.size(); ++ihf) {
271  bool foundHF = iEvent.getByToken(inputTagCleanedHF_[ihf], hfCleaned);
272  if (!foundHF)
273  continue;
274  for (unsigned jhf = 0; jhf < (*hfCleaned).size(); ++jhf) {
275  hfCopy.push_back((*hfCleaned)[jhf]);
276  }
277  }
278  pfAlgo_.checkCleaning(hfCopy);
279  }
280 
281  // Save the final PFCandidate collection
282  auto pOutputCandidateCollection = pfAlgo_.makeConnectedCandidates();
283 
284  LogDebug("PFProducer") << "particle flow: putting products in the event";
285  if (verbose_) {
286  int nC = 0;
287  ostringstream ss;
288  for (auto const& cand : pOutputCandidateCollection) {
289  nC++;
290  ss << " " << nC << ") pid=" << cand.particleId() << " pt=" << cand.pt() << endl;
291  }
292  LogDebug("PFProducer") << "Here the full list:" << endl << ss.str();
293  }
294 
295  // Write in the event
296  iEvent.emplace(pfCandidatesToken_, pOutputCandidateCollection);
298 
299  if (postMuonCleaning_) {
300  auto& muAlgo = *pfAlgo_.getPFMuonAlgo();
301  // Save cosmic cleaned muon candidates
302  iEvent.put(muAlgo.transferCleanedCosmicCandidates(), "CleanedCosmicsMuons");
303  // Save tracker/global cleaned muon candidates
304  iEvent.put(muAlgo.transferCleanedTrackerAndGlobalCandidates(), "CleanedTrackerAndGlobalMuons");
305  // Save fake cleaned muon candidates
306  iEvent.put(muAlgo.transferCleanedFakeCandidates(), "CleanedFakeMuons");
307  // Save punch-through cleaned muon candidates
308  iEvent.put(muAlgo.transferPunchThroughCleanedMuonCandidates(), "CleanedPunchThroughMuons");
309  // Save punch-through cleaned neutral hadron candidates
310  iEvent.put(muAlgo.transferPunchThroughCleanedHadronCandidates(), "CleanedPunchThroughNeutralHadrons");
311  // Save added muon candidates
312  iEvent.put(muAlgo.transferAddedMuonCandidates(), "AddedMuonsAndHadrons");
313  }
314 }
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
Definition: PFProducer.cc:63
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
Definition: PFProducer.cc:59
reco::PFCandidateCollection & getCleanedCandidates()
Definition: PFAlgo.h:112
int ihf
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void setMuonHandle(const edm::Handle< reco::MuonCollection > &)
Definition: PFAlgo.cc:86
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
Definition: PFAlgo.cc:3589
bool use_EGammaFilters_
Definition: PFProducer.cc:72
edm::EDGetTokenT< reco::VertexCollection > vertices_
Definition: PFProducer.cc:60
void setPFVertexParameters(bool useVertex, reco::VertexCollection const &primaryVertices)
Definition: PFAlgo.cc:112
std::unique_ptr< PFEGammaFilters > pfegamma_
Definition: PFProducer.cc:73
bool useVerticesForNeutral_
Definition: PFProducer.cc:88
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:547
void setEGammaCollections(const edm::View< reco::PFCandidate > &pfEgammaCandidates, const edm::ValueMap< reco::GsfElectronRef > &valueMapGedElectrons, const edm::ValueMap< reco::PhotonRef > &valueMapGedPhotons)
Definition: PFAlgo.cc:76
const edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
Definition: PFProducer.cc:58
bool postHFCleaning_
Definition: PFProducer.cc:94
bool postMuonCleaning_
Definition: PFProducer.cc:82
const edm::EDPutTokenT< reco::PFCandidateCollection > pfCandidatesToken_
Definition: PFProducer.cc:55
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:334
edm::EDGetTokenT< edm::View< reco::PFCandidate > > inputTagPFEGammaCandidates_
Definition: PFProducer.cc:70
void reconstructParticles(const reco::PFBlockHandle &blockHandle, PFEGammaFilters const *pfegamma)
reconstruct particles
Definition: PFAlgo.cc:132
PFAlgo pfAlgo_
particle flow algorithm
Definition: PFProducer.cc:103
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:421
bool verbose_
verbose ?
Definition: PFProducer.cc:79
edm::EventID id() const
Definition: EventBase.h:59
edm::EDGetTokenT< edm::ValueMap< reco::PhotonRef > > inputTagValueMapGedPhotons_
Definition: PFProducer.cc:69
reco::PFCandidateCollection makeConnectedCandidates()
Definition: PFAlgo.h:115
PFMuonAlgo * getPFMuonAlgo()
Definition: PFAlgo.cc:66
const edm::EDPutTokenT< reco::PFCandidateCollection > pfCleanedCandidatesToken_
Definition: PFProducer.cc:56
#define str(s)
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
Definition: PFProducer.cc:68

Member Data Documentation

std::string PFProducer::calibrationsLabel_
private

Definition at line 92 of file PFProducer.cc.

Referenced by beginRun(), and PFProducer().

std::string PFProducer::electronExtraOutputCol_
private

Definition at line 64 of file PFProducer.cc.

const edm::EDGetTokenT<reco::PFBlockCollection> PFProducer::inputTagBlocks_
private

Definition at line 58 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

std::vector<edm::EDGetTokenT<reco::PFRecHitCollection> > PFProducer::inputTagCleanedHF_
private

Definition at line 63 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

edm::EDGetTokenT<reco::GsfElectronCollection> PFProducer::inputTagEgammaElectrons_
private

Definition at line 61 of file PFProducer.cc.

Referenced by PFProducer().

edm::EDGetTokenT<reco::MuonCollection> PFProducer::inputTagMuons_
private

Definition at line 59 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

edm::EDGetTokenT<edm::View<reco::PFCandidate> > PFProducer::inputTagPFEGammaCandidates_
private

Definition at line 70 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<reco::GsfElectronRef> > PFProducer::inputTagValueMapGedElectrons_
private

Definition at line 68 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<reco::PhotonRef> > PFProducer::inputTagValueMapGedPhotons_
private

Definition at line 69 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

PFAlgo PFProducer::pfAlgo_
private

particle flow algorithm

Definition at line 103 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

const edm::EDPutTokenT<reco::PFCandidateCollection> PFProducer::pfCandidatesToken_
private

Definition at line 55 of file PFProducer.cc.

Referenced by produce().

const edm::EDPutTokenT<reco::PFCandidateCollection> PFProducer::pfCleanedCandidatesToken_
private

Definition at line 56 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

std::unique_ptr<PFEGammaFilters> PFProducer::pfegamma_ = 0
private

Definition at line 73 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

PFEnergyCalibration PFProducer::pfEnergyCalibration_
private

Definition at line 99 of file PFProducer.cc.

Referenced by beginRun(), and PFProducer().

PFEnergyCalibrationHF PFProducer::pfEnergyCalibrationHF_
private

Definition at line 100 of file PFProducer.cc.

Referenced by PFProducer().

std::string PFProducer::photonExtraOutputCol_
private

Definition at line 65 of file PFProducer.cc.

bool PFProducer::postHFCleaning_
private

Definition at line 94 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

bool PFProducer::postMuonCleaning_
private

Definition at line 82 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

bool PFProducer::use_EGammaFilters_
private

Definition at line 72 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

bool PFProducer::useCalibrationsFromDB_
private

Definition at line 91 of file PFProducer.cc.

Referenced by beginRun(), and PFProducer().

bool PFProducer::useEGammaElectrons_
private

Definition at line 85 of file PFProducer.cc.

Referenced by PFProducer().

bool PFProducer::useHO_
private

Definition at line 76 of file PFProducer.cc.

Referenced by PFProducer().

bool PFProducer::useVerticesForNeutral_
private

Definition at line 88 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

bool PFProducer::verbose_
private

verbose ?

Definition at line 79 of file PFProducer.cc.

Referenced by PFProducer(), and produce().

edm::EDGetTokenT<reco::VertexCollection> PFProducer::vertices_
private

Definition at line 60 of file PFProducer.cc.

Referenced by PFProducer(), and produce().