rivet is hosted by Hepforge, IPPP Durham
D0_2008_S7837160.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/WFinder.hh"
00005 #include "Rivet/Projections/LeadingParticlesFinalState.hh"
00006 #include "Rivet/Projections/IdentifiedFinalState.hh"
00007 
00008 namespace Rivet {
00009 
00010   using namespace Cuts;
00011 
00012 
00013   /// @brief D0 Run II measurement of W charge asymmetry
00014   /// @author Andy Buckley
00015   /// @author Gavin Hesketh
00016   class D0_2008_S7837160 : public Analysis {
00017   public:
00018 
00019     /// Default constructor.
00020     D0_2008_S7837160()
00021       : Analysis("D0_2008_S7837160")
00022     {    }
00023 
00024 
00025     /// @name Analysis methods
00026     //@{
00027 
00028     // Book histograms and set up projections
00029     void init() {
00030       // Projections
00031       FinalState fs;
00032       /// @todo Use separate pT and ETmiss cuts in WFinder
00033       const WFinder wfe(fs, etaIn(-5, 5) & (pT >= 25.0*GeV), PID::ELECTRON, 60.0*GeV, 100.0*GeV, 25.0*GeV, 0.2);
00034       addProjection(wfe, "WFe");
00035 
00036       // Histograms (temporary +- charge histos and scatters to store the calculated asymmetries)
00037       for (size_t pmindex = 0; pmindex < 2; ++pmindex) {
00038         const string suffix = (pmindex == 0) ? "plus" : "minus";
00039         _hs_dsigpm_deta_25_35[pmindex] = bookHisto1D("TMP/dsigpm_deta_25_35_" + suffix, refData(1, 1, 1));
00040         _hs_dsigpm_deta_35[pmindex] = bookHisto1D("TMP/dsigpm_deta_35_" + suffix, refData(1, 1, 2));
00041         _hs_dsigpm_deta_25[pmindex] = bookHisto1D("TMP/dsigpm_deta_25_" + suffix, refData(1, 1, 3));
00042       }
00043       _h_asym1 = bookScatter2D(1, 1, 1);
00044       _h_asym2 = bookScatter2D(1, 1, 2);
00045       _h_asym3 = bookScatter2D(1, 1, 3);
00046     }
00047 
00048 
00049     /// Do the analysis
00050     void analyze(const Event & event) {
00051       const WFinder& wf = applyProjection<WFinder>(event, "WFe");
00052       if (wf.bosons().size() == 0) {
00053         MSG_DEBUG("No W candidates found: vetoing");
00054         vetoEvent;
00055       }
00056 
00057       // Get the e+- momentum, and an effective charge including the eta sign
00058       /// @todo Is it correct to multiply the eta sign into the charge to "fold" the plot?
00059       const FourMomentum p_e = wf.constituentLeptons()[0].momentum();
00060       const int chg_e = sign(p_e.eta()) * sign(charge(wf.constituentLeptons()[0]));
00061       assert(chg_e == 1 || chg_e == -1);
00062       MSG_TRACE("Charged lepton sign = " << chg_e);
00063 
00064       // Fill histos with appropriate +- indexing
00065       const double weight = event.weight();
00066       const size_t pmindex = (chg_e > 0) ? 0 : 1;
00067       if (p_e.Et() < 35*GeV) _hs_dsigpm_deta_25_35[pmindex]->fill(fabs(p_e.eta()), weight);
00068       else _hs_dsigpm_deta_35[pmindex]->fill(fabs(p_e.eta()), weight);
00069       _hs_dsigpm_deta_25[pmindex]->fill(fabs(p_e.eta()), weight);
00070     }
00071 
00072 
00073     /// @name Helper functions for constructing asymmetry histograms in finalize()
00074     //@{
00075     void calc_asymm(const Histo1DPtr plus, const Histo1DPtr minus, Scatter2DPtr target) {
00076       divide(*plus - *minus, *plus + *minus, target);
00077     }
00078     void calc_asymm(const Histo1DPtr histos[2], Scatter2DPtr target) {
00079       calc_asymm(histos[0], histos[1], target);
00080     }
00081     //@}
00082 
00083 
00084     /// @brief Finalize
00085     ///
00086     /// Construct asymmetry: (dsig+/deta - dsig-/deta) / (dsig+/deta + dsig-/deta) for each ET region
00087     void finalize() {
00088       calc_asymm(_hs_dsigpm_deta_25_35, _h_asym1);
00089       calc_asymm(_hs_dsigpm_deta_35, _h_asym2);
00090       calc_asymm(_hs_dsigpm_deta_25, _h_asym3);
00091       _h_asym1->scale(1.,100.);
00092       _h_asym2->scale(1.,100.);
00093       _h_asym3->scale(1.,100.);
00094     }
00095 
00096     //@}
00097 
00098 
00099   private:
00100 
00101     /// @name Histograms
00102     //@{
00103     Histo1DPtr _hs_dsigpm_deta_25_35[2], _hs_dsigpm_deta_35[2], _hs_dsigpm_deta_25[2];
00104     Scatter2DPtr _h_asym1, _h_asym2, _h_asym3;
00105     //@}
00106 
00107   };
00108 
00109 
00110 
00111   // The hook for the plugin system
00112   DECLARE_RIVET_PLUGIN(D0_2008_S7837160);
00113 
00114 }