test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFAlgo.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFProducer_PFAlgo_h
2 #define RecoParticleFlow_PFProducer_PFAlgo_h
3 
4 #include <iostream>
5 
6 
7 // #include "FWCore/Framework/interface/Handle.h"
10 // #include "FWCore/Framework/interface/OrphanHandle.h"
12 
16 
17 // next include is necessary for inline functions.
19 
26 
37 
39 
48 class PFElectronAlgo;
49 class PFPhotonAlgo;
50 class PFMuonAlgo;
51 
52 class PFAlgo {
53 
54  public:
55 
57  PFAlgo();
58 
60  virtual ~PFAlgo();
61 
62  void setHOTag(bool ho) { useHO_ = ho;}
63  void setAlgo( int algo ) {algo_ = algo;}
67 
68  void setParameters(double nSigmaECAL,
69  double nSigmaHCAL,
70  const boost::shared_ptr<PFEnergyCalibration>& calibration,
71  const boost::shared_ptr<PFEnergyCalibrationHF>& thepfEnergyCalibrationHF);
72 
74  connector_.setParameters(iCfgCandConnector);
75  }
76 
77  void setCandConnectorParameters(bool bCorrect,
78  bool bCalibPrimary,
79  double dptRel_PrimaryTrack,
80  double dptRel_MergedTrack,
81  double ptErrorSecondary,
82  const std::vector<double>& nuclCalibFactors){
83  connector_.setParameters(bCorrect, bCalibPrimary, dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary, nuclCalibFactors);
84  }
85 
86 
88 
90 
91  void setPFEleParameters(double mvaEleCut,
92  std::string mvaWeightFileEleID,
93  bool usePFElectrons,
94  const boost::shared_ptr<PFSCEnergyCalibration>& thePFSCEnergyCalibration,
95  const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
101  unsigned int nTrackIsoForEgammaSC,
103  bool applyCrackCorrections=false,
104  bool usePFSCEleCalib=true,
105  bool useEGElectrons=false,
106  bool useEGammaSupercluster = true);
107 
108  void setPFPhotonParameters(bool usePFPhoton,
109  std::string mvaWeightFileConvID,
110  double mvaConvCut,
111  bool useReg,
113  const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
114  double sumPtTrackIsoForPhoton,
116 
117  void setEGammaParameters(bool use_EGammaFilters,
118  std::string ele_iso_path_mvaWeightFile,
119  double ele_iso_pt,
120  double ele_iso_mva_barrel,
121  double ele_iso_mva_endcap,
122  double ele_iso_combIso_barrel,
123  double ele_iso_combIso_endcap,
124  double ele_noniso_mva,
125  unsigned int ele_missinghits,
127  const edm::ParameterSet& ele_protectionsForJetMET,
128  double ph_MinEt,
129  double ph_combIso,
130  double ph_HoE,
131  double ph_sietaieta_eb,
132  double ph_sietaieta_ee,
133  const edm::ParameterSet& ph_protectionsForJetMET);
134 
135 
136  void setEGammaCollections(const edm::View<reco::PFCandidate> & pfEgammaCandidates,
137  const edm::ValueMap<reco::GsfElectronRef> & valueMapGedElectrons,
138  const edm::ValueMap<reco::PhotonRef> & valueMapGedPhotons);
139 
140 
141 
142  // void setPFPhotonRegWeights(
143  // const GBRForest *LCorrForest,
144  // const GBRForest *GCorrForest,
145  // const GBRForest *ResForest
146 
147  // );
149  const GBRForest *LCorrForestEB,
150  const GBRForest *LCorrForestEE,
151  const GBRForest *GCorrForestBarrel,
152  const GBRForest *GCorrForestEndcapHr9,
153  const GBRForest *GCorrForestEndcapLr9,
154  const GBRForest *PFEcalResolution
155  );
157  double minHFCleaningPt,
158  double minSignificance,
159  double maxSignificance,
161  double maxDeltaPhiPt,
162  double minDeltaMet);
163 
165  bool rejectTracks_Step45,
167  bool usePFConversions,
168  bool usePFDecays,
169  double dptRel_DispVtx);
170 
171  //MIKEB : Parameters for the vertices..
174 
175  // FlorianB : Collection of e/g electrons
176  void setEGElectronCollection(const reco::GsfElectronCollection & egelectrons);
177 
181  void reconstructParticles( const reco::PFBlockHandle& blockHandle );
182 
184  virtual void reconstructParticles( const reco::PFBlockCollection& blocks );
185 
188 
189  // Post Electron Extra Ref
191 
192  // Post Photon Extra Ref
194 
196  const std::auto_ptr< reco::PFCandidateCollection >& pfCandidates() const {
197  return pfCandidates_;
198  }
199 
201  std::auto_ptr< reco::PFCandidateCollection> transferElectronCandidates() {
202  return pfElectronCandidates_;
203  }
204 
206  // done this way because the pfElectronExtra is needed later in the code to create the Refs and with an auto_ptr, it would be destroyed
207  std::auto_ptr< reco::PFCandidateElectronExtraCollection> transferElectronExtra() {
208  std::auto_ptr< reco::PFCandidateElectronExtraCollection> result(new reco::PFCandidateElectronExtraCollection);
209  result->insert(result->end(),pfElectronExtra_.begin(),pfElectronExtra_.end());
210  return result;
211  }
212 
213 
215  // done this way because the pfPhotonExtra is needed later in the code to create the Refs and with an auto_ptr, it would be destroyed
216  std::auto_ptr< reco::PFCandidatePhotonExtraCollection> transferPhotonExtra() {
217  std::auto_ptr< reco::PFCandidatePhotonExtraCollection> result(new reco::PFCandidatePhotonExtraCollection);
218  result->insert(result->end(),pfPhotonExtra_.begin(),pfPhotonExtra_.end());
219  return result;
220  }
221 
222 
224  std::auto_ptr< reco::PFCandidateCollection >& transferCleanedCandidates() {
225  return pfCleanedCandidates_;
226  }
227 
229  std::auto_ptr< reco::PFCandidateCollection > transferCandidates() {
231  }
232 
234  boost::shared_ptr<PFEnergyCalibration> thePFEnergyCalibration() {
235  return calibration_;
236  }
237 
238  friend std::ostream& operator<<(std::ostream& out, const PFAlgo& algo);
239 
240  protected:
241 
244  virtual void processBlock( const reco::PFBlockRef& blockref,
245  std::list<reco::PFBlockRef>& hcalBlockRefs,
246  std::list<reco::PFBlockRef>& ecalBlockRefs );
247 
251  unsigned reconstructTrack( const reco::PFBlockElement& elt,bool allowLoose= false);
252 
258 
259  unsigned reconstructCluster( const reco::PFCluster& cluster,
260  double particleEnergy,
261  bool useDirection = false,
262  double particleX=0.,
263  double particleY=0.,
264  double particleZ=0.);
265 
266 
268  // double gammaCalibratedEnergy( double clusterEnergy ) const;
269 
272  // double neutralHadronCalibratedEnergy( double energyHCAL,
273  // double energyECAL=-1) const;
274 
275 
277  double neutralHadronEnergyResolution( double clusterEnergy,
278  double clusterEta ) const;
279 
280 
281  double nSigmaHCAL( double clusterEnergy,
282  double clusterEta ) const;
283 
284  std::auto_ptr< reco::PFCandidateCollection > pfCandidates_;
286  std::auto_ptr< reco::PFCandidateCollection > pfElectronCandidates_;
288  std::auto_ptr< reco::PFCandidateCollection > pfPhotonCandidates_;
289  // the post-HF-cleaned candidates
290  std::auto_ptr< reco::PFCandidateCollection > pfCleanedCandidates_;
291 
296 
298  void associatePSClusters(unsigned iEcal,
299  reco::PFBlockElement::Type psElementType,
300  const reco::PFBlock& block,
302  const reco::PFBlock::LinkData& linkData,
303  std::vector<bool>& active,
304  std::vector<double>& psEne);
305 
306  bool isFromSecInt(const reco::PFBlockElement& eTrack, std::string order) const;
307 
308 
309  // Post HF Cleaning
310  void postCleaning();
311 
312 
313 
314 
315  private:
319  unsigned bi );
320 
323 
325  double nSigmaECAL_;
326 
328  double nSigmaHCAL_;
329 
330  boost::shared_ptr<PFEnergyCalibration> calibration_;
331  boost::shared_ptr<PFEnergyCalibrationHF> thepfEnergyCalibrationHF_;
332  boost::shared_ptr<PFSCEnergyCalibration> thePFSCEnergyCalibration_;
333 
334  bool useHO_;
335  int algo_;
336  bool debug_;
337 
340  std::vector<double> setchi2Values_;
341  double mvaEleCut_;
354  unsigned int nTrackIsoForEgammaSC_;
358 
359 
367 
368 
369  // Option to let PF decide the muon momentum
371 
376 
380 
384  int nVtx_;
385 
389 
391  std::vector<double> muonHCAL_;
392  std::vector<double> muonECAL_;
393  std::vector<double> muonHO_;
394  double nSigmaTRACK_;
395  double ptError_;
396  std::vector<double> factors45_;
397 
398  // Parameters for post HF cleaning
406  double minDeltaMet_;
408 
409  //MIKE -May19th: Add option for the vertices....
412 
414 
415 };
416 
417 
418 #endif
419 
420 
std::auto_ptr< reco::PFCandidateCollection > transferCandidates()
Definition: PFAlgo.h:229
unsigned int nTrackIsoForEgammaSC_
Definition: PFAlgo.h:354
Abstract base class for a PFBlock element (track, cluster...)
double ptError_
Definition: PFAlgo.h:395
bool isFromSecInt(const reco::PFBlockElement &eTrack, std::string order) const
Definition: PFAlgo.cc:3416
bool usePFConversions_
Definition: PFAlgo.h:378
std::vector< double > muonHCAL_
Variables for muons and fakes.
Definition: PFAlgo.h:391
bool postMuonCleaning_
Definition: PFAlgo.h:400
std::auto_ptr< reco::PFCandidateCollection > connect(std::auto_ptr< reco::PFCandidateCollection > &pfCand)
double maxDeltaPhiPt_
Definition: PFAlgo.h:405
void setPFMuonAndFakeParameters(const edm::ParameterSet &pset)
Definition: PFAlgo.cc:302
double maxSignificance_
Definition: PFAlgo.h:403
double sumEtEcalIsoForEgammaSC_endcap_
Definition: PFAlgo.h:349
std::auto_ptr< reco::PFCandidateCollection > pfPhotonCandidates_
the unfiltered photon collection
Definition: PFAlgo.h:288
double mvaEleCut_
Definition: PFAlgo.h:341
double minHFCleaningPt_
Definition: PFAlgo.h:401
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
double coneEcalIsoForEgammaSC_
Definition: PFAlgo.h:350
double minDeltaMet_
Definition: PFAlgo.h:406
double minSignificance_
Definition: PFAlgo.h:402
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
Definition: PFAlgo.h:73
unsigned reconstructCluster(const reco::PFCluster &cluster, double particleEnergy, bool useDirection=false, double particleX=0., double particleY=0., double particleZ=0.)
Definition: PFAlgo.cc:3184
void reconstructParticles(const reco::PFBlockHandle &blockHandle)
Definition: PFAlgo.cc:415
std::vector< double > setchi2Values_
Definition: PFAlgo.h:340
bool useProtectionsForJetMET_
Definition: PFAlgo.h:363
double coneTrackIsoForEgammaSC_
Definition: PFAlgo.h:353
std::auto_ptr< reco::PFCandidateElectronExtraCollection > transferElectronExtra()
Definition: PFAlgo.h:207
double nSigmaHCAL_
number of sigma to judge energy excess in HCAL
Definition: PFAlgo.h:328
std::map< unsigned int, Link > LinkData
Definition: PFBlock.h:46
virtual void processBlock(const reco::PFBlockRef &blockref, std::list< reco::PFBlockRef > &hcalBlockRefs, std::list< reco::PFBlockRef > &ecalBlockRefs)
Definition: PFAlgo.cc:538
void setMuonHandle(const edm::Handle< reco::MuonCollection > &)
Definition: PFAlgo.cc:331
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
const edm::ValueMap< reco::PhotonRef > * valueMapGedPhotons_
Definition: PFAlgo.h:366
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
Definition: PFAlgo.cc:3559
PFCandConnector connector_
Definition: PFAlgo.h:388
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
Definition: PFAlgo.cc:354
double sumEtEcalIsoForEgammaSC_barrel_
Definition: PFAlgo.h:348
PFElectronAlgo * pfele_
Definition: PFAlgo.h:355
std::auto_ptr< reco::PFCandidateCollection > pfCleanedCandidates_
Definition: PFAlgo.h:290
void setPFEleParameters(double mvaEleCut, std::string mvaWeightFileEleID, bool usePFElectrons, const boost::shared_ptr< PFSCEnergyCalibration > &thePFSCEnergyCalibration, const boost::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)
Definition: PFAlgo.cc:99
PFMuonAlgo * pfmu_
Definition: PFAlgo.h:357
void setPFVertexParameters(bool useVertex, const reco::VertexCollection *primaryVertices)
Definition: PFAlgo.cc:372
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
Definition: PFAlgo.cc:3447
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
int nVtx_
Definition: PFAlgo.h:384
bool rejectTracks_Step45_
Definition: PFAlgo.h:375
double minSignificanceReduction_
Definition: PFAlgo.h:404
void setPFPhotonParameters(bool usePFPhoton, std::string mvaWeightFileConvID, double mvaConvCut, bool useReg, std::string X0_Map, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumPtTrackIsoForPhoton, double sumPtTrackIsoSlopeForPhoton)
Definition: PFAlgo.cc:161
std::vector< double > factors45_
Definition: PFAlgo.h:396
bool useHO_
Definition: PFAlgo.h:334
tuple result
Definition: mps_fire.py:84
dictionary elements
int algo_
Definition: PFAlgo.h:335
bool useEGammaSupercluster_
Definition: PFAlgo.h:347
bool usePFNuclearInteractions_
Definition: PFAlgo.h:377
bool postHFCleaning_
Definition: PFAlgo.h:399
void setDebug(bool debug)
Definition: PFAlgo.h:66
void setEGammaCollections(const edm::View< reco::PFCandidate > &pfEgammaCandidates, const edm::ValueMap< reco::GsfElectronRef > &valueMapGedElectrons, const edm::ValueMap< reco::PhotonRef > &valueMapGedPhotons)
Definition: PFAlgo.cc:267
boost::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration()
return the pointer to the calibration function
Definition: PFAlgo.h:234
void setParameters(double nSigmaECAL, double nSigmaHCAL, const boost::shared_ptr< PFEnergyCalibration > &calibration, const boost::shared_ptr< PFEnergyCalibrationHF > &thepfEnergyCalibrationHF)
Definition: PFAlgo.cc:79
Based on a class from : V. Roberfroid, February 2008.
const edm::View< reco::PFCandidate > * pfEgammaCandidates_
Definition: PFAlgo.h:364
bool useEGElectrons_
Definition: PFAlgo.h:346
void associatePSClusters(unsigned iEcal, reco::PFBlockElement::Type psElementType, const reco::PFBlock &block, const edm::OwnVector< reco::PFBlockElement > &elements, const reco::PFBlock::LinkData &linkData, std::vector< bool > &active, std::vector< double > &psEne)
Associate PS clusters to a given ECAL cluster, and return their energy.
Definition: PFAlgo.cc:3361
std::string mvaWeightFileEleID_
Variables for PFElectrons.
Definition: PFAlgo.h:339
std::auto_ptr< reco::PFCandidateCollection > transferElectronCandidates()
Definition: PFAlgo.h:201
bool usePFMuonMomAssign_
Definition: PFAlgo.h:370
PFPhotonAlgo * pfpho_
Definition: PFAlgo.h:356
void setPFPhotonRegWeights(const GBRForest *LCorrForestEB, const GBRForest *LCorrForestEE, const GBRForest *GCorrForestBarrel, const GBRForest *GCorrForestEndcapHr9, const GBRForest *GCorrForestEndcapLr9, const GBRForest *PFEcalResolution)
Definition: PFAlgo.cc:289
reco::Vertex primaryVertex_
Definition: PFAlgo.h:410
double nSigmaHCAL(double clusterEnergy, double clusterEta) const
Definition: PFAlgo.cc:3311
edm::Handle< reco::MuonCollection > muonHandle_
Definition: PFAlgo.h:413
bool usePFSCEleCalib_
Definition: PFAlgo.h:345
std::vector< double > muonECAL_
Definition: PFAlgo.h:392
void setPFMuonAlgo(PFMuonAlgo *algo)
Definition: PFAlgo.h:64
void setPostHFCleaningParameters(bool postHFCleaning, double minHFCleaningPt, double minSignificance, double maxSignificance, double minSignificanceReduction, double maxDeltaPhiPt, double minDeltaMet)
Definition: PFAlgo.cc:337
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:11
PFEGammaFilters * pfegamma_
Definition: PFAlgo.h:362
reco::PFBlockRef createBlockRef(const reco::PFBlockCollection &blocks, unsigned bi)
Definition: PFAlgo.cc:3349
reco::PFCandidatePhotonExtraCollection pfPhotonExtra_
the extra photon collection
Definition: PFAlgo.h:295
void setHOTag(bool ho)
Definition: PFAlgo.h:62
void setCandConnectorParameters(bool bCorrect, bool bCalibPrimary, double dptRel_PrimaryTrack, double dptRel_MergedTrack, double ptErrorSecondary, const std::vector< double > &nuclCalibFactors)
Definition: PFAlgo.h:77
double useBestMuonTrack_
Definition: PFAlgo.h:407
unsigned reconstructTrack(const reco::PFBlockElement &elt, bool allowLoose=false)
Definition: PFAlgo.cc:3109
#define debug
Definition: HDRShower.cc:19
std::vector< double > muonHO_
Definition: PFAlgo.h:393
bool useVertices_
Definition: PFAlgo.h:411
std::vector< reco::PFCandidatePhotonExtra > PFCandidatePhotonExtraCollection
collection of PFCandidatePhotonExtras
double dptRel_DispVtx_
Definition: PFAlgo.h:383
boost::shared_ptr< PFEnergyCalibration > calibration_
Definition: PFAlgo.h:330
list blocks
Definition: gather_cfg.py:90
reco::PFBlockHandle blockHandle_
input block handle (full framework case)
Definition: PFAlgo.h:322
boost::shared_ptr< PFSCEnergyCalibration > thePFSCEnergyCalibration_
Definition: PFAlgo.h:332
std::auto_ptr< reco::PFCandidatePhotonExtraCollection > transferPhotonExtra()
Definition: PFAlgo.h:216
virtual ~PFAlgo()
destructor
Definition: PFAlgo.cc:71
std::auto_ptr< reco::PFCandidateCollection > & transferCleanedCandidates()
Definition: PFAlgo.h:224
boost::shared_ptr< PFEnergyCalibrationHF > thepfEnergyCalibrationHF_
Definition: PFAlgo.h:331
bool rejectTracks_Bad_
Definition: PFAlgo.h:374
PFAlgo()
constructor
Definition: PFAlgo.cc:59
std::auto_ptr< reco::PFCandidateCollection > pfCandidates_
Definition: PFAlgo.h:284
PFMuonAlgo * getPFMuonAlgo()
Definition: PFAlgo.cc:93
bool useEGammaFilters_
Variables for NEW EGAMMA selection.
Definition: PFAlgo.h:361
bool debug_
Definition: PFAlgo.h:336
void setPhotonExtraRef(const edm::OrphanHandle< reco::PFCandidatePhotonExtraCollection > &pf_extrah)
Definition: PFAlgo.cc:3716
bool applyCrackCorrectionsElectrons_
Definition: PFAlgo.h:344
void setParameters(const edm::ParameterSet &iCfgCandConnector)
double sumPtTrackIsoForEgammaSC_endcap_
Definition: PFAlgo.h:352
double nSigmaTRACK_
Definition: PFAlgo.h:394
std::auto_ptr< reco::PFCandidateCollection > pfElectronCandidates_
the unfiltered electron collection
Definition: PFAlgo.h:286
double neutralHadronEnergyResolution(double clusterEnergy, double clusterEta) const
todo: use PFClusterTools for this
Definition: PFAlgo.cc:3296
void postCleaning()
Definition: PFAlgo.cc:3452
std::vector< reco::PFCandidateElectronExtra > PFCandidateElectronExtraCollection
collection of PFCandidateElectronExtras
reco::PFCandidateElectronExtraCollection pfElectronExtra_
the unfiltered electron collection
Definition: PFAlgo.h:293
Definition: PFAlgo.h:52
bool usePFPhotons_
Definition: PFAlgo.h:343
bool usePFDecays_
Definition: PFAlgo.h:379
void setDebug(bool debug)
void setAlgo(int algo)
Definition: PFAlgo.h:63
double sumPtTrackIsoForEgammaSC_barrel_
Definition: PFAlgo.h:351
const std::auto_ptr< reco::PFCandidateCollection > & pfCandidates() const
Definition: PFAlgo.h:196
void setEGammaParameters(bool use_EGammaFilters, std::string ele_iso_path_mvaWeightFile, double ele_iso_pt, double ele_iso_mva_barrel, double ele_iso_mva_endcap, double ele_iso_combIso_barrel, double ele_iso_combIso_endcap, double ele_noniso_mva, unsigned int ele_missinghits, bool useProtectionsForJetMET, const edm::ParameterSet &ele_protectionsForJetMET, double ph_MinEt, double ph_combIso, double ph_HoE, double ph_sietaieta_eb, double ph_sietaieta_ee, const edm::ParameterSet &ph_protectionsForJetMET)
Definition: PFAlgo.cc:212
const edm::ValueMap< reco::GsfElectronRef > * valueMapGedElectrons_
Definition: PFAlgo.h:365
friend std::ostream & operator<<(std::ostream &out, const PFAlgo &algo)
void setElectronExtraRef(const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > &extrah)
Definition: PFAlgo.cc:3664
double nSigmaECAL_
number of sigma to judge energy excess in ECAL
Definition: PFAlgo.h:325
Block of elements.
Definition: PFBlock.h:30
bool usePFElectrons_
Definition: PFAlgo.h:342