CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFElectronAlgo.h
Go to the documentation of this file.
1 #ifndef PFProducer_PFElectronAlgo_H
2 #define PFProducer_PFElectronAlgo_H
3 
14 #include "TMVA/Reader.h"
15 #include <iostream>
16 
17 
20 
21 namespace reco {
22 class PFCandidate;
23 }
24 
26  public:
27 
28  //constructor
29  PFElectronAlgo(const double mvaEleCut,
30  std::string mvaWeightFileEleID,
31  const boost::shared_ptr<PFSCEnergyCalibration>& thePFSCEnergyCalibration,
32  const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
33  bool applyCrackCorrections,
34  bool usePFSCEleCalib,
35  bool useEGElectrons,
36  bool useEGammaSupercluster,
37  double sumEtEcalIsoForEgammaSC_barrel,
38  double sumEtEcalIsoForEgammaSC_endcap,
39  double coneEcalIsoForEgammaSC,
40  double sumPtTrackIsoForEgammaSC_barrel,
41  double sumPtTrackIsoForEgammaSC_endcap,
42  unsigned int nTrackIsoForEgammaSC,
43  double coneTrackIsoForEgammaSC);
44 
45  //destructor
47 
48  //check candidate validity
50  std::vector<bool>& active)
51  {
52  isvalid_=false;
53  RunPFElectron(blockRef,active);
54  return isvalid_;};
55 
56  //get electron PFCandidate
57  const std::vector<reco::PFCandidate>& getElectronCandidates() {return elCandidate_;};
58 
59  //get all electron PFCandidate
60  const std::vector<reco::PFCandidate>& getAllElectronCandidates() {return allElCandidate_;};
61 
62  //get the electron PFCandidateExtra (for all candidates)
63  const std::vector< reco::PFCandidateElectronExtra>& getElectronExtra() {return electronExtra_;};
64 
65  // retrieve the list of pre-defined e/g electrons
66  void setEGElectronCollection(const reco::GsfElectronCollection & egelectrons);
67 
68  private:
69  typedef std::map< unsigned int, std::vector<unsigned int> > AssMap;
70 
71  void RunPFElectron(const reco::PFBlockRef& blockRef,
72  std::vector<bool>& active);
73 
74  unsigned int FindClosestElement(const unsigned int iele,
75  std::multimap<double, unsigned int>& Elems,
76  float& chi2cut,
77  std::vector<bool>& active,
78  const reco::PFBlockRef& blockRef);
79 
80  bool SetLinks(const reco::PFBlockRef& blockRef,
81  AssMap& associatedToGsf_,
82  AssMap& associatedToBrems_,
83  AssMap& associatedToEcal_,
84  std::vector<bool>& active);
85 
86  void SetIDOutputs(const reco::PFBlockRef& blockRef,
87  AssMap& associatedToGsf_,
88  AssMap& associatedToBrems_,
89  AssMap& associatedToEcal_);
90 
91  void SetCandidates(const reco::PFBlockRef& blockRef,
92  AssMap& associatedToGsf_,
93  AssMap& associatedToBrems_,
94  AssMap& associatedToEcal_);
95 
96  void SetActive(const reco::PFBlockRef& blockRef,
97  AssMap& associatedToGsf_,
98  AssMap& associatedToBrems_,
99  AssMap& associatedToEcal_,
100  std::vector<bool>& active);
101 
102  unsigned int whichTrackAlgo(const reco::TrackRef& trackRef);
103 
104  bool isPrimaryTrack(const reco::PFBlockElementTrack& KfEl,
105  const reco::PFBlockElementGsfTrack& GsfEl);
106 
107  std::vector<reco::PFCandidate> elCandidate_;
108  std::vector<reco::PFCandidate> allElCandidate_;
109  std::map<unsigned int,std::vector<reco::PFCandidate> > electronConstituents_;
110  std::vector<double> BDToutput_;
111  std::vector<reco::PFCandidateElectronExtra > electronExtra_;
112  std::vector<bool> lockExtraKf_;
113  std::vector<bool> GsfTrackSingleEcal_;
114  std::vector< std::pair <unsigned int, unsigned int> > fifthStepKfTrack_;
115  std::vector< std::pair <unsigned int, unsigned int> > convGsfTrack_;
116 
117 
118  TMVA::Reader *tmvaReader_;
119  double mvaEleCut_;
120  boost::shared_ptr<PFSCEnergyCalibration> thePFSCEnergyCalibration_;
121  boost::shared_ptr<PFEnergyCalibration> thePFEnergyCalibration_;
131  unsigned int nTrackIsoForEgammaSC_;
133 
134  const char *mvaWeightFile_;
135 
136  // New BDT observables
137  // Normalization
139 
140  // Pure Tracking observ.
143  // int nhit_gsf,nhit_kf;
145 
146  // Tracker-Ecal observ.
149  float SigmaEtaEta;
150  //int lateBrem,firstBrem,earlyBrem;
153 
154  bool isvalid_;
155 
156  const std::vector<reco::GsfElectron> * theGsfElectrons_;
157 };
158 
159 
160 #endif
std::vector< std::pair< unsigned int, unsigned int > > fifthStepKfTrack_
void SetIDOutputs(const reco::PFBlockRef &blockRef, AssMap &associatedToGsf_, AssMap &associatedToBrems_, AssMap &associatedToEcal_)
std::map< unsigned int, std::vector< unsigned int > > AssMap
const std::vector< reco::PFCandidate > & getAllElectronCandidates()
float EtotBremPinPoutMode
void SetCandidates(const reco::PFBlockRef &blockRef, AssMap &associatedToGsf_, AssMap &associatedToBrems_, AssMap &associatedToEcal_)
std::vector< std::pair< unsigned int, unsigned int > > convGsfTrack_
bool isElectronValidCandidate(const reco::PFBlockRef &blockRef, std::vector< bool > &active)
const char * mvaWeightFile_
std::vector< reco::PFCandidateElectronExtra > electronExtra_
const std::vector< reco::GsfElectron > * theGsfElectrons_
bool isPrimaryTrack(const reco::PFBlockElementTrack &KfEl, const reco::PFBlockElementGsfTrack &GsfEl)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
double coneEcalIsoForEgammaSC_
TMVA::Reader * tmvaReader_
void SetActive(const reco::PFBlockRef &blockRef, AssMap &associatedToGsf_, AssMap &associatedToBrems_, AssMap &associatedToEcal_, std::vector< bool > &active)
void RunPFElectron(const reco::PFBlockRef &blockRef, std::vector< bool > &active)
const std::vector< reco::PFCandidateElectronExtra > & getElectronExtra()
double sumEtEcalIsoForEgammaSC_barrel_
std::vector< bool > lockExtraKf_
std::vector< double > BDToutput_
unsigned int FindClosestElement(const unsigned int iele, std::multimap< double, unsigned int > &Elems, float &chi2cut, std::vector< bool > &active, const reco::PFBlockRef &blockRef)
double sumEtEcalIsoForEgammaSC_endcap_
std::map< unsigned int, std::vector< reco::PFCandidate > > electronConstituents_
const std::vector< reco::PFCandidate > & getElectronCandidates()
double sumPtTrackIsoForEgammaSC_endcap_
unsigned int whichTrackAlgo(const reco::TrackRef &trackRef)
boost::shared_ptr< PFSCEnergyCalibration > thePFSCEnergyCalibration_
double coneTrackIsoForEgammaSC_
bool SetLinks(const reco::PFBlockRef &blockRef, AssMap &associatedToGsf_, AssMap &associatedToBrems_, AssMap &associatedToEcal_, std::vector< bool > &active)
std::vector< bool > GsfTrackSingleEcal_
PFElectronAlgo(const double mvaEleCut, std::string mvaWeightFileEleID, const boost::shared_ptr< PFSCEnergyCalibration > &thePFSCEnergyCalibration, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, bool applyCrackCorrections, bool usePFSCEleCalib, bool useEGElectrons, bool useEGammaSupercluster, double sumEtEcalIsoForEgammaSC_barrel, double sumEtEcalIsoForEgammaSC_endcap, double coneEcalIsoForEgammaSC, double sumPtTrackIsoForEgammaSC_barrel, double sumPtTrackIsoForEgammaSC_endcap, unsigned int nTrackIsoForEgammaSC, double coneTrackIsoForEgammaSC)
double sumPtTrackIsoForEgammaSC_barrel_
unsigned int nTrackIsoForEgammaSC_
boost::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration_
std::vector< reco::PFCandidate > elCandidate_
bool applyCrackCorrections_
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
bool useEGammaSupercluster_
std::vector< reco::PFCandidate > allElCandidate_