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 
26 
27 #include <iostream>
28 
31 
33 
38 class PFMuonAlgo;
39 
41 public:
42  std::vector<unsigned> hcalIs;
43  std::vector<unsigned> hoIs;
44  std::vector<unsigned> ecalIs;
45  std::vector<unsigned> trackIs;
46  std::vector<unsigned> ps1Is;
47  std::vector<unsigned> ps2Is;
48 
49  std::vector<unsigned> hfEmIs;
50  std::vector<unsigned> hfHadIs;
51 };
52 
53 class PFAlgo {
54 public:
56  PFAlgo(double nSigmaECAL,
57  double nSigmaHCAL,
58  double nSigmaHFEM,
59  double nSigmaHFHAD,
60  std::vector<double> resolHF_square,
62  PFEnergyCalibrationHF& thepfEnergyCalibrationHF,
63  const edm::ParameterSet& pset);
64 
65  void setHOTag(bool ho) { useHO_ = ho; }
67 
70  }
71 
73  bool bCalibPrimary,
74  double dptRel_PrimaryTrack,
75  double dptRel_MergedTrack,
76  double ptErrorSecondary,
77  const std::vector<double>& nuclCalibFactors) {
80  }
81 
83 
84  void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET);
85 
87  const edm::ValueMap<reco::GsfElectronRef>& valueMapGedElectrons,
88  const edm::ValueMap<reco::PhotonRef>& valueMapGedPhotons);
89 
90  void setPostHFCleaningParameters(bool postHFCleaning, const edm::ParameterSet& pfHFCleaningParams);
91 
95  bool usePFConversions,
96  bool usePFDecays,
97  double dptRel_DispVtx);
98 
99  //MIKEB : Parameters for the vertices..
101 
102  // FlorianB : Collection of e/g electrons
103  void setEGElectronCollection(const reco::GsfElectronCollection& egelectrons);
104 
106  void reconstructParticles(const reco::PFBlockHandle& blockHandle, PFEGammaFilters const* pfegamma);
107 
110 
113 
116 
117  friend std::ostream& operator<<(std::ostream& out, const PFAlgo& algo);
118 
119 private:
120  void egammaFilters(const reco::PFBlockRef& blockref, std::vector<bool>& active, PFEGammaFilters const* pfegamma);
121  void conversionAlgo(const edm::OwnVector<reco::PFBlockElement>& elements, std::vector<bool>& active);
124  bool isActive,
125  int iElement);
126  bool checkHasDeadHcal(const std::multimap<double, unsigned>& hcalElems, const std::vector<bool>& deadArea);
128  std::multimap<double, unsigned>& ecalElems,
129  std::multimap<double, unsigned>& hcalElems,
130  const std::vector<bool>& active,
131  reco::PFBlock::LinkData& linkData,
132  unsigned int iTrack);
133  bool checkGoodTrackDeadHcal(const reco::TrackRef& trackRef, bool hasDeadHcal);
134  void elementLoop(const reco::PFBlock& block,
135  reco::PFBlock::LinkData& linkData,
137  std::vector<bool>& active,
138  const reco::PFBlockRef& blockref,
139  ElementIndices& inds,
140  std::vector<bool>& deadArea);
143  std::vector<bool>& active,
144  ElementIndices& inds,
145  std::vector<bool>& deadArea,
146  unsigned int iEle);
148  reco::PFBlock::LinkData& linkData,
150  const reco::PFBlockRef& blockref,
151  std::vector<bool>& active,
152  bool goodTrackDeadHcal,
153  bool hasDeadHcal,
154  unsigned int iTrack,
155  std::multimap<double, unsigned>& ecalElems,
156  reco::TrackRef& trackRef);
157 
158  //Looks for a HF-associated element in the block and produces a PFCandidate from it with HF_EM and/or HF_HAD calibrations
160  reco::PFBlock::LinkData& linkData,
162  std::vector<bool>& active,
163  const reco::PFBlockRef& blockref,
164  ElementIndices& inds);
165 
167  reco::PFBlock::LinkData& linkData,
169  std::vector<bool>& active,
170  const reco::PFBlockRef& blockref,
171  ElementIndices& inds,
172  std::vector<bool>& deadArea);
174  reco::PFBlock::LinkData& linkData,
176  std::vector<bool>& active,
177  const reco::PFBlockRef& blockref,
178  ElementIndices& inds,
179  std::vector<bool>& deadArea);
180 
182  reco::PFBlock::LinkData& linkData,
184  std::vector<bool>& active,
185  const reco::PFBlockRef& blockref,
186  ElementIndices& inds,
187  std::vector<bool>& deadArea);
188 
191  void processBlock(const reco::PFBlockRef& blockref,
192  std::list<reco::PFBlockRef>& hcalBlockRefs,
193  std::list<reco::PFBlockRef>& ecalBlockRefs,
194  PFEGammaFilters const* pfegamma);
195 
199  unsigned reconstructTrack(const reco::PFBlockElement& elt, bool allowLoose = false);
200 
206 
207  unsigned reconstructCluster(const reco::PFCluster& cluster,
208  double particleEnergy,
209  bool useDirection = false,
210  double particleX = 0.,
211  double particleY = 0.,
212  double particleZ = 0.);
213 
214  void setHcalDepthInfo(reco::PFCandidate& cand, const reco::PFCluster& cluster) const;
215 
217  double neutralHadronEnergyResolution(double clusterEnergy, double clusterEta) const;
218 
219  double nSigmaHCAL(double clusterEnergy, double clusterEta) const;
220 
221  double hfEnergyResolution(double clusterEnergy) const;
222 
223  double nSigmaHFEM(double clusterEnergy) const;
224  double nSigmaHFHAD(double clusterEnergy) const;
225 
226  std::unique_ptr<reco::PFCandidateCollection> pfCandidates_;
227  // the post-HF-cleaned candidates
229 
231  void associatePSClusters(unsigned iEcal,
232  reco::PFBlockElement::Type psElementType,
233  const reco::PFBlock& block,
235  const reco::PFBlock::LinkData& linkData,
236  std::vector<bool>& active,
237  std::vector<double>& psEne);
238 
239  bool isFromSecInt(const reco::PFBlockElement& eTrack, std::string order) const;
240 
241  // Post HF Cleaning
242  void postCleaning();
243 
245  const double nSigmaECAL_;
246 
248  const double nSigmaHCAL_;
249 
251  const double nSigmaHFEM_;
252  const double nSigmaHFHAD_;
253 
254  // HF resolution
255  const std::vector<double> resolHF_square_;
256 
259 
260  bool useHO_;
261 
262  std::unique_ptr<PFMuonAlgo> pfmu_;
263 
270 
271  // Option to let PF decide the muon momentum
273 
278 
282 
286  int nVtx_;
287 
291 
293  std::vector<double> muonHCAL_;
294  std::vector<double> muonECAL_;
295  std::vector<double> muonHO_;
296  double nSigmaTRACK_;
297  double ptError_;
298  std::vector<double> factors45_;
299 
306 
315 
316  // Parameters for post HF cleaning
324  double minDeltaMet_;
326 
327  //MIKE -May19th: Add option for the vertices....
329  bool useVertices_ = false;
330 
332 
333  // Named constants
334  const double nSigmaEConstHCAL = 100.;
335  const double nSigmaEConstHFEM = 100.;
336  const double nSigmaEConstHFHAD = 100.;
337 };
338 
339 #endif
std::vector< unsigned > ps1Is
Definition: PFAlgo.h:46
bool checkHasDeadHcal(const std::multimap< double, unsigned > &hcalElems, const std::vector< bool > &deadArea)
Definition: PFAlgo.cc:875
Abstract base class for a PFBlock element (track, cluster...)
double ptError_
Definition: PFAlgo.h:297
bool usePFConversions_
Definition: PFAlgo.h:280
float goodTrackDeadHcal_dxy_
Definition: PFAlgo.h:305
std::vector< double > muonHCAL_
Variables for muons and fakes.
Definition: PFAlgo.h:293
bool postMuonCleaning_
Definition: PFAlgo.h:318
reco::PFCandidateCollection & getCleanedCandidates()
Definition: PFAlgo.h:112
double maxDeltaPhiPt_
Definition: PFAlgo.h:323
double maxSignificance_
Definition: PFAlgo.h:321
std::vector< unsigned > hoIs
Definition: PFAlgo.h:43
bool checkGoodTrackDeadHcal(const reco::TrackRef &trackRef, bool hasDeadHcal)
Definition: PFAlgo.cc:902
std::vector< unsigned > ps2Is
Definition: PFAlgo.h:47
const double nSigmaHFEM_
number of sigma to judge energy excess in HF
Definition: PFAlgo.h:251
double minHFCleaningPt_
Definition: PFAlgo.h:319
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
double minDeltaMet_
Definition: PFAlgo.h:324
const double nSigmaHCAL_
number of sigma to judge energy excess in HCAL
Definition: PFAlgo.h:248
double minSignificance_
Definition: PFAlgo.h:320
std::unique_ptr< reco::PFCandidateCollection > pfCandidates_
Definition: PFAlgo.h:226
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
Definition: PFAlgo.h:68
unsigned reconstructCluster(const reco::PFCluster &cluster, double particleEnergy, bool useDirection=false, double particleX=0., double particleY=0., double particleZ=0.)
Definition: PFAlgo.cc:3234
void elementLoop(const reco::PFBlock &block, reco::PFBlock::LinkData &linkData, const edm::OwnVector< reco::PFBlockElement > &elements, std::vector< bool > &active, const reco::PFBlockRef &blockref, ElementIndices &inds, std::vector< bool > &deadArea)
Definition: PFAlgo.cc:995
bool useProtectionsForJetMET_
Definition: PFAlgo.h:266
const std::vector< double > resolHF_square_
Definition: PFAlgo.h:255
float goodPixelTrackDeadHcal_minEta_
Definition: PFAlgo.h:307
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::map< unsigned int, Link > LinkData
Definition: PFBlock.h:39
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
const edm::ValueMap< reco::PhotonRef > * valueMapGedPhotons_
Definition: PFAlgo.h:269
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
Definition: PFAlgo.cc:3607
const double nSigmaEConstHCAL
Definition: PFAlgo.h:334
PFCandConnector connector_
Definition: PFAlgo.h:290
reco::PFCandidateCollection pfCleanedCandidates_
Definition: PFAlgo.h:228
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
Definition: PFAlgo.cc:96
void egammaFilters(const reco::PFBlockRef &blockref, std::vector< bool > &active, PFEGammaFilters const *pfegamma)
Definition: PFAlgo.cc:220
bool isFromSecInt(const reco::PFBlockElement &eTrack, std::string order) const
Definition: PFAlgo.cc:3482
float goodPixelTrackDeadHcal_dxy_
Definition: PFAlgo.h:313
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
int nVtx_
Definition: PFAlgo.h:286
bool rejectTracks_Step45_
Definition: PFAlgo.h:277
double minSignificanceReduction_
Definition: PFAlgo.h:322
std::vector< double > factors45_
Definition: PFAlgo.h:298
double hfEnergyResolution(double clusterEnergy) const
Definition: PFAlgo.cc:3392
bool useHO_
Definition: PFAlgo.h:260
void setPFVertexParameters(bool useVertex, reco::VertexCollection const &primaryVertices)
Definition: PFAlgo.cc:110
std::vector< unsigned > hfHadIs
Definition: PFAlgo.h:50
void setPostHFCleaningParameters(bool postHFCleaning, const edm::ParameterSet &pfHFCleaningParams)
Definition: PFAlgo.cc:86
std::vector< unsigned > hcalIs
Definition: PFAlgo.h:42
bool usePFNuclearInteractions_
Definition: PFAlgo.h:279
const double nSigmaEConstHFEM
Definition: PFAlgo.h:335
bool postHFCleaning_
Definition: PFAlgo.h:317
void setEGammaCollections(const edm::View< reco::PFCandidate > &pfEgammaCandidates, const edm::ValueMap< reco::GsfElectronRef > &valueMapGedElectrons, const edm::ValueMap< reco::PhotonRef > &valueMapGedPhotons)
Definition: PFAlgo.cc:76
Based on a class from : V. Roberfroid, February 2008.
const edm::View< reco::PFCandidate > * pfEgammaCandidates_
Definition: PFAlgo.h:267
void createCandidatesECAL(const reco::PFBlock &block, reco::PFBlock::LinkData &linkData, const edm::OwnVector< reco::PFBlockElement > &elements, std::vector< bool > &active, const reco::PFBlockRef &blockref, ElementIndices &inds, std::vector< bool > &deadArea)
Definition: PFAlgo.cc:3026
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:3439
bool recoTracksNotHCAL(const reco::PFBlock &block, reco::PFBlock::LinkData &linkData, const edm::OwnVector< reco::PFBlockElement > &elements, const reco::PFBlockRef &blockref, std::vector< bool > &active, bool goodTrackDeadHcal, bool hasDeadHcal, unsigned int iTrack, std::multimap< double, unsigned > &ecalElems, reco::TrackRef &trackRef)
Definition: PFAlgo.cc:399
double nSigmaHFEM(double clusterEnergy) const
Definition: PFAlgo.cc:3404
bool usePFMuonMomAssign_
Definition: PFAlgo.h:272
float goodTrackDeadHcal_validFr_
Definition: PFAlgo.h:304
reco::Vertex primaryVertex_
Definition: PFAlgo.h:328
edm::Handle< reco::MuonCollection > muonHandle_
Definition: PFAlgo.h:331
std::vector< double > muonECAL_
Definition: PFAlgo.h:294
PFEnergyCalibration & calibration_
Definition: PFAlgo.h:257
const double nSigmaEConstHFHAD
Definition: PFAlgo.h:336
void setMuonHandle(const edm::Handle< reco::MuonCollection > &muons)
Definition: PFAlgo.h:66
void processBlock(const reco::PFBlockRef &blockref, std::list< reco::PFBlockRef > &hcalBlockRefs, std::list< reco::PFBlockRef > &ecalBlockRefs, PFEGammaFilters const *pfegamma)
Definition: PFAlgo.cc:3075
int goodPixelTrackDeadHcal_maxLost3Hit_
Definition: PFAlgo.h:311
void createCandidatesHCAL(const reco::PFBlock &block, reco::PFBlock::LinkData &linkData, const edm::OwnVector< reco::PFBlockElement > &elements, std::vector< bool > &active, const reco::PFBlockRef &blockref, ElementIndices &inds, std::vector< bool > &deadArea)
Definition: PFAlgo.cc:1700
void setHOTag(bool ho)
Definition: PFAlgo.h:65
void setCandConnectorParameters(bool bCorrect, bool bCalibPrimary, double dptRel_PrimaryTrack, double dptRel_MergedTrack, double ptErrorSecondary, const std::vector< double > &nuclCalibFactors)
Definition: PFAlgo.h:72
double useBestMuonTrack_
Definition: PFAlgo.h:325
PFAlgo(double nSigmaECAL, double nSigmaHCAL, double nSigmaHFEM, double nSigmaHFHAD, std::vector< double > resolHF_square, PFEnergyCalibration &calibration, PFEnergyCalibrationHF &thepfEnergyCalibrationHF, const edm::ParameterSet &pset)
constructor
Definition: PFAlgo.cc:15
void reconstructParticles(const reco::PFBlockHandle &blockHandle, PFEGammaFilters const *pfegamma)
reconstruct particles
Definition: PFAlgo.cc:130
float goodPixelTrackDeadHcal_maxPt_
Definition: PFAlgo.h:308
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
double nSigmaHFHAD(double clusterEnergy) const
Definition: PFAlgo.cc:3409
int decideType(const edm::OwnVector< reco::PFBlockElement > &elements, const reco::PFBlockElement::Type type, std::vector< bool > &active, ElementIndices &inds, std::vector< bool > &deadArea, unsigned int iEle)
Definition: PFAlgo.cc:1199
unsigned reconstructTrack(const reco::PFBlockElement &elt, bool allowLoose=false)
Definition: PFAlgo.cc:3155
int goodTrackDeadHcal_layers_
Definition: PFAlgo.h:303
std::vector< unsigned > hfEmIs
Definition: PFAlgo.h:49
std::vector< double > muonHO_
Definition: PFAlgo.h:295
bool useVertices_
Definition: PFAlgo.h:329
float goodPixelTrackDeadHcal_ptErrRel_
Definition: PFAlgo.h:309
double dptRel_DispVtx_
Definition: PFAlgo.h:285
std::vector< unsigned > ecalIs
Definition: PFAlgo.h:44
double neutralHadronEnergyResolution(double clusterEnergy, double clusterEta) const
todo: use PFClusterTools for this
Definition: PFAlgo.cc:3375
void relinkTrackToHcal(const reco::PFBlock &block, std::multimap< double, unsigned > &ecalElems, std::multimap< double, unsigned > &hcalElems, const std::vector< bool > &active, reco::PFBlock::LinkData &linkData, unsigned int iTrack)
Definition: PFAlgo.cc:941
const double nSigmaECAL_
number of sigma to judge energy excess in ECAL
Definition: PFAlgo.h:245
reco::PFCandidateCollection connect(reco::PFCandidateCollection &pfCand) const
PFEnergyCalibrationHF & thepfEnergyCalibrationHF_
Definition: PFAlgo.h:258
void setHcalDepthInfo(reco::PFCandidate &cand, const reco::PFCluster &cluster) const
Definition: PFAlgo.cc:3345
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
double nSigmaHCAL(double clusterEnergy, double clusterEta) const
Definition: PFAlgo.cc:3385
void conversionAlgo(const edm::OwnVector< reco::PFBlockElement > &elements, std::vector< bool > &active)
Definition: PFAlgo.cc:370
void createCandidatesHF(const reco::PFBlock &block, reco::PFBlock::LinkData &linkData, const edm::OwnVector< reco::PFBlockElement > &elements, std::vector< bool > &active, const reco::PFBlockRef &blockref, ElementIndices &inds)
Definition: PFAlgo.cc:1257
bool rejectTracks_Bad_
Definition: PFAlgo.h:276
reco::PFCandidateCollection makeConnectedCandidates()
Definition: PFAlgo.h:115
PFMuonAlgo * getPFMuonAlgo()
Definition: PFAlgo.cc:66
bool useEGammaFilters_
Variables for NEW EGAMMA selection.
Definition: PFAlgo.h:265
void createCandidatesHCALUnlinked(const reco::PFBlock &block, reco::PFBlock::LinkData &linkData, const edm::OwnVector< reco::PFBlockElement > &elements, std::vector< bool > &active, const reco::PFBlockRef &blockref, ElementIndices &inds, std::vector< bool > &deadArea)
Definition: PFAlgo.cc:2827
float goodTrackDeadHcal_ptErrRel_
Variables for track cleaning in bad HCal areas.
Definition: PFAlgo.h:301
void setParameters(const edm::ParameterSet &iCfgCandConnector)
int goodPixelTrackDeadHcal_maxLost4Hit_
Definition: PFAlgo.h:312
const double nSigmaHFHAD_
Definition: PFAlgo.h:252
float goodPixelTrackDeadHcal_chi2n_
Definition: PFAlgo.h:310
double nSigmaTRACK_
Definition: PFAlgo.h:296
void postCleaning()
Definition: PFAlgo.cc:3511
std::vector< unsigned > trackIs
Definition: PFAlgo.h:45
Definition: PFAlgo.h:53
bool usePFDecays_
Definition: PFAlgo.h:281
std::unique_ptr< PFMuonAlgo > pfmu_
Definition: PFAlgo.h:262
float goodTrackDeadHcal_chi2n_
Definition: PFAlgo.h:302
float goodPixelTrackDeadHcal_dz_
Definition: PFAlgo.h:314
bool checkAndReconstructSecondaryInteraction(const reco::PFBlockRef &blockref, const edm::OwnVector< reco::PFBlockElement > &elements, bool isActive, int iElement)
Definition: PFAlgo.cc:855
void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET)
Definition: PFAlgo.cc:68
const edm::ValueMap< reco::GsfElectronRef > * valueMapGedElectrons_
Definition: PFAlgo.h:268
friend std::ostream & operator<<(std::ostream &out, const PFAlgo &algo)
Block of elements.
Definition: PFBlock.h:26