rivet is hosted by Hepforge, IPPP Durham
MC_WWJETS.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analyses/MC_JetAnalysis.hh"
00003 #include "Rivet/Projections/WFinder.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Projections/VetoedFinalState.hh"
00006 #include "Rivet/Tools/Logging.hh"
00007 #include "Rivet/Tools/ParticleIdUtils.hh"
00008 #include "Rivet/RivetYODA.hh"
00009 
00010 namespace Rivet {
00011 
00012 
00013   /// @brief MC validation analysis for W^+[enu]W^-[munu] + jets events
00014   class MC_WWJETS : public MC_JetAnalysis {
00015   public:
00016 
00017     /// Default constructor
00018     MC_WWJETS()
00019       : MC_JetAnalysis("MC_WWJETS", 4, "Jets")
00020     {    }
00021 
00022 
00023     /// @name Analysis methods
00024     //@{
00025 
00026     /// Book histograms
00027     void init() {
00028       FinalState fs;
00029       WFinder wenufinder(fs, -3.5, 3.5, 25.0*GeV, ELECTRON, 60.0*GeV, 100.0*GeV, 25.0*GeV, 0.2);
00030       addProjection(wenufinder, "WenuFinder");
00031 
00032       VetoedFinalState wmnuinput;
00033       wmnuinput.addVetoOnThisFinalState(wenufinder);
00034       WFinder wmnufinder(wmnuinput, -3.5, 3.5, 25.0*GeV, MUON, 60.0*GeV, 100.0*GeV, 25.0*GeV, 0.2);
00035       addProjection(wmnufinder, "WmnuFinder");
00036 
00037       VetoedFinalState jetinput;
00038       jetinput
00039           .addVetoOnThisFinalState(wenufinder)
00040           .addVetoOnThisFinalState(wmnufinder);
00041       FastJets jetpro(jetinput, FastJets::KT, 0.7);
00042       addProjection(jetpro, "Jets");
00043 
00044       // properties of the pair momentum
00045       _h_WW_pT = bookHisto1D("WW_pT", logspace(100, 1.0, 0.5*sqrtS()));
00046       _h_WW_pT_peak = bookHisto1D("WW_pT_peak", 25, 0.0, 25.0);
00047       _h_WW_eta = bookHisto1D("WW_eta", 40, -7.0, 7.0);
00048       _h_WW_phi = bookHisto1D("WW_phi", 25, 0.0, TWOPI);
00049       _h_WW_m = bookHisto1D("WW_m", logspace(100, 150.0, 180.0+0.25*sqrtS()));
00050 
00051       // correlations between the WW
00052       _h_WW_dphi = bookHisto1D("WW_dphi", 25, 0.0, PI);  /// @todo non-linear?
00053       _h_WW_deta = bookHisto1D("WW_deta", 25, -7.0, 7.0);
00054       _h_WW_dR = bookHisto1D("WW_dR", 25, 0.5, 7.0);
00055       _h_WW_dpT = bookHisto1D("WW_dpT", logspace(100, 1.0, 0.5*sqrtS()));
00056       _h_WW_costheta_planes = bookHisto1D("WW_costheta_planes", 25, -1.0, 1.0);
00057 
00058       /// @todo fuer WW: missing ET
00059 
00060       // properties of the W bosons
00061       _h_W_pT = bookHisto1D("W_pT", logspace(100, 10.0, 0.25*sqrtS()));
00062       _h_W_eta = bookHisto1D("W_eta", 70, -7.0, 7.0);
00063 
00064       // properties of the leptons
00065       _h_Wl_pT = bookHisto1D("Wl_pT", logspace(100, 30.0, 0.1
00066                                                       *sqrtS()));
00067       _h_Wl_eta = bookHisto1D("Wl_eta", 40, -3.5, 3.5);
00068 
00069       // correlations between the opposite charge leptons
00070       _h_WeWm_dphi = bookHisto1D("WeWm_dphi", 25, 0.0, PI);
00071       _h_WeWm_deta = bookHisto1D("WeWm_deta", 25, -5.0, 5.0);
00072       _h_WeWm_dR = bookHisto1D("WeWm_dR", 25, 0.5, 5.0);
00073       _h_WeWm_m = bookHisto1D("WeWm_m", 100, 0.0, 300.0);
00074 
00075       // correlations with jets
00076       _h_WW_jet1_deta = bookHisto1D("WW_jet1_deta", 70, -7.0, 7.0);
00077       _h_WW_jet1_dR = bookHisto1D("WW_jet1_dR", 25, 1.5, 7.0);
00078       _h_We_jet1_dR = bookHisto1D("We_jet1_dR", 25, 0.0, 7.0);
00079 
00080       // global stuff
00081       _h_HT = bookHisto1D("HT", logspace(100, 100.0, 0.5*sqrtS()));
00082       _h_jets_m_12 = bookHisto1D("jets_m_12", logspace(100, 1.0, 0.25*sqrtS()));
00083 
00084       MC_JetAnalysis::init();
00085     }
00086 
00087 
00088 
00089     /// Do the analysis
00090     void analyze(const Event & e) {
00091       const double weight = e.weight();
00092 
00093       const WFinder& wenufinder = applyProjection<WFinder>(e, "WenuFinder");
00094       if (wenufinder.bosons().size()!=1) {
00095         vetoEvent;
00096       }
00097 
00098       const WFinder& wmnufinder = applyProjection<WFinder>(e, "WmnuFinder");
00099       if (wmnufinder.bosons().size()!=1) {
00100         vetoEvent;
00101       }
00102 
00103       FourMomentum wenu(wenufinder.bosons()[0].momentum());
00104       FourMomentum wmnu(wmnufinder.bosons()[0].momentum());
00105       FourMomentum ww(wenu+wmnu);
00106       // find leptons
00107       FourMomentum ep=wenufinder.constituentLeptons()[0].momentum();
00108       FourMomentum enu=wenufinder.constituentNeutrinos()[0].momentum();
00109       FourMomentum mm=wmnufinder.constituentLeptons()[0].momentum();
00110       FourMomentum mnu=wmnufinder.constituentNeutrinos()[0].momentum();
00111 
00112       _h_WW_pT->fill(ww.pT(),weight);
00113       _h_WW_pT_peak->fill(ww.pT(),weight);
00114       _h_WW_eta->fill(ww.eta(),weight);
00115       _h_WW_phi->fill(ww.azimuthalAngle(),weight);
00116       double mww2=ww.mass2();
00117       if (mww2>0.0) _h_WW_m->fill(sqrt(mww2), weight);
00118 
00119       _h_WW_dphi->fill(mapAngle0ToPi(wenu.phi()-wmnu.phi()), weight);
00120       _h_WW_deta->fill(wenu.eta()-wmnu.eta(), weight);
00121       _h_WW_dR->fill(deltaR(wenu,wmnu), weight);
00122       _h_WW_dpT->fill(fabs(wenu.pT()-wmnu.pT()), weight);
00123 
00124       Vector3 crossWenu = ep.vector3().cross(enu.vector3());
00125       Vector3 crossWmnu = mm.vector3().cross(mnu.vector3());
00126       double costheta = crossWenu.dot(crossWmnu)/crossWenu.mod()/crossWmnu.mod();
00127       _h_WW_costheta_planes->fill(costheta, weight);
00128 
00129       _h_W_pT->fill(wenu.pT(),weight);
00130       _h_W_pT->fill(wmnu.pT(),weight);
00131       _h_W_eta->fill(wenu.eta(),weight);
00132       _h_W_eta->fill(wmnu.eta(),weight);
00133 
00134       _h_Wl_pT->fill(ep.pT(), weight);
00135       _h_Wl_pT->fill(mm.pT(), weight);
00136       _h_Wl_eta->fill(ep.eta(), weight);
00137       _h_Wl_eta->fill(mm.eta(), weight);
00138 
00139       _h_WeWm_dphi->fill(mapAngle0ToPi(ep.phi()-mm.phi()), weight);
00140       _h_WeWm_deta->fill(ep.eta()-mm.eta(), weight);
00141       _h_WeWm_dR->fill(deltaR(ep,mm), weight);
00142       double m2=FourMomentum(ep+mm).mass2();
00143       if (m2 < 0) m2 = 0.0;
00144       _h_WeWm_m->fill(sqrt(m2), weight);
00145 
00146       const FastJets& jetpro = applyProjection<FastJets>(e, "Jets");
00147       const Jets& jets = jetpro.jetsByPt(20.0*GeV);
00148       if (jets.size() > 0) {
00149         _h_WW_jet1_deta->fill(ww.eta()-jets[0].momentum().eta(), weight);
00150         _h_WW_jet1_dR->fill(deltaR(ww, jets[0].momentum()), weight);
00151         _h_We_jet1_dR->fill(deltaR(ep, jets[0].momentum()), weight);
00152       }
00153 
00154       double HT=ep.pT()+mm.pT()+FourMomentum(enu+mnu).pT();
00155       foreach (const Jet& jet, jets) {
00156         HT+=jet.momentum().pT();
00157       }
00158       if (HT>0.0) _h_HT->fill(HT, weight);
00159 
00160       if (jets.size()>1) {
00161         FourMomentum jet1(jets[0].momentum());
00162         FourMomentum jet2(jets[1].momentum());
00163         _h_jets_m_12->fill(FourMomentum(jet1+jet2).mass(), weight);
00164       }
00165 
00166       MC_JetAnalysis::analyze(e);
00167     }
00168 
00169 
00170     /// Finalize
00171     void finalize() {
00172       double norm=crossSection()/sumOfWeights();
00173       scale(_h_WW_pT, norm);
00174       scale(_h_WW_pT_peak, norm);
00175       scale(_h_WW_eta, norm);
00176       scale(_h_WW_phi, norm);
00177       scale(_h_WW_m, norm);
00178       scale(_h_WW_dphi, norm);
00179       scale(_h_WW_deta, norm);
00180       scale(_h_WW_dR, norm);
00181       scale(_h_WW_dpT, norm);
00182       scale(_h_WW_costheta_planes, norm);
00183       scale(_h_W_pT, norm);
00184       scale(_h_W_eta, norm);
00185       scale(_h_Wl_pT, norm);
00186       scale(_h_Wl_eta, norm);
00187       scale(_h_WeWm_dphi, norm);
00188       scale(_h_WeWm_deta, norm);
00189       scale(_h_WeWm_dR, norm);
00190       scale(_h_WeWm_m, norm);
00191       scale(_h_WW_jet1_deta, norm);
00192       scale(_h_WW_jet1_dR, norm);
00193       scale(_h_We_jet1_dR, norm);
00194       scale(_h_jets_m_12, norm);
00195       scale(_h_HT, norm);
00196 
00197       MC_JetAnalysis::finalize();
00198     }
00199 
00200     //@}
00201 
00202 
00203   private:
00204 
00205     /// @name Histograms
00206     //@{
00207     Histo1DPtr _h_WW_pT;
00208     Histo1DPtr _h_WW_pT_peak;
00209     Histo1DPtr _h_WW_eta;
00210     Histo1DPtr _h_WW_phi;
00211     Histo1DPtr _h_WW_m;
00212     Histo1DPtr _h_WW_dphi;
00213     Histo1DPtr _h_WW_deta;
00214     Histo1DPtr _h_WW_dR;
00215     Histo1DPtr _h_WW_dpT;
00216     Histo1DPtr _h_WW_costheta_planes;
00217     Histo1DPtr _h_W_pT;
00218     Histo1DPtr _h_W_eta;
00219     Histo1DPtr _h_Wl_pT;
00220     Histo1DPtr _h_Wl_eta;
00221     Histo1DPtr _h_WeWm_dphi;
00222     Histo1DPtr _h_WeWm_deta;
00223     Histo1DPtr _h_WeWm_dR;
00224     Histo1DPtr _h_WeWm_m;
00225     Histo1DPtr _h_WW_jet1_deta;
00226     Histo1DPtr _h_WW_jet1_dR;
00227     Histo1DPtr _h_We_jet1_dR;
00228     Histo1DPtr _h_jets_m_12;
00229     Histo1DPtr _h_HT;
00230     //@}
00231 
00232   };
00233 
00234 
00235 
00236   // The hook for the plugin system
00237   DECLARE_RIVET_PLUGIN(MC_WWJETS);
00238 
00239 }