ATLAS_2013_I1230812.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/ZFinder.hh" 00004 #include "Rivet/Projections/FastJets.hh" 00005 #include "Rivet/Projections/VetoedFinalState.hh" 00006 00007 namespace Rivet { 00008 00009 00010 /// Z + jets in pp at 7 TeV (combined channel / base class) 00011 /// @note This base class contains a "mode" variable for combined, e, and mu channel derived classes 00012 class ATLAS_2013_I1230812 : public Analysis { 00013 public: 00014 00015 /// @name Constructors etc. 00016 //@{ 00017 00018 /// Constructor 00019 ATLAS_2013_I1230812(string name="ATLAS_2013_I1230812") 00020 : Analysis(name) 00021 { 00022 // This class uses the combined e+mu mode 00023 _mode = 1; 00024 } 00025 00026 //@} 00027 00028 00029 /// Book histograms and initialise projections before the run 00030 void init() { 00031 // Determine the e/mu decay channels used 00032 /// @todo Note that Zs are accepted with any rapidity: the cuts are on the e/mu: is this correct? 00033 Cut pt20 = Cuts::pT >= 20.0*GeV; 00034 if (_mode == 1) { 00035 // Combined 00036 ZFinder zfinder(FinalState(-2.5, 2.5), pt20, PID::ELECTRON, 66*GeV, 116*GeV); 00037 addProjection(zfinder, "zfinder"); 00038 } else if (_mode == 2) { 00039 // Electron 00040 Cut eta_e = Cuts::abseta < 1.37 || Cuts::absetaIn(1.52, 2.47); 00041 ZFinder zfinder(FinalState(eta_e), pt20, PID::ELECTRON, 66*GeV, 116*GeV); 00042 addProjection(zfinder, "zfinder"); 00043 } else if (_mode == 3) { 00044 // Muon 00045 ZFinder zfinder(FinalState(Cuts::abseta < 2.4), pt20, PID::MUON, 66*GeV, 116*GeV); 00046 addProjection(zfinder, "zfinder"); 00047 } else { 00048 MSG_ERROR("Unknown decay channel mode!!!"); 00049 } 00050 00051 // Define veto FS in order to prevent Z-decay products entering the jet algorithm 00052 VetoedFinalState had_fs; 00053 had_fs.addVetoOnThisFinalState(getProjection<ZFinder>("zfinder")); 00054 FastJets jets(had_fs, FastJets::ANTIKT, 0.4); 00055 jets.useInvisibles(true); 00056 addProjection(jets, "jets"); 00057 00058 _h_njet_incl = bookHisto1D( 1, 1, _mode); 00059 _h_njet_incl_ratio = bookScatter2D(2, 1, _mode, true); 00060 _h_njet_excl = bookHisto1D( 3, 1, _mode); 00061 _h_njet_excl_ratio = bookScatter2D(4, 1, _mode, true); 00062 _h_njet_excl_pt150 = bookHisto1D( 5, 1, _mode); 00063 _h_njet_excl_pt150_ratio = bookScatter2D(6, 1, _mode, true); 00064 _h_njet_excl_vbf = bookHisto1D ( 7, 1, _mode); 00065 _h_njet_excl_vbf_ratio = bookScatter2D(8, 1, _mode, true); 00066 _h_ptlead = bookHisto1D( 9, 1, _mode); 00067 _h_ptseclead = bookHisto1D( 10, 1, _mode); 00068 _h_ptthirdlead = bookHisto1D( 11, 1, _mode); 00069 _h_ptfourthlead = bookHisto1D( 12, 1, _mode); 00070 _h_ptlead_excl = bookHisto1D( 13, 1, _mode); 00071 _h_pt_ratio = bookHisto1D( 14, 1, _mode); 00072 _h_pt_z = bookHisto1D( 15, 1, _mode); 00073 _h_pt_z_excl = bookHisto1D( 16, 1, _mode); 00074 _h_ylead = bookHisto1D( 17, 1, _mode); 00075 _h_yseclead = bookHisto1D( 18, 1, _mode); 00076 _h_ythirdlead = bookHisto1D( 19, 1, _mode); 00077 _h_yfourthlead = bookHisto1D( 20, 1, _mode); 00078 _h_deltay = bookHisto1D( 21, 1, _mode); 00079 _h_mass = bookHisto1D( 22, 1, _mode); 00080 _h_deltaphi = bookHisto1D( 23, 1, _mode); 00081 _h_deltaR = bookHisto1D( 24, 1, _mode); 00082 _h_ptthirdlead_vbf = bookHisto1D( 25, 1, _mode); 00083 _h_ythirdlead_vbf = bookHisto1D( 26, 1, _mode); 00084 _h_ht = bookHisto1D( 27, 1, _mode); 00085 _h_st = bookHisto1D( 28, 1, _mode); 00086 } 00087 00088 00089 /// Perform the per-event analysis 00090 void analyze(const Event& event) { 00091 00092 const ZFinder& zfinder = applyProjection<ZFinder>(event, "zfinder"); 00093 if (zfinder.constituents().size()!=2) vetoEvent; 00094 00095 FourMomentum z = zfinder.bosons()[0].momentum(); 00096 FourMomentum lp = zfinder.constituents()[0].momentum(); 00097 FourMomentum lm = zfinder.constituents()[1].momentum(); 00098 if (deltaR(lp, lm)<0.2) vetoEvent; 00099 00100 Jets jets; 00101 /// @todo Replace with a Cut passed to jetsByPt 00102 foreach(const Jet& jet, applyProjection<FastJets>(event, "jets").jetsByPt(30*GeV)) { 00103 FourMomentum jmom = jet.momentum(); 00104 if (jmom.absrap() < 4.4 && deltaR(lp, jmom) > 0.5 && deltaR(lm, jmom) > 0.5) { 00105 jets.push_back(jet); 00106 } 00107 } 00108 00109 const double weight = event.weight(); 00110 00111 // Fill jet multiplicities 00112 for (size_t ijet = 0; ijet <= jets.size(); ++ijet) { 00113 _h_njet_incl->fill(ijet, weight); 00114 } 00115 _h_njet_excl->fill(jets.size(), weight); 00116 00117 // Require at least one jet 00118 if (jets.size() >= 1) { 00119 // Leading jet histos 00120 const double ptlead = jets[0].pT()/GeV; 00121 const double yabslead = fabs(jets[0].rapidity()); 00122 const double ptz = z.pT()/GeV; 00123 _h_ptlead->fill(ptlead, weight); 00124 _h_ylead ->fill(yabslead, weight); 00125 _h_pt_z ->fill(ptz, weight); 00126 // Fill jet multiplicities 00127 if (ptlead > 150) _h_njet_excl_pt150->fill(jets.size(), weight); 00128 00129 // Loop over selected jets, fill inclusive distributions 00130 double st=0; 00131 double ht=lp.pT()/GeV+lm.pT()/GeV; 00132 for (size_t ijet = 0; ijet < jets.size(); ++ijet) { 00133 ht+=jets[ijet].pT()/GeV; 00134 st+=jets[ijet].pT()/GeV; 00135 } 00136 _h_ht->fill(ht, weight); 00137 _h_st->fill(st, weight); 00138 00139 // Require exactly one jet 00140 if (jets.size() == 1) { 00141 _h_ptlead_excl->fill(ptlead, weight); 00142 _h_pt_z_excl ->fill(ptz, weight); 00143 } 00144 } 00145 00146 00147 // Require at least two jets 00148 if (jets.size() >= 2) { 00149 // Second jet histos 00150 const double ptlead = jets[0].pT()/GeV; 00151 const double pt2ndlead = jets[1].pT()/GeV; 00152 const double ptratio = pt2ndlead/ptlead; 00153 const double yabs2ndlead = fabs(jets[1].rapidity()); 00154 _h_ptseclead->fill(pt2ndlead, weight); 00155 _h_yseclead->fill( yabs2ndlead, weight); 00156 _h_pt_ratio->fill( ptratio, weight); 00157 00158 // Dijet histos 00159 const double deltaphi = fabs(deltaPhi(jets[1], jets[0])); 00160 const double deltarap = fabs(jets[0].rapidity() - jets[1].rapidity()) ; 00161 const double deltar = fabs(deltaR(jets[0], jets[1], RAPIDITY)); 00162 const double mass = (jets[0].momentum() + jets[1].momentum()).mass()/GeV; 00163 _h_mass->fill( mass, weight); 00164 _h_deltay->fill( deltarap, weight); 00165 _h_deltaphi->fill(deltaphi, weight); 00166 _h_deltaR->fill( deltar, weight); 00167 00168 if (mass > 350 && deltarap > 3) _h_njet_excl_vbf->fill(jets.size(), weight); 00169 } 00170 00171 // Require at least three jets 00172 if (jets.size() >= 3) { 00173 // Third jet histos 00174 const double pt3rdlead = jets[2].pT()/GeV; 00175 const double yabs3rdlead = fabs(jets[2].rapidity()); 00176 _h_ptthirdlead->fill(pt3rdlead, weight); 00177 _h_ythirdlead->fill( yabs3rdlead, weight); 00178 00179 //Histos after VBF preselection 00180 const double deltarap = fabs(jets[0].rapidity() - jets[1].rapidity()) ; 00181 const double mass = (jets[0].momentum() + jets[1].momentum()).mass(); 00182 if (mass > 350 && deltarap > 3) { 00183 _h_ptthirdlead_vbf->fill(pt3rdlead, weight); 00184 _h_ythirdlead_vbf->fill( yabs3rdlead, weight); 00185 } 00186 } 00187 00188 // Require at least four jets 00189 if (jets.size() >= 4) { 00190 // Fourth jet histos 00191 const double pt4thlead = jets[3].pT()/GeV; 00192 const double yabs4thlead = fabs(jets[3].rapidity()); 00193 _h_ptfourthlead->fill(pt4thlead, weight); 00194 _h_yfourthlead->fill( yabs4thlead, weight); 00195 } 00196 } 00197 00198 /// @name Ratio calculator util functions 00199 //@{ 00200 00201 /// Calculate the efficiency error, being careful about div-by-zero 00202 double err_incl(const HistoBin1D &M, const HistoBin1D &N, bool hasWeights) { 00203 double r = safediv(M.sumW(), N.sumW()); 00204 if (hasWeights) { // use F. James's approximation for weighted events 00205 return sqrt( safediv((1 - 2 * r) * M.sumW2() + r * r * N.sumW2(), N.sumW() * N.sumW()) ); 00206 } 00207 return sqrt( safediv(r * (1 - r), N.sumW()) ); 00208 } 00209 00210 /// Calculate the ratio error, being careful about div-by-zero 00211 double err_excl(const HistoBin1D &A, const HistoBin1D &B) { 00212 double r = safediv(A.sumW(), B.sumW()); 00213 double dAsquared = safediv(A.sumW2(), A.sumW() * A.sumW()); // squared relative error of A 00214 double dBsquared = safediv(B.sumW2(), B.sumW() * B.sumW()); // squared relative error of B 00215 return r * sqrt(dAsquared + dBsquared); 00216 } 00217 00218 00219 //@} 00220 00221 void finalize() { 00222 bool hasWeights = _h_njet_incl->effNumEntries() != _h_njet_incl->numEntries(); 00223 for (size_t i = 0; i < 6; ++i) { 00224 _h_njet_incl_ratio->point(i).setY(safediv(_h_njet_incl->bin(i + 1).sumW(), _h_njet_incl->bin(i).sumW()), 00225 err_incl(_h_njet_incl->bin(i + 1), _h_njet_incl->bin(i), hasWeights)); 00226 _h_njet_excl_ratio->point(i).setY(safediv(_h_njet_excl->bin(i + 1).sumW(), _h_njet_excl->bin(i).sumW()), 00227 err_excl(_h_njet_excl->bin(i + 1), _h_njet_excl->bin(i))); 00228 if (i >= 1) { 00229 _h_njet_excl_pt150_ratio->point(i - 1).setY(safediv(_h_njet_excl_pt150->bin(i).sumW(), _h_njet_excl_pt150->bin(i - 1).sumW()), 00230 err_excl(_h_njet_excl_pt150->bin(i), _h_njet_excl_pt150->bin(i - 1))); 00231 if (i >= 2) { 00232 _h_njet_excl_vbf_ratio->point(i - 2).setY(safediv(_h_njet_excl_vbf->bin(i).sumW(), _h_njet_excl_vbf->bin(i - 1).sumW()), 00233 err_excl(_h_njet_excl_vbf->bin(i), _h_njet_excl_vbf->bin(i - 1))); 00234 } 00235 } 00236 } 00237 00238 const double xs = crossSectionPerEvent()/picobarn; 00239 scale(_h_njet_incl , xs); 00240 scale(_h_njet_excl , xs); 00241 scale(_h_njet_excl_pt150, xs); 00242 scale(_h_njet_excl_vbf , xs); 00243 scale(_h_ptlead , xs); 00244 scale(_h_ptseclead , xs); 00245 scale(_h_ptthirdlead , xs); 00246 scale(_h_ptfourthlead , xs); 00247 scale(_h_ptlead_excl , xs); 00248 scale(_h_pt_ratio , xs); 00249 scale(_h_pt_z , xs); 00250 scale(_h_pt_z_excl , xs); 00251 scale(_h_ylead , xs); 00252 scale(_h_yseclead , xs); 00253 scale(_h_ythirdlead , xs); 00254 scale(_h_yfourthlead , xs); 00255 scale(_h_deltay , xs); 00256 scale(_h_mass , xs); 00257 scale(_h_deltaphi , xs); 00258 scale(_h_deltaR , xs); 00259 scale(_h_ptthirdlead_vbf, xs); 00260 scale(_h_ythirdlead_vbf , xs); 00261 scale(_h_ht , xs); 00262 scale(_h_st , xs); 00263 } 00264 00265 //@} 00266 00267 00268 protected: 00269 00270 size_t _mode; 00271 00272 00273 private: 00274 00275 Scatter2DPtr _h_njet_incl_ratio; 00276 Scatter2DPtr _h_njet_excl_ratio; 00277 Scatter2DPtr _h_njet_excl_pt150_ratio; 00278 Scatter2DPtr _h_njet_excl_vbf_ratio; 00279 Histo1DPtr _h_njet_incl; 00280 Histo1DPtr _h_njet_excl; 00281 Histo1DPtr _h_njet_excl_pt150; 00282 Histo1DPtr _h_njet_excl_vbf; 00283 Histo1DPtr _h_ptlead; 00284 Histo1DPtr _h_ptseclead; 00285 Histo1DPtr _h_ptthirdlead; 00286 Histo1DPtr _h_ptfourthlead; 00287 Histo1DPtr _h_ptlead_excl; 00288 Histo1DPtr _h_pt_ratio; 00289 Histo1DPtr _h_pt_z; 00290 Histo1DPtr _h_pt_z_excl; 00291 Histo1DPtr _h_ylead; 00292 Histo1DPtr _h_yseclead; 00293 Histo1DPtr _h_ythirdlead; 00294 Histo1DPtr _h_yfourthlead; 00295 Histo1DPtr _h_deltay; 00296 Histo1DPtr _h_mass; 00297 Histo1DPtr _h_deltaphi; 00298 Histo1DPtr _h_deltaR; 00299 Histo1DPtr _h_ptthirdlead_vbf; 00300 Histo1DPtr _h_ythirdlead_vbf; 00301 Histo1DPtr _h_ht; 00302 Histo1DPtr _h_st; 00303 }; 00304 00305 00306 00307 class ATLAS_2013_I1230812_EL : public ATLAS_2013_I1230812 { 00308 public: 00309 ATLAS_2013_I1230812_EL() 00310 : ATLAS_2013_I1230812("ATLAS_2013_I1230812_EL") 00311 { 00312 _mode = 2; 00313 } 00314 }; 00315 00316 00317 00318 class ATLAS_2013_I1230812_MU : public ATLAS_2013_I1230812 { 00319 public: 00320 ATLAS_2013_I1230812_MU() 00321 : ATLAS_2013_I1230812("ATLAS_2013_I1230812_MU") 00322 { 00323 _mode = 3; 00324 } 00325 }; 00326 00327 00328 00329 DECLARE_RIVET_PLUGIN(ATLAS_2013_I1230812); 00330 DECLARE_RIVET_PLUGIN(ATLAS_2013_I1230812_EL); 00331 DECLARE_RIVET_PLUGIN(ATLAS_2013_I1230812_MU); 00332 } Generated on Wed Oct 7 2015 12:09:11 for The Rivet MC analysis system by ![]() |