00001 #ifndef smartselectionmonitor_hzz_hh
00002 #define smartselectionmonitor_hzz_hh
00003
00004 #include <PhysicsObjects.h>
00005 #include <SmartSelectionMonitor.h>
00006 #include <Utils.h>
00007
00008 #include <type_traits>
00009
00010 struct base_evt{
00011 TString s_jetCat;
00012 TString s_lepCat;
00013 double MT;
00014 double M_Boson;
00015 double pT_Boson;
00016 double eta_Boson;
00017 double phi_Boson;
00018 double MET;
00019 double METphi;
00020 int nJets;
00021 int runNumber;
00022 int nVtx;
00023 double deltaPhi_MET_Jet;
00024 double deltaPhi_MET_Boson;
00025 double METoPT;
00026 double METpar;
00027 double METperp;
00028 double MET_significance;
00029 double rho;
00030 double jet0_pT;
00031 double jet1_pT;
00032 double jet2_pT;
00033 double jet3_pT;
00034 double HT_selJets;
00035
00036 void Fill_baseEvt(TString s_jetCat_, TString s_lepCat_, TLorentzVector boson_, TLorentzVector METVector_, std::vector<Jet> const &selJets_, double run_, double PV_npvsGood_, double fixedGridRhoFastjetAll_, double MET_significance_){
00037 s_jetCat = s_jetCat_;
00038 s_lepCat = s_lepCat_;
00039 MT = sqrt(pow(sqrt(pow(boson_.Pt(),2)+pow(boson_.M(),2))+sqrt(pow(METVector_.Pt(),2)+pow(91.1876,2)),2)-pow((boson_+METVector_).Pt(),2));;
00040 M_Boson = boson_.M();
00041 pT_Boson = boson_.Pt();
00042 eta_Boson = boson_.Eta();
00043 phi_Boson = boson_.Phi();
00044 MET = METVector_.Pt();
00045 METphi = METVector_.Phi();
00046 nJets = selJets_.size();
00047 runNumber = run_;
00048 nVtx = PV_npvsGood_;
00049 double minDeltaPhiJetMET = 4.;
00050 for(int i = 0 ; i < int(selJets_.size()) ; i++){
00051 if (fabs(utils::deltaPhi(selJets_[i].p4, METVector_)) < minDeltaPhiJetMET) minDeltaPhiJetMET = fabs(utils::deltaPhi(selJets_[i].p4, METVector_));
00052 }
00053 deltaPhi_MET_Jet = minDeltaPhiJetMET;
00054 deltaPhi_MET_Boson = fabs(utils::deltaPhi(boson_, METVector_));
00055 METoPT = METVector_.Pt()/(1.*boson_.Pt());
00056 double METorth_ =0, METpar_ = 0;
00057 TVector3 bosonDir = boson_.Vect();
00058 if (bosonDir.Perp()>0){
00059 TVector3 bosonDir2D(bosonDir.x()/bosonDir.Perp(), bosonDir.y()/bosonDir.Perp(), 0);
00060 TVector3 bosonPerp2D(-bosonDir2D.y(),bosonDir2D.x(),0);
00061 TVector3 METVector3D = METVector_.Vect();
00062 METpar_ = - METVector3D.Dot(bosonDir2D);
00063 METorth_ = METVector3D.Dot(bosonPerp2D);
00064 }
00065 METpar = METpar_;
00066 METperp = METorth_;
00067 MET_significance = MET_significance_;
00068 rho = fixedGridRhoFastjetAll_;
00069 jet0_pT = ((selJets_.size() > 0) ? selJets_[0].p4.Pt() : 0);
00070 jet1_pT = ((selJets_.size() > 1) ? selJets_[1].p4.Pt() : 0);
00071 jet2_pT = ((selJets_.size() > 2) ? selJets_[2].p4.Pt() : 0);
00072 jet3_pT = ((selJets_.size() > 3) ? selJets_[3].p4.Pt() : 0);
00073 double allSelJets_HT =0.;
00074 for (unsigned int i =0; i < selJets_.size(); i++) allSelJets_HT += selJets_[i].p4.Pt();
00075 HT_selJets = allSelJets_HT;
00076 }
00077
00078 };
00079
00080 struct evt : base_evt{
00081 double lep1pT;
00082 double lep2pT;
00083 double lep1eta;
00084 double lep2eta;
00085
00086 void Fill_evt(
00087 TString s_jetCat_, TString s_lepCat_, TLorentzVector boson_,
00088 TLorentzVector METVector_, std::vector<Jet> const &selJets_,
00089 double run_, double PV_npvsGood_, double fixedGridRhoFastjetAll_,
00090 double MET_significance_, std::vector<Lepton> const &selLeptons_) {
00091
00092 Fill_baseEvt(s_jetCat_, s_lepCat_, boson_, METVector_, selJets_, run_,
00093 PV_npvsGood_, fixedGridRhoFastjetAll_, MET_significance_);
00094
00095 if (selLeptons_.size() > 1) {
00096 lep1pT = selLeptons_[0].p4.Pt();
00097 lep2pT = selLeptons_[1].p4.Pt();
00098 lep1eta = selLeptons_[0].p4.Eta();
00099 lep2eta = selLeptons_[1].p4.Eta();
00100 }
00101 }
00102 };
00103
00104 struct photon_evt : base_evt{
00105 double HoE;
00106 double sigmaIEtaIEta;
00107 double chIsoRhoCorr;
00108 double neuIsoRhoCorr;
00109 double phoIsoRhoCorr;
00110 double R9;
00111
00112 void Fill_photonEvt(TString s_jetCat_, TString s_lepCat_, TLorentzVector boson_, TLorentzVector METVector_, std::vector<Jet> const &selJets_, double run_, double PV_npvsGood_, double fixedGridRhoFastjetAll_, double MET_significance_, double HoE_ = -1., double sigmaIEtaIEta_ = -1., double chIsoRhoCorr_ = -1., double neuIsoRhoCorr_ = -1., double phoIsoRhoCorr_ = -1., double R9_ = -1.){
00113 Fill_baseEvt(s_jetCat_, s_lepCat_, boson_, METVector_, selJets_, run_, PV_npvsGood_, fixedGridRhoFastjetAll_, MET_significance_);
00114 HoE = HoE_;
00115 sigmaIEtaIEta = sigmaIEtaIEta_;
00116 chIsoRhoCorr = chIsoRhoCorr_;
00117 neuIsoRhoCorr = neuIsoRhoCorr_;
00118 phoIsoRhoCorr = phoIsoRhoCorr_;
00119 R9 = R9_;
00120 }
00121
00122
00123 };
00124
00125
00126
00127 class SmartSelectionMonitor_hzz : public SmartSelectionMonitor {
00128
00129 public:
00130
00131 SmartSelectionMonitor_hzz ();
00132
00133 SmartSelectionMonitor_hzz (std::vector<double> const &ptThresholds);
00134
00135
00136 bool declareHistos();
00137 bool declareHistos_InstrMET();
00138 bool declareHistos_NRB();
00139
00140
00141 template<class T> bool fillHistoForAllCategories(TString name, double variable, T currentEvt, TString tag, double weight, bool divideByBinWidth = true);
00142 template<class T> bool fill2DHistoForAllCategories(TString name, double variableX, double variableY, T currentEvt, TString tag, double weight);
00143 template<class T> bool fillProfileForAllCategories(TString name, double variableY, double variableX, T currentEvt, TString tag, double weight);
00144
00145
00146 template<class T> bool fillAnalysisHistos_common(T currentEvt, TString tag, double weight, bool divideByBinWidth = true);
00147 bool fillAnalysisHistos(evt currentEvt, TString tag, double weight, bool divideByBinWidth = true);
00148 bool fillAnalysisHistos(photon_evt currentEvt, TString tag, double weight, bool divideByBinWidth = true);
00149 bool fillPhotonIDHistos_InstrMET(photon_evt currentEvt, TString tag, double weight, bool divideByBinWidth = true);
00150 bool fillInstrMETControlRegionHisto(base_evt currentEvt, TString tag, double weight, bool divideByBinWidth = true);
00151
00152
00153 void WriteForSysts(TString systName, bool keepEverything);
00154
00155 private:
00156
00157 std::vector<double> ptThresholds_;
00158
00159 };
00160
00161 #endif