21 : putToken_{produces<reco::PFCandidateCollection>()}
22 ,
pfAlgo_(iConfig.getUntrackedParameter<
bool>(
"debug",
false))
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")
40 = iConfig.getParameter<
bool>(
"postMuonCleaning");
42 if( iConfig.existsAs<
bool>(
"useEGammaFilters") ) {
49 = iConfig.getParameter<
bool>(
"usePFElectrons");
52 = iConfig.getParameter<
bool>(
"usePFPhotons");
61 usePFPhotons_ =
false;
69 = (
usePFPhotons_) ? iConfig.getParameter<
bool>(
"useRegressionFromDB") :
false;
72 = iConfig.getParameter<
bool>(
"useEGammaElectrons");
79 = iConfig.getParameter<
std::string>(
"pf_electron_output_col");
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 ));
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");
126 = iConfig.getParameter<
double>(
"pf_nsigma_ECAL");
128 = iConfig.getParameter<
double>(
"pf_nsigma_HCAL");
132 = iConfig.getParameter<
double>(
"pf_electron_mvaCut");
135 string mvaWeightFileEleID
136 = iConfig.getParameter<
string>(
"pf_electronID_mvaWeightFile");
138 bool applyCrackCorrectionsForElectrons
139 = iConfig.getParameter<
bool>(
"pf_electronID_crackCorrection");
141 string path_mvaWeightFileEleID;
144 path_mvaWeightFileEleID =
edm::FileInPath ( mvaWeightFileEleID.c_str() ).fullPath();
149 string path_mvaWeightFileConvID;
150 string mvaWeightFileConvID;
151 string path_mvaWeightFileGCorr;
152 string path_mvaWeightFileLCorr;
154 string path_mvaWeightFileRes;
155 double mvaConvCut=-99.;
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");
167 string X0_Map=iConfig.getParameter<
string>(
"X0_Map");
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();
178 TFile *fgbr =
new TFile(path_mvaWeightFileGCorr.c_str(),
"READ");
180 TFile *fgbr2 =
new TFile(path_mvaWeightFileLCorr.c_str(),
"READ");
182 TFile *fgbr3 =
new TFile(path_mvaWeightFileRes.c_str(),
"READ");
184 LogDebug(
"PFProducer")<<
"Will set regressions from binary files " <<endl;
197 useProtectionsForJetMET = iConfig.getParameter<
bool>(
"useProtectionsForJetMET");
203 = iConfig.getParameter<
bool>(
"rejectTracks_Bad");
206 = iConfig.getParameter<
bool>(
"rejectTracks_Step45");
209 = iConfig.getParameter<
bool>(
"usePFNuclearInteractions");
212 = iConfig.getParameter<
bool>(
"usePFConversions");
215 = iConfig.getParameter<
bool>(
"usePFDecays");
218 = iConfig.getParameter<
double>(
"dptRel_DispVtx");
227 = iConfig.getParameter<
bool>(
"useCalibrationsFromDB");
229 if (useCalibrationsFromDB_)
232 auto calibration = std::make_shared<PFEnergyCalibration>();
237 thepfEnergyCalibrationHF);
241 path_mvaWeightFileEleID,
243 thePFSCEnergyCalibration,
245 sumEtEcalIsoForEgammaSC_barrel,
246 sumEtEcalIsoForEgammaSC_endcap,
247 coneEcalIsoForEgammaSC,
248 sumPtTrackIsoForEgammaSC_barrel,
249 sumPtTrackIsoForEgammaSC_endcap,
250 nTrackIsoForEgammaSC,
251 coneTrackIsoForEgammaSC,
252 applyCrackCorrectionsForElectrons,
255 useEGammaSupercluster);
261 path_mvaWeightFileConvID,
266 sumPtTrackIsoForPhoton,
267 sumPtTrackIsoSlopeForPhoton);
280 usePFNuclearInteractions,
285 if (usePFNuclearInteractions)
296 = iConfig.getParameter<
bool>(
"postHFCleaning");
298 = iConfig.getParameter<
double>(
"minHFCleaningPt");
300 = iConfig.getParameter<
double>(
"minSignificance");
302 = iConfig.getParameter<
double>(
"maxSignificance");
304 = iConfig.getParameter<
double>(
"minSignificanceReduction");
306 = iConfig.getParameter<
double>(
"maxDeltaPhiPt");
308 = iConfig.getParameter<
double>(
"minDeltaMet");
315 minSignificanceReduction,
320 std::vector<edm::InputTag> tags =iConfig.getParameter< std::vector<edm::InputTag> >(
"cleanedHF");
321 for (
unsigned int i=0;
i<tags.size();++
i)
328 useHO_= iConfig.getParameter<
bool>(
"useHO");
332 iConfig.getUntrackedParameter<
bool>(
"verbose",
false);
423 LogDebug(
"PFProducer")<<
"START event: " <<iEvent.
id().
event() <<
" in run "<<iEvent.
id().
run()<<endl;
430 assert(
blocks.isValid() );
442 LogDebug(
"PFProducer")<<
"particle flow is starting"<<endl;
450 LogInfo(
"PFProducer") <<str.str()<<endl;
467 std::unique_ptr<reco::PFCandidatePhotonExtraCollection> pOutputPhotonCandidateExtraCollection(
pfAlgo_.
transferPhotonExtra() );
475 std::unique_ptr<reco::PFCandidateCollection>
478 std::unique_ptr<reco::PFCandidateCollection>
481 std::unique_ptr<reco::PFCandidateCollection>
484 std::unique_ptr<reco::PFCandidateCollection>
487 std::unique_ptr<reco::PFCandidateCollection>
490 std::unique_ptr<reco::PFCandidateCollection>
498 if (!foundHF)
continue;
499 for (
unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
500 hfCopy.push_back( (*hfCleaned)[jhf] );
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;
519 for(
auto const&
cand : pOutputCandidateCollection) {
529 iEvent.
put(
std::move(pCleanedCandidateCollection),
"CleanedHF");
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");
542 std::unique_ptr<reco::PFCandidateCollection>
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
sumPtTrackIsoForEgammaSC_barrel
const GBRForest * ReaderRes_
EventNumber_t event() const
std::string photonExtraOutputCol_
const GBRForest * ReaderEcalRes_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
sumPtTrackIsoForEgammaSC_endcap
void setPFMuonAndFakeParameters(const edm::ParameterSet &pset)
const GBRForest * ReaderLCEB_
const GBRForest * ReaderGCEndCapHighr9_
reco::PFCandidateCollection transferCandidates()
std::unique_ptr< reco::PFCandidateElectronExtraCollection > transferElectronExtra()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
std::unique_ptr< reco::PFCandidateCollection > transferAddedMuonCandidates()
std::string calibrationsLabel_
const edm::EDPutTokenT< reco::PFCandidateCollection > putToken_
std::unique_ptr< reco::PFCandidateCollection > transferCleanedTrackerAndGlobalCandidates()
void setMuonHandle(const edm::Handle< reco::MuonCollection > &)
const GBRForest * ReaderLC_
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
sumEtEcalIsoForEgammaSC_endcap
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
bool useCalibrationsFromDB_
edm::EDGetTokenT< reco::VertexCollection > vertices_
void produce(edm::Event &, const edm::EventSetup &) override
void setPFVertexParameters(bool useVertex, reco::VertexCollection const &primaryVertices)
std::unique_ptr< PFEGammaFilters > pfegamma_
const GBRForest * ReaderLCEE_
bool useVerticesForNeutral_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
PFProducer(const edm::ParameterSet &)
void setEGammaCollections(const edm::View< reco::PFCandidate > &pfEgammaCandidates, const edm::ValueMap< reco::GsfElectronRef > &valueMapGedElectrons, const edm::ValueMap< reco::PhotonRef > &valueMapGedPhotons)
void setBadHcalTrackParams(const edm::ParameterSet &pset)
std::unique_ptr< reco::PFCandidateCollection > transferCleanedCandidates()
std::unique_ptr< reco::PFCandidateCollection > transferElectronCandidates()
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)
void setPFPhotonRegWeights(const GBRForest *LCorrForestEB, const GBRForest *LCorrForestEE, const GBRForest *GCorrForestBarrel, const GBRForest *GCorrForestEndcapHr9, const GBRForest *GCorrForestEndcapLr9, const GBRForest *PFEcalResolution)
bool get(ProductID const &oid, Handle< PROD > &result) const
calibPFSCEle_Fbrem_endcap
std::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration()
return the pointer to the calibration function
void setParameters(double nSigmaECAL, double nSigmaHCAL, const std::shared_ptr< PFEnergyCalibration > &calibration, const std::shared_ptr< PFEnergyCalibrationHF > &thepfEnergyCalibrationHF)
sumEtEcalIsoForEgammaSC_barrel
void beginRun(const edm::Run &, const edm::EventSetup &) override
void setPostHFCleaningParameters(bool postHFCleaning, double minHFCleaningPt, double minSignificance, double maxSignificance, double minSignificanceReduction, double maxDeltaPhiPt, double minDeltaMet)
edm::EDGetTokenT< edm::View< reco::PFCandidate > > inputTagPFEGammaCandidates_
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)
edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
void reconstructParticles(const reco::PFBlockHandle &blockHandle, PFEGammaFilters const *pfegamma)
const GBRForest * ReaderGCEndCapLowr9_
bool useRegressionFromDB_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::unique_ptr< reco::PFCandidatePhotonExtraCollection > transferPhotonExtra()
PFAlgo pfAlgo_
particle flow algorithm
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
std::string electronOutputCol_
std::string electronExtraOutputCol_
std::unique_ptr< reco::PFCandidateCollection > transferCleanedCosmicCandidates()
edm::EDGetTokenT< edm::ValueMap< reco::PhotonRef > > inputTagValueMapGedPhotons_
std::unique_ptr< reco::PFCandidateCollection > transferCleanedFakeCandidates()
PFMuonAlgo * getPFMuonAlgo()
void setPhotonExtraRef(const edm::OrphanHandle< reco::PFCandidatePhotonExtraCollection > &pf_extrah)
sumPtTrackIsoSlopeForPhoton
calibPFSCEle_Fbrem_barrel
const GBRForest * ReaderGCBarrel_
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedHadronCandidates()
T const * product() const
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagEgammaElectrons_
void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET)
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
void setElectronExtraRef(const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > &extrah)
const GBRForest * ReaderGC_
std::unique_ptr< reco::PFCandidateCollection > transferPunchThroughCleanedMuonCandidates()