CMS_2013_I1224539_WJET.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/FinalState.hh" 00004 #include "Rivet/Projections/FastJets.hh" 00005 #include "Rivet/Projections/WFinder.hh" 00006 #include "Rivet/Projections/ZFinder.hh" 00007 #include "fastjet/tools/Filter.hh" 00008 #include "fastjet/tools/Pruner.hh" 00009 00010 namespace Rivet { 00011 00012 using namespace Cuts; 00013 00014 00015 class CMS_2013_I1224539_WJET : public Analysis { 00016 public: 00017 00018 /// @name Constructors etc. 00019 //@{ 00020 00021 /// Constructor 00022 CMS_2013_I1224539_WJET() 00023 : Analysis("CMS_2013_I1224539_WJET"), 00024 _filter(fastjet::Filter(fastjet::JetDefinition(fastjet::cambridge_algorithm, 0.3), fastjet::SelectorNHardest(3))), 00025 _trimmer(fastjet::Filter(fastjet::JetDefinition(fastjet::kt_algorithm, 0.2), fastjet::SelectorPtFractionMin(0.03))), 00026 _pruner(fastjet::Pruner(fastjet::cambridge_algorithm, 0.1, 0.5)) 00027 { } 00028 00029 //@} 00030 00031 00032 public: 00033 00034 /// @name Analysis methods 00035 //@{ 00036 00037 /// Book histograms and initialise projections before the run 00038 void init() { 00039 FinalState fs(-2.4, 2.4, 0*GeV); 00040 addProjection(fs, "FS"); 00041 00042 // Find W's with pT > 120, MET > 50 00043 WFinder wfinder(fs, etaIn(-2.4,2.4) & (pT >= 80.0*GeV), PID::ELECTRON, 50*GeV, 1000*GeV, 50.0*GeV, 00044 0.2, WFinder::CLUSTERNODECAY, WFinder::NOTRACK, WFinder::TRANSMASS); 00045 addProjection(wfinder, "WFinder"); 00046 00047 // W+jet jet collections 00048 addProjection(FastJets(wfinder.remainingFinalState(), FastJets::ANTIKT, 0.7), "JetsAK7_wj"); 00049 addProjection(FastJets(wfinder.remainingFinalState(), FastJets::CAM, 0.8), "JetsCA8_wj"); 00050 addProjection(FastJets(wfinder.remainingFinalState(), FastJets::CAM, 1.2), "JetsCA12_wj"); 00051 00052 // Histograms 00053 /// @note These are 2D histos rendered into slices 00054 const int wjetsOffset = 51; 00055 for (size_t i = 0; i < N_PT_BINS_vj; ++i) { 00056 _h_ungroomedJetMass_AK7_wj[i] = bookHisto1D(wjetsOffset+i+1+0*N_PT_BINS_vj, 1, 1); 00057 _h_filteredJetMass_AK7_wj[i] = bookHisto1D(wjetsOffset+i+1+1*N_PT_BINS_vj, 1, 1); 00058 _h_trimmedJetMass_AK7_wj[i] = bookHisto1D(wjetsOffset+i+1+2*N_PT_BINS_vj, 1, 1); 00059 _h_prunedJetMass_AK7_wj[i] = bookHisto1D(wjetsOffset+i+1+3*N_PT_BINS_vj, 1, 1); 00060 _h_prunedJetMass_CA8_wj[i] = bookHisto1D(wjetsOffset+i+1+4*N_PT_BINS_vj, 1, 1); 00061 if (i > 0) _h_filteredJetMass_CA12_wj[i] = bookHisto1D(wjetsOffset+i+5*N_PT_BINS_vj, 1, 1); 00062 } 00063 } 00064 00065 00066 bool isBackToBack_wj(const WFinder& wf, const fastjet::PseudoJet& psjet) { 00067 const FourMomentum& w = wf.bosons()[0].momentum(); 00068 const FourMomentum& l1 = wf.constituentLeptons()[0].momentum(); 00069 const FourMomentum& l2 = wf.constituentNeutrinos()[0].momentum(); 00070 /// @todo We should make FourMomentum know how to construct itself from a PseudoJet 00071 const FourMomentum jmom(psjet.e(), psjet.px(), psjet.py(), psjet.pz()); 00072 return (deltaPhi(w, jmom) > 2.0 && deltaR(l1, jmom) > 1.0 && deltaPhi(l2, jmom) > 0.4); 00073 } 00074 00075 00076 // Find the pT histogram bin index for value pt (in GeV), to hack a 2D histogram equivalent 00077 /// @todo Use a YODA axis/finder alg when available 00078 size_t findPtBin(double ptJ) { 00079 const double ptBins_vj[N_PT_BINS_vj+1] = { 125.0, 150.0, 220.0, 300.0, 450.0 }; 00080 for (size_t ibin = 0; ibin < N_PT_BINS_vj; ++ibin) { 00081 if (inRange(ptJ, ptBins_vj[ibin], ptBins_vj[ibin+1])) return ibin; 00082 } 00083 return N_PT_BINS_vj; 00084 } 00085 00086 00087 /// Perform the per-event analysis 00088 void analyze(const Event& event) { 00089 const double weight = event.weight(); 00090 00091 // Get the W 00092 const WFinder& wfinder = applyProjection<WFinder>(event, "WFinder"); 00093 if (wfinder.bosons().size() != 1) vetoEvent; 00094 const Particle& w = wfinder.bosons()[0]; 00095 const Particle& l = wfinder.constituentLeptons()[0]; 00096 00097 // Require a fairly high-pT W and charged lepton 00098 if (l.pT() < 80*GeV || w.pT() < 120*GeV) vetoEvent; 00099 00100 // Get the pseudojets. 00101 const PseudoJets& psjetsCA8_wj = applyProjection<FastJets>(event, "JetsCA8_wj").pseudoJetsByPt( 50.0*GeV ); 00102 const PseudoJets& psjetsCA12_wj = applyProjection<FastJets>(event, "JetsCA12_wj").pseudoJetsByPt( 50.0*GeV ); 00103 00104 // AK7 jets 00105 const PseudoJets& psjetsAK7_wj = applyProjection<FastJets>(event, "JetsAK7_wj").pseudoJetsByPt( 50.0*GeV ); 00106 if (!psjetsAK7_wj.empty()) { 00107 // Get the leading jet and make sure it's back-to-back with the W 00108 const fastjet::PseudoJet& j0 = psjetsAK7_wj[0]; 00109 if (isBackToBack_wj(wfinder, j0)) { 00110 const size_t njetBin = findPtBin(j0.pt()/GeV); 00111 if (njetBin < N_PT_BINS_vj) { 00112 fastjet::PseudoJet filtered0 = _filter(j0); 00113 fastjet::PseudoJet trimmed0 = _trimmer(j0); 00114 fastjet::PseudoJet pruned0 = _pruner(j0); 00115 _h_ungroomedJetMass_AK7_wj[njetBin]->fill(j0.m()/GeV, weight); 00116 _h_filteredJetMass_AK7_wj[njetBin]->fill(filtered0.m()/GeV, weight); 00117 _h_trimmedJetMass_AK7_wj[njetBin]->fill(trimmed0.m()/GeV, weight); 00118 _h_prunedJetMass_AK7_wj[njetBin]->fill(pruned0.m()/GeV, weight); 00119 } 00120 } 00121 } 00122 00123 // CA8 jets 00124 if (!psjetsCA8_wj.empty()) { 00125 // Get the leading jet and make sure it's back-to-back with the W 00126 const fastjet::PseudoJet& j0 = psjetsCA8_wj[0]; 00127 if (isBackToBack_wj(wfinder, j0)) { 00128 const size_t njetBin = findPtBin(j0.pt()/GeV); 00129 if (njetBin < N_PT_BINS_vj) { 00130 fastjet::PseudoJet pruned0 = _pruner(j0); 00131 _h_prunedJetMass_CA8_wj[njetBin]->fill(pruned0.m()/GeV, weight); 00132 } 00133 } 00134 } 00135 00136 // CA12 jets 00137 if (!psjetsCA12_wj.empty()) { 00138 // Get the leading jet and make sure it's back-to-back with the W 00139 const fastjet::PseudoJet& j0 = psjetsCA12_wj[0]; 00140 if (isBackToBack_wj(wfinder, j0)) { 00141 const size_t njetBin = findPtBin(j0.pt()/GeV); 00142 if (njetBin < N_PT_BINS_vj&&njetBin>0) { 00143 fastjet::PseudoJet filtered0 = _filter(j0); 00144 _h_filteredJetMass_CA12_wj[njetBin]->fill( filtered0.m() / GeV, weight); 00145 } 00146 } 00147 } 00148 00149 } 00150 00151 00152 /// Normalise histograms etc., after the run 00153 void finalize() { 00154 const double normalizationVal = 1000; 00155 for (size_t i = 0; i < N_PT_BINS_vj; ++i) { 00156 normalize(_h_ungroomedJetMass_AK7_wj[i], normalizationVal); 00157 normalize(_h_filteredJetMass_AK7_wj[i], normalizationVal); 00158 normalize(_h_trimmedJetMass_AK7_wj[i], normalizationVal); 00159 normalize(_h_prunedJetMass_AK7_wj[i], normalizationVal); 00160 normalize(_h_prunedJetMass_CA8_wj[i], normalizationVal); 00161 if (i > 0) normalize( _h_filteredJetMass_CA12_wj[i], normalizationVal); 00162 } 00163 } 00164 00165 //@} 00166 00167 00168 private: 00169 00170 /// @name FastJet grooming tools (configured in constructor init list) 00171 //@{ 00172 const fastjet::Filter _filter; 00173 const fastjet::Filter _trimmer; 00174 const fastjet::Pruner _pruner; 00175 //@} 00176 00177 00178 /// @name Histograms 00179 //@{ 00180 enum BINS_vj { PT_125_150_vj=0, PT_150_220_vj, PT_220_300_vj, PT_300_450_vj, N_PT_BINS_vj }; 00181 Histo1DPtr _h_ungroomedJetMass_AK7_wj[N_PT_BINS_vj]; 00182 Histo1DPtr _h_filteredJetMass_AK7_wj[N_PT_BINS_vj]; 00183 Histo1DPtr _h_trimmedJetMass_AK7_wj[N_PT_BINS_vj]; 00184 Histo1DPtr _h_prunedJetMass_AK7_wj[N_PT_BINS_vj]; 00185 Histo1DPtr _h_prunedJetMass_CA8_wj[N_PT_BINS_vj]; 00186 Histo1DPtr _h_filteredJetMass_CA12_wj[N_PT_BINS_vj]; 00187 //@} 00188 00189 }; 00190 00191 00192 // The hook for the plugin system 00193 DECLARE_RIVET_PLUGIN(CMS_2013_I1224539_WJET); 00194 00195 } Generated on Tue Sep 30 2014 19:45:43 for The Rivet MC analysis system by ![]() |