21 using namespace boost;
31 std::vector<double> calibHF_eta_step;
32 std::vector<double> calibHF_a_EMonly;
33 std::vector<double> calibHF_b_HADonly;
34 std::vector<double> calibHF_a_EMHAD;
35 std::vector<double> calibHF_b_EMHAD;
37 calibHF_eta_step = iConfig.
getParameter<std::vector<double> >(
"calibHF_eta_step");
38 calibHF_a_EMonly = iConfig.
getParameter<std::vector<double> >(
"calibHF_a_EMonly");
39 calibHF_b_HADonly = iConfig.
getParameter<std::vector<double> >(
"calibHF_b_HADonly");
40 calibHF_a_EMHAD = iConfig.
getParameter<std::vector<double> >(
"calibHF_a_EMHAD");
41 calibHF_b_EMHAD = iConfig.
getParameter<std::vector<double> >(
"calibHF_b_EMHAD");
42 boost::shared_ptr<PFEnergyCalibrationHF>
43 thepfEnergyCalibrationHF (
new PFEnergyCalibrationHF(calibHF_use,calibHF_eta_step,calibHF_a_EMonly,calibHF_b_HADonly,calibHF_a_EMHAD,calibHF_b_EMHAD) ) ;
64 if( useEGammaElectrons_) {
69 = iConfig.
getParameter<std::string>(
"pf_electron_output_col");
72 std::vector<double> calibPFSCEle_Fbrem_barrel;
73 std::vector<double> calibPFSCEle_Fbrem_endcap;
74 std::vector<double> calibPFSCEle_barrel;
75 std::vector<double> calibPFSCEle_endcap;
76 usePFSCEleCalib = iConfig.
getParameter<
bool>(
"usePFSCEleCalib");
77 calibPFSCEle_Fbrem_barrel = iConfig.
getParameter<std::vector<double> >(
"calibPFSCEle_Fbrem_barrel");
78 calibPFSCEle_Fbrem_endcap = iConfig.
getParameter<std::vector<double> >(
"calibPFSCEle_Fbrem_endcap");
79 calibPFSCEle_barrel = iConfig.
getParameter<std::vector<double> >(
"calibPFSCEle_barrel");
80 calibPFSCEle_endcap = iConfig.
getParameter<std::vector<double> >(
"calibPFSCEle_endcap");
81 boost::shared_ptr<PFSCEnergyCalibration>
82 thePFSCEnergyCalibration (
new PFSCEnergyCalibration(calibPFSCEle_Fbrem_barrel,calibPFSCEle_Fbrem_endcap,
83 calibPFSCEle_barrel,calibPFSCEle_endcap ));
85 bool useEGammaSupercluster = iConfig.
getParameter<
bool>(
"useEGammaSupercluster");
86 double sumEtEcalIsoForEgammaSC_barrel = iConfig.
getParameter<
double>(
"sumEtEcalIsoForEgammaSC_barrel");
87 double sumEtEcalIsoForEgammaSC_endcap = iConfig.
getParameter<
double>(
"sumEtEcalIsoForEgammaSC_endcap");
88 double coneEcalIsoForEgammaSC = iConfig.
getParameter<
double>(
"coneEcalIsoForEgammaSC");
89 double sumPtTrackIsoForEgammaSC_barrel = iConfig.
getParameter<
double>(
"sumPtTrackIsoForEgammaSC_barrel");
90 double sumPtTrackIsoForEgammaSC_endcap = iConfig.
getParameter<
double>(
"sumPtTrackIsoForEgammaSC_endcap");
91 double coneTrackIsoForEgammaSC = iConfig.
getParameter<
double>(
"coneTrackIsoForEgammaSC");
92 unsigned int nTrackIsoForEgammaSC = iConfig.
getParameter<
unsigned int>(
"nTrackIsoForEgammaSC");
96 produces<reco::PFCandidateCollection>();
97 produces<reco::PFCandidateCollection>(
"CleanedHF");
98 produces<reco::PFCandidateCollection>(
"CleanedCosmicsMuons");
99 produces<reco::PFCandidateCollection>(
"CleanedTrackerAndGlobalMuons");
100 produces<reco::PFCandidateCollection>(
"CleanedFakeMuons");
101 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughMuons");
102 produces<reco::PFCandidateCollection>(
"CleanedPunchThroughNeutralHadrons");
103 produces<reco::PFCandidateCollection>(
"AddedMuonsAndHadrons");
106 if (usePFElectrons_) {
107 produces<reco::PFCandidateCollection>(electronOutputCol_);
108 produces<reco::PFCandidateElectronExtraCollection>(electronExtraOutputCol_);
120 string mvaWeightFileEleID
121 = iConfig.
getParameter<
string>(
"pf_electronID_mvaWeightFile");
123 bool applyCrackCorrectionsForElectrons
124 = iConfig.
getParameter<
bool>(
"pf_electronID_crackCorrection");
126 string path_mvaWeightFileEleID;
129 path_mvaWeightFileEleID =
edm::FileInPath ( mvaWeightFileEleID.c_str() ).fullPath();
134 string path_mvaWeightFileConvID;
135 string mvaWeightFileConvID;
136 double mvaConvCut=-99.;
139 mvaWeightFileConvID =iConfig.
getParameter<
string>(
"pf_convID_mvaWeightFile");
141 mvaConvCut = iConfig.
getParameter<
double>(
"pf_conv_mvaCut");
142 path_mvaWeightFileConvID =
edm::FileInPath ( mvaWeightFileConvID.c_str() ).fullPath();
148 bool rejectTracks_Bad
151 bool rejectTracks_Step45
154 bool usePFNuclearInteractions
155 = iConfig.
getParameter<
bool>(
"usePFNuclearInteractions");
157 bool usePFConversions
163 double dptRel_DispVtx
172 useCalibrationsFromDB_
175 boost::shared_ptr<PFEnergyCalibration>
183 pfAlgo_.reset(
new PFAlgo);
189 pfAlgo_->setParameters( nSigmaECAL,
192 thepfEnergyCalibrationHF);
195 pfAlgo_->setPFEleParameters(mvaEleCut,
196 path_mvaWeightFileEleID,
198 thePFSCEnergyCalibration,
200 sumEtEcalIsoForEgammaSC_barrel,
201 sumEtEcalIsoForEgammaSC_endcap,
202 coneEcalIsoForEgammaSC,
203 sumPtTrackIsoForEgammaSC_barrel,
204 sumPtTrackIsoForEgammaSC_endcap,
205 nTrackIsoForEgammaSC,
206 coneTrackIsoForEgammaSC,
207 applyCrackCorrectionsForElectrons,
210 useEGammaSupercluster);
215 pfAlgo_->setPFPhotonParameters(usePFPhotons_,
216 path_mvaWeightFileConvID,
223 pfAlgo_->setDisplacedVerticesParameters(rejectTracks_Bad,
225 usePFNuclearInteractions,
230 if (usePFNuclearInteractions)
231 pfAlgo_->setCandConnectorParameters( iCfgCandConnector );
234 std::vector<double> muonHCAL
235 = iConfig.
getParameter<std::vector<double> >(
"muon_HCAL");
236 std::vector<double> muonECAL
237 = iConfig.
getParameter<std::vector<double> >(
"muon_ECAL");
238 assert ( muonHCAL.size() == 2 && muonECAL.size() == 2 );
247 std::vector<double> factors45
248 = iConfig.
getParameter<std::vector<double> >(
"factors_45");
249 assert ( factors45.size() == 2 );
251 bool usePFMuonMomAssign
255 pfAlgo_->setPFMuonAndFakeParameters(muonHCAL,
266 double minHFCleaningPt
268 double minSignificance
270 double maxSignificance
272 double minSignificanceReduction
273 = iConfig.
getParameter<
double>(
"minSignificanceReduction");
280 pfAlgo_->setPostHFCleaningParameters(postHFCleaning,
284 minSignificanceReduction,
290 = iConfig.
getParameter< std::vector<edm::InputTag> >(
"cleanedHF");
294 useVerticesForNeutral_ = iConfig.
getParameter<
bool>(
"useVerticesForNeutral");
304 pfAlgo_->setDebug( debug_ );
337 if ( useCalibrationsFromDB_ ) {
344 pfAlgo_->thePFEnergyCalibration()->setCalibrationFunctions(pfCalibrations);
375 LogDebug(
"PFProducer")<<
"START event: "
377 <<
" in run "<<iEvent.
id().
run()<<endl;
383 bool gotVertices = iEvent.
getByLabel(vertices_,vertices);
386 err<<
"Cannot find vertices for this event.Continuing Without them ";
387 LogError(
"PFProducer")<<err.str()<<endl;
391 pfAlgo_->setPFVertexParameters(useVerticesForNeutral_,*vertices);
397 LogDebug(
"PFProducer")<<
"getting blocks"<<endl;
403 err<<
"cannot find blocks: "<<inputTagBlocks_;
404 LogError(
"PFProducer")<<err.str()<<endl;
413 if ( postMuonCleaning_ ) {
415 LogDebug(
"PFProducer")<<
"getting muons"<<endl;
416 found = iEvent.
getByLabel( inputTagMuons_, muons );
420 err<<
"cannot find muons: "<<inputTagMuons_;
421 LogError(
"PFProducer")<<err.str()<<endl;
428 if (useEGammaElectrons_) {
431 LogDebug(
"PFProducer")<<
" Reading e/gamma electrons activated "<<endl;
432 found = iEvent.
getByLabel( inputTagEgammaElectrons_, egelectrons );
436 err<<
"cannot find electrons: "<<inputTagEgammaElectrons_;
437 LogError(
"PFProducer")<<err.str()<<endl;
442 pfAlgo_->setEGElectronCollection(*egelectrons);
446 LogDebug(
"PFProducer")<<
"particle flow is starting"<<endl;
450 pfAlgo_->reconstructParticles( blocks );
454 str<<(*pfAlgo_)<<endl;
456 LogInfo(
"PFProducer") <<str.str()<<endl;
460 if ( postMuonCleaning_ )
461 pfAlgo_->postMuonCleaning( muons, *vertices );
465 if(usePFElectrons_) {
466 auto_ptr< reco::PFCandidateElectronExtraCollection >
467 pOutputElectronCandidateExtraCollection( pfAlgo_->transferElectronExtra() );
470 iEvent.
put(pOutputElectronCandidateExtraCollection,electronExtraOutputCol_);
471 pfAlgo_->setElectronExtraRef(electronExtraProd);
476 auto_ptr< reco::PFCandidateCollection >
477 pCosmicsMuonCleanedCandidateCollection( pfAlgo_->transferCosmicsMuonCleanedCandidates() );
479 auto_ptr< reco::PFCandidateCollection >
480 pTrackerAndGlobalCleanedMuonCandidateCollection( pfAlgo_->transferCleanedTrackerAndGlobalMuonCandidates() );
482 auto_ptr< reco::PFCandidateCollection >
483 pFakeCleanedMuonCandidateCollection( pfAlgo_->transferFakeMuonCleanedCandidates() );
485 auto_ptr< reco::PFCandidateCollection >
486 pPunchThroughMuonCleanedCandidateCollection( pfAlgo_->transferPunchThroughMuonCleanedCandidates() );
488 auto_ptr< reco::PFCandidateCollection >
489 pPunchThroughHadronCleanedCandidateCollection( pfAlgo_->transferPunchThroughHadronCleanedCandidates() );
491 auto_ptr< reco::PFCandidateCollection >
492 pAddedMuonCandidateCollection( pfAlgo_->transferAddedMuonCandidates() );
496 for (
unsigned ihf=0; ihf<inputTagCleanedHF_.size(); ++ihf ) {
498 bool foundHF = iEvent.
getByLabel( inputTagCleanedHF_[ihf], hfCleaned );
499 if (!foundHF)
continue;
500 for (
unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
501 hfCopy.push_back( (*hfCleaned)[jhf] );
504 pfAlgo_->checkCleaning( hfCopy );
507 auto_ptr< reco::PFCandidateCollection >
508 pCleanedCandidateCollection( pfAlgo_->transferCleanedCandidates() );
512 auto_ptr< reco::PFCandidateCollection >
513 pOutputCandidateCollection( pfAlgo_->transferCandidates() );
517 LogDebug(
"PFProducer")<<
"particle flow: putting products in the event"<<endl;
518 if ( verbose_ )
std::cout <<
"particle flow: putting products in the event. Here the full list"<<endl;
520 for( reco::PFCandidateCollection::const_iterator itCand = (*pOutputCandidateCollection).begin(); itCand != (*pOutputCandidateCollection).end(); itCand++) {
522 if (verbose_ )
std::cout << nC <<
")" << (*itCand).particleId() << std::endl;
527 iEvent.
put(pOutputCandidateCollection);
528 iEvent.
put(pCleanedCandidateCollection,
"CleanedHF");
530 if ( postMuonCleaning_ ) {
531 iEvent.
put(pCosmicsMuonCleanedCandidateCollection,
"CleanedCosmicsMuons");
532 iEvent.
put(pTrackerAndGlobalCleanedMuonCandidateCollection,
"CleanedTrackerAndGlobalMuons");
533 iEvent.
put(pFakeCleanedMuonCandidateCollection,
"CleanedFakeMuons");
534 iEvent.
put(pPunchThroughMuonCleanedCandidateCollection,
"CleanedPunchThroughMuons");
535 iEvent.
put(pPunchThroughHadronCleanedCandidateCollection,
"CleanedPunchThroughNeutralHadrons");
536 iEvent.
put(pAddedMuonCandidateCollection,
"AddedMuonsAndHadrons");
541 auto_ptr< reco::PFCandidateCollection >
542 pOutputElectronCandidateCollection( pfAlgo_->transferElectronCandidates() );
543 iEvent.
put(pOutputElectronCandidateCollection,electronOutputCol_);
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
PFProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void beginRun(edm::Run &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
T const * product() const
virtual void produce(edm::Event &, const edm::EventSetup &)