00001 #ifndef ElectroWeakAnalysis_ErsatzMEt_h
00002 #define ElectroWeakAnalysis_ErsatzMEt_h
00003
00004
00005
00006
00007
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <memory>
00025
00026
00027 #include "FWCore/Framework/interface/Frameworkfwd.h"
00028 #include "FWCore/Framework/interface/EDAnalyzer.h"
00029 #include "FWCore/Framework/interface/Event.h"
00030 #include "FWCore/Framework/interface/ESHandle.h"
00031 #include "FWCore/Framework/interface/MakerMacros.h"
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033 #include "FWCore/ServiceRegistry/interface/Service.h"
00034 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00035
00036 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00037 #include "CLHEP/Random/RandFlat.h"
00038
00039 #include "DataFormats/Common/interface/ValueMap.h"
00040
00041 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00042 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00043 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00044
00045 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
00046 #include "RecoEcal/EgammaClusterAlgos/interface/EgammaSCEnergyCorrectionAlgo.h"
00047
00048 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
00049 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00050 #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
00051 #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
00052 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00053 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00054 #include "Geometry/Records/interface/CaloTopologyRecord.h"
00055
00056 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
00057
00058 #include "DataFormats/TrackReco/interface/Track.h"
00059 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00060 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00061 #include "DataFormats/Common/interface/TriggerResults.h"
00062 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00063 #include "DataFormats/METReco/interface/CaloMET.h"
00064 #include "DataFormats/METReco/interface/CaloMETFwd.h"
00065 #include "DataFormats/METReco/interface/GenMET.h"
00066 #include "DataFormats/METReco/interface/GenMETFwd.h"
00067 #include "DataFormats/METReco/interface/PFMET.h"
00068 #include "DataFormats/METReco/interface/PFMETFwd.h"
00069 #include "DataFormats/METReco/interface/MET.h"
00070 #include "DataFormats/METReco/interface/METFwd.h"
00071
00072 #include "DataFormats/Math/interface/deltaR.h"
00073
00074
00075 #include "Math/GenVector/VectorUtil.h"
00076
00077 #include "TTree.h"
00078 #include "TH1.h"
00079 #include "TH2.h"
00080
00081 #include "ElectroWeakAnalysis/ZEE/interface/UniqueElectrons.h"
00082 #include "ElectroWeakAnalysis/ZEE/interface/ElectronSelector.h"
00083 #include "ElectroWeakAnalysis/ZEE/interface/CaloVectors.h"
00084 #include "ElectroWeakAnalysis/ZEE/interface/SCEnergyCorrections.h"
00085
00086 #define nEntries_arr_ 4
00087
00088
00089
00090
00091
00092 class ErsatzMEt : public edm::EDAnalyzer {
00093 public:
00094 explicit ErsatzMEt(const edm::ParameterSet&);
00095 ~ErsatzMEt();
00096
00097
00098 private:
00099 virtual void beginJob() ;
00100 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00101
00102
00103
00104 std::map<reco::GsfElectronRef, reco::GsfElectronRef> probeFinder(const std::vector<reco::GsfElectronRef>&,
00105 const edm::Handle<reco::GsfElectronCollection>);
00106 reco::MET ersatzFabrik(const reco::GsfElectronRef&, const reco::SuperCluster&,
00107 const reco::MET&, const int);
00108 reco::MET ersatzFabrik(const reco::GsfElectronRef&, const reco::GsfElectronRef&,
00109 const reco::MET&);
00110 bool isInBarrel(double);
00111 bool isInEndCap(double);
00112 bool isInFiducial(double);
00113
00114 virtual void endJob();
00115
00116
00117 edm::InputTag MCTruthCollection_;
00118 edm::InputTag ElectronCollection_, HybridScCollection_, M5x5ScCollection_;
00119 edm::InputTag eIdRobust_, eIdRobustTight_;
00120 edm::InputTag GenMEtCollection_, CaloMEtCollection_, T1MEtCollection_, PfMEtCollection_, TcMEtCollection_;
00121 edm::InputTag CaloTowerCollection_;
00122 edm::InputTag TriggerEvent_, TriggerResults_, TriggerPath_;
00123 std::string TriggerName_, ProcessName_;
00124 edm::ParameterSet hyb_fCorrPSet_, m5x5_fCorrPSet_;
00125 double mW_, mZ_, mTPmin_, mTPmax_;
00126 double BarrelEtaMax_, EndCapEtaMin_, EndCapEtaMax_;
00127
00128 enum cut_index_t { EtCut_, EB_sIhIh_, EB_dEtaIn_, EB_dPhiIn_, EB_TrckIso_, EB_EcalIso_, EB_HcalIso_,
00129 EE_sIhIh_, EE_dEtaIn_, EE_dPhiIn_, EE_TrckIso_, EE_EcalIso_, EE_HcalIso_};
00130
00131 std::vector<double> CutVector_;
00132
00133 int etaWidth_, phiWidth_;
00134 bool Zevent_, HLTPathCheck_;
00135
00136 HLTConfigProvider hltConfig_;
00137
00138 edm::ESHandle<CaloGeometry> geoHandle_;
00139 edm::ESHandle<CaloTopology> pTopology_;
00140
00141 TTree* t_;
00142 int nTags_, nProbes_;
00143 double CaloMEt_, T1MEt_, PfMEt_, TcMEt_;
00144 double CaloMEtphi_, T1MEtphi_, PfMEtphi_, TcMEtphi_;
00145 int McElec_nZmum_, McElec_nFinal_;
00146 double McZ_m_, McZ_pt_, McZ_phi_, McZ_eta_, McZ_y_;
00147 double McZ_rescM_, McZ_rescPt_, McZ_rescEta_, McZ_rescPhi_, McZ_rescY_;
00148
00149 int probe_nClus_[nEntries_arr_];
00150 int tag_q_[nEntries_arr_];
00151 double tag_pt_[nEntries_arr_], tag_eta_[nEntries_arr_], tag_phi_[nEntries_arr_];
00152
00153
00154
00155
00156 double tag_rescPt_[nEntries_arr_], tag_rescEta_[nEntries_arr_], tag_rescPhi_[nEntries_arr_];
00157 double tag_sIhIh_[nEntries_arr_], tag_dPhiIn_[nEntries_arr_], tag_dEtaIn_[nEntries_arr_];
00158 double tag_trckIso_[nEntries_arr_], tag_ecalIso_[nEntries_arr_], tag_hcalIso_[nEntries_arr_];
00159 double tag_e2x5Max_[nEntries_arr_], tag_e1x5Max_[nEntries_arr_], tag_e5x5_[nEntries_arr_];
00160 double tag_hoe_[nEntries_arr_], tag_eop_[nEntries_arr_], tag_pin_[nEntries_arr_], tag_pout_[nEntries_arr_];
00161 int probe_q_[nEntries_arr_];
00162 double probe_pt_[nEntries_arr_], probe_eta_[nEntries_arr_], probe_phi_[nEntries_arr_];
00163 double probe_rescPt_[nEntries_arr_], probe_rescEta_[nEntries_arr_], probe_rescPhi_[nEntries_arr_];
00164 double probe_sIhIh_[nEntries_arr_], probe_dPhiIn_[nEntries_arr_], probe_dEtaIn_[nEntries_arr_];
00165 double probe_trckIso_[nEntries_arr_], probe_ecalIso_[nEntries_arr_], probe_hcalIso_[nEntries_arr_];
00166 double probe_e2x5Max_[nEntries_arr_], probe_e1x5Max_[nEntries_arr_], probe_e5x5_[nEntries_arr_];
00167 double probe_hoe_[nEntries_arr_], probe_eop_[nEntries_arr_], probe_pin_[nEntries_arr_], probe_pout_[nEntries_arr_];
00168 double Z_pt_[nEntries_arr_], Z_eta_[nEntries_arr_], Z_phi_[nEntries_arr_], Z_m_[nEntries_arr_], Z_y_[nEntries_arr_];
00169 double Z_rescPt_[nEntries_arr_], Z_rescEta_[nEntries_arr_], Z_rescPhi_[nEntries_arr_], Z_rescM_[nEntries_arr_], Z_rescY_[nEntries_arr_];
00170 double Z_probe_dPhi_[nEntries_arr_];
00171 double ErsatzV1CaloMEt_[nEntries_arr_], ErsatzV1CaloMt_[nEntries_arr_], ErsatzV1CaloMEtPhi_[nEntries_arr_];
00172 double ErsatzV2CaloMEt_[nEntries_arr_], ErsatzV2CaloMEtPhi_[nEntries_arr_], ErsatzV2CaloMt_[nEntries_arr_];
00173 double ErsatzV3CaloMEt_[nEntries_arr_], ErsatzV3CaloMEtPhi_[nEntries_arr_], ErsatzV3CaloMt_[nEntries_arr_];
00174 double ErsatzV4CaloMEt_[nEntries_arr_], ErsatzV4CaloMEtPhi_[nEntries_arr_], ErsatzV4CaloMt_[nEntries_arr_];
00175 double ErsatzV1T1MEt_[nEntries_arr_], ErsatzV1T1Mt_[nEntries_arr_], ErsatzV1T1MEtPhi_[nEntries_arr_];
00176 double ErsatzV1PfMEt_[nEntries_arr_], ErsatzV1PfMt_[nEntries_arr_], ErsatzV1PfMEtPhi_[nEntries_arr_];
00177 double ErsatzV1TcMEt_[nEntries_arr_], ErsatzV1TcMt_[nEntries_arr_], ErsatzV1TcMEtPhi_[nEntries_arr_];
00178 double ErsatzV1_Mesc_[nEntries_arr_], ErsatzV1_rescMesc_[nEntries_arr_];
00179 double ErsatzV2_Mesc_[nEntries_arr_], ErsatzV2_rescMesc_[nEntries_arr_];
00180 double ErsatzV3_Mesc_[nEntries_arr_], ErsatzV3_rescMesc_[nEntries_arr_];
00181 double ErsatzV4_Mesc_[nEntries_arr_], ErsatzV4_rescMesc_[nEntries_arr_];
00182
00183 double McElec_pt_[nEntries_arr_], McElec_eta_[nEntries_arr_], McElec_phi_[nEntries_arr_];
00184 double McElec_rescPt_[nEntries_arr_], McElec_rescEta_[nEntries_arr_], McElec_rescPhi_[nEntries_arr_];
00185 double McProbe_pt_[nEntries_arr_], McProbe_eta_[nEntries_arr_], McProbe_phi_[nEntries_arr_];
00186 double McProbe_rescPt_[nEntries_arr_], McProbe_rescEta_[nEntries_arr_], McProbe_rescPhi_[nEntries_arr_];
00187 double McElecProbe_dPhi_[nEntries_arr_], McElecProbe_dEta_[nEntries_arr_], McElecProbe_dR_[nEntries_arr_];
00188
00189 double probe_d_MCE_SCE_[nEntries_arr_];
00190 double probe_sc_pt_[nEntries_arr_], probe_sc_eta_[nEntries_arr_], probe_sc_phi_[nEntries_arr_];
00191 double probe_sc_E_[nEntries_arr_], probe_sc_rawE_[nEntries_arr_], probe_sc_nClus_[nEntries_arr_];
00192 double probe_scV2_E_[nEntries_arr_];
00193 double probe_scV3_E_[nEntries_arr_];
00194 double probe_scV4_E_[nEntries_arr_];
00195
00196 int iComb_;
00197 };
00198 #endif
00199