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 
35 
37 
46 class PFElectronAlgo;
47 class PFPhotonAlgo;
48 class PFMuonAlgo;
49 
50 class PFAlgo {
51 
52  public:
53 
55  PFAlgo();
56 
58  virtual ~PFAlgo();
59 
60  void setHOTag(bool ho) { useHO_ = ho;}
61  void setAlgo( int algo ) {algo_ = algo;}
62  void setPFMuonAlgo(PFMuonAlgo* algo) {pfmu_ =algo;}
65 
66  void setParameters(double nSigmaECAL,
67  double nSigmaHCAL,
68  const boost::shared_ptr<PFEnergyCalibration>& calibration,
69  const boost::shared_ptr<PFEnergyCalibrationHF>& thepfEnergyCalibrationHF);
70 
71  void setCandConnectorParameters( const edm::ParameterSet& iCfgCandConnector ){
72  connector_.setParameters(iCfgCandConnector);
73  }
74 
75  void setCandConnectorParameters(bool bCorrect,
76  bool bCalibPrimary,
77  double dptRel_PrimaryTrack,
78  double dptRel_MergedTrack,
79  double ptErrorSecondary,
80  std::vector<double> nuclCalibFactors){
81  connector_.setParameters(bCorrect, bCalibPrimary, dptRel_PrimaryTrack, dptRel_MergedTrack, ptErrorSecondary, nuclCalibFactors);
82  }
83 
84 
86 
88 
89  void setPFEleParameters(double mvaEleCut,
90  std::string mvaWeightFileEleID,
91  bool usePFElectrons,
92  const boost::shared_ptr<PFSCEnergyCalibration>& thePFSCEnergyCalibration,
93  const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
94  double sumEtEcalIsoForEgammaSC_barrel,
95  double sumEtEcalIsoForEgammaSC_endcap,
96  double coneEcalIsoForEgammaSC,
97  double sumPtTrackIsoForEgammaSC_barrel,
98  double sumPtTrackIsoForEgammaSC_endcap,
99  unsigned int nTrackIsoForEgammaSC,
100  double coneTrackIsoForEgammaSC,
101  bool applyCrackCorrections=false,
102  bool usePFSCEleCalib=true,
103  bool useEGElectrons=false,
104  bool useEGammaSupercluster = true);
105 
106  void setPFPhotonParameters(bool usePFPhoton,
107  std::string mvaWeightFileConvID,
108  double mvaConvCut,
109  bool useReg,
110  std::string X0_Map,
111  const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
112  double sumPtTrackIsoForPhoton,
113  double sumPtTrackIsoSlopeForPhoton
114 );
115 
116  // void setPFPhotonRegWeights(
117  // const GBRForest *LCorrForest,
118  // const GBRForest *GCorrForest,
119  // const GBRForest *ResForest
120 
121  // );
123  const GBRForest *LCorrForestEB,
124  const GBRForest *LCorrForestEE,
125  const GBRForest *GCorrForestBarrel,
126  const GBRForest *GCorrForestEndcapHr9,
127  const GBRForest *GCorrForestEndcapLr9,
128  const GBRForest *PFEcalResolution
129  );
130  void setPostHFCleaningParameters(bool postHFCleaning,
131  double minHFCleaningPt,
132  double minSignificance,
133  double maxSignificance,
134  double minSignificanceReduction,
135  double maxDeltaPhiPt,
136  double minDeltaMet);
137 
138  void setDisplacedVerticesParameters(bool rejectTracks_Bad,
139  bool rejectTracks_Step45,
140  bool usePFNuclearInteractions,
141  bool usePFConversions,
142  bool usePFDecays,
143  double dptRel_DispVtx);
144 
145  //MIKEB : Parameters for the vertices..
146  void setPFVertexParameters(bool useVertex,
147  const reco::VertexCollection* primaryVertices);
148 
149  // FlorianB : Collection of e/g electrons
150  void setEGElectronCollection(const reco::GsfElectronCollection & egelectrons);
151 
155  void reconstructParticles( const reco::PFBlockHandle& blockHandle );
156 
158  virtual void reconstructParticles( const reco::PFBlockCollection& blocks );
159 
161  void checkCleaning( const reco::PFRecHitCollection& cleanedHF );
162 
163  // Post Electron Extra Ref
165 
166  // Post Photon Extra Ref
168 
170  const std::auto_ptr< reco::PFCandidateCollection >& pfCandidates() const {
171  return pfCandidates_;
172  }
173 
175  std::auto_ptr< reco::PFCandidateCollection> transferElectronCandidates() {
176  return pfElectronCandidates_;
177  }
178 
180  // 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
181  std::auto_ptr< reco::PFCandidateElectronExtraCollection> transferElectronExtra() {
182  std::auto_ptr< reco::PFCandidateElectronExtraCollection> result(new reco::PFCandidateElectronExtraCollection);
183  result->insert(result->end(),pfElectronExtra_.begin(),pfElectronExtra_.end());
184  return result;
185  }
186 
187 
189  // 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
190  std::auto_ptr< reco::PFCandidatePhotonExtraCollection> transferPhotonExtra() {
191  std::auto_ptr< reco::PFCandidatePhotonExtraCollection> result(new reco::PFCandidatePhotonExtraCollection);
192  result->insert(result->end(),pfPhotonExtra_.begin(),pfPhotonExtra_.end());
193  return result;
194  }
195 
196 
198  std::auto_ptr< reco::PFCandidateCollection >& transferCleanedCandidates() {
199  return pfCleanedCandidates_;
200  }
201 
203  std::auto_ptr< reco::PFCandidateCollection > transferCandidates() {
205  }
206 
208  boost::shared_ptr<PFEnergyCalibration> thePFEnergyCalibration() {
209  return calibration_;
210  }
211 
212  friend std::ostream& operator<<(std::ostream& out, const PFAlgo& algo);
213 
214  protected:
215 
218  virtual void processBlock( const reco::PFBlockRef& blockref,
219  std::list<reco::PFBlockRef>& hcalBlockRefs,
220  std::list<reco::PFBlockRef>& ecalBlockRefs );
221 
225  unsigned reconstructTrack( const reco::PFBlockElement& elt,bool allowLoose= false);
226 
232 
233  unsigned reconstructCluster( const reco::PFCluster& cluster,
234  double particleEnergy,
235  bool useDirection = false,
236  double particleX=0.,
237  double particleY=0.,
238  double particleZ=0.);
239 
240 
242  // double gammaCalibratedEnergy( double clusterEnergy ) const;
243 
246  // double neutralHadronCalibratedEnergy( double energyHCAL,
247  // double energyECAL=-1) const;
248 
249 
251  double neutralHadronEnergyResolution( double clusterEnergy,
252  double clusterEta ) const;
253 
254 
255  double nSigmaHCAL( double clusterEnergy,
256  double clusterEta ) const;
257 
258  std::auto_ptr< reco::PFCandidateCollection > pfCandidates_;
260  std::auto_ptr< reco::PFCandidateCollection > pfElectronCandidates_;
262  std::auto_ptr< reco::PFCandidateCollection > pfPhotonCandidates_;
263  // the post-HF-cleaned candidates
264  std::auto_ptr< reco::PFCandidateCollection > pfCleanedCandidates_;
265 
270 
272  void associatePSClusters(unsigned iEcal,
273  reco::PFBlockElement::Type psElementType,
274  const reco::PFBlock& block,
276  const reco::PFBlock::LinkData& linkData,
277  std::vector<bool>& active,
278  std::vector<double>& psEne);
279 
280  bool isFromSecInt(const reco::PFBlockElement& eTrack, std::string order) const;
281 
282 
283  // Post HF Cleaning
284  void postCleaning();
285 
286 
287 
288 
289  private:
293  unsigned bi );
294 
297 
299  double nSigmaECAL_;
300 
302  double nSigmaHCAL_;
303 
304  boost::shared_ptr<PFEnergyCalibration> calibration_;
305  boost::shared_ptr<PFEnergyCalibrationHF> thepfEnergyCalibrationHF_;
306  boost::shared_ptr<PFSCEnergyCalibration> thePFSCEnergyCalibration_;
307 
308  bool useHO_;
309  int algo_;
310  bool debug_;
311 
314  std::vector<double> setchi2Values_;
315  double mvaEleCut_;
328  unsigned int nTrackIsoForEgammaSC_;
332 
333  // Option to let PF decide the muon momentum
335 
340 
344 
348 
349 
353 
355  std::vector<double> muonHCAL_;
356  std::vector<double> muonECAL_;
357  std::vector<double> muonHO_;
358  double nSigmaTRACK_;
359  double ptError_;
360  std::vector<double> factors45_;
361 
362  // Parameters for post HF cleaning
370  double minDeltaMet_;
372 
373  //MIKE -May19th: Add option for the vertices....
376 
378 
379 };
380 
381 
382 #endif
383 
384 
std::auto_ptr< reco::PFCandidateCollection > transferCandidates()
Definition: PFAlgo.h:203
unsigned int nTrackIsoForEgammaSC_
Definition: PFAlgo.h:328
Abstract base class for a PFBlock element (track, cluster...)
double ptError_
Definition: PFAlgo.h:359
bool isFromSecInt(const reco::PFBlockElement &eTrack, std::string order) const
Definition: PFAlgo.cc:3222
bool usePFConversions_
Definition: PFAlgo.h:342
std::vector< double > muonHCAL_
Variables for muons and fakes.
Definition: PFAlgo.h:355
bool postMuonCleaning_
Definition: PFAlgo.h:364
std::auto_ptr< reco::PFCandidateCollection > connect(std::auto_ptr< reco::PFCandidateCollection > &pfCand)
double maxDeltaPhiPt_
Definition: PFAlgo.h:369
void setPFMuonAndFakeParameters(const edm::ParameterSet &pset)
Definition: PFAlgo.cc:230
double maxSignificance_
Definition: PFAlgo.h:367
double sumEtEcalIsoForEgammaSC_endcap_
Definition: PFAlgo.h:323
std::auto_ptr< reco::PFCandidateCollection > pfPhotonCandidates_
the unfiltered photon collection
Definition: PFAlgo.h:262
double mvaEleCut_
Definition: PFAlgo.h:315
double minHFCleaningPt_
Definition: PFAlgo.h:365
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
double coneEcalIsoForEgammaSC_
Definition: PFAlgo.h:324
double minDeltaMet_
Definition: PFAlgo.h:370
double minSignificance_
Definition: PFAlgo.h:366
void setCandConnectorParameters(const edm::ParameterSet &iCfgCandConnector)
Definition: PFAlgo.h:71
unsigned reconstructCluster(const reco::PFCluster &cluster, double particleEnergy, bool useDirection=false, double particleX=0., double particleY=0., double particleZ=0.)
Definition: PFAlgo.cc:2990
void reconstructParticles(const reco::PFBlockHandle &blockHandle)
Definition: PFAlgo.cc:343
std::vector< double > setchi2Values_
Definition: PFAlgo.h:314
double coneTrackIsoForEgammaSC_
Definition: PFAlgo.h:327
std::auto_ptr< reco::PFCandidateElectronExtraCollection > transferElectronExtra()
Definition: PFAlgo.h:181
double nSigmaHCAL_
number of sigma to judge energy excess in HCAL
Definition: PFAlgo.h:302
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:466
void setMuonHandle(const edm::Handle< reco::MuonCollection > &)
Definition: PFAlgo.cc:259
list elements
Definition: asciidump.py:414
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
void checkCleaning(const reco::PFRecHitCollection &cleanedHF)
Check HF Cleaning.
Definition: PFAlgo.cc:3365
PFCandConnector connector_
Definition: PFAlgo.h:352
void setDisplacedVerticesParameters(bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
Definition: PFAlgo.cc:282
double sumEtEcalIsoForEgammaSC_barrel_
Definition: PFAlgo.h:322
PFElectronAlgo * pfele_
Definition: PFAlgo.h:329
std::auto_ptr< reco::PFCandidateCollection > pfCleanedCandidates_
Definition: PFAlgo.h:264
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:95
PFMuonAlgo * pfmu_
Definition: PFAlgo.h:331
void setPFVertexParameters(bool useVertex, const reco::VertexCollection *primaryVertices)
Definition: PFAlgo.cc:300
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
Definition: PFAlgo.cc:3253
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
bool rejectTracks_Step45_
Definition: PFAlgo.h:339
double minSignificanceReduction_
Definition: PFAlgo.h:368
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:157
std::vector< double > factors45_
Definition: PFAlgo.h:360
bool useHO_
Definition: PFAlgo.h:308
int algo_
Definition: PFAlgo.h:309
bool useEGammaSupercluster_
Definition: PFAlgo.h:321
bool usePFNuclearInteractions_
Definition: PFAlgo.h:341
bool postHFCleaning_
Definition: PFAlgo.h:363
void setDebug(bool debug)
Definition: PFAlgo.h:64
boost::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration()
return the pointer to the calibration function
Definition: PFAlgo.h:208
void setParameters(double nSigmaECAL, double nSigmaHCAL, const boost::shared_ptr< PFEnergyCalibration > &calibration, const boost::shared_ptr< PFEnergyCalibrationHF > &thepfEnergyCalibrationHF)
Definition: PFAlgo.cc:75
Based on a class from : V. Roberfroid, February 2008.
bool useEGElectrons_
Definition: PFAlgo.h:320
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:3167
std::string mvaWeightFileEleID_
Variables for PFElectrons.
Definition: PFAlgo.h:313
tuple result
Definition: query.py:137
std::auto_ptr< reco::PFCandidateCollection > transferElectronCandidates()
Definition: PFAlgo.h:175
bool usePFMuonMomAssign_
Definition: PFAlgo.h:334
PFPhotonAlgo * pfpho_
Definition: PFAlgo.h:330
void setPFPhotonRegWeights(const GBRForest *LCorrForestEB, const GBRForest *LCorrForestEE, const GBRForest *GCorrForestBarrel, const GBRForest *GCorrForestEndcapHr9, const GBRForest *GCorrForestEndcapLr9, const GBRForest *PFEcalResolution)
Definition: PFAlgo.cc:217
reco::Vertex primaryVertex_
Definition: PFAlgo.h:374
double nSigmaHCAL(double clusterEnergy, double clusterEta) const
Definition: PFAlgo.cc:3117
edm::Handle< reco::MuonCollection > muonHandle_
Definition: PFAlgo.h:377
bool usePFSCEleCalib_
Definition: PFAlgo.h:319
std::vector< double > muonECAL_
Definition: PFAlgo.h:356
void setPFMuonAlgo(PFMuonAlgo *algo)
Definition: PFAlgo.h:62
void setPostHFCleaningParameters(bool postHFCleaning, double minHFCleaningPt, double minSignificance, double maxSignificance, double minSignificanceReduction, double maxDeltaPhiPt, double minDeltaMet)
Definition: PFAlgo.cc:265
block
Formating index page&#39;s pieces.
Definition: Association.py:232
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:11
reco::PFBlockRef createBlockRef(const reco::PFBlockCollection &blocks, unsigned bi)
Definition: PFAlgo.cc:3155
reco::PFCandidatePhotonExtraCollection pfPhotonExtra_
the extra photon collection
Definition: PFAlgo.h:269
void setHOTag(bool ho)
Definition: PFAlgo.h:60
double useBestMuonTrack_
Definition: PFAlgo.h:371
tuple out
Definition: dbtoconf.py:99
unsigned reconstructTrack(const reco::PFBlockElement &elt, bool allowLoose=false)
Definition: PFAlgo.cc:2916
std::vector< double > muonHO_
Definition: PFAlgo.h:357
bool useVertices_
Definition: PFAlgo.h:375
std::vector< reco::PFCandidatePhotonExtra > PFCandidatePhotonExtraCollection
collection of PFCandidatePhotonExtras
double dptRel_DispVtx_
Definition: PFAlgo.h:347
boost::shared_ptr< PFEnergyCalibration > calibration_
Definition: PFAlgo.h:304
list blocks
Definition: gather_cfg.py:90
reco::PFBlockHandle blockHandle_
input block handle (full framework case)
Definition: PFAlgo.h:296
void setCandConnectorParameters(bool bCorrect, bool bCalibPrimary, double dptRel_PrimaryTrack, double dptRel_MergedTrack, double ptErrorSecondary, std::vector< double > nuclCalibFactors)
Definition: PFAlgo.h:75
boost::shared_ptr< PFSCEnergyCalibration > thePFSCEnergyCalibration_
Definition: PFAlgo.h:306
std::auto_ptr< reco::PFCandidatePhotonExtraCollection > transferPhotonExtra()
Definition: PFAlgo.h:190
virtual ~PFAlgo()
destructor
Definition: PFAlgo.cc:68
std::auto_ptr< reco::PFCandidateCollection > & transferCleanedCandidates()
Definition: PFAlgo.h:198
boost::shared_ptr< PFEnergyCalibrationHF > thepfEnergyCalibrationHF_
Definition: PFAlgo.h:305
bool rejectTracks_Bad_
Definition: PFAlgo.h:338
PFAlgo()
constructor
Definition: PFAlgo.cc:57
std::auto_ptr< reco::PFCandidateCollection > pfCandidates_
Definition: PFAlgo.h:258
PFMuonAlgo * getPFMuonAlgo()
Definition: PFAlgo.cc:89
bool debug_
Definition: PFAlgo.h:310
void setPhotonExtraRef(const edm::OrphanHandle< reco::PFCandidatePhotonExtraCollection > &pf_extrah)
Definition: PFAlgo.cc:3522
bool applyCrackCorrectionsElectrons_
Definition: PFAlgo.h:318
void setParameters(const edm::ParameterSet &iCfgCandConnector)
double sumPtTrackIsoForEgammaSC_endcap_
Definition: PFAlgo.h:326
double nSigmaTRACK_
Definition: PFAlgo.h:358
std::auto_ptr< reco::PFCandidateCollection > pfElectronCandidates_
the unfiltered electron collection
Definition: PFAlgo.h:260
#define debug
Definition: MEtoEDMFormat.h:34
double neutralHadronEnergyResolution(double clusterEnergy, double clusterEta) const
todo: use PFClusterTools for this
Definition: PFAlgo.cc:3102
void postCleaning()
Definition: PFAlgo.cc:3258
std::vector< reco::PFCandidateElectronExtra > PFCandidateElectronExtraCollection
collection of PFCandidateElectronExtras
reco::PFCandidateElectronExtraCollection pfElectronExtra_
the unfiltered electron collection
Definition: PFAlgo.h:267
Definition: PFAlgo.h:50
bool usePFPhotons_
Definition: PFAlgo.h:317
bool usePFDecays_
Definition: PFAlgo.h:343
void setDebug(bool debug)
void setAlgo(int algo)
Definition: PFAlgo.h:61
double sumPtTrackIsoForEgammaSC_barrel_
Definition: PFAlgo.h:325
const std::auto_ptr< reco::PFCandidateCollection > & pfCandidates() const
Definition: PFAlgo.h:170
friend std::ostream & operator<<(std::ostream &out, const PFAlgo &algo)
void setElectronExtraRef(const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > &extrah)
Definition: PFAlgo.cc:3470
double nSigmaECAL_
number of sigma to judge energy excess in ECAL
Definition: PFAlgo.h:299
Block of elements.
Definition: PFBlock.h:30
bool usePFElectrons_
Definition: PFAlgo.h:316