|
[Rivet-svn] r3835 - schools/2010-Lauterbad/setups/day2/rivetblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue Jul 17 14:48:05 BST 2012
Author: hoeth Date: Tue Jul 17 14:48:05 2012 New Revision: 3835 Log: Lauterbad local Rivet modifications Added: schools/2010-Lauterbad/setups/day2/rivet/ schools/2010-Lauterbad/setups/day2/rivet/MC_ZJETS_NOCLUS.cc schools/2010-Lauterbad/setups/day2/rivet/rivet.patch Added: schools/2010-Lauterbad/setups/day2/rivet/MC_ZJETS_NOCLUS.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ schools/2010-Lauterbad/setups/day2/rivet/MC_ZJETS_NOCLUS.cc Tue Jul 17 14:48:05 2012 (r3835) @@ -0,0 +1,118 @@ +// -*- C++ -*- +#include "Rivet/Analyses/MC_JetAnalysis.hh" +#include "Rivet/Projections/ZFinder.hh" +#include "Rivet/Projections/FastJets.hh" +#include "Rivet/Tools/Logging.hh" +#include "Rivet/RivetAIDA.hh" + +namespace Rivet { + + + /// @brief MC validation analysis for Z + jets events + class MC_ZJETS_NOCLUS : public MC_JetAnalysis { + public: + + /// Default constructor + MC_ZJETS_NOCLUS() + : MC_JetAnalysis("MC_ZJETS_NOCLUS", 4, "Jets") + { + setNeedsCrossSection(true); + } + + + /// @name Analysis methods + //@{ + + /// Book histograms + void init() { + ZFinder zfinder(-3.5, 3.5, 25.0*GeV, ELECTRON, 65.0*GeV, 115.0*GeV, 0.2, false, true); + addProjection(zfinder, "ZFinder"); + FastJets jetpro(zfinder.remainingFinalState(), FastJets::KT, 0.7); + addProjection(jetpro, "Jets"); + + _h_Z_mass = bookHistogram1D("Z_mass", 50, 66.0, 116.0); + _h_Z_pT = bookHistogram1D("Z_pT", logBinEdges(100, 1.0, 0.5*sqrtS())); + _h_Z_pT_peak = bookHistogram1D("Z_pT_peak", 25, 0.0, 25.0); + _h_Z_y = bookHistogram1D("Z_y", 40, -4.0, 4.0); + _h_Z_phi = bookHistogram1D("Z_phi", 25, 0.0, TWOPI); + _h_Z_jet1_deta = bookHistogram1D("Z_jet1_deta", 50, -5.0, 5.0); + _h_Z_jet1_dR = bookHistogram1D("Z_jet1_dR", 25, 0.5, 7.0); + _h_lepton_pT = bookHistogram1D("lepton_pT", logBinEdges(100, 10.0, 0.25*sqrtS())); + _h_lepton_eta = bookHistogram1D("lepton_eta", 40, -4.0, 4.0); + + MC_JetAnalysis::init(); + } + + + + /// Do the analysis + void analyze(const Event & e) { + const ZFinder& zfinder = applyProjection<ZFinder>(e, "ZFinder"); + if (zfinder.bosons().size()!=1) { + vetoEvent; + } + const double weight = e.weight(); + + FourMomentum zmom(zfinder.bosons()[0].momentum()); + _h_Z_mass->fill(zmom.mass(),weight); + _h_Z_pT->fill(zmom.pT(),weight); + _h_Z_pT_peak->fill(zmom.pT(),weight); + _h_Z_y->fill(zmom.rapidity(),weight); + _h_Z_phi->fill(zmom.azimuthalAngle(),weight); + foreach (const Particle& l, zfinder.constituents()) { + _h_lepton_pT->fill(l.momentum().pT(), weight); + _h_lepton_eta->fill(l.momentum().eta(), weight); + } + + const FastJets& jetpro = applyProjection<FastJets>(e, "Jets"); + const Jets& jets = jetpro.jetsByPt(20.0*GeV); + if (jets.size() > 0) { + _h_Z_jet1_deta->fill(zmom.eta()-jets[0].momentum().eta(), weight); + _h_Z_jet1_dR->fill(deltaR(zmom, jets[0].momentum()), weight); + } + + MC_JetAnalysis::analyze(e); + } + + + /// Finalize + void finalize() { + scale(_h_Z_mass, crossSection()/sumOfWeights()); + scale(_h_Z_pT, crossSection()/sumOfWeights()); + scale(_h_Z_pT_peak, crossSection()/sumOfWeights()); + scale(_h_Z_y, crossSection()/sumOfWeights()); + scale(_h_Z_phi, crossSection()/sumOfWeights()); + scale(_h_Z_jet1_deta, crossSection()/sumOfWeights()); + scale(_h_Z_jet1_dR, crossSection()/sumOfWeights()); + scale(_h_lepton_pT, crossSection()/sumOfWeights()); + scale(_h_lepton_eta, crossSection()/sumOfWeights()); + + MC_JetAnalysis::finalize(); + } + + //@} + + + private: + + /// @name Histograms + //@{ + AIDA::IHistogram1D * _h_Z_mass; + AIDA::IHistogram1D * _h_Z_pT; + AIDA::IHistogram1D * _h_Z_pT_peak; + AIDA::IHistogram1D * _h_Z_y; + AIDA::IHistogram1D * _h_Z_phi; + AIDA::IHistogram1D * _h_Z_jet1_deta; + AIDA::IHistogram1D * _h_Z_jet1_dR; + AIDA::IHistogram1D * _h_lepton_pT; + AIDA::IHistogram1D * _h_lepton_eta; + //@} + + }; + + + + // The hook for the plugin system + DECLARE_RIVET_PLUGIN(MC_ZJETS_NOCLUS); + +} Added: schools/2010-Lauterbad/setups/day2/rivet/rivet.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ schools/2010-Lauterbad/setups/day2/rivet/rivet.patch Tue Jul 17 14:48:05 2012 (r3835) @@ -0,0 +1,72 @@ +Index: src/Analyses/D0_2008_S7554427.cc +=================================================================== +--- src/Analyses/D0_2008_S7554427.cc (revision 2601) ++++ src/Analyses/D0_2008_S7554427.cc (working copy) +@@ -35,6 +35,9 @@ + + _h_ZpT = bookHistogram1D(1, 1, 1); + _h_forward_ZpT = bookHistogram1D(3, 1, 1); ++ _weights_ZpT = 0.0; ++ _weights_forward_ZpT = 0.0; ++ + } + + +@@ -48,8 +51,10 @@ + double yZ = fabs(zfinder.particles()[0].momentum().rapidity()); + double pTZ = zfinder.particles()[0].momentum().pT(); + _h_ZpT->fill(pTZ, weight); ++ _weights_ZpT += weight; + if (yZ > 2.0) { + _h_forward_ZpT->fill(pTZ, weight); ++ _weights_forward_ZpT += weight; + } + } + else { +@@ -62,8 +67,10 @@ + + // Finalize + void finalize() { +- normalize(_h_ZpT); +- normalize(_h_forward_ZpT); ++ // normalize(_h_ZpT); ++ // normalize(_h_forward_ZpT); ++ scale(_h_ZpT, 1./_weights_ZpT); ++ scale(_h_forward_ZpT, 1./_weights_forward_ZpT); + } + + //@} +@@ -73,6 +80,7 @@ + + /// @name Histograms + //@{ ++ double _weights_ZpT, _weights_forward_ZpT; + AIDA::IHistogram1D * _h_ZpT; + AIDA::IHistogram1D * _h_forward_ZpT; + //@} +Index: src/Analyses/Makefile.am +=================================================================== +--- src/Analyses/Makefile.am (revision 2601) ++++ src/Analyses/Makefile.am (working copy) +@@ -147,6 +147,7 @@ + MC_PHOTONJETS.cc \ + MC_WJETS.cc \ + MC_ZJETS.cc \ ++ MC_ZJETS_NOCLUS.cc \ + MC_LEADINGJETS.cc \ + MC_DIPHOTON.cc \ + MC_SUSY.cc +Index: bin/compare-histos +=================================================================== +--- bin/compare-histos (revision 2601) ++++ bin/compare-histos (working copy) +@@ -323,7 +323,8 @@ + if len(activefiles) == 1 and opts.NO_SHOW_IF_ONLY_ONE: + if not opts.RIVETREFS: + logging.warning("Skipping histo '%s' since only one plot is present" % name) +- continue ++ if HISTOS[activefiles[0]][name].isdata: ++ continue + + ## Identify reference file for this histo + ref = opts.REF_ID
More information about the Rivet-svn mailing list |