CMS 3D CMS Logo

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 
9 
13 
14 // next include is necessary for inline functions.
16 
23 
31 
37 
39 
48 class PFMuonAlgo;
49 
50 class PFAlgo {
51 
52  public:
53 
55  PFAlgo(bool debug);
56 
57  void setHOTag(bool ho) { useHO_ = ho;}
58  void setAlgo( int algo ) {algo_ = algo;}
61 
62  void setParameters(double nSigmaECAL,
63  double nSigmaHCAL,
64  const std::shared_ptr<PFEnergyCalibration>& calibration,
65  const std::shared_ptr<PFEnergyCalibrationHF>& thepfEnergyCalibrationHF);
66 
68  connector_.setParameters(iCfgCandConnector);
69  }
70 
72  bool bCalibPrimary,
73  double dptRel_PrimaryTrack,
74  double dptRel_MergedTrack,
75  double ptErrorSecondary,
76  const std::vector<double>& nuclCalibFactors){
77  connector_.setParameters(bCorrect, bCalibPrimary, dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary, nuclCalibFactors);
78  }
79 
80 
82 
83  void setBadHcalTrackParams(const edm::ParameterSet& pset);
84 
86 
87  void setPFEleParameters(double mvaEleCut,
88  std::string mvaWeightFileEleID,
89  bool usePFElectrons,
90  const std::shared_ptr<PFSCEnergyCalibration>& thePFSCEnergyCalibration,
91  const std::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
97  unsigned int nTrackIsoForEgammaSC,
99  bool applyCrackCorrections=false,
100  bool usePFSCEleCalib=true,
101  bool useEGElectrons=false,
102  bool useEGammaSupercluster = true);
103 
104  void setPFPhotonParameters(bool usePFPhoton,
105  std::string mvaWeightFileConvID,
106  double mvaConvCut,
107  bool useReg,
109  const std::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
110  double sumPtTrackIsoForPhoton,
112 
113  void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET);
114 
115 
117  const edm::ValueMap<reco::GsfElectronRef> & valueMapGedElectrons,
118  const edm::ValueMap<reco::PhotonRef> & valueMapGedPhotons);
119 
120 
121 
122  // void setPFPhotonRegWeights(
123  // const GBRForest *LCorrForest,
124  // const GBRForest *GCorrForest,
125  // const GBRForest *ResForest
126 
127  // );
129  const GBRForest *LCorrForestEB,
130  const GBRForest *LCorrForestEE,
131  const GBRForest *GCorrForestBarrel,
132  const GBRForest *GCorrForestEndcapHr9,
133  const GBRForest *GCorrForestEndcapLr9,
134  const GBRForest *PFEcalResolution
135  );
137  double minHFCleaningPt,
138  double minSignificance,
139  double maxSignificance,
141  double maxDeltaPhiPt,
142  double minDeltaMet);
143 
145  bool rejectTracks_Step45,
147  bool usePFConversions,
148  bool usePFDecays,
149  double dptRel_DispVtx);
150 
151  //MIKEB : Parameters for the vertices..
153 
154  // FlorianB : Collection of e/g electrons
155  void setEGElectronCollection(const reco::GsfElectronCollection & egelectrons);
156 
160  void reconstructParticles( const reco::PFBlockHandle& blockHandle, PFEGammaFilters const* pfegamma );
161 
163  void reconstructParticles( const reco::PFBlockCollection& blocks, PFEGammaFilters const* pfegamma );
164 
167 
168  // Post Electron Extra Ref
170 
171  // Post Photon Extra Ref
173 
175  const std::unique_ptr<reco::PFCandidateCollection>& pfCandidates() const {
176  return pfCandidates_;
177  }
178 
180  std::unique_ptr<reco::PFCandidateCollection> transferElectronCandidates() {
182  }
183 
185  // done this way because the pfElectronExtra is needed later in the code to create the Refs and with a unique_ptr, it would be destroyed
186  std::unique_ptr<reco::PFCandidateElectronExtraCollection> transferElectronExtra() {
187  auto result = std::make_unique<reco::PFCandidateElectronExtraCollection>();
188  result->insert(result->end(),pfElectronExtra_.begin(),pfElectronExtra_.end());
189  return result;
190  }
191 
192 
194  // done this way because the pfPhotonExtra is needed later in the code to create the Refs and with a unique_ptr, it would be destroyed
195  std::unique_ptr< reco::PFCandidatePhotonExtraCollection> transferPhotonExtra() {
196  auto result = std::make_unique<reco::PFCandidatePhotonExtraCollection>();
197  result->insert(result->end(),pfPhotonExtra_.begin(),pfPhotonExtra_.end());
198  return result;
199  }
200 
201 
203  std::unique_ptr<reco::PFCandidateCollection> transferCleanedCandidates() {
205  }
206 
210  }
211 
213  std::shared_ptr<PFEnergyCalibration> thePFEnergyCalibration() {
214  return calibration_;
215  }
216 
217  friend std::ostream& operator<<(std::ostream& out, const PFAlgo& algo);
218 
219  private:
220 
223  void processBlock( const reco::PFBlockRef& blockref,
224  std::list<reco::PFBlockRef>& hcalBlockRefs,
225  std::list<reco::PFBlockRef>& ecalBlockRefs, PFEGammaFilters const* pfegamma );
226 
230  unsigned reconstructTrack( const reco::PFBlockElement& elt,bool allowLoose= false);
231 
237 
238  unsigned reconstructCluster( const reco::PFCluster& cluster,
239  double particleEnergy,
240  bool useDirection = false,
241  double particleX=0.,
242  double particleY=0.,
243  double particleZ=0.);
244 
245  void setHcalDepthInfo(reco::PFCandidate & cand, const reco::PFCluster& cluster) const ;
246 
248  // double gammaCalibratedEnergy( double clusterEnergy ) const;
249 
252  // double neutralHadronCalibratedEnergy( double energyHCAL,
253  // double energyECAL=-1) const;
254 
255 
257  double neutralHadronEnergyResolution( double clusterEnergy,
258  double clusterEta ) const;
259 
260 
261  double nSigmaHCAL( double clusterEnergy,
262  double clusterEta ) const;
263 
264  std::unique_ptr<reco::PFCandidateCollection> pfCandidates_;
266  std::unique_ptr<reco::PFCandidateCollection> pfElectronCandidates_;
268  std::unique_ptr<reco::PFCandidateCollection> pfPhotonCandidates_;
269  // the post-HF-cleaned candidates
270  std::unique_ptr<reco::PFCandidateCollection> pfCleanedCandidates_;
271 
276 
278  void associatePSClusters(unsigned iEcal,
279  reco::PFBlockElement::Type psElementType,
280  const reco::PFBlock& block,
282  const reco::PFBlock::LinkData& linkData,
283  std::vector<bool>& active,
284  std::vector<double>& psEne);
285 
286  bool isFromSecInt(const reco::PFBlockElement& eTrack, std::string order) const;
287 
288 
289  // Post HF Cleaning
290  void postCleaning();
291 
295  unsigned bi );
296 
299 
301  double nSigmaECAL_;
302 
304  double nSigmaHCAL_;
305 
306  std::shared_ptr<PFEnergyCalibration> calibration_;
307  std::shared_ptr<PFEnergyCalibrationHF> thepfEnergyCalibrationHF_;
308  std::shared_ptr<PFSCEnergyCalibration> thePFSCEnergyCalibration_;
309 
310  bool useHO_;
311  int algo_;
312  const bool debug_;
313 
316  std::vector<double> setchi2Values_;
317  double mvaEleCut_;
330  unsigned int nTrackIsoForEgammaSC_;
331  std::unique_ptr<PFElectronAlgo> pfele_;
332  std::unique_ptr<PFPhotonAlgo> pfpho_;
334 
335 
342 
343 
344  // Option to let PF decide the muon momentum
346 
351 
355 
359  int nVtx_;
360 
364 
366  std::vector<double> muonHCAL_;
367  std::vector<double> muonECAL_;
368  std::vector<double> muonHO_;
369  double nSigmaTRACK_;
370  double ptError_;
371  std::vector<double> factors45_;
372 
379 
388 
389 
390  // Parameters for post HF cleaning
398  double minDeltaMet_;
400 
401  //MIKE -May19th: Add option for the vertices....
404 
406 
407 };
408 
409 
410 #endif
unsigned int nTrackIsoForEgammaSC_
Definition: PFAlgo.h:330
Abstract base class for a PFBlock element (track, cluster...)
double ptError_
Definition: PFAlgo.h:370
bool isFromSecInt(const reco::PFBlockElement &eTrack, std::string order) const
Definition: PFAlgo.cc:3475
bool usePFConversions_
Definition: PFAlgo.h:353
float goodTrackDeadHcal_dxy_
Definition: PFAlgo.h:378
std::vector< double > muonHCAL_
Variables for muons and fakes.
Definition: PFAlgo.h:366
bool postMuonCleaning_
Definition: PFAlgo.h:392
double maxDeltaPhiPt_
Definition: PFAlgo.h:397
void setPFMuonAndFakeParameters(const edm::ParameterSet &pset)
Definition: PFAlgo.cc:228
PFAlgo(bool debug)
constructor
Definition: PFAlgo.cc:49
double maxSignificance_
Definition: PFAlgo.h:395
double sumEtEcalIsoForEgammaSC_endcap_
Definition: PFAlgo.h:325
double mvaEleCut_
Definition: PFAlgo.h:317
double minHFCleaningPt_
Definition: PFAlgo.h:393
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
double coneEcalIsoForEgammaSC_
Definition: PFAlgo.h:326
double minDeltaMet_
Definition: PFAlgo.h:398
reco::PFCandidateCollection transferCandidates()
Definition: PFAlgo.h:208
std::unique_ptr< reco::PFCandidateElectronExtraCollection > transferElectronExtra()
Definition: PFAlgo.h:186
double minSignificance_
Definition: PFAlgo.h:394
std::unique_ptr< reco::PFCandidateCollection > pfCandidates_
Definition: PFAlgo.h:264
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
Definition: PFAlgo.h:67
unsigned reconstructCluster(const reco::PFCluster &cluster, double particleEnergy, bool useDirection=false, double particleX=0., double particleY=0., double particleZ=0.)
Definition: PFAlgo.cc:3215
const std::unique_ptr< reco::PFCandidateCollection > & pfCandidates() const
Definition: PFAlgo.h:175
std::vector< double > setchi2Values_
Definition: PFAlgo.h:316
bool useProtectionsForJetMET_
Definition: PFAlgo.h:338
std::unique_ptr< PFElectronAlgo > pfele_
Definition: PFAlgo.h:331
double coneTrackIsoForEgammaSC_
Definition: PFAlgo.h:329
float goodPixelTrackDeadHcal_minEta_
Definition: PFAlgo.h:380
double nSigmaHCAL_
number of sigma to judge energy excess in HCAL
Definition: PFAlgo.h:304
std::map< unsigned int, Link > LinkData
Definition: PFBlock.h:46
void setMuonHandle(const edm::Handle< reco::MuonCollection > &)
Definition: PFAlgo.cc:263
std::shared_ptr< PFEnergyCalibrationHF > thepfEnergyCalibrationHF_
Definition: PFAlgo.h:307
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:341
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
Definition: PFAlgo.cc:3614
PFCandConnector connector_
Definition: PFAlgo.h:363
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
Definition: PFAlgo.cc:285
std::shared_ptr< PFEnergyCalibration > calibration_
Definition: PFAlgo.h:306
double sumEtEcalIsoForEgammaSC_barrel_
Definition: PFAlgo.h:324
float goodPixelTrackDeadHcal_dxy_
Definition: PFAlgo.h:386
PFMuonAlgo * pfmu_
Definition: PFAlgo.h:333
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
Definition: PFAlgo.cc:3506
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
int nVtx_
Definition: PFAlgo.h:359
bool rejectTracks_Step45_
Definition: PFAlgo.h:350
double minSignificanceReduction_
Definition: PFAlgo.h:396
std::vector< double > factors45_
Definition: PFAlgo.h:371
bool useHO_
Definition: PFAlgo.h:310
void setPFVertexParameters(bool useVertex, reco::VertexCollection const &primaryVertices)
Definition: PFAlgo.cc:302
int algo_
Definition: PFAlgo.h:311
bool useEGammaSupercluster_
Definition: PFAlgo.h:323
std::unique_ptr< reco::PFCandidateCollection > pfCleanedCandidates_
Definition: PFAlgo.h:270
std::unique_ptr< PFPhotonAlgo > pfpho_
Definition: PFAlgo.h:332
bool usePFNuclearInteractions_
Definition: PFAlgo.h:352
bool postHFCleaning_
Definition: PFAlgo.h:391
void setEGammaCollections(const edm::View< reco::PFCandidate > &pfEgammaCandidates, const edm::ValueMap< reco::GsfElectronRef > &valueMapGedElectrons, const edm::ValueMap< reco::PhotonRef > &valueMapGedPhotons)
Definition: PFAlgo.cc:204
void setBadHcalTrackParams(const edm::ParameterSet &pset)
Definition: PFAlgo.cc:244
Based on a class from : V. Roberfroid, February 2008.
const edm::View< reco::PFCandidate > * pfEgammaCandidates_
Definition: PFAlgo.h:339
std::unique_ptr< reco::PFCandidateCollection > transferCleanedCandidates()
Definition: PFAlgo.h:203
bool useEGElectrons_
Definition: PFAlgo.h:322
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:3421
std::unique_ptr< reco::PFCandidateCollection > transferElectronCandidates()
Definition: PFAlgo.h:180
std::string mvaWeightFileEleID_
Variables for PFElectrons.
Definition: PFAlgo.h:315
void setPFEleParameters(double mvaEleCut, std::string mvaWeightFileEleID, bool usePFElectrons, const std::shared_ptr< PFSCEnergyCalibration > &thePFSCEnergyCalibration, const std::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumEtEcalIsoForEgammaSC_barrel, double sumEtEcalIsoForEgammaSC_endcap, double coneEcalIsoForEgammaSC, double sumPtTrackIsoForEgammaSC_barrel, double sumPtTrackIsoForEgammaSC_endcap, unsigned int nTrackIsoForEgammaSC, double coneTrackIsoForEgammaSC, bool applyCrackCorrections=false, bool usePFSCEleCalib=true, bool useEGElectrons=false, bool useEGammaSupercluster=true)
Definition: PFAlgo.cc:82
bool usePFMuonMomAssign_
Definition: PFAlgo.h:345
float goodTrackDeadHcal_validFr_
Definition: PFAlgo.h:377
void setPFPhotonRegWeights(const GBRForest *LCorrForestEB, const GBRForest *LCorrForestEE, const GBRForest *GCorrForestBarrel, const GBRForest *GCorrForestEndcapHr9, const GBRForest *GCorrForestEndcapLr9, const GBRForest *PFEcalResolution)
Definition: PFAlgo.cc:215
reco::Vertex primaryVertex_
Definition: PFAlgo.h:402
double nSigmaHCAL(double clusterEnergy, double clusterEta) const
Definition: PFAlgo.cc:3375
edm::Handle< reco::MuonCollection > muonHandle_
Definition: PFAlgo.h:405
bool usePFSCEleCalib_
Definition: PFAlgo.h:321
std::vector< double > muonECAL_
Definition: PFAlgo.h:367
reco::PFCandidateCollection connect(reco::PFCandidateCollection &pfCand) const
std::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration()
return the pointer to the calibration function
Definition: PFAlgo.h:213
void setParameters(double nSigmaECAL, double nSigmaHCAL, const std::shared_ptr< PFEnergyCalibration > &calibration, const std::shared_ptr< PFEnergyCalibrationHF > &thepfEnergyCalibrationHF)
Definition: PFAlgo.cc:62
void setPFMuonAlgo(PFMuonAlgo *algo)
Definition: PFAlgo.h:59
void setPostHFCleaningParameters(bool postHFCleaning, double minHFCleaningPt, double minSignificance, double maxSignificance, double minSignificanceReduction, double maxDeltaPhiPt, double minDeltaMet)
Definition: PFAlgo.cc:268
void setPFPhotonParameters(bool usePFPhoton, std::string mvaWeightFileConvID, double mvaConvCut, bool useReg, std::string X0_Map, const std::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumPtTrackIsoForPhoton, double sumPtTrackIsoSlopeForPhoton)
Definition: PFAlgo.cc:144
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:11
void processBlock(const reco::PFBlockRef &blockref, std::list< reco::PFBlockRef > &hcalBlockRefs, std::list< reco::PFBlockRef > &ecalBlockRefs, PFEGammaFilters const *pfegamma)
Definition: PFAlgo.cc:465
int goodPixelTrackDeadHcal_maxLost3Hit_
Definition: PFAlgo.h:384
std::shared_ptr< PFSCEnergyCalibration > thePFSCEnergyCalibration_
Definition: PFAlgo.h:308
reco::PFBlockRef createBlockRef(const reco::PFBlockCollection &blocks, unsigned bi)
Definition: PFAlgo.cc:3409
reco::PFCandidatePhotonExtraCollection pfPhotonExtra_
the extra photon collection
Definition: PFAlgo.h:275
void setHOTag(bool ho)
Definition: PFAlgo.h:57
void setCandConnectorParameters(bool bCorrect, bool bCalibPrimary, double dptRel_PrimaryTrack, double dptRel_MergedTrack, double ptErrorSecondary, const std::vector< double > &nuclCalibFactors)
Definition: PFAlgo.h:71
double useBestMuonTrack_
Definition: PFAlgo.h:399
std::unique_ptr< reco::PFCandidateCollection > pfPhotonCandidates_
the unfiltered photon collection
Definition: PFAlgo.h:268
void reconstructParticles(const reco::PFBlockHandle &blockHandle, PFEGammaFilters const *pfegamma)
Definition: PFAlgo.cc:344
float goodPixelTrackDeadHcal_maxPt_
Definition: PFAlgo.h:381
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::unique_ptr< reco::PFCandidatePhotonExtraCollection > transferPhotonExtra()
Definition: PFAlgo.h:195
unsigned reconstructTrack(const reco::PFBlockElement &elt, bool allowLoose=false)
Definition: PFAlgo.cc:3136
#define debug
Definition: HDRShower.cc:19
int goodTrackDeadHcal_layers_
Definition: PFAlgo.h:376
std::vector< double > muonHO_
Definition: PFAlgo.h:368
bool useVertices_
Definition: PFAlgo.h:403
primaryVertices
Definition: jets_cff.py:27
float goodPixelTrackDeadHcal_ptErrRel_
Definition: PFAlgo.h:382
std::vector< reco::PFCandidatePhotonExtra > PFCandidatePhotonExtraCollection
collection of PFCandidatePhotonExtras
double dptRel_DispVtx_
Definition: PFAlgo.h:358
reco::PFBlockHandle blockHandle_
input block handle (full framework case)
Definition: PFAlgo.h:298
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
bool rejectTracks_Bad_
Definition: PFAlgo.h:349
PFMuonAlgo * getPFMuonAlgo()
Definition: PFAlgo.cc:76
bool useEGammaFilters_
Variables for NEW EGAMMA selection.
Definition: PFAlgo.h:337
void setPhotonExtraRef(const edm::OrphanHandle< reco::PFCandidatePhotonExtraCollection > &pf_extrah)
Definition: PFAlgo.cc:3769
bool applyCrackCorrectionsElectrons_
Definition: PFAlgo.h:320
float goodTrackDeadHcal_ptErrRel_
Variables for track cleaning in bad HCal areas.
Definition: PFAlgo.h:374
void setParameters(const edm::ParameterSet &iCfgCandConnector)
double sumPtTrackIsoForEgammaSC_endcap_
Definition: PFAlgo.h:328
std::unique_ptr< reco::PFCandidateCollection > pfElectronCandidates_
the unfiltered electron collection
Definition: PFAlgo.h:266
int goodPixelTrackDeadHcal_maxLost4Hit_
Definition: PFAlgo.h:385
float goodPixelTrackDeadHcal_chi2n_
Definition: PFAlgo.h:383
const bool debug_
Definition: PFAlgo.h:312
double nSigmaTRACK_
Definition: PFAlgo.h:369
double neutralHadronEnergyResolution(double clusterEnergy, double clusterEta) const
todo: use PFClusterTools for this
Definition: PFAlgo.cc:3360
void postCleaning()
Definition: PFAlgo.cc:3511
std::vector< reco::PFCandidateElectronExtra > PFCandidateElectronExtraCollection
collection of PFCandidateElectronExtras
reco::PFCandidateElectronExtraCollection pfElectronExtra_
the unfiltered electron collection
Definition: PFAlgo.h:273
Definition: PFAlgo.h:50
bool usePFPhotons_
Definition: PFAlgo.h:319
bool usePFDecays_
Definition: PFAlgo.h:354
void setAlgo(int algo)
Definition: PFAlgo.h:58
float goodTrackDeadHcal_chi2n_
Definition: PFAlgo.h:375
double sumPtTrackIsoForEgammaSC_barrel_
Definition: PFAlgo.h:327
float goodPixelTrackDeadHcal_dz_
Definition: PFAlgo.h:387
def move(src, dest)
Definition: eostools.py:511
void setHcalDepthInfo(reco::PFCandidate &cand, const reco::PFCluster &cluster) const
Definition: PFAlgo.cc:3329
void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET)
Definition: PFAlgo.cc:195
const edm::ValueMap< reco::GsfElectronRef > * valueMapGedElectrons_
Definition: PFAlgo.h:340
friend std::ostream & operator<<(std::ostream &out, const PFAlgo &algo)
void setElectronExtraRef(const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > &extrah)
Definition: PFAlgo.cc:3718
double nSigmaECAL_
number of sigma to judge energy excess in ECAL
Definition: PFAlgo.h:301
Block of elements.
Definition: PFBlock.h:30
bool usePFElectrons_
Definition: PFAlgo.h:318