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 
19 
20 namespace reco {
21 class PFCandidate;
22 }
23 
25  public:
26 
27  //constructor
28  PFElectronAlgo(const double mvaEleCut,
29  std::string mvaWeightFileEleID,
30  const boost::shared_ptr<PFSCEnergyCalibration>& thePFSCEnergyCalibration,
31  bool applyCrackCorrections,
32  bool usePFSCEleCalib,
33  bool useEGElectrons,
40  unsigned int nTrackIsoForEgammaSC,
42 
43  //destructor
45 
46  //check candidate validity
48  std::vector<bool>& active)
49  {
50  isvalid_=false;
51  RunPFElectron(blockRef,active);
52  return isvalid_;};
53 
54  //get electron PFCandidate
55  const std::vector<reco::PFCandidate>& getElectronCandidates() {return elCandidate_;};
56 
57  //get all electron PFCandidate
58  const std::vector<reco::PFCandidate>& getAllElectronCandidates() {return allElCandidate_;};
59 
60  //get the electron PFCandidateExtra (for all candidates)
61  const std::vector< reco::PFCandidateElectronExtra>& getElectronExtra() {return electronExtra_;};
62 
63  // retrieve the list of pre-defined e/g electrons
64  void setEGElectronCollection(const reco::GsfElectronCollection & egelectrons);
65 
66  private:
67  typedef std::map< unsigned int, std::vector<unsigned int> > AssMap;
68 
69  void RunPFElectron(const reco::PFBlockRef& blockRef,
70  std::vector<bool>& active);
71 
72  unsigned int FindClosestElement(const unsigned int iele,
73  std::multimap<double, unsigned int>& Elems,
74  float& chi2cut,
75  std::vector<bool>& active,
76  const reco::PFBlockRef& blockRef);
77 
78  bool SetLinks(const reco::PFBlockRef& blockRef,
79  AssMap& associatedToGsf_,
80  AssMap& associatedToBrems_,
81  AssMap& associatedToEcal_,
82  std::vector<bool>& active);
83 
84  void SetIDOutputs(const reco::PFBlockRef& blockRef,
85  AssMap& associatedToGsf_,
86  AssMap& associatedToBrems_,
87  AssMap& associatedToEcal_);
88 
89  void SetCandidates(const reco::PFBlockRef& blockRef,
90  AssMap& associatedToGsf_,
91  AssMap& associatedToBrems_,
92  AssMap& associatedToEcal_);
93 
94  void SetActive(const reco::PFBlockRef& blockRef,
95  AssMap& associatedToGsf_,
96  AssMap& associatedToBrems_,
97  AssMap& associatedToEcal_,
98  std::vector<bool>& active);
99 
100  unsigned int whichTrackAlgo(const reco::TrackRef& trackRef);
101 
102  bool isPrimaryTrack(const reco::PFBlockElementTrack& KfEl,
103  const reco::PFBlockElementGsfTrack& GsfEl);
104 
105  std::vector<reco::PFCandidate> elCandidate_;
106  std::vector<reco::PFCandidate> allElCandidate_;
107  std::map<unsigned int,std::vector<reco::PFCandidate> > electronConstituents_;
108  std::vector<double> BDToutput_;
109  std::vector<reco::PFCandidateElectronExtra > electronExtra_;
110  std::vector<bool> lockExtraKf_;
111  std::vector<bool> GsfTrackSingleEcal_;
112  std::vector< std::pair <unsigned int, unsigned int> > fifthStepKfTrack_;
113  std::vector< std::pair <unsigned int, unsigned int> > convGsfTrack_;
114 
115 
116  TMVA::Reader *tmvaReader_;
117  double mvaEleCut_;
118  boost::shared_ptr<PFSCEnergyCalibration> thePFSCEnergyCalibration_;
128  unsigned int nTrackIsoForEgammaSC_;
130 
131  const char *mvaWeightFile_;
132 
133  // New BDT observables
134  // Normalization
136 
137  // Pure Tracking observ.
140  // int nhit_gsf,nhit_kf;
142 
143  // Tracker-Ecal observ.
146  float SigmaEtaEta;
147  //int lateBrem,firstBrem,earlyBrem;
150 
151  bool isvalid_;
152 
153  const std::vector<reco::GsfElectron> * theGsfElectrons_;
154 };
155 
156 
157 #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, 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_
std::vector< reco::PFCandidate > elCandidate_
bool applyCrackCorrections_
void setEGElectronCollection(const reco::GsfElectronCollection &egelectrons)
bool useEGammaSupercluster_
std::vector< reco::PFCandidate > allElCandidate_