CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFProducer.cc
Go to the documentation of this file.
3 
19 #include <sstream>
20 
21 #include "TFile.h"
22 
23 using namespace std;
24 
25 using namespace boost;
26 
27 using namespace edm;
28 
29 
30 
32 
33  //--ab: get calibration factors for HF:
34  bool calibHF_use;
35  std::vector<double> calibHF_eta_step;
36  std::vector<double> calibHF_a_EMonly;
37  std::vector<double> calibHF_b_HADonly;
38  std::vector<double> calibHF_a_EMHAD;
39  std::vector<double> calibHF_b_EMHAD;
40  calibHF_use = iConfig.getParameter<bool>("calibHF_use");
41  calibHF_eta_step = iConfig.getParameter<std::vector<double> >("calibHF_eta_step");
42  calibHF_a_EMonly = iConfig.getParameter<std::vector<double> >("calibHF_a_EMonly");
43  calibHF_b_HADonly = iConfig.getParameter<std::vector<double> >("calibHF_b_HADonly");
44  calibHF_a_EMHAD = iConfig.getParameter<std::vector<double> >("calibHF_a_EMHAD");
45  calibHF_b_EMHAD = iConfig.getParameter<std::vector<double> >("calibHF_b_EMHAD");
46  boost::shared_ptr<PFEnergyCalibrationHF>
47  thepfEnergyCalibrationHF ( new PFEnergyCalibrationHF(calibHF_use,calibHF_eta_step,calibHF_a_EMonly,calibHF_b_HADonly,calibHF_a_EMHAD,calibHF_b_EMHAD) ) ;
48  //-----------------
49 
50  inputTagBlocks_
51  = iConfig.getParameter<InputTag>("blocks");
52 
53  //Post cleaning of the muons
54  inputTagMuons_
55  = iConfig.getParameter<InputTag>("muons");
56  postMuonCleaning_
57  = iConfig.getParameter<bool>("postMuonCleaning");
58 
59  usePFElectrons_
60  = iConfig.getParameter<bool>("usePFElectrons");
61 
62  usePFPhotons_
63  = iConfig.getParameter<bool>("usePFPhotons");
64 
65  usePhotonReg_
66  = (usePFPhotons_) ? iConfig.getParameter<bool>("usePhotonReg") : false ;
67 
68  useRegressionFromDB_
69  = (usePFPhotons_) ? iConfig.getParameter<bool>("useRegressionFromDB") : false;
70 
71  useEGammaElectrons_
72  = iConfig.getParameter<bool>("useEGammaElectrons");
73 
74  if( useEGammaElectrons_) {
75  inputTagEgammaElectrons_ = iConfig.getParameter<edm::InputTag>("egammaElectrons");
76  }
77 
78  electronOutputCol_
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  boost::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>();
107  produces<reco::PFCandidateCollection>("CleanedHF");
108  produces<reco::PFCandidateCollection>("CleanedCosmicsMuons");
109  produces<reco::PFCandidateCollection>("CleanedTrackerAndGlobalMuons");
110  produces<reco::PFCandidateCollection>("CleanedFakeMuons");
111  produces<reco::PFCandidateCollection>("CleanedPunchThroughMuons");
112  produces<reco::PFCandidateCollection>("CleanedPunchThroughNeutralHadrons");
113  produces<reco::PFCandidateCollection>("AddedMuonsAndHadrons");
114 
115 
116  if (usePFElectrons_) {
117  produces<reco::PFCandidateCollection>(electronOutputCol_);
118  produces<reco::PFCandidateElectronExtraCollection>(electronExtraOutputCol_);
119  }
120 
121  if (usePFPhotons_) {
122  produces<reco::PFCandidatePhotonExtraCollection>(photonExtraOutputCol_);
123  }
124 
125 
126  double nSigmaECAL
127  = iConfig.getParameter<double>("pf_nsigma_ECAL");
128  double nSigmaHCAL
129  = iConfig.getParameter<double>("pf_nsigma_HCAL");
130 
131  //PFElectrons Configuration
132  double mvaEleCut
133  = iConfig.getParameter<double>("pf_electron_mvaCut");
134 
135 
136  string mvaWeightFileEleID
137  = iConfig.getParameter<string>("pf_electronID_mvaWeightFile");
138 
139  bool applyCrackCorrectionsForElectrons
140  = iConfig.getParameter<bool>("pf_electronID_crackCorrection");
141 
142  string path_mvaWeightFileEleID;
143  if(usePFElectrons_)
144  {
145  path_mvaWeightFileEleID = edm::FileInPath ( mvaWeightFileEleID.c_str() ).fullPath();
146  }
147 
148  //PFPhoton Configuration
149 
150  string path_mvaWeightFileConvID;
151  string mvaWeightFileConvID;
152  string path_mvaWeightFileGCorr;
153  string path_mvaWeightFileLCorr;
154  string path_X0_Map;
155  string path_mvaWeightFileRes;
156  double mvaConvCut=-99.;
157  double sumPtTrackIsoForPhoton = 99.;
158  double sumPtTrackIsoSlopeForPhoton = 99.;
159 
160  if(usePFPhotons_ )
161  {
162  mvaWeightFileConvID =iConfig.getParameter<string>("pf_convID_mvaWeightFile");
163  mvaConvCut = iConfig.getParameter<double>("pf_conv_mvaCut");
164  path_mvaWeightFileConvID = edm::FileInPath ( mvaWeightFileConvID.c_str() ).fullPath();
165  sumPtTrackIsoForPhoton = iConfig.getParameter<double>("sumPtTrackIsoForPhoton");
166  sumPtTrackIsoSlopeForPhoton = iConfig.getParameter<double>("sumPtTrackIsoSlopeForPhoton");
167 
168  string X0_Map=iConfig.getParameter<string>("X0_Map");
169  path_X0_Map = edm::FileInPath( X0_Map.c_str() ).fullPath();
170 
171  if(!useRegressionFromDB_) {
172  string mvaWeightFileLCorr=iConfig.getParameter<string>("pf_locC_mvaWeightFile");
173  path_mvaWeightFileLCorr = edm::FileInPath( mvaWeightFileLCorr.c_str() ).fullPath();
174  string mvaWeightFileGCorr=iConfig.getParameter<string>("pf_GlobC_mvaWeightFile");
175  path_mvaWeightFileGCorr = edm::FileInPath( mvaWeightFileGCorr.c_str() ).fullPath();
176  string mvaWeightFileRes=iConfig.getParameter<string>("pf_Res_mvaWeightFile");
177  path_mvaWeightFileRes=edm::FileInPath(mvaWeightFileRes.c_str()).fullPath();
178 
179  TFile *fgbr = new TFile(path_mvaWeightFileGCorr.c_str(),"READ");
180  ReaderGC_ =(const GBRForest*)fgbr->Get("GBRForest");
181  TFile *fgbr2 = new TFile(path_mvaWeightFileLCorr.c_str(),"READ");
182  ReaderLC_ = (const GBRForest*)fgbr2->Get("GBRForest");
183  TFile *fgbr3 = new TFile(path_mvaWeightFileRes.c_str(),"READ");
184  ReaderRes_ = (const GBRForest*)fgbr3->Get("GBRForest");
185  LogDebug("PFProducer")<<"Will set regressions from binary files " <<endl;
186  }
187 
188  }
189 
190 
191  //Secondary tracks and displaced vertices parameters
192 
193  bool rejectTracks_Bad
194  = iConfig.getParameter<bool>("rejectTracks_Bad");
195 
196  bool rejectTracks_Step45
197  = iConfig.getParameter<bool>("rejectTracks_Step45");
198 
199  bool usePFNuclearInteractions
200  = iConfig.getParameter<bool>("usePFNuclearInteractions");
201 
202  bool usePFConversions
203  = iConfig.getParameter<bool>("usePFConversions");
204 
205  bool usePFDecays
206  = iConfig.getParameter<bool>("usePFDecays");
207 
208  double dptRel_DispVtx
209  = iConfig.getParameter<double>("dptRel_DispVtx");
210 
211  edm::ParameterSet iCfgCandConnector
212  = iConfig.getParameter<edm::ParameterSet>("iCfgCandConnector");
213 
214 
215  // fToRead = iConfig.getUntrackedParameter<vector<string> >("toRead");
216 
217  useCalibrationsFromDB_
218  = iConfig.getParameter<bool>("useCalibrationsFromDB");
219 
220  boost::shared_ptr<PFEnergyCalibration>
221  calibration( new PFEnergyCalibration() );
222 
223  int algoType
224  = iConfig.getParameter<unsigned>("algoType");
225 
226  switch(algoType) {
227  case 0:
228  pfAlgo_.reset( new PFAlgo);
229  break;
230  default:
231  assert(0);
232  }
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,
242  usePFElectrons_,
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,
254  useEGammaElectrons_,
255  useEGammaSupercluster);
256 
257  // pfAlgo_->setPFConversionParameters(usePFConversions);
258 
259  // PFPhotons:
260  pfAlgo_->setPFPhotonParameters(usePFPhotons_,
261  path_mvaWeightFileConvID,
262  mvaConvCut,
263  usePhotonReg_,
264  path_X0_Map,
265  calibration,
266  sumPtTrackIsoForPhoton,
267  sumPtTrackIsoSlopeForPhoton);
268 
269 
270  //Secondary tracks and displaced vertices parameters
271 
272  pfAlgo_->setDisplacedVerticesParameters(rejectTracks_Bad,
273  rejectTracks_Step45,
274  usePFNuclearInteractions,
275  usePFConversions,
276  usePFDecays,
277  dptRel_DispVtx);
278 
279  if (usePFNuclearInteractions)
280  pfAlgo_->setCandConnectorParameters( iCfgCandConnector );
281 
282 
283 
284  // Set muon and fake track parameters
285  pfAlgo_->setPFMuonAndFakeParameters(iConfig);
286 
287  //Post cleaning of the HF
288  bool postHFCleaning
289  = iConfig.getParameter<bool>("postHFCleaning");
290  double minHFCleaningPt
291  = iConfig.getParameter<double>("minHFCleaningPt");
292  double minSignificance
293  = iConfig.getParameter<double>("minSignificance");
294  double maxSignificance
295  = iConfig.getParameter<double>("maxSignificance");
296  double minSignificanceReduction
297  = iConfig.getParameter<double>("minSignificanceReduction");
298  double maxDeltaPhiPt
299  = iConfig.getParameter<double>("maxDeltaPhiPt");
300  double minDeltaMet
301  = iConfig.getParameter<double>("minDeltaMet");
302 
303  // Set post HF cleaning muon parameters
304  pfAlgo_->setPostHFCleaningParameters(postHFCleaning,
305  minHFCleaningPt,
306  minSignificance,
307  maxSignificance,
308  minSignificanceReduction,
309  maxDeltaPhiPt,
310  minDeltaMet);
311 
312  // Input tags for HF cleaned rechits
313  inputTagCleanedHF_
314  = iConfig.getParameter< std::vector<edm::InputTag> >("cleanedHF");
315 
316  //MIKE: Vertex Parameters
317  vertices_ = iConfig.getParameter<edm::InputTag>("vertexCollection");
318  useVerticesForNeutral_ = iConfig.getParameter<bool>("useVerticesForNeutral");
319 
320  // Use HO clusters and links in the PF reconstruction
321  useHO_= iConfig.getParameter<bool>("useHO");
322  pfAlgo_->setHOTag(useHO_);
323 
324  verbose_ =
325  iConfig.getUntrackedParameter<bool>("verbose",false);
326 
327  bool debug_ =
328  iConfig.getUntrackedParameter<bool>("debug",false);
329 
330  pfAlgo_->setDebug( debug_ );
331 
332 }
333 
334 
335 
337 
338 void
340  const edm::EventSetup & es)
341 {
342 
343 
344  /*
345  static map<string, PerformanceResult::ResultType> functType;
346 
347  functType["PFfa_BARREL"] = PerformanceResult::PFfa_BARREL;
348  functType["PFfa_ENDCAP"] = PerformanceResult::PFfa_ENDCAP;
349  functType["PFfb_BARREL"] = PerformanceResult::PFfb_BARREL;
350  functType["PFfb_ENDCAP"] = PerformanceResult::PFfb_ENDCAP;
351  functType["PFfc_BARREL"] = PerformanceResult::PFfc_BARREL;
352  functType["PFfc_ENDCAP"] = PerformanceResult::PFfc_ENDCAP;
353  functType["PFfaEta_BARREL"] = PerformanceResult::PFfaEta_BARREL;
354  functType["PFfaEta_ENDCAP"] = PerformanceResult::PFfaEta_ENDCAP;
355  functType["PFfbEta_BARREL"] = PerformanceResult::PFfbEta_BARREL;
356  functType["PFfbEta_ENDCAP"] = PerformanceResult::PFfbEta_ENDCAP;
357  */
358 
359  if ( useCalibrationsFromDB_ ) {
360  // Read the PFCalibration functions from the global tags.
362  es.get<PFCalibrationRcd>().get(perfH);
363 
364  const PerformancePayloadFromTFormula *pfCalibrations = static_cast< const PerformancePayloadFromTFormula *>(perfH.product());
365 
366  pfAlgo_->thePFEnergyCalibration()->setCalibrationFunctions(pfCalibrations);
367  }
368 
369  /*
370  for(vector<string>::const_iterator name = fToRead.begin(); name != fToRead.end(); ++name) {
371 
372  cout << "Function: " << *name << endl;
373  PerformanceResult::ResultType fType = functType[*name];
374  pfCalibrations->printFormula(fType);
375 
376  // evaluate it @ 10 GeV
377  float energy = 10.;
378 
379  BinningPointByMap point;
380  point.insert(BinningVariables::JetEt, energy);
381 
382  if(pfCalibrations->isInPayload(fType, point)) {
383  float value = pfCalibrations->getResult(fType, point);
384  cout << " Energy before:: " << energy << " after: " << value << endl;
385  } else cout << "outside limits!" << endl;
386 
387  }
388  */
389 
390  if(useRegressionFromDB_) {
391  edm::ESHandle<GBRForest> readerPFLCEB;
392  edm::ESHandle<GBRForest> readerPFLCEE;
393  edm::ESHandle<GBRForest> readerPFGCEB;
394  edm::ESHandle<GBRForest> readerPFGCEEHR9;
395  edm::ESHandle<GBRForest> readerPFGCEELR9;
396  edm::ESHandle<GBRForest> readerPFRes;
397  es.get<GBRWrapperRcd>().get("PFLCorrectionBar",readerPFLCEB);
398  ReaderLCEB_=readerPFLCEB.product();
399  es.get<GBRWrapperRcd>().get("PFLCorrectionEnd",readerPFLCEE);
400  ReaderLCEE_=readerPFLCEE.product();
401  es.get<GBRWrapperRcd>().get("PFGCorrectionBar",readerPFGCEB);
402  ReaderGCBarrel_=readerPFGCEB.product();
403  es.get<GBRWrapperRcd>().get("PFGCorrectionEndHighR9",readerPFGCEEHR9);
404  ReaderGCEndCapHighr9_=readerPFGCEEHR9.product();
405  es.get<GBRWrapperRcd>().get("PFGCorrectionEndLowR9",readerPFGCEELR9);
406  ReaderGCEndCapLowr9_=readerPFGCEELR9.product();
407  es.get<GBRWrapperRcd>().get("PFEcalResolution",readerPFRes);
408  ReaderEcalRes_=readerPFRes.product();
409 
410  /*
411  LogDebug("PFProducer")<<"setting regressions from DB "<<endl;
412  */
413  }
414 
415  if(usePFPhotons_){
416  //pfAlgo_->setPFPhotonRegWeights(ReaderLC_, ReaderGC_, ReaderRes_);
417  pfAlgo_->setPFPhotonRegWeights(ReaderLCEB_,ReaderLCEE_,ReaderGCBarrel_,ReaderGCEndCapHighr9_, ReaderGCEndCapLowr9_, ReaderEcalRes_ );
418  }
419 }
420 
421 
422 void
424  const EventSetup& iSetup) {
425 
426  LogDebug("PFProducer")<<"START event: "
427  <<iEvent.id().event()
428  <<" in run "<<iEvent.id().run()<<endl;
429 
430 
431  // Get The vertices from the event
432  // and assign dynamic vertex parameters
434  bool gotVertices = iEvent.getByLabel(vertices_,vertices);
435  if(!gotVertices) {
436  ostringstream err;
437  err<<"Cannot find vertices for this event.Continuing Without them ";
438  LogError("PFProducer")<<err.str()<<endl;
439  }
440 
441  //Assign the PFAlgo Parameters
442  pfAlgo_->setPFVertexParameters(useVerticesForNeutral_,vertices.product());
443 
444  // get the collection of blocks
445 
447 
448  LogDebug("PFProducer")<<"getting blocks"<<endl;
449  bool found = iEvent.getByLabel( inputTagBlocks_, blocks );
450 
451  if(!found ) {
452 
453  ostringstream err;
454  err<<"cannot find blocks: "<<inputTagBlocks_;
455  LogError("PFProducer")<<err.str()<<endl;
456 
457  throw cms::Exception( "MissingProduct", err.str());
458  }
459 
460  // get the collection of muons
461 
463 
464  if ( postMuonCleaning_ ) {
465 
466  LogDebug("PFProducer")<<"getting muons"<<endl;
467  found = iEvent.getByLabel( inputTagMuons_, muons );
468  pfAlgo_->setMuonHandle(muons);
469  if(!found) {
470  ostringstream err;
471  err<<"cannot find muons: "<<inputTagMuons_;
472  LogError("PFProducer")<<err.str()<<endl;
473 
474  throw cms::Exception( "MissingProduct", err.str());
475 
476  }
477 
478  }
479 
480  if (useEGammaElectrons_) {
482 
483  LogDebug("PFProducer")<<" Reading e/gamma electrons activated "<<endl;
484  found = iEvent.getByLabel( inputTagEgammaElectrons_, egelectrons );
485 
486  if(!found) {
487  ostringstream err;
488  err<<"cannot find electrons: "<<inputTagEgammaElectrons_;
489  LogError("PFProducer")<<err.str()<<endl;
490 
491  throw cms::Exception( "MissingProduct", err.str());
492  }
493 
494  pfAlgo_->setEGElectronCollection(*egelectrons);
495  }
496 
497 
498  LogDebug("PFProducer")<<"particle flow is starting"<<endl;
499 
500  assert( blocks.isValid() );
501 
502  pfAlgo_->reconstructParticles( blocks );
503 
504  if(verbose_) {
505  ostringstream str;
506  str<<(*pfAlgo_)<<endl;
507  // cout << (*pfAlgo_) << endl;
508  LogInfo("PFProducer") <<str.str()<<endl;
509  }
510 
511 
512  // Florian 5/01/2011
513  // Save the PFElectron Extra Collection First as to be able to create valid References
514  if(usePFElectrons_) {
515  auto_ptr< reco::PFCandidateElectronExtraCollection >
516  pOutputElectronCandidateExtraCollection( pfAlgo_->transferElectronExtra() );
517 
519  iEvent.put(pOutputElectronCandidateExtraCollection,electronExtraOutputCol_);
520  pfAlgo_->setElectronExtraRef(electronExtraProd);
521  }
522 
523  // Daniele 18/05/2011
524  // Save the PFPhoton Extra Collection First as to be able to create valid References
525  if(usePFPhotons_) {
526  auto_ptr< reco::PFCandidatePhotonExtraCollection >
527  pOutputPhotonCandidateExtraCollection( pfAlgo_->transferPhotonExtra() );
528 
530  iEvent.put(pOutputPhotonCandidateExtraCollection,photonExtraOutputCol_);
531  pfAlgo_->setPhotonExtraRef(photonExtraProd);
532  }
533 
534 
535  // Save cosmic cleaned muon candidates
536  auto_ptr< reco::PFCandidateCollection >
537  pCosmicsMuonCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedCosmicCandidates() );
538  // Save tracker/global cleaned muon candidates
539  auto_ptr< reco::PFCandidateCollection >
540  pTrackerAndGlobalCleanedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedTrackerAndGlobalCandidates() );
541  // Save fake cleaned muon candidates
542  auto_ptr< reco::PFCandidateCollection >
543  pFakeCleanedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedFakeCandidates() );
544  // Save punch-through cleaned muon candidates
545  auto_ptr< reco::PFCandidateCollection >
546  pPunchThroughMuonCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferPunchThroughCleanedMuonCandidates() );
547  // Save punch-through cleaned neutral hadron candidates
548  auto_ptr< reco::PFCandidateCollection >
549  pPunchThroughHadronCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferPunchThroughCleanedHadronCandidates() );
550  // Save added muon candidates
551  auto_ptr< reco::PFCandidateCollection >
552  pAddedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferAddedMuonCandidates() );
553 
554  // Check HF overcleaning
556  for ( unsigned ihf=0; ihf<inputTagCleanedHF_.size(); ++ihf ) {
558  bool foundHF = iEvent.getByLabel( inputTagCleanedHF_[ihf], hfCleaned );
559  if (!foundHF) continue;
560  for ( unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
561  hfCopy.push_back( (*hfCleaned)[jhf] );
562  }
563  }
564  pfAlgo_->checkCleaning( hfCopy );
565 
566  // Save recovered HF candidates
567  auto_ptr< reco::PFCandidateCollection >
568  pCleanedCandidateCollection( pfAlgo_->transferCleanedCandidates() );
569 
570 
571  // Save the final PFCandidate collection
572  auto_ptr< reco::PFCandidateCollection >
573  pOutputCandidateCollection( pfAlgo_->transferCandidates() );
574 
575 
576 
577  LogDebug("PFProducer")<<"particle flow: putting products in the event"<<endl;
578  if ( verbose_ ) std::cout <<"particle flow: putting products in the event. Here the full list"<<endl;
579  int nC=0;
580  for( reco::PFCandidateCollection::const_iterator itCand = (*pOutputCandidateCollection).begin(); itCand != (*pOutputCandidateCollection).end(); itCand++) {
581  nC++;
582  if (verbose_ ) std::cout << nC << ")" << (*itCand).particleId() << std::endl;
583 
584  }
585 
586 
587 
588  // Write in the event
589  iEvent.put(pOutputCandidateCollection);
590  iEvent.put(pCleanedCandidateCollection,"CleanedHF");
591 
592  if ( postMuonCleaning_ ) {
593  iEvent.put(pCosmicsMuonCleanedCandidateCollection,"CleanedCosmicsMuons");
594  iEvent.put(pTrackerAndGlobalCleanedMuonCandidateCollection,"CleanedTrackerAndGlobalMuons");
595  iEvent.put(pFakeCleanedMuonCandidateCollection,"CleanedFakeMuons");
596  iEvent.put(pPunchThroughMuonCleanedCandidateCollection,"CleanedPunchThroughMuons");
597  iEvent.put(pPunchThroughHadronCleanedCandidateCollection,"CleanedPunchThroughNeutralHadrons");
598  iEvent.put(pAddedMuonCandidateCollection,"AddedMuonsAndHadrons");
599  }
600 
601  if(usePFElectrons_)
602  {
603  auto_ptr< reco::PFCandidateCollection >
604  pOutputElectronCandidateCollection( pfAlgo_->transferElectronCandidates() );
605  iEvent.put(pOutputElectronCandidateCollection,electronOutputCol_);
606 
607  }
608 }
609 
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
T getUntrackedParameter(std::string const &, T const &) const
int ihf
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
virtual void produce(edm::Event &, const edm::EventSetup &) override
Definition: PFProducer.cc:423
PFProducer(const edm::ParameterSet &)
Definition: PFProducer.cc:31
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: PFProducer.cc:339
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
const T & get() const
Definition: EventSetup.h:55
list blocks
Definition: gather_cfg.py:90
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:56
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:121
Definition: PFAlgo.h:50
Definition: Run.h:36