CMS 3D CMS Logo

PFProducer.cc
Go to the documentation of this file.
11 
12 #include <sstream>
13 
14 #include "TFile.h"
15 
16 using namespace std;
17 using namespace edm;
18 
19 
21  : putToken_{produces<reco::PFCandidateCollection>()}
22  , pfAlgo_(iConfig.getUntrackedParameter<bool>("debug",false))
23 {
24  //--ab: get calibration factors for HF:
25  auto thepfEnergyCalibrationHF = std::make_shared<PFEnergyCalibrationHF>(
26  iConfig.getParameter<bool>("calibHF_use"),
27  iConfig.getParameter<std::vector<double> >("calibHF_eta_step"),
28  iConfig.getParameter<std::vector<double> >("calibHF_a_EMonly"),
29  iConfig.getParameter<std::vector<double> >("calibHF_b_HADonly"),
30  iConfig.getParameter<std::vector<double> >("calibHF_a_EMHAD"),
31  iConfig.getParameter<std::vector<double> >("calibHF_b_EMHAD")
32  );
33  //-----------------
34 
35  inputTagBlocks_ = consumes<reco::PFBlockCollection>(iConfig.getParameter<InputTag>("blocks"));
36 
37  //Post cleaning of the muons
38  inputTagMuons_ = consumes<reco::MuonCollection>(iConfig.getParameter<InputTag>("muons"));
40  = iConfig.getParameter<bool>("postMuonCleaning");
41 
42  if( iConfig.existsAs<bool>("useEGammaFilters") ) {
43  use_EGammaFilters_ = iConfig.getParameter<bool>("useEGammaFilters");
44  } else {
45  use_EGammaFilters_ = false;
46  }
47 
49  = iConfig.getParameter<bool>("usePFElectrons");
50 
52  = iConfig.getParameter<bool>("usePFPhotons");
53 
54  // **************************** !! IMPORTANT !! ************************************
55  // When you code is swithed on, automatically turn off the old PFElectrons/PFPhotons.
56  // The two algorithms can not run at the same time
57  // *********************************************************************************
58 
59  if(use_EGammaFilters_) {
60  usePFElectrons_ = false;
61  usePFPhotons_ = false;
62  }
63 
64 
66  = (usePFPhotons_) ? iConfig.getParameter<bool>("usePhotonReg") : false ;
67 
69  = (usePFPhotons_) ? iConfig.getParameter<bool>("useRegressionFromDB") : false;
70 
72  = iConfig.getParameter<bool>("useEGammaElectrons");
73 
74  if( useEGammaElectrons_) {
75  inputTagEgammaElectrons_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("egammaElectrons"));
76  }
77 
79  = iConfig.getParameter<std::string>("pf_electron_output_col");
80 
81  bool usePFSCEleCalib;
82  std::vector<double> calibPFSCEle_Fbrem_barrel;
83  std::vector<double> calibPFSCEle_Fbrem_endcap;
84  std::vector<double> calibPFSCEle_barrel;
85  std::vector<double> calibPFSCEle_endcap;
86  usePFSCEleCalib = iConfig.getParameter<bool>("usePFSCEleCalib");
87  calibPFSCEle_Fbrem_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_Fbrem_barrel");
88  calibPFSCEle_Fbrem_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_Fbrem_endcap");
89  calibPFSCEle_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_barrel");
90  calibPFSCEle_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_endcap");
91  std::shared_ptr<PFSCEnergyCalibration>
92  thePFSCEnergyCalibration ( new PFSCEnergyCalibration(calibPFSCEle_Fbrem_barrel,calibPFSCEle_Fbrem_endcap,
93  calibPFSCEle_barrel,calibPFSCEle_endcap ));
94 
95  bool useEGammaSupercluster = iConfig.getParameter<bool>("useEGammaSupercluster");
96  double sumEtEcalIsoForEgammaSC_barrel = iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_barrel");
97  double sumEtEcalIsoForEgammaSC_endcap = iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_endcap");
98  double coneEcalIsoForEgammaSC = iConfig.getParameter<double>("coneEcalIsoForEgammaSC");
99  double sumPtTrackIsoForEgammaSC_barrel = iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_barrel");
100  double sumPtTrackIsoForEgammaSC_endcap = iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_endcap");
101  double coneTrackIsoForEgammaSC = iConfig.getParameter<double>("coneTrackIsoForEgammaSC");
102  unsigned int nTrackIsoForEgammaSC = iConfig.getParameter<unsigned int>("nTrackIsoForEgammaSC");
103 
104 
105  // register products
106  produces<reco::PFCandidateCollection>("CleanedHF");
107  produces<reco::PFCandidateCollection>("CleanedCosmicsMuons");
108  produces<reco::PFCandidateCollection>("CleanedTrackerAndGlobalMuons");
109  produces<reco::PFCandidateCollection>("CleanedFakeMuons");
110  produces<reco::PFCandidateCollection>("CleanedPunchThroughMuons");
111  produces<reco::PFCandidateCollection>("CleanedPunchThroughNeutralHadrons");
112  produces<reco::PFCandidateCollection>("AddedMuonsAndHadrons");
113 
114 
115  if (usePFElectrons_) {
116  produces<reco::PFCandidateCollection>(electronOutputCol_);
117  produces<reco::PFCandidateElectronExtraCollection>(electronExtraOutputCol_);
118  }
119 
120  if (usePFPhotons_) {
121  produces<reco::PFCandidatePhotonExtraCollection>(photonExtraOutputCol_);
122  }
123 
124 
125  double nSigmaECAL
126  = iConfig.getParameter<double>("pf_nsigma_ECAL");
127  double nSigmaHCAL
128  = iConfig.getParameter<double>("pf_nsigma_HCAL");
129 
130  //PFElectrons Configuration
131  double mvaEleCut
132  = iConfig.getParameter<double>("pf_electron_mvaCut");
133 
134 
135  string mvaWeightFileEleID
136  = iConfig.getParameter<string>("pf_electronID_mvaWeightFile");
137 
138  bool applyCrackCorrectionsForElectrons
139  = iConfig.getParameter<bool>("pf_electronID_crackCorrection");
140 
141  string path_mvaWeightFileEleID;
142  if(usePFElectrons_)
143  {
144  path_mvaWeightFileEleID = edm::FileInPath ( mvaWeightFileEleID.c_str() ).fullPath();
145  }
146 
147  //PFPhoton Configuration
148 
149  string path_mvaWeightFileConvID;
150  string mvaWeightFileConvID;
151  string path_mvaWeightFileGCorr;
152  string path_mvaWeightFileLCorr;
153  string path_X0_Map;
154  string path_mvaWeightFileRes;
155  double mvaConvCut=-99.;
156  double sumPtTrackIsoForPhoton = 99.;
157  double sumPtTrackIsoSlopeForPhoton = 99.;
158 
159  if(usePFPhotons_ )
160  {
161  mvaWeightFileConvID =iConfig.getParameter<string>("pf_convID_mvaWeightFile");
162  mvaConvCut = iConfig.getParameter<double>("pf_conv_mvaCut");
163  path_mvaWeightFileConvID = edm::FileInPath ( mvaWeightFileConvID.c_str() ).fullPath();
164  sumPtTrackIsoForPhoton = iConfig.getParameter<double>("sumPtTrackIsoForPhoton");
165  sumPtTrackIsoSlopeForPhoton = iConfig.getParameter<double>("sumPtTrackIsoSlopeForPhoton");
166 
167  string X0_Map=iConfig.getParameter<string>("X0_Map");
168  path_X0_Map = edm::FileInPath( X0_Map.c_str() ).fullPath();
169 
170  if(!useRegressionFromDB_) {
171  string mvaWeightFileLCorr=iConfig.getParameter<string>("pf_locC_mvaWeightFile");
172  path_mvaWeightFileLCorr = edm::FileInPath( mvaWeightFileLCorr.c_str() ).fullPath();
173  string mvaWeightFileGCorr=iConfig.getParameter<string>("pf_GlobC_mvaWeightFile");
174  path_mvaWeightFileGCorr = edm::FileInPath( mvaWeightFileGCorr.c_str() ).fullPath();
175  string mvaWeightFileRes=iConfig.getParameter<string>("pf_Res_mvaWeightFile");
176  path_mvaWeightFileRes=edm::FileInPath(mvaWeightFileRes.c_str()).fullPath();
177 
178  TFile *fgbr = new TFile(path_mvaWeightFileGCorr.c_str(),"READ");
179  ReaderGC_ =(const GBRForest*)fgbr->Get("GBRForest");
180  TFile *fgbr2 = new TFile(path_mvaWeightFileLCorr.c_str(),"READ");
181  ReaderLC_ = (const GBRForest*)fgbr2->Get("GBRForest");
182  TFile *fgbr3 = new TFile(path_mvaWeightFileRes.c_str(),"READ");
183  ReaderRes_ = (const GBRForest*)fgbr3->Get("GBRForest");
184  LogDebug("PFProducer")<<"Will set regressions from binary files " <<endl;
185  }
186 
187  }
188 
189 
190  // Reading new EGamma selection cuts
191  bool useProtectionsForJetMET(false);
192  // Reading new EGamma ubiased collections and value maps
193  if(use_EGammaFilters_) {
194  inputTagPFEGammaCandidates_ = consumes<edm::View<reco::PFCandidate> >((iConfig.getParameter<edm::InputTag>("PFEGammaCandidates")));
195  inputTagValueMapGedElectrons_ = consumes<edm::ValueMap<reco::GsfElectronRef>>(iConfig.getParameter<edm::InputTag>("GedElectronValueMap"));
196  inputTagValueMapGedPhotons_ = consumes<edm::ValueMap<reco::PhotonRef> >(iConfig.getParameter<edm::InputTag>("GedPhotonValueMap"));
197  useProtectionsForJetMET = iConfig.getParameter<bool>("useProtectionsForJetMET");
198  }
199 
200  //Secondary tracks and displaced vertices parameters
201 
202  bool rejectTracks_Bad
203  = iConfig.getParameter<bool>("rejectTracks_Bad");
204 
206  = iConfig.getParameter<bool>("rejectTracks_Step45");
207 
209  = iConfig.getParameter<bool>("usePFNuclearInteractions");
210 
211  bool usePFConversions
212  = iConfig.getParameter<bool>("usePFConversions");
213 
214  bool usePFDecays
215  = iConfig.getParameter<bool>("usePFDecays");
216 
217  double dptRel_DispVtx
218  = iConfig.getParameter<double>("dptRel_DispVtx");
219 
221  = iConfig.getParameter<edm::ParameterSet>("iCfgCandConnector");
222 
223 
224  // fToRead = iConfig.getUntrackedParameter<vector<string> >("toRead");
225 
227  = iConfig.getParameter<bool>("useCalibrationsFromDB");
228 
229  if (useCalibrationsFromDB_)
230  calibrationsLabel_ = iConfig.getParameter<std::string>("calibrationsLabel");
231 
232  auto calibration = std::make_shared<PFEnergyCalibration>();
233 
234  pfAlgo_.setParameters( nSigmaECAL,
235  nSigmaHCAL,
236  calibration,
237  thepfEnergyCalibrationHF);
238 
239  //PFElectrons: call the method setpfeleparameters
240  pfAlgo_.setPFEleParameters(mvaEleCut,
241  path_mvaWeightFileEleID,
243  thePFSCEnergyCalibration,
244  calibration,
245  sumEtEcalIsoForEgammaSC_barrel,
246  sumEtEcalIsoForEgammaSC_endcap,
247  coneEcalIsoForEgammaSC,
248  sumPtTrackIsoForEgammaSC_barrel,
249  sumPtTrackIsoForEgammaSC_endcap,
250  nTrackIsoForEgammaSC,
251  coneTrackIsoForEgammaSC,
252  applyCrackCorrectionsForElectrons,
253  usePFSCEleCalib,
255  useEGammaSupercluster);
256 
257  // pfAlgo_.setPFConversionParameters(usePFConversions);
258 
259  // PFPhotons:
260  pfAlgo_.setPFPhotonParameters(usePFPhotons_,
261  path_mvaWeightFileConvID,
262  mvaConvCut,
264  path_X0_Map,
265  calibration,
266  sumPtTrackIsoForPhoton,
267  sumPtTrackIsoSlopeForPhoton);
268 
269 
270  // NEW EGamma Filters
271  pfAlgo_.setEGammaParameters(use_EGammaFilters_, useProtectionsForJetMET);
272 
273  if(use_EGammaFilters_) pfegamma_ = std::make_unique<PFEGammaFilters>(iConfig);
274 
275 
276  //Secondary tracks and displaced vertices parameters
277 
278  pfAlgo_.setDisplacedVerticesParameters(rejectTracks_Bad,
279  rejectTracks_Step45,
280  usePFNuclearInteractions,
281  usePFConversions,
282  usePFDecays,
283  dptRel_DispVtx);
284 
285  if (usePFNuclearInteractions)
286  pfAlgo_.setCandConnectorParameters( iCfgCandConnector );
287 
288 
289 
290  // Set muon and fake track parameters
293 
294  //Post cleaning of the HF
296  = iConfig.getParameter<bool>("postHFCleaning");
297  double minHFCleaningPt
298  = iConfig.getParameter<double>("minHFCleaningPt");
299  double minSignificance
300  = iConfig.getParameter<double>("minSignificance");
301  double maxSignificance
302  = iConfig.getParameter<double>("maxSignificance");
304  = iConfig.getParameter<double>("minSignificanceReduction");
305  double maxDeltaPhiPt
306  = iConfig.getParameter<double>("maxDeltaPhiPt");
307  double minDeltaMet
308  = iConfig.getParameter<double>("minDeltaMet");
309 
310  // Set post HF cleaning muon parameters
312  minHFCleaningPt,
313  minSignificance,
314  maxSignificance,
315  minSignificanceReduction,
316  maxDeltaPhiPt,
317  minDeltaMet);
318 
319  // Input tags for HF cleaned rechits
320  std::vector<edm::InputTag> tags =iConfig.getParameter< std::vector<edm::InputTag> >("cleanedHF");
321  for (unsigned int i=0;i<tags.size();++i)
322  inputTagCleanedHF_.push_back(consumes<reco::PFRecHitCollection>(tags[i]));
323  //MIKE: Vertex Parameters
324  vertices_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"));
325  useVerticesForNeutral_ = iConfig.getParameter<bool>("useVerticesForNeutral");
326 
327  // Use HO clusters and links in the PF reconstruction
328  useHO_= iConfig.getParameter<bool>("useHO");
329  pfAlgo_.setHOTag(useHO_);
330 
331  verbose_ =
332  iConfig.getUntrackedParameter<bool>("verbose",false);
333 }
334 
335 
336 void
338  const edm::EventSetup & es)
339 {
340 
341 
342  /*
343  static map<string, PerformanceResult::ResultType> functType;
344 
345  functType["PFfa_BARREL"] = PerformanceResult::PFfa_BARREL;
346  functType["PFfa_ENDCAP"] = PerformanceResult::PFfa_ENDCAP;
347  functType["PFfb_BARREL"] = PerformanceResult::PFfb_BARREL;
348  functType["PFfb_ENDCAP"] = PerformanceResult::PFfb_ENDCAP;
349  functType["PFfc_BARREL"] = PerformanceResult::PFfc_BARREL;
350  functType["PFfc_ENDCAP"] = PerformanceResult::PFfc_ENDCAP;
351  functType["PFfaEta_BARREL"] = PerformanceResult::PFfaEta_BARREL;
352  functType["PFfaEta_ENDCAP"] = PerformanceResult::PFfaEta_ENDCAP;
353  functType["PFfbEta_BARREL"] = PerformanceResult::PFfbEta_BARREL;
354  functType["PFfbEta_ENDCAP"] = PerformanceResult::PFfbEta_ENDCAP;
355  */
356 
357  if ( useCalibrationsFromDB_ ) {
358  // read the PFCalibration functions from the global tags
360  es.get<PFCalibrationRcd>().get(calibrationsLabel_, perfH);
361 
362  PerformancePayloadFromTFormula const * pfCalibrations = static_cast< const PerformancePayloadFromTFormula *>(perfH.product());
363 
364  pfAlgo_.thePFEnergyCalibration()->setCalibrationFunctions(pfCalibrations);
365  }
366 
367  /*
368  for(vector<string>::const_iterator name = fToRead.begin(); name != fToRead.end(); ++name) {
369 
370  cout << "Function: " << *name << endl;
371  PerformanceResult::ResultType fType = functType[*name];
372  pfCalibrations->printFormula(fType);
373 
374  // evaluate it @ 10 GeV
375  float energy = 10.;
376 
377  BinningPointByMap point;
378  point.insert(BinningVariables::JetEt, energy);
379 
380  if(pfCalibrations->isInPayload(fType, point)) {
381  float value = pfCalibrations->getResult(fType, point);
382  cout << " Energy before:: " << energy << " after: " << value << endl;
383  } else cout << "outside limits!" << endl;
384 
385  }
386  */
387 
389  edm::ESHandle<GBRForest> readerPFLCEB;
390  edm::ESHandle<GBRForest> readerPFLCEE;
391  edm::ESHandle<GBRForest> readerPFGCEB;
392  edm::ESHandle<GBRForest> readerPFGCEEHR9;
393  edm::ESHandle<GBRForest> readerPFGCEELR9;
394  edm::ESHandle<GBRForest> readerPFRes;
395  es.get<GBRWrapperRcd>().get("PFLCorrectionBar",readerPFLCEB);
396  ReaderLCEB_=readerPFLCEB.product();
397  es.get<GBRWrapperRcd>().get("PFLCorrectionEnd",readerPFLCEE);
398  ReaderLCEE_=readerPFLCEE.product();
399  es.get<GBRWrapperRcd>().get("PFGCorrectionBar",readerPFGCEB);
400  ReaderGCBarrel_=readerPFGCEB.product();
401  es.get<GBRWrapperRcd>().get("PFGCorrectionEndHighR9",readerPFGCEEHR9);
402  ReaderGCEndCapHighr9_=readerPFGCEEHR9.product();
403  es.get<GBRWrapperRcd>().get("PFGCorrectionEndLowR9",readerPFGCEELR9);
404  ReaderGCEndCapLowr9_=readerPFGCEELR9.product();
405  es.get<GBRWrapperRcd>().get("PFEcalResolution",readerPFRes);
406  ReaderEcalRes_=readerPFRes.product();
407 
408  /*
409  LogDebug("PFProducer")<<"setting regressions from DB "<<endl;
410  */
411  }
412 
413  if(usePFPhotons_){
414  //pfAlgo_.setPFPhotonRegWeights(ReaderLC_, ReaderGC_, ReaderRes_);
416  }
417 }
418 
419 
420 void
422 {
423  LogDebug("PFProducer")<<"START event: " <<iEvent.id().event() <<" in run "<<iEvent.id().run()<<endl;
424 
425  //Assign the PFAlgo Parameters
427 
428  // get the collection of blocks
429  auto blocks = iEvent.getHandle( inputTagBlocks_);
430  assert( blocks.isValid() );
431 
432  // get the collection of muons
434 
436 
440 
441 
442  LogDebug("PFProducer")<<"particle flow is starting"<<endl;
443 
445 
446  if(verbose_) {
447  ostringstream str;
448  str<< pfAlgo_ <<endl;
449  // cout << pfAlgo_ << endl;
450  LogInfo("PFProducer") <<str.str()<<endl;
451  }
452 
453 
454  // Florian 5/01/2011
455  // Save the PFElectron Extra Collection First as to be able to create valid References
456  if(usePFElectrons_) {
457  std::unique_ptr<reco::PFCandidateElectronExtraCollection> pOutputElectronCandidateExtraCollection( pfAlgo_.transferElectronExtra() );
458 
460  iEvent.put(std::move(pOutputElectronCandidateExtraCollection),electronExtraOutputCol_);
461  pfAlgo_.setElectronExtraRef(electronExtraProd);
462  }
463 
464  // Daniele 18/05/2011
465  // Save the PFPhoton Extra Collection First as to be able to create valid References
466  if(usePFPhotons_) {
467  std::unique_ptr<reco::PFCandidatePhotonExtraCollection> pOutputPhotonCandidateExtraCollection( pfAlgo_.transferPhotonExtra() );
468 
470  iEvent.put(std::move(pOutputPhotonCandidateExtraCollection),photonExtraOutputCol_);
471  pfAlgo_.setPhotonExtraRef(photonExtraProd);
472  }
473 
474  // Save cosmic cleaned muon candidates
475  std::unique_ptr<reco::PFCandidateCollection>
476  pCosmicsMuonCleanedCandidateCollection( pfAlgo_.getPFMuonAlgo()->transferCleanedCosmicCandidates() );
477  // Save tracker/global cleaned muon candidates
478  std::unique_ptr<reco::PFCandidateCollection>
479  pTrackerAndGlobalCleanedMuonCandidateCollection( pfAlgo_.getPFMuonAlgo()->transferCleanedTrackerAndGlobalCandidates() );
480  // Save fake cleaned muon candidates
481  std::unique_ptr<reco::PFCandidateCollection>
482  pFakeCleanedMuonCandidateCollection( pfAlgo_.getPFMuonAlgo()->transferCleanedFakeCandidates() );
483  // Save punch-through cleaned muon candidates
484  std::unique_ptr<reco::PFCandidateCollection>
485  pPunchThroughMuonCleanedCandidateCollection( pfAlgo_.getPFMuonAlgo()->transferPunchThroughCleanedMuonCandidates() );
486  // Save punch-through cleaned neutral hadron candidates
487  std::unique_ptr<reco::PFCandidateCollection>
488  pPunchThroughHadronCleanedCandidateCollection( pfAlgo_.getPFMuonAlgo()->transferPunchThroughCleanedHadronCandidates() );
489  // Save added muon candidates
490  std::unique_ptr<reco::PFCandidateCollection>
491  pAddedMuonCandidateCollection( pfAlgo_.getPFMuonAlgo()->transferAddedMuonCandidates() );
492 
493  // Check HF overcleaning
495  for ( unsigned ihf=0; ihf<inputTagCleanedHF_.size(); ++ihf ) {
497  bool foundHF = iEvent.getByToken( inputTagCleanedHF_[ihf], hfCleaned );
498  if (!foundHF) continue;
499  for ( unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
500  hfCopy.push_back( (*hfCleaned)[jhf] );
501  }
502  }
503 
504  if (postHFCleaning_)
505  pfAlgo_.checkCleaning( hfCopy );
506 
507  // Save recovered HF candidates
508  std::unique_ptr<reco::PFCandidateCollection> pCleanedCandidateCollection( pfAlgo_.transferCleanedCandidates() );
509 
510 
511  // Save the final PFCandidate collection
512  reco::PFCandidateCollection pOutputCandidateCollection = pfAlgo_.transferCandidates();
513 
514 
515 
516  LogDebug("PFProducer")<<"particle flow: putting products in the event"<<endl;
517  if ( verbose_ ) std::cout <<"particle flow: putting products in the event. Here the full list"<<endl;
518  int nC=0;
519  for(auto const& cand : pOutputCandidateCollection) {
520  nC++;
521  if (verbose_ ) std::cout << nC << ")" << cand.particleId() << std::endl;
522 
523  }
524 
525 
526 
527  // Write in the event
528  iEvent.emplace(putToken_,pOutputCandidateCollection);
529  iEvent.put(std::move(pCleanedCandidateCollection),"CleanedHF");
530 
531  if ( postMuonCleaning_ ) {
532  iEvent.put(std::move(pCosmicsMuonCleanedCandidateCollection),"CleanedCosmicsMuons");
533  iEvent.put(std::move(pTrackerAndGlobalCleanedMuonCandidateCollection),"CleanedTrackerAndGlobalMuons");
534  iEvent.put(std::move(pFakeCleanedMuonCandidateCollection),"CleanedFakeMuons");
535  iEvent.put(std::move(pPunchThroughMuonCleanedCandidateCollection),"CleanedPunchThroughMuons");
536  iEvent.put(std::move(pPunchThroughHadronCleanedCandidateCollection),"CleanedPunchThroughNeutralHadrons");
537  iEvent.put(std::move(pAddedMuonCandidateCollection),"AddedMuonsAndHadrons");
538  }
539 
540  if(usePFElectrons_)
541  {
542  std::unique_ptr<reco::PFCandidateCollection>
543  pOutputElectronCandidateCollection( pfAlgo_.transferElectronCandidates() );
544  iEvent.put(std::move(pOutputElectronCandidateCollection),electronOutputCol_);
545 
546  }
547 }
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
Definition: PFProducer.h:60
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
const GBRForest * ReaderRes_
Definition: PFProducer.h:94
EventNumber_t event() const
Definition: EventID.h:41
std::string photonExtraOutputCol_
Definition: PFProducer.h:63
const GBRForest * ReaderEcalRes_
Definition: PFProducer.h:100
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
Definition: PFProducer.h:55
void setPFMuonAndFakeParameters(const edm::ParameterSet &pset)
Definition: PFAlgo.cc:228
int ihf
const GBRForest * ReaderLCEB_
Definition: PFProducer.h:95
const GBRForest * ReaderGCEndCapHighr9_
Definition: PFProducer.h:98
reco::PFCandidateCollection transferCandidates()
Definition: PFAlgo.h:208
std::unique_ptr< reco::PFCandidateElectronExtraCollection > transferElectronExtra()
Definition: PFAlgo.h:186
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
Definition: PFAlgo.h:67
std::unique_ptr< reco::PFCandidateCollection > transferAddedMuonCandidates()
Definition: PFMuonAlgo.h:79
std::string calibrationsLabel_
Definition: PFProducer.h:109
const edm::EDPutTokenT< reco::PFCandidateCollection > putToken_
Definition: PFProducer.h:52
std::unique_ptr< reco::PFCandidateCollection > transferCleanedTrackerAndGlobalCandidates()
Definition: PFMuonAlgo.h:63
void setMuonHandle(const edm::Handle< reco::MuonCollection > &)
Definition: PFAlgo.cc:263
const GBRForest * ReaderLC_
Definition: PFProducer.h:93
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
Definition: PFAlgo.cc:3614
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
Definition: PFAlgo.cc:285
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
Definition: PFAlgo.cc:3506
bool useCalibrationsFromDB_
Definition: PFProducer.h:108
bool use_EGammaFilters_
Definition: PFProducer.h:70
edm::EDGetTokenT< reco::VertexCollection > vertices_
Definition: PFProducer.h:56
void produce(edm::Event &, const edm::EventSetup &) override
Definition: PFProducer.cc:421
void setPFVertexParameters(bool useVertex, reco::VertexCollection const &primaryVertices)
Definition: PFAlgo.cc:302
std::unique_ptr< PFEGammaFilters > pfegamma_
Definition: PFProducer.h:71
const GBRForest * ReaderLCEE_
Definition: PFProducer.h:96
bool useVerticesForNeutral_
Definition: PFProducer.h:105
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:539
PFProducer(const edm::ParameterSet &)
Definition: PFProducer.cc:20
int iEvent
Definition: GenABIO.cc:224
void setEGammaCollections(const edm::View< reco::PFCandidate > &pfEgammaCandidates, const edm::ValueMap< reco::GsfElectronRef > &valueMapGedElectrons, const edm::ValueMap< reco::PhotonRef > &valueMapGedPhotons)
Definition: PFAlgo.cc:204
void setBadHcalTrackParams(const edm::ParameterSet &pset)
Definition: PFAlgo.cc:244
std::unique_ptr< reco::PFCandidateCollection > transferCleanedCandidates()
Definition: PFAlgo.h:203
bool postHFCleaning_
Definition: PFProducer.h:111
std::unique_ptr< reco::PFCandidateCollection > transferElectronCandidates()
Definition: PFAlgo.h:180
bool postMuonCleaning_
Definition: PFProducer.h:81
void setPFEleParameters(double mvaEleCut, std::string mvaWeightFileEleID, bool usePFElectrons, const std::shared_ptr< PFSCEnergyCalibration > &thePFSCEnergyCalibration, const std::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumEtEcalIsoForEgammaSC_barrel, double sumEtEcalIsoForEgammaSC_endcap, double coneEcalIsoForEgammaSC, double sumPtTrackIsoForEgammaSC_barrel, double sumPtTrackIsoForEgammaSC_endcap, unsigned int nTrackIsoForEgammaSC, double coneTrackIsoForEgammaSC, bool applyCrackCorrections=false, bool usePFSCEleCalib=true, bool useEGElectrons=false, bool useEGammaSupercluster=true)
Definition: PFAlgo.cc:82
void setPFPhotonRegWeights(const GBRForest *LCorrForestEB, const GBRForest *LCorrForestEE, const GBRForest *GCorrForestBarrel, const GBRForest *GCorrForestEndcapHr9, const GBRForest *GCorrForestEndcapLr9, const GBRForest *PFEcalResolution)
Definition: PFAlgo.cc:215
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:326
std::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration()
return the pointer to the calibration function
Definition: PFAlgo.h:213
void setParameters(double nSigmaECAL, double nSigmaHCAL, const std::shared_ptr< PFEnergyCalibration > &calibration, const std::shared_ptr< PFEnergyCalibrationHF > &thepfEnergyCalibrationHF)
Definition: PFAlgo.cc:62
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: PFProducer.cc:337
void setPostHFCleaningParameters(bool postHFCleaning, double minHFCleaningPt, double minSignificance, double maxSignificance, double minSignificanceReduction, double maxDeltaPhiPt, double minDeltaMet)
Definition: PFAlgo.cc:268
edm::EDGetTokenT< edm::View< reco::PFCandidate > > inputTagPFEGammaCandidates_
Definition: PFProducer.h:68
void setPFPhotonParameters(bool usePFPhoton, std::string mvaWeightFileConvID, double mvaConvCut, bool useReg, std::string X0_Map, const std::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumPtTrackIsoForPhoton, double sumPtTrackIsoSlopeForPhoton)
Definition: PFAlgo.cc:144
edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
Definition: PFProducer.h:54
void setHOTag(bool ho)
Definition: PFAlgo.h:57
void reconstructParticles(const reco::PFBlockHandle &blockHandle, PFEGammaFilters const *pfegamma)
Definition: PFAlgo.cc:344
const GBRForest * ReaderGCEndCapLowr9_
Definition: PFProducer.h:99
bool useHO_
Definition: PFProducer.h:75
bool useRegressionFromDB_
Definition: PFProducer.h:91
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::unique_ptr< reco::PFCandidatePhotonExtraCollection > transferPhotonExtra()
Definition: PFAlgo.h:195
PFAlgo pfAlgo_
particle flow algorithm
Definition: PFProducer.h:116
bool usePFElectrons_
Definition: PFProducer.h:84
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:413
std::string electronOutputCol_
Definition: PFProducer.h:61
bool verbose_
verbose ?
Definition: PFProducer.h:78
std::string electronExtraOutputCol_
Definition: PFProducer.h:62
bool useEGammaElectrons_
Definition: PFProducer.h:102
std::unique_ptr< reco::PFCandidateCollection > transferCleanedCosmicCandidates()
Definition: PFMuonAlgo.h:59
edm::EventID id() const
Definition: EventBase.h:59
edm::EDGetTokenT< edm::ValueMap< reco::PhotonRef > > inputTagValueMapGedPhotons_
Definition: PFProducer.h:67
std::unique_ptr< reco::PFCandidateCollection > transferCleanedFakeCandidates()
Definition: PFMuonAlgo.h:67
HLT enums.
T get() const
Definition: EventSetup.h:71
PFMuonAlgo * getPFMuonAlgo()
Definition: PFAlgo.cc:76
void setPhotonExtraRef(const edm::OrphanHandle< reco::PFCandidatePhotonExtraCollection > &pf_extrah)
Definition: PFAlgo.cc:3769
bool usePFPhotons_
Definition: PFProducer.h:87
const GBRForest * ReaderGCBarrel_
Definition: PFProducer.h:97
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedHadronCandidates()
Definition: PFMuonAlgo.h:75
#define str(s)
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagEgammaElectrons_
Definition: PFProducer.h:57
bool usePhotonReg_
Definition: PFProducer.h:90
def move(src, dest)
Definition: eostools.py:511
void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET)
Definition: PFAlgo.cc:195
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
Definition: PFProducer.h:66
Definition: Run.h:45
void setElectronExtraRef(const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > &extrah)
Definition: PFAlgo.cc:3718
const GBRForest * ReaderGC_
Definition: PFProducer.h:92
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedMuonCandidates()
Definition: PFMuonAlgo.h:71