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,
61  PFEnergyCalibration& calibration,
62  PFEnergyCalibrationHF& thepfEnergyCalibrationHF,
63  const edm::ParameterSet& pset);
64 
65  void setHOTag(bool ho) { useHO_ = ho; }
66  void setMuonHandle(const edm::Handle<reco::MuonCollection>&);
67 
69  connector_.setParameters(iCfgCandConnector);
70  }
71 
73  bool bCalibPrimary,
74  double dptRel_PrimaryTrack,
75  double dptRel_MergedTrack,
76  double ptErrorSecondary,
77  const std::vector<double>& nuclCalibFactors) {
78  connector_.setParameters(
79  bCorrect, bCalibPrimary, dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary, nuclCalibFactors);
80  }
81 
82  PFMuonAlgo* getPFMuonAlgo();
83 
84  void setEGammaParameters(bool use_EGammaFilters, bool useProtectionsForJetMET);
85 
86  void setEGammaCollections(const edm::View<reco::PFCandidate>& pfEgammaCandidates,
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 
92  void setDisplacedVerticesParameters(bool rejectTracks_Bad,
95  bool usePFConversions,
96  bool usePFDecays,
97  double dptRel_DispVtx);
98 
99  //MIKEB : Parameters for the vertices..
100  void setPFVertexParameters(bool useVertex, reco::VertexCollection const& primaryVertices);
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 
109  void checkCleaning(const reco::PFRecHitCollection& cleanedHF);
110 
112  reco::PFCandidateCollection& getCleanedCandidates() { return pfCleanedCandidates_; }
113 
115  reco::PFCandidateCollection makeConnectedCandidates() { return connector_.connect(*pfCandidates_); }
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);
122  bool checkAndReconstructSecondaryInteraction(const reco::PFBlockRef& blockref,
123  const edm::OwnVector<reco::PFBlockElement>& elements,
124  bool isActive,
125  int iElement);
126  bool checkHasDeadHcal(const std::multimap<double, unsigned>& hcalElems, const std::vector<bool>& deadArea);
127  void relinkTrackToHcal(const reco::PFBlock& block,
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,
136  const edm::OwnVector<reco::PFBlockElement>& elements,
137  std::vector<bool>& active,
138  const reco::PFBlockRef& blockref,
139  ElementIndices& inds,
140  std::vector<bool>& deadArea);
141  int decideType(const edm::OwnVector<reco::PFBlockElement>& elements,
143  std::vector<bool>& active,
144  ElementIndices& inds,
145  std::vector<bool>& deadArea,
146  unsigned int iEle);
147  bool recoTracksNotHCAL(const reco::PFBlock& block,
148  reco::PFBlock::LinkData& linkData,
149  const edm::OwnVector<reco::PFBlockElement>& elements,
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
159  void createCandidatesHF(const reco::PFBlock& block,
160  reco::PFBlock::LinkData& linkData,
161  const edm::OwnVector<reco::PFBlockElement>& elements,
162  std::vector<bool>& active,
163  const reco::PFBlockRef& blockref,
164  ElementIndices& inds);
165 
166  void createCandidatesHCAL(const reco::PFBlock& block,
167  reco::PFBlock::LinkData& linkData,
168  const edm::OwnVector<reco::PFBlockElement>& elements,
169  std::vector<bool>& active,
170  const reco::PFBlockRef& blockref,
171  ElementIndices& inds,
172  std::vector<bool>& deadArea);
173  void createCandidatesHCALUnlinked(const reco::PFBlock& block,
174  reco::PFBlock::LinkData& linkData,
175  const edm::OwnVector<reco::PFBlockElement>& elements,
176  std::vector<bool>& active,
177  const reco::PFBlockRef& blockref,
178  ElementIndices& inds,
179  std::vector<bool>& deadArea);
180 
181  void createCandidatesECAL(const reco::PFBlock& block,
182  reco::PFBlock::LinkData& linkData,
183  const edm::OwnVector<reco::PFBlockElement>& elements,
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,
234  const edm::OwnVector<reco::PFBlockElement>& elements,
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
type
Definition: HCALResponse.h:21
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
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:46
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
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
PFCandConnector connector_
Definition: PFAlgo.h:290
reco::PFCandidateCollection pfCleanedCandidates_
Definition: PFAlgo.h:228
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
float goodPixelTrackDeadHcal_dxy_
Definition: PFAlgo.h:313
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
bool useHO_
Definition: PFAlgo.h:260
std::vector< unsigned > hfHadIs
Definition: PFAlgo.h:50
std::vector< unsigned > hcalIs
Definition: PFAlgo.h:42
bool usePFNuclearInteractions_
Definition: PFAlgo.h:279
bool postHFCleaning_
Definition: PFAlgo.h:317
Based on a class from : V. Roberfroid, February 2008.
const edm::View< reco::PFCandidate > * pfEgammaCandidates_
Definition: PFAlgo.h:267
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
int goodPixelTrackDeadHcal_maxLost3Hit_
Definition: PFAlgo.h:311
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
float goodPixelTrackDeadHcal_maxPt_
Definition: PFAlgo.h:308
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
int goodTrackDeadHcal_layers_
Definition: PFAlgo.h:303
std::vector< unsigned > hfEmIs
Definition: PFAlgo.h:49
std::vector< double > muonHO_
Definition: PFAlgo.h:295
float goodPixelTrackDeadHcal_ptErrRel_
Definition: PFAlgo.h:309
double dptRel_DispVtx_
Definition: PFAlgo.h:285
std::vector< unsigned > ecalIs
Definition: PFAlgo.h:44
const double nSigmaECAL_
number of sigma to judge energy excess in ECAL
Definition: PFAlgo.h:245
PFEnergyCalibrationHF & thepfEnergyCalibrationHF_
Definition: PFAlgo.h:258
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
bool rejectTracks_Bad_
Definition: PFAlgo.h:276
reco::PFCandidateCollection makeConnectedCandidates()
Definition: PFAlgo.h:115
bool useEGammaFilters_
Variables for NEW EGAMMA selection.
Definition: PFAlgo.h:265
float goodTrackDeadHcal_ptErrRel_
Variables for track cleaning in bad HCal areas.
Definition: PFAlgo.h:301
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
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
const edm::ValueMap< reco::GsfElectronRef > * valueMapGedElectrons_
Definition: PFAlgo.h:268
Block of elements.
Definition: PFBlock.h:26