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 "boost/shared_ptr.hpp"
16 #include <iostream>
17 
18 
21 
22 namespace reco {
23 class PFCandidate;
24 }
25 
27  public:
28 
29  //constructor
30  PFElectronAlgo(const double mvaEleCut,
31  std::string mvaWeightFileEleID,
32  const boost::shared_ptr<PFSCEnergyCalibration>& thePFSCEnergyCalibration,
33  const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
35  bool usePFSCEleCalib,
36  bool useEGElectrons,
43  unsigned int nTrackIsoForEgammaSC,
45 
46  //destructor
48 
49  //check candidate validity
51  std::vector<bool>& active,
53  {
54  isvalid_=false;
55  RunPFElectron(blockRef,active, primaryVertex);
56  return isvalid_;};
57 
58  //get electron PFCandidate
59  const std::vector<reco::PFCandidate>& getElectronCandidates() {return elCandidate_;};
60 
61  //get all electron PFCandidate
62  const std::vector<reco::PFCandidate>& getAllElectronCandidates() {return allElCandidate_;};
63 
64  //get the electron PFCandidateExtra (for all candidates)
65  const std::vector< reco::PFCandidateElectronExtra>& getElectronExtra() {return electronExtra_;};
66 
67  // retrieve the list of pre-defined e/g electrons
68  void setEGElectronCollection(const reco::GsfElectronCollection & egelectrons);
69 
70  private:
71  typedef std::map< unsigned int, std::vector<unsigned int> > AssMap;
72 
73  void RunPFElectron(const reco::PFBlockRef& blockRef,
74  std::vector<bool>& active,
75  const reco::Vertex & primaryVertex);
76 
77  unsigned int FindClosestElement(const unsigned int iele,
78  std::multimap<double, unsigned int>& Elems,
79  float& chi2cut,
80  std::vector<bool>& active,
81  const reco::PFBlockRef& blockRef);
82 
83  bool SetLinks(const reco::PFBlockRef& blockRef,
84  AssMap& associatedToGsf_,
85  AssMap& associatedToBrems_,
86  AssMap& associatedToEcal_,
87  std::vector<bool>& active,
88  const reco::Vertex & primaryVertex);
89 
90  void SetIDOutputs(const reco::PFBlockRef& blockRef,
91  AssMap& associatedToGsf_,
92  AssMap& associatedToBrems_,
93  AssMap& associatedToEcal_,
94  const reco::Vertex & primaryVertex);
95 
96  void SetCandidates(const reco::PFBlockRef& blockRef,
97  AssMap& associatedToGsf_,
98  AssMap& associatedToBrems_,
99  AssMap& associatedToEcal_);
100 
101  void SetActive(const reco::PFBlockRef& blockRef,
102  AssMap& associatedToGsf_,
103  AssMap& associatedToBrems_,
104  AssMap& associatedToEcal_,
105  std::vector<bool>& active);
106 
107 
108 
109  bool isPrimaryTrack(const reco::PFBlockElementTrack& KfEl,
110  const reco::PFBlockElementGsfTrack& GsfEl);
111 
112  std::vector<reco::PFCandidate> elCandidate_;
113  std::vector<reco::PFCandidate> allElCandidate_;
114  std::map<unsigned int,std::vector<reco::PFCandidate> > electronConstituents_;
115  std::vector<double> BDToutput_;
116  std::vector<reco::PFCandidateElectronExtra > electronExtra_;
117  std::vector<bool> lockExtraKf_;
118  std::vector<bool> GsfTrackSingleEcal_;
119  std::vector< std::pair <unsigned int, unsigned int> > fifthStepKfTrack_;
120  std::vector< std::pair <unsigned int, unsigned int> > convGsfTrack_;
121 
122 
123  TMVA::Reader *tmvaReader_;
124  double mvaEleCut_;
125  boost::shared_ptr<PFSCEnergyCalibration> thePFSCEnergyCalibration_;
126  boost::shared_ptr<PFEnergyCalibration> thePFEnergyCalibration_;
136  unsigned int nTrackIsoForEgammaSC_;
138 
139  const char *mvaWeightFile_;
140 
141  // New BDT observables
142  // Normalization
144 
145  // Pure Tracking observ.
148  // int nhit_gsf,nhit_kf;
150 
151  // Tracker-Ecal observ.
154  float SigmaEtaEta;
155  //int lateBrem,firstBrem,earlyBrem;
158 
159  bool isvalid_;
160 
161  const std::vector<reco::GsfElectron> * theGsfElectrons_;
162 };
163 
164 
165 #endif
std::vector< std::pair< unsigned int, unsigned int > > fifthStepKfTrack_
bool SetLinks(const reco::PFBlockRef &blockRef, AssMap &associatedToGsf_, AssMap &associatedToBrems_, AssMap &associatedToEcal_, std::vector< bool > &active, const reco::Vertex &primaryVertex)
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_
tuple coneTrackIsoForEgammaSC
const char * mvaWeightFile_
std::vector< reco::PFCandidateElectronExtra > electronExtra_
tuple sumPtTrackIsoForEgammaSC_endcap
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_
tuple primaryVertex
tuple coneEcalIsoForEgammaSC
void SetActive(const reco::PFBlockRef &blockRef, AssMap &associatedToGsf_, AssMap &associatedToBrems_, AssMap &associatedToEcal_, std::vector< bool > &active)
tuple sumPtTrackIsoForEgammaSC_barrel
const std::vector< reco::PFCandidateElectronExtra > & getElectronExtra()
double sumEtEcalIsoForEgammaSC_barrel_
std::vector< bool > lockExtraKf_
tuple sumEtEcalIsoForEgammaSC_barrel
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_
void SetIDOutputs(const reco::PFBlockRef &blockRef, AssMap &associatedToGsf_, AssMap &associatedToBrems_, AssMap &associatedToEcal_, const reco::Vertex &primaryVertex)
tuple sumEtEcalIsoForEgammaSC_endcap
tuple usePFSCEleCalib
std::map< unsigned int, std::vector< reco::PFCandidate > > electronConstituents_
const std::vector< reco::PFCandidate > & getElectronCandidates()
double sumPtTrackIsoForEgammaSC_endcap_
tuple useEGammaSupercluster
boost::shared_ptr< PFSCEnergyCalibration > thePFSCEnergyCalibration_
double coneTrackIsoForEgammaSC_
std::vector< bool > GsfTrackSingleEcal_
bool isElectronValidCandidate(const reco::PFBlockRef &blockRef, std::vector< bool > &active, const reco::Vertex &primaryVertex)
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_
tuple applyCrackCorrections
unsigned int nTrackIsoForEgammaSC_
tuple nTrackIsoForEgammaSC
void RunPFElectron(const reco::PFBlockRef &blockRef, std::vector< bool > &active, const reco::Vertex &primaryVertex)
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_