Go to the documentation of this file.00001 #ifndef PFProducer_PFPhotonAlgo_H
00002 #define PFProducer_PFPhotonAlgo_H
00003
00004 #include "DataFormats/ParticleFlowReco/interface/PFBlockFwd.h"
00005 #include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
00006 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00007 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidatePhotonExtra.h"
00008 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidatePhotonExtraFwd.h"
00009 #include "DataFormats/Common/interface/Handle.h"
00010 #include "DataFormats/Common/interface/OrphanHandle.h"
00011 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h"
00012 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00013 #include "DataFormats/GsfTrackReco/interface/GsfTrackExtra.h"
00014 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h"
00015 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h"
00016 #include "DataFormats/VertexReco/interface/Vertex.h"
00017 #include "TMVA/Reader.h"
00018 #include <iostream>
00019
00020
00021 class PFEnergyCalibration;
00022
00023 namespace reco {
00024 class PFCandidate;
00025 class PFCandidateCollectioon;
00026 }
00027
00028 class PFPhotonAlgo {
00029 public:
00030
00031
00032 PFPhotonAlgo(std::string mvaweightfile,
00033 double mvaConvCut,
00034 const reco::Vertex& primary,
00035 const boost::shared_ptr<PFEnergyCalibration>& thePFEnergyCalibration,
00036 double sumPtTrackIsoForPhoton,
00037 double sumPtTrackIsoSlopeForPhoton
00038 );
00039
00040
00041 ~PFPhotonAlgo(){delete tmvaReader_;};
00042
00043
00044 bool isPhotonValidCandidate(const reco::PFBlockRef& blockRef,
00045 std::vector< bool >& active,
00046 std::auto_ptr< reco::PFCandidateCollection > &pfPhotonCandidates,
00047 std::vector<reco::PFCandidatePhotonExtra>& pfPhotonExtraCandidates,
00048 std::vector<reco::PFCandidate>&
00049 tempElectronCandidates
00050
00051 ){
00052 isvalid_=false;
00053
00054
00055 permElectronCandidates_.clear();
00056 match_ind.clear();
00057 RunPFPhoton(blockRef,
00058 active,
00059 pfPhotonCandidates,
00060 pfPhotonExtraCandidates,
00061 tempElectronCandidates
00062 );
00063 int ind=0;
00064 bool matched=false;
00065 int matches=match_ind.size();
00066
00067 for ( std::vector<reco::PFCandidate>::const_iterator ec=tempElectronCandidates.begin(); ec != tempElectronCandidates.end(); ++ec){
00068 for(int i=0; i<matches; i++)
00069 {
00070 if(ind==match_ind[i])
00071 {
00072 matched=true;
00073
00074 break;
00075 }
00076 }
00077 ++ind;
00078 if(matched)continue;
00079 permElectronCandidates_.push_back(*ec);
00080
00081 }
00082
00083 match_ind.clear();
00084
00085 tempElectronCandidates.clear();
00086 for ( std::vector<reco::PFCandidate>::const_iterator ec=permElectronCandidates_.begin(); ec != permElectronCandidates_.end(); ++ec)tempElectronCandidates.push_back(*ec);
00087 permElectronCandidates_.clear();
00088
00089 return isvalid_;
00090 };
00091
00092 private:
00093
00094 enum verbosityLevel {
00095 Silent,
00096 Summary,
00097 Chatty
00098 };
00099
00100
00101 bool isvalid_;
00102 verbosityLevel verbosityLevel_;
00103
00104
00105
00106
00107
00108 double MVACUT;
00109 reco::Vertex primaryVertex_;
00110 TMVA::Reader *tmvaReader_;
00111 boost::shared_ptr<PFEnergyCalibration> thePFEnergyCalibration_;
00112 double sumPtTrackIsoForPhoton_;
00113 double sumPtTrackIsoSlopeForPhoton_;
00114 std::vector<int>match_ind;
00115
00116
00117 std::vector< reco::PFCandidate >permElectronCandidates_;
00118 float nlost, nlayers;
00119 float chi2, STIP, del_phi,HoverPt, EoverPt, track_pt;
00120 double mvaValue;
00121 std::vector<unsigned int> AddFromElectron_;
00122 void RunPFPhoton(const reco::PFBlockRef& blockRef,
00123 std::vector< bool >& active,
00124
00125 std::auto_ptr< reco::PFCandidateCollection > &pfPhotonCandidates,
00126 std::vector<reco::PFCandidatePhotonExtra>&
00127 pfPhotonExtraCandidates,
00128
00129
00130 std::vector<reco::PFCandidate>&
00131 tempElectronCandidates
00132 );
00133
00134 bool EvaluateSingleLegMVA(const reco::PFBlockRef& blockref,
00135 const reco::Vertex& primaryvtx,
00136 unsigned int track_index);
00137
00138
00139 void EarlyConversion(
00140
00141
00142 std::vector<reco::PFCandidate>&
00143 tempElectronCandidates,
00144 const reco::PFBlockElementSuperCluster* sc
00145 );
00146 };
00147
00148 #endif