CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/HLTrigger/HLTanalyzers/interface/HLTEgamma.h

Go to the documentation of this file.
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 #include "DataFormats/EgammaReco/interface/HFEMClusterShape.h"
00047 #include "DataFormats/EgammaReco/interface/HFEMClusterShapeAssociation.h"
00048 
00049 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
00050 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00051 #include "DataFormats/Math/interface/Point3D.h"
00052 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00053 #include "MagneticField/Engine/interface/MagneticField.h"
00054 #include "DataFormats/Common/interface/ValueMap.h"
00055 
00062 class HLTEgamma {
00063 public:
00064   HLTEgamma();
00065 
00066   void setup(const edm::ParameterSet& pSet, TTree* tree);
00067 
00068   void clear(void);
00069 
00071   void analyze(
00072       const edm::Handle<reco::GsfElectronCollection>         & electrons,
00073       const edm::Handle<reco::PhotonCollection>              & photons,
00074       const edm::Handle<reco::ElectronCollection>            & electronIsoHandle,
00075       const edm::Handle<reco::ElectronCollection>            & electronNonIsoHandle,
00076       const edm::Handle<reco::ElectronIsolationMap>          & NonIsoTrackEleIsolMap,
00077       const edm::Handle<reco::ElectronIsolationMap>          & TrackEleIsolMap,
00078       const edm::Handle<reco::ElectronSeedCollection>        & L1IsoPixelSeedsMap,
00079       const edm::Handle<reco::ElectronSeedCollection>        & L1NonIsoPixelSeedsMap,
00080       const edm::Handle<reco::RecoEcalCandidateCollection>   & recoIsolecalcands,
00081       const edm::Handle<reco::RecoEcalCandidateCollection>   & recoNonIsolecalcands,
00082       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalIsolMap,
00083       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalNonIsolMap,
00084       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalEleIsolMap,
00085       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalEleNonIsolMap,
00086       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalIsolMap,
00087       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalNonIsolMap,
00088       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & TrackIsolMap,
00089       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & TrackNonIsolMap,
00090       EcalClusterLazyTools& lazyTools,
00091       const edm::ESHandle<MagneticField>& theMagField,
00092       reco::BeamSpot::Point & BSPosition,
00093       std::vector<edm::Handle<edm::ValueMap<float> > > & eIDValueMap, 
00094       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IsoMap, 
00095       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9NonIsoMap, 
00096       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IsoMap, 
00097       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9NonIsoMap, 
00098       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHIsoMap,
00099       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHNonIsoMap, 
00100       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IDIsoMap,
00101       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IDNonIsoMap,
00102       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IDIsoMap,
00103       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IDNonIsoMap,
00104       const edm::Handle<reco::SuperClusterCollection>        & electronHFClusterHandle, 
00105       const edm::Handle<reco::RecoEcalCandidateCollection>   & electronHFElectronHandle,  
00106       const edm::Handle<reco::HFEMClusterShapeAssociationCollection> & electronHFClusterAssociation,  
00107       const edm::Handle<reco::RecoEcalCandidateCollection>   & activityECAL,   
00108       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & activityEcalIsoMap,
00109       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & activityHcalIsoMap,
00110       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & activityTrackIsoMap,
00111       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & activityR9Map,
00112       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & activityR9IDMap,
00113       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & activityHoverEHMap,
00114       TTree* tree);
00115 
00116 private:
00117   struct OpenHLTPhoton;
00118   struct OpenHLTElectron;
00119 
00120   void MakeL1IsolatedPhotons(
00121       std::vector<OpenHLTPhoton> & photons,
00122       const edm::Handle<reco::RecoEcalCandidateCollection>   & recoIsolecalcands,
00123       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalIsolMap,
00124       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalIsolMap,
00125       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & TrackIsolMap,
00126       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IsoMap, 
00127       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHIsoMap, 
00128       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IDIsoMap,
00129       EcalClusterLazyTools& lazyTools
00130       );
00131 
00132   void MakeL1NonIsolatedPhotons(
00133       std::vector<OpenHLTPhoton> & photons,
00134       const edm::Handle<reco::RecoEcalCandidateCollection>   & recoNonIsolecalcands,
00135       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalNonIsolMap,
00136       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalNonIsolMap,
00137       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & TrackNonIsolMap,
00138       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9NonIsoMap,  
00139       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHNonIsoMap,  
00140       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonR9IDNonIsoMap,
00141       EcalClusterLazyTools& lazyTools
00142       );
00143 
00144   void MakeL1IsolatedElectrons(
00145       std::vector<OpenHLTElectron> & electrons,
00146       const edm::Handle<reco::ElectronCollection>            & electronIsoHandle,
00147       const edm::Handle<reco::RecoEcalCandidateCollection>   & recoIsolecalcands,
00148       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalEleIsolMap,
00149       const edm::Handle<reco::ElectronSeedCollection>        & L1IsoPixelSeedsMap,
00150       const edm::Handle<reco::ElectronIsolationMap>          & TrackEleIsolMap,
00151       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IsoMap,  
00152       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHIsoMap,  
00153       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalIsolMap, 
00154       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IDIsoMap,
00155       EcalClusterLazyTools& lazyTools,
00156       const edm::ESHandle<MagneticField>& theMagField,
00157       reco::BeamSpot::Point & BSPosition  );
00158 
00159   void MakeL1NonIsolatedElectrons(
00160       std::vector<OpenHLTElectron> & electrons,
00161       const edm::Handle<reco::ElectronCollection>            & electronNonIsoHandle,
00162       const edm::Handle<reco::RecoEcalCandidateCollection>   & recoNonIsolecalcands,
00163       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & HcalEleIsolMap,
00164       const edm::Handle<reco::ElectronSeedCollection>        & L1NonIsoPixelSeedsMap,
00165       const edm::Handle<reco::ElectronIsolationMap>          & TrackEleIsolMap, 
00166       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9NonIsoMap,   
00167       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & photonHoverEHIsoMap,  
00168       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & EcalIsolMap, 
00169       const edm::Handle<reco::RecoEcalCandidateIsolationMap> & electronR9IDNonIsoMap,
00170       EcalClusterLazyTools& lazyTools,
00171       const edm::ESHandle<MagneticField>& theMagField,
00172       reco::BeamSpot::Point & BSPosition  );
00173 
00174   void CalculateDetaDphi(
00175                        const edm::ESHandle<MagneticField>& theMagField, 
00176                        reco::BeamSpot::Point & BSPosition, 
00177                        const reco::ElectronRef eleref, 
00178                        float& deltaeta, 
00179                        float& deltaphi, bool useTrackProjectionToEcal);
00180 
00181   // Tree variables
00182   float *elpt, *elphi, *eleta, *elet, *ele, *elIP, *elTrkChi2NDF, *elTrkIsoR03, *elECaloIsoR03, *elHCaloIsoR03, *elFbrem; 
00183   float *eltrkiso, *elecaliso, *elhcaliso; 
00184   float *elsigmaietaieta, *eldeltaPhiIn,  *eldeltaEtaIn, *elhOverE; 
00185   float *elscEt, *eld0corr; 
00186   bool *elqGsfCtfScPixConsistent; 
00187   int *elmishits; 
00188   float *eldist, *eldcot;  
00189   float *photonpt, *photonphi, *photoneta, *photonet, *photone;
00190   float *photontrkiso, *photonecaliso, *photonhcaliso, *photonhovere, *photonClusShap, *photonr9id;
00191 
00192   float *hecalactivet, *hecalactiveta, *hecalactivphi, *hecalactiveiso, *hecalactivhiso, *hecalactivtiso, *hecalactivhovereh;
00193   float *hphotet, *hphoteta, *hphotphi, *hphoteiso, *hphothiso, *hphottiso, *hphothovereh;
00194   float *heleet, *heleeta, *helephi, *helevtxz, *heleE, *helep, *helehiso, *heletiso, *helehovereh, *heleeiso;
00195   //float *hphotClusShap, *heleClusShap, *heleDeta, *heleDphi;
00196   //float *hphotR9, *heleR9, *hphotR9ID, *heleR9ID;
00197   //int *hphotl1iso, *helel1iso, *helePixelSeeds;
00198   float *hecalactivClusShap,*hphotClusShap, *heleClusShap, *heleDeta, *heleDphi;
00199   float *hecalactivR9, *hphotR9, *heleR9, *hecalactivR9ID, *hphotR9ID, *heleR9ID;
00200   int *hecalactivl1iso,*hphotl1iso, *helel1iso, *helePixelSeeds;
00201   int *eleId, *elNLostHits;//eleId = RL  + 2*RT + 4*L +  4*T  //elNLostHits = conversion rejection  
00202   bool *elIsEcalDriven;  
00203   int *heleNewSC;
00204   int nele, nphoton, nhltecalactiv, nhltgam, nhltele, nhlthfele, nhlthfeclus;
00205   
00206   float *hhfelept, *hhfeleeta, *hhfclustere9e25, *hhfcluster2Dcut, *hhfclustereta, *hhfclusterphi; 
00207   float *hhfclustere1e9, *hhfclustereCOREe9, *hhfclustereSeL;
00208   
00209   struct OpenHLTPhoton {
00210     float Et;
00211     float eta;
00212     float phi;
00213     float ecalIsol;
00214     float hcalIsol;
00215     float trackIsol;
00216     float r9;
00217     bool  L1Isolated;
00218     float clusterShape;
00219     float hovereh;
00220     float r9ID;
00221     float et() const { return Et; } // Function defined as such to be compatible with EtGreater()
00222   };
00223 
00224   struct OpenHLTElectron {
00225     float Et;
00226     float eta;
00227     float phi;
00228     float E;
00229     float p;
00230          float vtxZ;
00231     float hcalIsol;
00232     float trackIsol;
00233     float ecalIsol;
00234     bool  L1Isolated;
00235     int   pixelSeeds;
00236     bool  newSC;
00237     float clusterShape;
00238     float r9;
00239     float Deta;
00240     float Dphi;
00241     float hovereh; 
00242     float r9ID;
00243     float et() const { return Et; } // Function defined as such to be compatible with EtGreater()
00244   };
00245 
00246 };
00247 
00248 #endif // HLTrigger_HLTanalyzers_HLTEgamma_h