00001 #ifndef HLTrigger_HLTanalyzers_HLTEgamma_h
00002 #define HLTrigger_HLTanalyzers_HLTEgamma_h
00003
00004
00005 #include <vector>
00006 #include <algorithm>
00007 #include <memory>
00008 #include <map>
00009
00010 #include "TTree.h"
00011
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013 #include "DataFormats/EgammaCandidates/interface/Photon.h"
00014 #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
00015 #include "DataFormats/EgammaCandidates/interface/Electron.h"
00016 #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
00017 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00018 #include "DataFormats/Candidate/interface/Candidate.h"
00019 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00020 #include "HLTrigger/HLTanalyzers/interface/JetUtil.h"
00021 #include "HLTrigger/HLTanalyzers/interface/CaloTowerBoundries.h"
00022 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00023
00024 #include "FWCore/Framework/interface/Event.h"
00025 #include "FWCore/Framework/interface/EventSetup.h"
00026 #include "DataFormats/Common/interface/Handle.h"
00027 #include "DataFormats/L1Trigger/interface/L1EmParticle.h"
00028 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
00029 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
00030 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
00031 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateIsolation.h"
00032 #include "DataFormats/Common/interface/RefToBase.h"
00033 #include "DataFormats/Common/interface/Ref.h"
00034 #include "DataFormats/Common/interface/RefProd.h"
00035 #include "FWCore/Framework/interface/ESHandle.h"
00036 #include "DataFormats/Common/interface/AssociationMap.h"
00037 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00038 #include "DataFormats/EgammaReco/interface/ElectronSeed.h"
00039 #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
00040 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00041
00042 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00043 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00044 #include "DataFormats/TrackReco/interface/Track.h"
00045 #include "DataFormats/EgammaCandidates/interface/ElectronIsolationAssociation.h"
00046
00047 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
00048 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00049 #include "DataFormats/Math/interface/Point3D.h"
00050 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00051 #include "MagneticField/Engine/interface/MagneticField.h"
00052 #include "DataFormats/Common/interface/ValueMap.h"
00053
00060 class HLTEgamma {
00061 public:
00062 HLTEgamma();
00063
00064 void setup(const edm::ParameterSet& pSet, TTree* tree);
00065
00066 void clear(void);
00067
00069 void analyze(
00070 const edm::Handle<reco::GsfElectronCollection> & electrons,
00071 const edm::Handle<reco::PhotonCollection> & photons,
00072 const edm::Handle<reco::ElectronCollection> & electronIsoHandle,
00073 const edm::Handle<reco::ElectronCollection> & electronNonIsoHandle,
00074 const edm::Handle<reco::ElectronIsolationMap> & NonIsoTrackEleIsolMap,
00075 const edm::Handle<reco::ElectronIsolationMap> & TrackEleIsolMap,
00076 const edm::Handle<reco::ElectronSeedCollection> & L1IsoPixelSeedsMap,
00077 const edm::Handle<reco::ElectronSeedCollection> & L1NonIsoPixelSeedsMap,
00078 const edm::Handle<reco::RecoEcalCandidateCollection> & recoIsolecalcands,
00079 const edm::Handle<reco::RecoEcalCandidateCollection> & recoNonIsolecalcands,
00080 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalIsolMap,
00081 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalNonIsolMap,
00082 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalEleIsolMap,
00083 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalEleNonIsolMap,
00084 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalIsolMap,
00085 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalNonIsolMap,
00086 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & TrackIsolMap,
00087 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & TrackNonIsolMap,
00088 EcalClusterLazyTools& lazyTools,
00089 const edm::ESHandle<MagneticField>& theMagField,
00090 reco::BeamSpot::Point & BSPosition,
00091 std::vector<edm::Handle<edm::ValueMap<float> > > & eIDValueMap,
00092 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IsoMap,
00093 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9NonIsoMap,
00094 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IsoMap,
00095 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9NonIsoMap,
00096 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHIsoMap,
00097 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHNonIsoMap,
00098 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IDIsoMap,
00099 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IDNonIsoMap,
00100 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IDIsoMap,
00101 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IDNonIsoMap,
00102 const edm::Handle<reco::SuperClusterCollection> & electronHFClusterHandle,
00103 const edm::Handle<reco::RecoEcalCandidateCollection> & electronHFElectronHandle,
00104 TTree* tree);
00105
00106 private:
00107 struct OpenHLTPhoton;
00108 struct OpenHLTElectron;
00109
00110 void MakeL1IsolatedPhotons(
00111 std::vector<OpenHLTPhoton> & photons,
00112 const edm::Handle<reco::RecoEcalCandidateCollection> & recoIsolecalcands,
00113 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalIsolMap,
00114 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalIsolMap,
00115 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & TrackIsolMap,
00116 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IsoMap,
00117 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHIsoMap,
00118 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IDIsoMap,
00119 EcalClusterLazyTools& lazyTools
00120 );
00121
00122 void MakeL1NonIsolatedPhotons(
00123 std::vector<OpenHLTPhoton> & photons,
00124 const edm::Handle<reco::RecoEcalCandidateCollection> & recoNonIsolecalcands,
00125 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalNonIsolMap,
00126 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalNonIsolMap,
00127 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & TrackNonIsolMap,
00128 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9NonIsoMap,
00129 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHNonIsoMap,
00130 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IDNonIsoMap,
00131 EcalClusterLazyTools& lazyTools
00132 );
00133
00134 void MakeL1IsolatedElectrons(
00135 std::vector<OpenHLTElectron> & electrons,
00136 const edm::Handle<reco::ElectronCollection> & electronIsoHandle,
00137 const edm::Handle<reco::RecoEcalCandidateCollection> & recoIsolecalcands,
00138 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalEleIsolMap,
00139 const edm::Handle<reco::ElectronSeedCollection> & L1IsoPixelSeedsMap,
00140 const edm::Handle<reco::ElectronIsolationMap> & TrackEleIsolMap,
00141 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IsoMap,
00142 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHIsoMap,
00143 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalIsolMap,
00144 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IDIsoMap,
00145 EcalClusterLazyTools& lazyTools,
00146 const edm::ESHandle<MagneticField>& theMagField,
00147 reco::BeamSpot::Point & BSPosition );
00148
00149 void MakeL1NonIsolatedElectrons(
00150 std::vector<OpenHLTElectron> & electrons,
00151 const edm::Handle<reco::ElectronCollection> & electronNonIsoHandle,
00152 const edm::Handle<reco::RecoEcalCandidateCollection> & recoNonIsolecalcands,
00153 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalEleIsolMap,
00154 const edm::Handle<reco::ElectronSeedCollection> & L1NonIsoPixelSeedsMap,
00155 const edm::Handle<reco::ElectronIsolationMap> & TrackEleIsolMap,
00156 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9NonIsoMap,
00157 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHIsoMap,
00158 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalIsolMap,
00159 const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IDNonIsoMap,
00160 EcalClusterLazyTools& lazyTools,
00161 const edm::ESHandle<MagneticField>& theMagField,
00162 reco::BeamSpot::Point & BSPosition );
00163
00164 void CalculateDetaDphi(
00165 const edm::ESHandle<MagneticField>& theMagField,
00166 reco::BeamSpot::Point & BSPosition,
00167 const reco::ElectronRef eleref,
00168 float& deltaeta,
00169 float& deltaphi, bool useTrackProjectionToEcal);
00170
00171
00172 float *elpt, *elphi, *eleta, *elet, *ele, *elIP, *elTrkChi2NDF, *elTrkIsoR03, *elECaloIsoR03, *elHCaloIsoR03, *elFbrem;
00173 float *eltrkiso, *elecaliso, *elhcaliso;
00174 float *elsigmaietaieta, *eldeltaPhiIn, *eldeltaEtaIn, *elhOverE;
00175 float *elscEt, *eld0corr;
00176 bool *elqGsfCtfScPixConsistent;
00177 int *elmishits;
00178 float *eldist, *eldcot;
00179 float *photonpt, *photonphi, *photoneta, *photonet, *photone;
00180
00181 float *hphotet, *hphoteta, *hphotphi, *hphoteiso, *hphothiso, *hphottiso, *hphothovereh;
00182 float *heleet, *heleeta, *helephi, *heleE, *helep, *helehiso, *heletiso, *helehovereh, *heleeiso;
00183 float *hphotClusShap, *heleClusShap, *heleDeta, *heleDphi;
00184 float *hphotR9, *heleR9, *hphotR9ID, *heleR9ID;
00185 int *hphotl1iso, *helel1iso, *helePixelSeeds;
00186 int *eleId, *elNLostHits;
00187 bool *elIsEcalDriven;
00188 int *heleNewSC;
00189 int nele, nphoton, nhltgam, nhltele, nhlthfele, nhlthfeclus;
00190
00191 float *hhfelept, *hhfeleeta, *hhfclustere9e25, *hhfcluster2Dcut;
00192
00193
00194 struct OpenHLTPhoton {
00195 float Et;
00196 float eta;
00197 float phi;
00198 float ecalIsol;
00199 float hcalIsol;
00200 float trackIsol;
00201 float r9;
00202 bool L1Isolated;
00203 float clusterShape;
00204 float hovereh;
00205 float r9ID;
00206 float et() const { return Et; }
00207 };
00208
00209 struct OpenHLTElectron {
00210 float Et;
00211 float eta;
00212 float phi;
00213 float E;
00214 float p;
00215 float hcalIsol;
00216 float trackIsol;
00217 float ecalIsol;
00218 bool L1Isolated;
00219 int pixelSeeds;
00220 bool newSC;
00221 float clusterShape;
00222 float r9;
00223 float Deta;
00224 float Dphi;
00225 float hovereh;
00226 float r9ID;
00227 float et() const { return Et; }
00228 };
00229
00230 };
00231
00232 #endif // HLTrigger_HLTanalyzers_HLTEgamma_h