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::EDProducer 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::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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
 
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::InputTag inputTagBlocks_
 
std::vector< edm::InputTaginputTagCleanedHF_
 
edm::InputTag inputTagEgammaElectrons_
 
edm::InputTag inputTagMuons_
 
edm::InputTag inputTagPFEGammaCandidates_
 
edm::InputTag inputTagValueMapGedElectrons_
 
edm::InputTag 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::InputTag vertices_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
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 30 of file PFProducer.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file PFProducer.cc.

References edm::ParameterSet::existsAs(), edm::false, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 412 of file PFProducer.cc.

412 {}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 415 of file PFProducer.cc.

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

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

Implements edm::EDProducer.

Definition at line 499 of file PFProducer.cc.

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

500  {
501 
502  LogDebug("PFProducer")<<"START event: "
503  <<iEvent.id().event()
504  <<" in run "<<iEvent.id().run()<<endl;
505 
506 
507  // Get The vertices from the event
508  // and assign dynamic vertex parameters
510  bool gotVertices = iEvent.getByLabel(vertices_,vertices);
511  if(!gotVertices) {
512  ostringstream err;
513  err<<"Cannot find vertices for this event.Continuing Without them ";
514  LogError("PFProducer")<<err.str()<<endl;
515  }
516 
517  //Assign the PFAlgo Parameters
518  pfAlgo_->setPFVertexParameters(useVerticesForNeutral_,vertices.product());
519 
520  // get the collection of blocks
521 
523 
524  LogDebug("PFProducer")<<"getting blocks"<<endl;
525  bool found = iEvent.getByLabel( inputTagBlocks_, blocks );
526 
527  if(!found ) {
528 
529  ostringstream err;
530  err<<"cannot find blocks: "<<inputTagBlocks_;
531  LogError("PFProducer")<<err.str()<<endl;
532 
533  throw cms::Exception( "MissingProduct", err.str());
534  }
535 
536  // get the collection of muons
537 
539 
540  if ( postMuonCleaning_ ) {
541 
542  LogDebug("PFProducer")<<"getting muons"<<endl;
543  found = iEvent.getByLabel( inputTagMuons_, muons );
544  pfAlgo_->setMuonHandle(muons);
545  if(!found) {
546  ostringstream err;
547  err<<"cannot find muons: "<<inputTagMuons_;
548  LogError("PFProducer")<<err.str()<<endl;
549 
550  throw cms::Exception( "MissingProduct", err.str());
551 
552  }
553 
554  }
555 
556  if (useEGammaElectrons_) {
558 
559  LogDebug("PFProducer")<<" Reading e/gamma electrons activated "<<endl;
560  found = iEvent.getByLabel( inputTagEgammaElectrons_, egelectrons );
561 
562  if(!found) {
563  ostringstream err;
564  err<<"cannot find electrons: "<<inputTagEgammaElectrons_;
565  LogError("PFProducer")<<err.str()<<endl;
566 
567  throw cms::Exception( "MissingProduct", err.str());
568  }
569 
570  pfAlgo_->setEGElectronCollection(*egelectrons);
571  }
572 
573  if(use_EGammaFilters_) {
574 
575  // Read PFEGammaCandidates
576 
577  edm::Handle<edm::View<reco::PFCandidate> > pfEgammaCandidates;
578 
579  found=iEvent.getByLabel(inputTagPFEGammaCandidates_,pfEgammaCandidates);
580 
581  if(!found ) {
582  std::ostringstream err;
583  err<<" cannot get PFEGammaCandidates: "
584  << inputTagPFEGammaCandidates_ <<std::endl;
585  edm::LogError("PFProducer")<<err.str();
586  throw cms::Exception( "MissingProduct", err.str());
587  }
588 
589  // Get the value maps
590 
592  found = iEvent.getByLabel(inputTagValueMapGedElectrons_,valueMapGedElectrons);
593 
594  if(!found ) {
595  std::ostringstream err;
596  err<<" cannot get valueMapGedElectrons: "
597  << inputTagValueMapGedElectrons_ <<std::endl;
598  edm::LogError("PFProducer")<<err.str();
599  throw cms::Exception( "MissingProduct", err.str());
600  }
601 
602 
603  edm::Handle<edm::ValueMap<reco::PhotonRef> > valueMapGedPhotons;
604  found = iEvent.getByLabel(inputTagValueMapGedPhotons_,valueMapGedPhotons);
605 
606  if(!found ) {
607  std::ostringstream err;
608  err<<" cannot get valueMapGedPhotons: "
609  << inputTagValueMapGedPhotons_ <<std::endl;
610  edm::LogError("PFProducer")<<err.str();
611  throw cms::Exception( "MissingProduct", err.str());
612  }
613 
614  pfAlgo_->setEGammaCollections(*pfEgammaCandidates,
615  *valueMapGedElectrons,
616  *valueMapGedPhotons);
617 
618  }
619 
620 
621 
622  LogDebug("PFProducer")<<"particle flow is starting"<<endl;
623 
624  assert( blocks.isValid() );
625 
626  pfAlgo_->reconstructParticles( blocks );
627 
628  if(verbose_) {
629  ostringstream str;
630  str<<(*pfAlgo_)<<endl;
631  // cout << (*pfAlgo_) << endl;
632  LogInfo("PFProducer") <<str.str()<<endl;
633  }
634 
635 
636  // Florian 5/01/2011
637  // Save the PFElectron Extra Collection First as to be able to create valid References
638  if(usePFElectrons_) {
639  auto_ptr< reco::PFCandidateElectronExtraCollection >
640  pOutputElectronCandidateExtraCollection( pfAlgo_->transferElectronExtra() );
641 
643  iEvent.put(pOutputElectronCandidateExtraCollection,electronExtraOutputCol_);
644  pfAlgo_->setElectronExtraRef(electronExtraProd);
645  }
646 
647  // Daniele 18/05/2011
648  // Save the PFPhoton Extra Collection First as to be able to create valid References
649  if(usePFPhotons_) {
650  auto_ptr< reco::PFCandidatePhotonExtraCollection >
651  pOutputPhotonCandidateExtraCollection( pfAlgo_->transferPhotonExtra() );
652 
654  iEvent.put(pOutputPhotonCandidateExtraCollection,photonExtraOutputCol_);
655  pfAlgo_->setPhotonExtraRef(photonExtraProd);
656  }
657 
658  // Save cosmic cleaned muon candidates
659  auto_ptr< reco::PFCandidateCollection >
660  pCosmicsMuonCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedCosmicCandidates() );
661  // Save tracker/global cleaned muon candidates
662  auto_ptr< reco::PFCandidateCollection >
663  pTrackerAndGlobalCleanedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedTrackerAndGlobalCandidates() );
664  // Save fake cleaned muon candidates
665  auto_ptr< reco::PFCandidateCollection >
666  pFakeCleanedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferCleanedFakeCandidates() );
667  // Save punch-through cleaned muon candidates
668  auto_ptr< reco::PFCandidateCollection >
669  pPunchThroughMuonCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferPunchThroughCleanedMuonCandidates() );
670  // Save punch-through cleaned neutral hadron candidates
671  auto_ptr< reco::PFCandidateCollection >
672  pPunchThroughHadronCleanedCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferPunchThroughCleanedHadronCandidates() );
673  // Save added muon candidates
674  auto_ptr< reco::PFCandidateCollection >
675  pAddedMuonCandidateCollection( pfAlgo_->getPFMuonAlgo()->transferAddedMuonCandidates() );
676 
677  // Check HF overcleaning
679  for ( unsigned ihf=0; ihf<inputTagCleanedHF_.size(); ++ihf ) {
681  bool foundHF = iEvent.getByLabel( inputTagCleanedHF_[ihf], hfCleaned );
682  if (!foundHF) continue;
683  for ( unsigned jhf=0; jhf<(*hfCleaned).size(); ++jhf ) {
684  hfCopy.push_back( (*hfCleaned)[jhf] );
685  }
686  }
687  pfAlgo_->checkCleaning( hfCopy );
688 
689  // Save recovered HF candidates
690  auto_ptr< reco::PFCandidateCollection >
691  pCleanedCandidateCollection( pfAlgo_->transferCleanedCandidates() );
692 
693 
694  // Save the final PFCandidate collection
695  auto_ptr< reco::PFCandidateCollection >
696  pOutputCandidateCollection( pfAlgo_->transferCandidates() );
697 
698 
699 
700  LogDebug("PFProducer")<<"particle flow: putting products in the event"<<endl;
701  if ( verbose_ ) std::cout <<"particle flow: putting products in the event. Here the full list"<<endl;
702  int nC=0;
703  for( reco::PFCandidateCollection::const_iterator itCand = (*pOutputCandidateCollection).begin(); itCand != (*pOutputCandidateCollection).end(); itCand++) {
704  nC++;
705  if (verbose_ ) std::cout << nC << ")" << (*itCand).particleId() << std::endl;
706 
707  }
708 
709 
710 
711  // Write in the event
712  iEvent.put(pOutputCandidateCollection);
713  iEvent.put(pCleanedCandidateCollection,"CleanedHF");
714 
715  if ( postMuonCleaning_ ) {
716  iEvent.put(pCosmicsMuonCleanedCandidateCollection,"CleanedCosmicsMuons");
717  iEvent.put(pTrackerAndGlobalCleanedMuonCandidateCollection,"CleanedTrackerAndGlobalMuons");
718  iEvent.put(pFakeCleanedMuonCandidateCollection,"CleanedFakeMuons");
719  iEvent.put(pPunchThroughMuonCleanedCandidateCollection,"CleanedPunchThroughMuons");
720  iEvent.put(pPunchThroughHadronCleanedCandidateCollection,"CleanedPunchThroughNeutralHadrons");
721  iEvent.put(pAddedMuonCandidateCollection,"AddedMuonsAndHadrons");
722  }
723 
724  if(usePFElectrons_)
725  {
726  auto_ptr< reco::PFCandidateCollection >
727  pOutputElectronCandidateCollection( pfAlgo_->transferElectronCandidates() );
728  iEvent.put(pOutputElectronCandidateCollection,electronOutputCol_);
729 
730  }
731 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
edm::InputTag inputTagValueMapGedPhotons_
Definition: PFProducer.h:51
std::string photonExtraOutputCol_
Definition: PFProducer.h:47
int ihf
std::auto_ptr< PFAlgo > pfAlgo_
particle flow algorithm
Definition: PFProducer.h:96
edm::InputTag inputTagMuons_
Definition: PFProducer.h:41
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
std::vector< edm::InputTag > inputTagCleanedHF_
Definition: PFProducer.h:44
bool use_EGammaFilters_
Definition: PFProducer.h:53
bool useVerticesForNeutral_
Definition: PFProducer.h:87
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::InputTag vertices_
Definition: PFProducer.h:42
bool postMuonCleaning_
Definition: PFProducer.h:63
edm::InputTag inputTagValueMapGedElectrons_
Definition: PFProducer.h:50
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
edm::InputTag inputTagBlocks_
Definition: PFProducer.h:40
bool usePFElectrons_
Definition: PFProducer.h:66
edm::InputTag inputTagEgammaElectrons_
Definition: PFProducer.h:43
std::string electronOutputCol_
Definition: PFProducer.h:45
bool verbose_
verbose ?
Definition: PFProducer.h:60
list blocks
Definition: gather_cfg.py:90
std::string electronExtraOutputCol_
Definition: PFProducer.h:46
bool useEGammaElectrons_
Definition: PFProducer.h:84
edm::InputTag inputTagPFEGammaCandidates_
Definition: PFProducer.h:52
T const * product() const
Definition: Handle.h:81
edm::EventID id() const
Definition: EventBase.h:56
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:121
bool usePFPhotons_
Definition: PFProducer.h:69

Member Data Documentation

std::string PFProducer::electronExtraOutputCol_
private

Definition at line 46 of file PFProducer.h.

std::string PFProducer::electronOutputCol_
private

Definition at line 45 of file PFProducer.h.

edm::InputTag PFProducer::inputTagBlocks_
private

Definition at line 40 of file PFProducer.h.

std::vector<edm::InputTag> PFProducer::inputTagCleanedHF_
private

Definition at line 44 of file PFProducer.h.

edm::InputTag PFProducer::inputTagEgammaElectrons_
private

Definition at line 43 of file PFProducer.h.

edm::InputTag PFProducer::inputTagMuons_
private

Definition at line 41 of file PFProducer.h.

edm::InputTag PFProducer::inputTagPFEGammaCandidates_
private

Definition at line 52 of file PFProducer.h.

edm::InputTag PFProducer::inputTagValueMapGedElectrons_
private

Definition at line 50 of file PFProducer.h.

edm::InputTag PFProducer::inputTagValueMapGedPhotons_
private

Definition at line 51 of file PFProducer.h.

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

particle flow algorithm

Definition at line 96 of file PFProducer.h.

std::string PFProducer::photonExtraOutputCol_
private

Definition at line 47 of file PFProducer.h.

bool PFProducer::postMuonCleaning_
private

Definition at line 63 of file PFProducer.h.

const GBRForest* PFProducer::ReaderEcalRes_
private

Definition at line 82 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGC_
private

Definition at line 74 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCBarrel_
private

Definition at line 79 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCEndCapHighr9_
private

Definition at line 80 of file PFProducer.h.

const GBRForest* PFProducer::ReaderGCEndCapLowr9_
private

Definition at line 81 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLC_
private

Definition at line 75 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLCEB_
private

Definition at line 77 of file PFProducer.h.

const GBRForest* PFProducer::ReaderLCEE_
private

Definition at line 78 of file PFProducer.h.

const GBRForest* PFProducer::ReaderRes_
private

Definition at line 76 of file PFProducer.h.

bool PFProducer::use_EGammaFilters_
private

Definition at line 53 of file PFProducer.h.

bool PFProducer::useCalibrationsFromDB_
private

Definition at line 90 of file PFProducer.h.

bool PFProducer::useEGammaElectrons_
private

Definition at line 84 of file PFProducer.h.

bool PFProducer::useHO_
private

Definition at line 57 of file PFProducer.h.

bool PFProducer::usePFElectrons_
private

Definition at line 66 of file PFProducer.h.

bool PFProducer::usePFPhotons_
private

Definition at line 69 of file PFProducer.h.

bool PFProducer::usePhotonReg_
private

Definition at line 72 of file PFProducer.h.

bool PFProducer::useRegressionFromDB_
private

Definition at line 73 of file PFProducer.h.

bool PFProducer::useVerticesForNeutral_
private

Definition at line 87 of file PFProducer.h.

bool PFProducer::verbose_
private

verbose ?

Definition at line 60 of file PFProducer.h.

edm::InputTag PFProducer::vertices_
private

Definition at line 42 of file PFProducer.h.