CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
PFProducer Class Reference

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

#include <PFProducer.h>

Inheritance diagram for PFProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 PFProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string electronExtraOutputCol_
 
std::string electronOutputCol_
 
edm::EDGetTokenT
< reco::PFBlockCollection
inputTagBlocks_
 
std::vector< edm::EDGetTokenT
< reco::PFRecHitCollection > > 
inputTagCleanedHF_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
inputTagEgammaElectrons_
 
edm::EDGetTokenT
< reco::MuonCollection
inputTagMuons_
 
edm::EDGetTokenT< edm::View
< reco::PFCandidate > > 
inputTagPFEGammaCandidates_
 
edm::EDGetTokenT
< edm::ValueMap
< reco::GsfElectronRef > > 
inputTagValueMapGedElectrons_
 
edm::EDGetTokenT
< edm::ValueMap
< reco::PhotonRef > > 
inputTagValueMapGedPhotons_
 
std::auto_ptr< PFAlgopfAlgo_
 particle flow algorithm More...
 
std::string photonExtraOutputCol_
 
bool postMuonCleaning_
 
const GBRForestReaderEcalRes_
 
const GBRForestReaderGC_
 
const GBRForestReaderGCBarrel_
 
const GBRForestReaderGCEndCapHighr9_
 
const GBRForestReaderGCEndCapLowr9_
 
const GBRForestReaderLC_
 
const GBRForestReaderLCEB_
 
const GBRForestReaderLCEE_
 
const GBRForestReaderRes_
 
bool use_EGammaFilters_
 
bool useCalibrationsFromDB_
 
bool useEGammaElectrons_
 
bool useHO_
 
bool usePFElectrons_
 
bool usePFPhotons_
 
bool usePhotonReg_
 
bool useRegressionFromDB_
 
bool useVerticesForNeutral_
 
bool verbose_
 verbose ? More...
 
edm::EDGetTokenT
< reco::VertexCollection
vertices_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 42 of file PFProducer.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file PFProducer.cc.

References edm::ParameterSet::existsAs(), edm::false, contentValuesFiles::fullPath, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, LogDebug, AlCaHLTBitMon_QueryRunRegistry::string, and o2o::tags.

26  {
27 
28  //--ab: get calibration factors for HF:
29  bool calibHF_use;
30  std::vector<double> calibHF_eta_step;
31  std::vector<double> calibHF_a_EMonly;
32  std::vector<double> calibHF_b_HADonly;
33  std::vector<double> calibHF_a_EMHAD;
34  std::vector<double> calibHF_b_EMHAD;
35  calibHF_use = iConfig.getParameter<bool>("calibHF_use");
36  calibHF_eta_step = iConfig.getParameter<std::vector<double> >("calibHF_eta_step");
37  calibHF_a_EMonly = iConfig.getParameter<std::vector<double> >("calibHF_a_EMonly");
38  calibHF_b_HADonly = iConfig.getParameter<std::vector<double> >("calibHF_b_HADonly");
39  calibHF_a_EMHAD = iConfig.getParameter<std::vector<double> >("calibHF_a_EMHAD");
40  calibHF_b_EMHAD = iConfig.getParameter<std::vector<double> >("calibHF_b_EMHAD");
41  boost::shared_ptr<PFEnergyCalibrationHF>
42  thepfEnergyCalibrationHF ( new PFEnergyCalibrationHF(calibHF_use,calibHF_eta_step,calibHF_a_EMonly,calibHF_b_HADonly,calibHF_a_EMHAD,calibHF_b_EMHAD) ) ;
43  //-----------------
44 
45  inputTagBlocks_ = consumes<reco::PFBlockCollection>(iConfig.getParameter<InputTag>("blocks"));
46 
47  //Post cleaning of the muons
48  inputTagMuons_ = consumes<reco::MuonCollection>(iConfig.getParameter<InputTag>("muons"));
50  = iConfig.getParameter<bool>("postMuonCleaning");
51 
52  if( iConfig.existsAs<bool>("useEGammaFilters") ) {
53  use_EGammaFilters_ = iConfig.getParameter<bool>("useEGammaFilters");
54  } else {
55  use_EGammaFilters_ = false;
56  }
57 
59  = iConfig.getParameter<bool>("usePFElectrons");
60 
62  = iConfig.getParameter<bool>("usePFPhotons");
63 
64  // **************************** !! IMPORTANT !! ************************************
65  // When you code is swithed on, automatically turn off the old PFElectrons/PFPhotons.
66  // The two algorithms can not run at the same time
67  // *********************************************************************************
68 
69  if(use_EGammaFilters_) {
70  usePFElectrons_ = false;
71  usePFPhotons_ = false;
72  }
73 
74 
76  = (usePFPhotons_) ? iConfig.getParameter<bool>("usePhotonReg") : false ;
77 
79  = (usePFPhotons_) ? iConfig.getParameter<bool>("useRegressionFromDB") : false;
80 
82  = iConfig.getParameter<bool>("useEGammaElectrons");
83 
84  if( useEGammaElectrons_) {
85  inputTagEgammaElectrons_ = consumes<reco::GsfElectronCollection>(iConfig.getParameter<edm::InputTag>("egammaElectrons"));
86  }
87 
89  = iConfig.getParameter<std::string>("pf_electron_output_col");
90 
91  bool usePFSCEleCalib;
92  std::vector<double> calibPFSCEle_Fbrem_barrel;
93  std::vector<double> calibPFSCEle_Fbrem_endcap;
94  std::vector<double> calibPFSCEle_barrel;
95  std::vector<double> calibPFSCEle_endcap;
96  usePFSCEleCalib = iConfig.getParameter<bool>("usePFSCEleCalib");
97  calibPFSCEle_Fbrem_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_Fbrem_barrel");
98  calibPFSCEle_Fbrem_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_Fbrem_endcap");
99  calibPFSCEle_barrel = iConfig.getParameter<std::vector<double> >("calibPFSCEle_barrel");
100  calibPFSCEle_endcap = iConfig.getParameter<std::vector<double> >("calibPFSCEle_endcap");
101  boost::shared_ptr<PFSCEnergyCalibration>
102  thePFSCEnergyCalibration ( new PFSCEnergyCalibration(calibPFSCEle_Fbrem_barrel,calibPFSCEle_Fbrem_endcap,
103  calibPFSCEle_barrel,calibPFSCEle_endcap ));
104 
105  bool useEGammaSupercluster = iConfig.getParameter<bool>("useEGammaSupercluster");
106  double sumEtEcalIsoForEgammaSC_barrel = iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_barrel");
107  double sumEtEcalIsoForEgammaSC_endcap = iConfig.getParameter<double>("sumEtEcalIsoForEgammaSC_endcap");
108  double coneEcalIsoForEgammaSC = iConfig.getParameter<double>("coneEcalIsoForEgammaSC");
109  double sumPtTrackIsoForEgammaSC_barrel = iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_barrel");
110  double sumPtTrackIsoForEgammaSC_endcap = iConfig.getParameter<double>("sumPtTrackIsoForEgammaSC_endcap");
111  double coneTrackIsoForEgammaSC = iConfig.getParameter<double>("coneTrackIsoForEgammaSC");
112  unsigned int nTrackIsoForEgammaSC = iConfig.getParameter<unsigned int>("nTrackIsoForEgammaSC");
113 
114 
115  // register products
116  produces<reco::PFCandidateCollection>();
117  produces<reco::PFCandidateCollection>("CleanedHF");
118  produces<reco::PFCandidateCollection>("CleanedCosmicsMuons");
119  produces<reco::PFCandidateCollection>("CleanedTrackerAndGlobalMuons");
120  produces<reco::PFCandidateCollection>("CleanedFakeMuons");
121  produces<reco::PFCandidateCollection>("CleanedPunchThroughMuons");
122  produces<reco::PFCandidateCollection>("CleanedPunchThroughNeutralHadrons");
123  produces<reco::PFCandidateCollection>("AddedMuonsAndHadrons");
124 
125 
126  if (usePFElectrons_) {
127  produces<reco::PFCandidateCollection>(electronOutputCol_);
128  produces<reco::PFCandidateElectronExtraCollection>(electronExtraOutputCol_);
129  }
130 
131  if (usePFPhotons_) {
132  produces<reco::PFCandidatePhotonExtraCollection>(photonExtraOutputCol_);
133  }
134 
135 
136  double nSigmaECAL
137  = iConfig.getParameter<double>("pf_nsigma_ECAL");
138  double nSigmaHCAL
139  = iConfig.getParameter<double>("pf_nsigma_HCAL");
140 
141  //PFElectrons Configuration
142  double mvaEleCut
143  = iConfig.getParameter<double>("pf_electron_mvaCut");
144 
145 
146  string mvaWeightFileEleID
147  = iConfig.getParameter<string>("pf_electronID_mvaWeightFile");
148 
149  bool applyCrackCorrectionsForElectrons
150  = iConfig.getParameter<bool>("pf_electronID_crackCorrection");
151 
152  string path_mvaWeightFileEleID;
153  if(usePFElectrons_)
154  {
155  path_mvaWeightFileEleID = edm::FileInPath ( mvaWeightFileEleID.c_str() ).fullPath();
156  }
157 
158  //PFPhoton Configuration
159 
160  string path_mvaWeightFileConvID;
161  string mvaWeightFileConvID;
162  string path_mvaWeightFileGCorr;
163  string path_mvaWeightFileLCorr;
164  string path_X0_Map;
165  string path_mvaWeightFileRes;
166  double mvaConvCut=-99.;
167  double sumPtTrackIsoForPhoton = 99.;
168  double sumPtTrackIsoSlopeForPhoton = 99.;
169 
170  if(usePFPhotons_ )
171  {
172  mvaWeightFileConvID =iConfig.getParameter<string>("pf_convID_mvaWeightFile");
173  mvaConvCut = iConfig.getParameter<double>("pf_conv_mvaCut");
174  path_mvaWeightFileConvID = edm::FileInPath ( mvaWeightFileConvID.c_str() ).fullPath();
175  sumPtTrackIsoForPhoton = iConfig.getParameter<double>("sumPtTrackIsoForPhoton");
176  sumPtTrackIsoSlopeForPhoton = iConfig.getParameter<double>("sumPtTrackIsoSlopeForPhoton");
177 
178  string X0_Map=iConfig.getParameter<string>("X0_Map");
179  path_X0_Map = edm::FileInPath( X0_Map.c_str() ).fullPath();
180 
181  if(!useRegressionFromDB_) {
182  string mvaWeightFileLCorr=iConfig.getParameter<string>("pf_locC_mvaWeightFile");
183  path_mvaWeightFileLCorr = edm::FileInPath( mvaWeightFileLCorr.c_str() ).fullPath();
184  string mvaWeightFileGCorr=iConfig.getParameter<string>("pf_GlobC_mvaWeightFile");
185  path_mvaWeightFileGCorr = edm::FileInPath( mvaWeightFileGCorr.c_str() ).fullPath();
186  string mvaWeightFileRes=iConfig.getParameter<string>("pf_Res_mvaWeightFile");
187  path_mvaWeightFileRes=edm::FileInPath(mvaWeightFileRes.c_str()).fullPath();
188 
189  TFile *fgbr = new TFile(path_mvaWeightFileGCorr.c_str(),"READ");
190  ReaderGC_ =(const GBRForest*)fgbr->Get("GBRForest");
191  TFile *fgbr2 = new TFile(path_mvaWeightFileLCorr.c_str(),"READ");
192  ReaderLC_ = (const GBRForest*)fgbr2->Get("GBRForest");
193  TFile *fgbr3 = new TFile(path_mvaWeightFileRes.c_str(),"READ");
194  ReaderRes_ = (const GBRForest*)fgbr3->Get("GBRForest");
195  LogDebug("PFProducer")<<"Will set regressions from binary files " <<endl;
196  }
197 
198  }
199 
200 
201  // Reading new EGamma selection cuts
202  bool useProtectionsForJetMET(false);
203  double ele_iso_pt(0.0), ele_iso_mva_barrel(0.0), ele_iso_mva_endcap(0.0),
204  ele_iso_combIso_barrel(0.0), ele_iso_combIso_endcap(0.0),
205  ele_noniso_mva(0.0);
206  unsigned int ele_missinghits(0);
207  double ph_MinEt(0.0), ph_combIso(0.0), ph_HoE(0.0),
208  ph_sietaieta_eb(0.0),ph_sietaieta_ee(0.0);
209  string ele_iso_mvaWeightFile(""), ele_iso_path_mvaWeightFile("");
210  edm::ParameterSet ele_protectionsForJetMET,ph_protectionsForJetMET;
211 
212  // Reading new EGamma ubiased collections and value maps
213  if(use_EGammaFilters_) {
214  ele_iso_mvaWeightFile = iConfig.getParameter<string>("isolatedElectronID_mvaWeightFile");
215  ele_iso_path_mvaWeightFile = edm::FileInPath ( ele_iso_mvaWeightFile.c_str() ).fullPath();
216  inputTagPFEGammaCandidates_ = consumes<edm::View<reco::PFCandidate> >((iConfig.getParameter<edm::InputTag>("PFEGammaCandidates")));
217  inputTagValueMapGedElectrons_ = consumes<edm::ValueMap<reco::GsfElectronRef>>(iConfig.getParameter<edm::InputTag>("GedElectronValueMap"));
218  inputTagValueMapGedPhotons_ = consumes<edm::ValueMap<reco::PhotonRef> >(iConfig.getParameter<edm::InputTag>("GedPhotonValueMap"));
219  ele_iso_pt = iConfig.getParameter<double>("electron_iso_pt");
220  ele_iso_mva_barrel = iConfig.getParameter<double>("electron_iso_mva_barrel");
221  ele_iso_mva_endcap = iConfig.getParameter<double>("electron_iso_mva_endcap");
222  ele_iso_combIso_barrel = iConfig.getParameter<double>("electron_iso_combIso_barrel");
223  ele_iso_combIso_endcap = iConfig.getParameter<double>("electron_iso_combIso_endcap");
224  ele_noniso_mva = iConfig.getParameter<double>("electron_noniso_mvaCut");
225  ele_missinghits = iConfig.getParameter<unsigned int>("electron_missinghits");
226  ph_MinEt = iConfig.getParameter<double>("photon_MinEt");
227  ph_combIso = iConfig.getParameter<double>("photon_combIso");
228  ph_HoE = iConfig.getParameter<double>("photon_HoE");
229  ph_sietaieta_eb = iConfig.getParameter<double>("photon_SigmaiEtaiEta_barrel");
230  ph_sietaieta_ee = iConfig.getParameter<double>("photon_SigmaiEtaiEta_endcap");
231  useProtectionsForJetMET =
232  iConfig.getParameter<bool>("useProtectionsForJetMET");
233  ele_protectionsForJetMET =
234  iConfig.getParameter<edm::ParameterSet>("electron_protectionsForJetMET");
235  ph_protectionsForJetMET =
236  iConfig.getParameter<edm::ParameterSet>("photon_protectionsForJetMET");
237  }
238 
239  //Secondary tracks and displaced vertices parameters
240 
241  bool rejectTracks_Bad
242  = iConfig.getParameter<bool>("rejectTracks_Bad");
243 
244  bool rejectTracks_Step45
245  = iConfig.getParameter<bool>("rejectTracks_Step45");
246 
247  bool usePFNuclearInteractions
248  = iConfig.getParameter<bool>("usePFNuclearInteractions");
249 
250  bool usePFConversions
251  = iConfig.getParameter<bool>("usePFConversions");
252 
253  bool usePFDecays
254  = iConfig.getParameter<bool>("usePFDecays");
255 
256  double dptRel_DispVtx
257  = iConfig.getParameter<double>("dptRel_DispVtx");
258 
259  edm::ParameterSet iCfgCandConnector
260  = iConfig.getParameter<edm::ParameterSet>("iCfgCandConnector");
261 
262 
263  // fToRead = iConfig.getUntrackedParameter<vector<string> >("toRead");
264 
266  = iConfig.getParameter<bool>("useCalibrationsFromDB");
267 
268  boost::shared_ptr<PFEnergyCalibration>
269  calibration( new PFEnergyCalibration() );
270 
271  int algoType
272  = iConfig.getParameter<unsigned>("algoType");
273 
274  switch(algoType) {
275  case 0:
276  pfAlgo_.reset( new PFAlgo);
277  break;
278  default:
279  assert(0);
280  }
281 
282  pfAlgo_->setParameters( nSigmaECAL,
283  nSigmaHCAL,
284  calibration,
285  thepfEnergyCalibrationHF);
286 
287  //PFElectrons: call the method setpfeleparameters
288  pfAlgo_->setPFEleParameters(mvaEleCut,
289  path_mvaWeightFileEleID,
291  thePFSCEnergyCalibration,
292  calibration,
293  sumEtEcalIsoForEgammaSC_barrel,
294  sumEtEcalIsoForEgammaSC_endcap,
295  coneEcalIsoForEgammaSC,
296  sumPtTrackIsoForEgammaSC_barrel,
297  sumPtTrackIsoForEgammaSC_endcap,
298  nTrackIsoForEgammaSC,
299  coneTrackIsoForEgammaSC,
300  applyCrackCorrectionsForElectrons,
301  usePFSCEleCalib,
303  useEGammaSupercluster);
304 
305  // pfAlgo_->setPFConversionParameters(usePFConversions);
306 
307  // PFPhotons:
308  pfAlgo_->setPFPhotonParameters(usePFPhotons_,
309  path_mvaWeightFileConvID,
310  mvaConvCut,
312  path_X0_Map,
313  calibration,
314  sumPtTrackIsoForPhoton,
315  sumPtTrackIsoSlopeForPhoton);
316 
317 
318  // NEW EGamma Filters
319  pfAlgo_->setEGammaParameters(use_EGammaFilters_,
320  ele_iso_path_mvaWeightFile,
321  ele_iso_pt,
322  ele_iso_mva_barrel,
323  ele_iso_mva_endcap,
324  ele_iso_combIso_barrel,
325  ele_iso_combIso_endcap,
326  ele_noniso_mva,
327  ele_missinghits,
328  useProtectionsForJetMET,
329  ele_protectionsForJetMET,
330  ph_MinEt,
331  ph_combIso,
332  ph_HoE,
333  ph_sietaieta_eb,
334  ph_sietaieta_ee,
335  ph_protectionsForJetMET);
336 
337  //Secondary tracks and displaced vertices parameters
338 
339  pfAlgo_->setDisplacedVerticesParameters(rejectTracks_Bad,
340  rejectTracks_Step45,
341  usePFNuclearInteractions,
342  usePFConversions,
343  usePFDecays,
344  dptRel_DispVtx);
345 
346  if (usePFNuclearInteractions)
347  pfAlgo_->setCandConnectorParameters( iCfgCandConnector );
348 
349 
350 
351  // Set muon and fake track parameters
352  pfAlgo_->setPFMuonAndFakeParameters(iConfig);
353 
354  //Post cleaning of the HF
355  bool postHFCleaning
356  = iConfig.getParameter<bool>("postHFCleaning");
357  double minHFCleaningPt
358  = iConfig.getParameter<double>("minHFCleaningPt");
359  double minSignificance
360  = iConfig.getParameter<double>("minSignificance");
361  double maxSignificance
362  = iConfig.getParameter<double>("maxSignificance");
363  double minSignificanceReduction
364  = iConfig.getParameter<double>("minSignificanceReduction");
365  double maxDeltaPhiPt
366  = iConfig.getParameter<double>("maxDeltaPhiPt");
367  double minDeltaMet
368  = iConfig.getParameter<double>("minDeltaMet");
369 
370  // Set post HF cleaning muon parameters
371  pfAlgo_->setPostHFCleaningParameters(postHFCleaning,
372  minHFCleaningPt,
373  minSignificance,
374  maxSignificance,
375  minSignificanceReduction,
376  maxDeltaPhiPt,
377  minDeltaMet);
378 
379  // Input tags for HF cleaned rechits
380  std::vector<edm::InputTag> tags =iConfig.getParameter< std::vector<edm::InputTag> >("cleanedHF");
381  for (unsigned int i=0;i<tags.size();++i)
382  inputTagCleanedHF_.push_back(consumes<reco::PFRecHitCollection>(tags[i]));
383  //MIKE: Vertex Parameters
384  vertices_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"));
385  useVerticesForNeutral_ = iConfig.getParameter<bool>("useVerticesForNeutral");
386 
387  // Use HO clusters and links in the PF reconstruction
388  useHO_= iConfig.getParameter<bool>("useHO");
389  pfAlgo_->setHOTag(useHO_);
390 
391  verbose_ =
392  iConfig.getUntrackedParameter<bool>("verbose",false);
393 
394  bool debug_ =
395  iConfig.getUntrackedParameter<bool>("debug",false);
396 
397  pfAlgo_->setDebug( debug_ );
398 
399 }
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
Definition: PFProducer.h:57
#define LogDebug(id)
const GBRForest * ReaderRes_
Definition: PFProducer.h:90
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string photonExtraOutputCol_
Definition: PFProducer.h:60
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
Definition: PFProducer.h:52
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:110
const GBRForest * ReaderLC_
Definition: PFProducer.h:89
bool useCalibrationsFromDB_
Definition: PFProducer.h:104
bool use_EGammaFilters_
Definition: PFProducer.h:67
edm::EDGetTokenT< reco::VertexCollection > vertices_
Definition: PFProducer.h:53
bool useVerticesForNeutral_
Definition: PFProducer.h:101
bool postMuonCleaning_
Definition: PFProducer.h:77
edm::EDGetTokenT< edm::View< reco::PFCandidate > > inputTagPFEGammaCandidates_
Definition: PFProducer.h:65
edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
Definition: PFProducer.h:51
tuple tags
Definition: o2o.py:248
bool useHO_
Definition: PFProducer.h:71
bool useRegressionFromDB_
Definition: PFProducer.h:87
bool usePFElectrons_
Definition: PFProducer.h:80
std::string electronOutputCol_
Definition: PFProducer.h:58
bool verbose_
verbose ?
Definition: PFProducer.h:74
std::string electronExtraOutputCol_
Definition: PFProducer.h:59
bool useEGammaElectrons_
Definition: PFProducer.h:98
edm::EDGetTokenT< edm::ValueMap< reco::PhotonRef > > inputTagValueMapGedPhotons_
Definition: PFProducer.h:64
bool usePFPhotons_
Definition: PFProducer.h:83
volatile std::atomic< bool > shutdown_flag false
Definition: PFAlgo.h:52
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagEgammaElectrons_
Definition: PFProducer.h:54
bool usePhotonReg_
Definition: PFProducer.h:86
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
Definition: PFProducer.h:63
const GBRForest * ReaderGC_
Definition: PFProducer.h:88
PFProducer::~PFProducer ( )

Definition at line 403 of file PFProducer.cc.

403 {}

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 406 of file PFProducer.cc.

References edm::EventSetup::get(), and edm::ESHandle< class >::product().

408 {
409 
410 
411  /*
412  static map<string, PerformanceResult::ResultType> functType;
413 
414  functType["PFfa_BARREL"] = PerformanceResult::PFfa_BARREL;
415  functType["PFfa_ENDCAP"] = PerformanceResult::PFfa_ENDCAP;
416  functType["PFfb_BARREL"] = PerformanceResult::PFfb_BARREL;
417  functType["PFfb_ENDCAP"] = PerformanceResult::PFfb_ENDCAP;
418  functType["PFfc_BARREL"] = PerformanceResult::PFfc_BARREL;
419  functType["PFfc_ENDCAP"] = PerformanceResult::PFfc_ENDCAP;
420  functType["PFfaEta_BARREL"] = PerformanceResult::PFfaEta_BARREL;
421  functType["PFfaEta_ENDCAP"] = PerformanceResult::PFfaEta_ENDCAP;
422  functType["PFfbEta_BARREL"] = PerformanceResult::PFfbEta_BARREL;
423  functType["PFfbEta_ENDCAP"] = PerformanceResult::PFfbEta_ENDCAP;
424  */
425 
426  if ( useCalibrationsFromDB_ ) {
427  // Read the PFCalibration functions from the global tags.
429  es.get<PFCalibrationRcd>().get(perfH);
430 
431  const PerformancePayloadFromTFormula *pfCalibrations = static_cast< const PerformancePayloadFromTFormula *>(perfH.product());
432 
433  pfAlgo_->thePFEnergyCalibration()->setCalibrationFunctions(pfCalibrations);
434  }
435 
436  /*
437  for(vector<string>::const_iterator name = fToRead.begin(); name != fToRead.end(); ++name) {
438 
439  cout << "Function: " << *name << endl;
440  PerformanceResult::ResultType fType = functType[*name];
441  pfCalibrations->printFormula(fType);
442 
443  // evaluate it @ 10 GeV
444  float energy = 10.;
445 
446  BinningPointByMap point;
447  point.insert(BinningVariables::JetEt, energy);
448 
449  if(pfCalibrations->isInPayload(fType, point)) {
450  float value = pfCalibrations->getResult(fType, point);
451  cout << " Energy before:: " << energy << " after: " << value << endl;
452  } else cout << "outside limits!" << endl;
453 
454  }
455  */
456 
458  edm::ESHandle<GBRForest> readerPFLCEB;
459  edm::ESHandle<GBRForest> readerPFLCEE;
460  edm::ESHandle<GBRForest> readerPFGCEB;
461  edm::ESHandle<GBRForest> readerPFGCEEHR9;
462  edm::ESHandle<GBRForest> readerPFGCEELR9;
463  edm::ESHandle<GBRForest> readerPFRes;
464  es.get<GBRWrapperRcd>().get("PFLCorrectionBar",readerPFLCEB);
465  ReaderLCEB_=readerPFLCEB.product();
466  es.get<GBRWrapperRcd>().get("PFLCorrectionEnd",readerPFLCEE);
467  ReaderLCEE_=readerPFLCEE.product();
468  es.get<GBRWrapperRcd>().get("PFGCorrectionBar",readerPFGCEB);
469  ReaderGCBarrel_=readerPFGCEB.product();
470  es.get<GBRWrapperRcd>().get("PFGCorrectionEndHighR9",readerPFGCEEHR9);
471  ReaderGCEndCapHighr9_=readerPFGCEEHR9.product();
472  es.get<GBRWrapperRcd>().get("PFGCorrectionEndLowR9",readerPFGCEELR9);
473  ReaderGCEndCapLowr9_=readerPFGCEELR9.product();
474  es.get<GBRWrapperRcd>().get("PFEcalResolution",readerPFRes);
475  ReaderEcalRes_=readerPFRes.product();
476 
477  /*
478  LogDebug("PFProducer")<<"setting regressions from DB "<<endl;
479  */
480  }
481 
482  if(usePFPhotons_){
483  //pfAlgo_->setPFPhotonRegWeights(ReaderLC_, ReaderGC_, ReaderRes_);
485  }
486 }
const GBRForest * ReaderEcalRes_
Definition: PFProducer.h:96
const GBRForest * ReaderLCEB_
Definition: PFProducer.h:91
const GBRForest * ReaderGCEndCapHighr9_
Definition: PFProducer.h:94
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:110
bool useCalibrationsFromDB_
Definition: PFProducer.h:104
const GBRForest * ReaderLCEE_
Definition: PFProducer.h:92
const GBRForest * ReaderGCEndCapLowr9_
Definition: PFProducer.h:95
bool useRegressionFromDB_
Definition: PFProducer.h:87
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool usePFPhotons_
Definition: PFProducer.h:83
const GBRForest * ReaderGCBarrel_
Definition: PFProducer.h:93
void PFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 490 of file PFProducer.cc.

References gather_cfg::blocks, gather_cfg::cout, edm::EventID::event(), edm::Event::getByToken(), edm::EventBase::id(), ihf, edm::HandleBase::isValid(), LogDebug, patZpeak::muons, edm::Handle< T >::product(), edm::Event::put(), and edm::EventID::run().

491  {
492 
493  LogDebug("PFProducer")<<"START event: "
494  <<iEvent.id().event()
495  <<" in run "<<iEvent.id().run()<<endl;
496 
497 
498  // Get The vertices from the event
499  // and assign dynamic vertex parameters
501  bool gotVertices = iEvent.getByToken(vertices_,vertices);
502  if(!gotVertices) {
503  ostringstream err;
504  err<<"Cannot find vertices for this event.Continuing Without them ";
505  LogError("PFProducer")<<err.str()<<endl;
506  }
507 
508  //Assign the PFAlgo Parameters
509  pfAlgo_->setPFVertexParameters(useVerticesForNeutral_,vertices.product());
510 
511  // get the collection of blocks
512 
514 
515  iEvent.getByToken( inputTagBlocks_, blocks );
516 
517  // get the collection of muons
518 
520 
521  if ( postMuonCleaning_ ) {
522 
523  iEvent.getByToken( inputTagMuons_, muons );
524  pfAlgo_->setMuonHandle(muons);
525  }
526 
527  if (useEGammaElectrons_) {
529  iEvent.getByToken( inputTagEgammaElectrons_, egelectrons );
530  pfAlgo_->setEGElectronCollection(*egelectrons);
531  }
532 
533  if(use_EGammaFilters_) {
534 
535  // Read PFEGammaCandidates
536 
537  edm::Handle<edm::View<reco::PFCandidate> > pfEgammaCandidates;
538  iEvent.getByToken(inputTagPFEGammaCandidates_,pfEgammaCandidates);
539 
540  // Get the value maps
541 
543  iEvent.getByToken(inputTagValueMapGedElectrons_,valueMapGedElectrons);
544 
545  edm::Handle<edm::ValueMap<reco::PhotonRef> > valueMapGedPhotons;
546  iEvent.getByToken(inputTagValueMapGedPhotons_,valueMapGedPhotons);
547 
548  pfAlgo_->setEGammaCollections(*pfEgammaCandidates,
549  *valueMapGedElectrons,
550  *valueMapGedPhotons);
551 
552  }
553 
554 
555  LogDebug("PFProducer")<<"particle flow is starting"<<endl;
556 
557  assert( blocks.isValid() );
558 
559  pfAlgo_->reconstructParticles( blocks );
560 
561  if(verbose_) {
562  ostringstream str;
563  str<<(*pfAlgo_)<<endl;
564  // cout << (*pfAlgo_) << endl;
565  LogInfo("PFProducer") <<str.str()<<endl;
566  }
567 
568 
569  // Florian 5/01/2011
570  // Save the PFElectron Extra Collection First as to be able to create valid References
571  if(usePFElectrons_) {
572  auto_ptr< reco::PFCandidateElectronExtraCollection >
573  pOutputElectronCandidateExtraCollection( pfAlgo_->transferElectronExtra() );
574 
576  iEvent.put(pOutputElectronCandidateExtraCollection,electronExtraOutputCol_);
577  pfAlgo_->setElectronExtraRef(electronExtraProd);
578  }
579 
580  // Daniele 18/05/2011
581  // Save the PFPhoton Extra Collection First as to be able to create valid References
582  if(usePFPhotons_) {
583  auto_ptr< reco::PFCandidatePhotonExtraCollection >
584  pOutputPhotonCandidateExtraCollection( pfAlgo_->transferPhotonExtra() );
585 
587  iEvent.put(pOutputPhotonCandidateExtraCollection,photonExtraOutputCol_);
588  pfAlgo_->setPhotonExtraRef(photonExtraProd);
589  }
590 
591  // Save cosmic cleaned muon candidates
592  auto_ptr< reco::PFCandidateCollection >
593  pCosmicsMuonCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedCosmicCandidates() );
594  // Save tracker/global cleaned muon candidates
595  auto_ptr< reco::PFCandidateCollection >
596  pTrackerAndGlobalCleanedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedTrackerAndGlobalCandidates() );
597  // Save fake cleaned muon candidates
598  auto_ptr< reco::PFCandidateCollection >
599  pFakeCleanedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedFakeCandidates() );
600  // Save punch-through cleaned muon candidates
601  auto_ptr< reco::PFCandidateCollection >
602  pPunchThroughMuonCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferPunchThroughCleanedMuonCandidates() );
603  // Save punch-through cleaned neutral hadron candidates
604  auto_ptr< reco::PFCandidateCollection >
605  pPunchThroughHadronCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferPunchThroughCleanedHadronCandidates() );
606  // Save added muon candidates
607  auto_ptr< reco::PFCandidateCollection >
608  pAddedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferAddedMuonCandidates() );
609 
610  // Check HF overcleaning
612  for ( unsigned ihf=0; ihf<inputTagCleanedHF_.size(); ++ihf ) {
614  bool foundHF = iEvent.getByToken( inputTagCleanedHF_[ihf], hfCleaned );
615  if (!foundHF) continue;
616  for ( unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
617  hfCopy.push_back( (*hfCleaned)[jhf] );
618  }
619  }
620  pfAlgo_->checkCleaning( hfCopy );
621 
622  // Save recovered HF candidates
623  auto_ptr< reco::PFCandidateCollection >
624  pCleanedCandidateCollection( pfAlgo_->transferCleanedCandidates() );
625 
626 
627  // Save the final PFCandidate collection
628  auto_ptr< reco::PFCandidateCollection >
629  pOutputCandidateCollection( pfAlgo_->transferCandidates() );
630 
631 
632 
633  LogDebug("PFProducer")<<"particle flow: putting products in the event"<<endl;
634  if ( verbose_ ) std::cout <<"particle flow: putting products in the event. Here the full list"<<endl;
635  int nC=0;
636  for( reco::PFCandidateCollection::const_iterator itCand = (*pOutputCandidateCollection).begin(); itCand != (*pOutputCandidateCollection).end(); itCand++) {
637  nC++;
638  if (verbose_ ) std::cout << nC << ")" << (*itCand).particleId() << std::endl;
639 
640  }
641 
642 
643 
644  // Write in the event
645  iEvent.put(pOutputCandidateCollection);
646  iEvent.put(pCleanedCandidateCollection,"CleanedHF");
647 
648  if ( postMuonCleaning_ ) {
649  iEvent.put(pCosmicsMuonCleanedCandidateCollection,"CleanedCosmicsMuons");
650  iEvent.put(pTrackerAndGlobalCleanedMuonCandidateCollection,"CleanedTrackerAndGlobalMuons");
651  iEvent.put(pFakeCleanedMuonCandidateCollection,"CleanedFakeMuons");
652  iEvent.put(pPunchThroughMuonCleanedCandidateCollection,"CleanedPunchThroughMuons");
653  iEvent.put(pPunchThroughHadronCleanedCandidateCollection,"CleanedPunchThroughNeutralHadrons");
654  iEvent.put(pAddedMuonCandidateCollection,"AddedMuonsAndHadrons");
655  }
656 
657  if(usePFElectrons_)
658  {
659  auto_ptr< reco::PFCandidateCollection >
660  pOutputElectronCandidateCollection( pfAlgo_->transferElectronCandidates() );
661  iEvent.put(pOutputElectronCandidateCollection,electronOutputCol_);
662 
663  }
664 }
std::vector< edm::EDGetTokenT< reco::PFRecHitCollection > > inputTagCleanedHF_
Definition: PFProducer.h:57
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
std::string photonExtraOutputCol_
Definition: PFProducer.h:60
edm::EDGetTokenT< reco::MuonCollection > inputTagMuons_
Definition: PFProducer.h:52
int ihf
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:110
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
bool use_EGammaFilters_
Definition: PFProducer.h:67
edm::EDGetTokenT< reco::VertexCollection > vertices_
Definition: PFProducer.h:53
bool useVerticesForNeutral_
Definition: PFProducer.h:101
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool postMuonCleaning_
Definition: PFProducer.h:77
edm::EDGetTokenT< edm::View< reco::PFCandidate > > inputTagPFEGammaCandidates_
Definition: PFProducer.h:65
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< reco::PFBlockCollection > inputTagBlocks_
Definition: PFProducer.h:51
bool usePFElectrons_
Definition: PFProducer.h:80
std::string electronOutputCol_
Definition: PFProducer.h:58
bool verbose_
verbose ?
Definition: PFProducer.h:74
list blocks
Definition: gather_cfg.py:90
std::string electronExtraOutputCol_
Definition: PFProducer.h:59
bool useEGammaElectrons_
Definition: PFProducer.h:98
T const * product() const
Definition: Handle.h:81
edm::EventID id() const
Definition: EventBase.h:56
edm::EDGetTokenT< edm::ValueMap< reco::PhotonRef > > inputTagValueMapGedPhotons_
Definition: PFProducer.h:64
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:121
bool usePFPhotons_
Definition: PFProducer.h:83
edm::EDGetTokenT< reco::GsfElectronCollection > inputTagEgammaElectrons_
Definition: PFProducer.h:54
edm::EDGetTokenT< edm::ValueMap< reco::GsfElectronRef > > inputTagValueMapGedElectrons_
Definition: PFProducer.h:63

Member Data Documentation

std::string PFProducer::electronExtraOutputCol_
private

Definition at line 59 of file PFProducer.h.

std::string PFProducer::electronOutputCol_
private

Definition at line 58 of file PFProducer.h.

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

Definition at line 51 of file PFProducer.h.

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

Definition at line 57 of file PFProducer.h.

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

Definition at line 54 of file PFProducer.h.

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

Definition at line 52 of file PFProducer.h.

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

Definition at line 65 of file PFProducer.h.

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

Definition at line 63 of file PFProducer.h.

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

Definition at line 64 of file PFProducer.h.

std::auto_ptr<PFAlgo> PFProducer::pfAlgo_
private

particle flow algorithm

Definition at line 110 of file PFProducer.h.

std::string PFProducer::photonExtraOutputCol_
private

Definition at line 60 of file PFProducer.h.

bool PFProducer::postMuonCleaning_
private

Definition at line 77 of file PFProducer.h.

const GBRForest* PFProducer::ReaderEcalRes_
private

Definition at line 96 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGC_
private

Definition at line 88 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCBarrel_
private

Definition at line 93 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCEndCapHighr9_
private

Definition at line 94 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCEndCapLowr9_
private

Definition at line 95 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLC_
private

Definition at line 89 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLCEB_
private

Definition at line 91 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLCEE_
private

Definition at line 92 of file PFProducer.h.

const GBRForest* PFProducer::ReaderRes_
private

Definition at line 90 of file PFProducer.h.

bool PFProducer::use_EGammaFilters_
private

Definition at line 67 of file PFProducer.h.

bool PFProducer::useCalibrationsFromDB_
private

Definition at line 104 of file PFProducer.h.

bool PFProducer::useEGammaElectrons_
private

Definition at line 98 of file PFProducer.h.

bool PFProducer::useHO_
private

Definition at line 71 of file PFProducer.h.

bool PFProducer::usePFElectrons_
private

Definition at line 80 of file PFProducer.h.

bool PFProducer::usePFPhotons_
private

Definition at line 83 of file PFProducer.h.

bool PFProducer::usePhotonReg_
private

Definition at line 86 of file PFProducer.h.

bool PFProducer::useRegressionFromDB_
private

Definition at line 87 of file PFProducer.h.

bool PFProducer::useVerticesForNeutral_
private

Definition at line 101 of file PFProducer.h.

bool PFProducer::verbose_
private

verbose ?

Definition at line 74 of file PFProducer.h.

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

Definition at line 53 of file PFProducer.h.