D0_2008_S7837160.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Tools/ParticleIdUtils.hh"
00005 #include "Rivet/Projections/FinalState.hh"
00006 #include "Rivet/Projections/WFinder.hh"
00007 #include "Rivet/Projections/LeadingParticlesFinalState.hh"
00008 #include "Rivet/Projections/IdentifiedFinalState.hh"
00009 #include "Rivet/RivetAIDA.hh"
00010 
00011 #include "LWH/Histogram1D.h"
00012 #include "LWH/HistogramFactory.h"
00013 
00014 namespace Rivet {
00015 
00016 
00017   /// @brief D0 Run II measurement of W charge asymmetry
00018   /// @author Andy Buckley
00019   /// @author Gavin Hesketh
00020   class D0_2008_S7837160 : public Analysis {
00021 
00022   public:
00023 
00024     /// Default constructor.
00025     D0_2008_S7837160()
00026       : Analysis("D0_2008_S7837160")
00027     {
00028       // Run II W charge asymmetry
00029       setBeams(PROTON, ANTIPROTON);
00030     }
00031 
00032 
00033     /// @name Analysis methods
00034     //@{
00035 
00036     // Book histograms and set up projections
00037     void init() {
00038       // Projections
00039       /// @todo Use separate pT and ETmiss cuts in WFinder
00040       const WFinder wfe(-5, 5, 0.0*GeV, ELECTRON, 60.0*GeV, 100.0*GeV, 0*GeV, 0.2);
00041       addProjection(wfe, "WFe");
00042 
00043       // Cross-section histograms
00044       const BinEdges& edges = binEdges(1,1,1);
00045       _h_dsigplus_deta_25_35  = bookHistogram1D("/dsigplus_deta_25_35", edges);
00046       _h_dsigminus_deta_25_35 = bookHistogram1D("/dsigminus_deta_25_35", edges);
00047       _h_dsigplus_deta_35     = bookHistogram1D("/dsigplus_deta_35", edges);
00048       _h_dsigminus_deta_35    = bookHistogram1D("/dsigminus_deta_35", edges);
00049       _h_dsigplus_deta_25     = bookHistogram1D("/dsigplus_deta_25", edges);
00050       _h_dsigminus_deta_25    = bookHistogram1D("/dsigminus_deta_25", edges);
00051     }
00052 
00053 
00054     /// Do the analysis
00055     void analyze(const Event & event) {
00056       const WFinder& wf = applyProjection<WFinder>(event, "WFe");
00057       if (wf.size() == 0) {
00058         getLog() << Log::DEBUG << "No W candidates found: vetoing" << endl;
00059         vetoEvent;
00060       }
00061 
00062       // Require that leptons have Et >= 25 GeV
00063       /// @todo Use pT cut in WFinder
00064       /// @todo Any ETmiss cut?
00065       FourMomentum p_e;
00066       int chg_e = 0;
00067       foreach (const Particle& l, wf.constituentLeptonsFinalState().particles()) {
00068         const FourMomentum pl = l.momentum();
00069         if (abs(l.pdgId()) == ELECTRON) {
00070           chg_e = PID::threeCharge(l.pdgId());
00071           p_e = pl;
00072         }
00073         if (pl.Et()/GeV < 25.0) {
00074           getLog() << Log::DEBUG << l.pdgId() << " fails Et cut" << endl;
00075           vetoEvent;
00076         }
00077       }
00078       if (p_e.eta() < 0) chg_e *= -1;
00079       assert(chg_e != 0);
00080 
00081       const double weight = event.weight();
00082       const double eta_e = fabs(p_e.eta());
00083       const double et_e = p_e.Et();
00084       if (et_e < 35*GeV) {
00085         // 25 <= ET < 35
00086         if (chg_e < 0) {
00087           _h_dsigminus_deta_25_35->fill(eta_e, weight);
00088         } else {
00089           _h_dsigplus_deta_25_35->fill(eta_e, weight);
00090         }
00091       } else {
00092         // ET >= 35
00093         if (chg_e < 0) {
00094           _h_dsigminus_deta_35->fill(eta_e, weight);
00095         } else {
00096           _h_dsigplus_deta_35->fill(eta_e, weight);
00097         }
00098       }
00099       // Inclusive: ET >= 25
00100       if (chg_e < 0) {
00101         _h_dsigminus_deta_25->fill(eta_e, weight);
00102       } else {
00103         _h_dsigplus_deta_25->fill(eta_e, weight);
00104       }
00105     }
00106 
00107 
00108     /// Finalize
00109     void finalize() {
00110       // Construct asymmetry: (dsig+/deta - dsig-/deta) / (dsig+/deta + dsig-/deta) for each Et region
00111       AIDA::IHistogramFactory& hf = histogramFactory();
00112 
00113       IHistogram1D* num25_35 = hf.subtract("/num25_35", *_h_dsigplus_deta_25_35, *_h_dsigminus_deta_25_35);
00114       num25_35->scale(100.);
00115       IHistogram1D* denom25_35 = hf.add("/denom25_35", *_h_dsigplus_deta_25_35, *_h_dsigminus_deta_25_35);
00116       assert(num25_35 && denom25_35);
00117       hf.divide(histoDir() + "/d01-x01-y01", *num25_35, *denom25_35);
00118       hf.destroy(num25_35);
00119       hf.destroy(denom25_35);
00120       //
00121       IHistogram1D* num35 = hf.subtract("/num35", *_h_dsigplus_deta_35, *_h_dsigminus_deta_35);
00122       num35->scale(100.);
00123       IHistogram1D* denom35 = hf.add("/denom35", *_h_dsigplus_deta_35, *_h_dsigminus_deta_35);
00124       assert(num35 && denom35);
00125       hf.divide(histoDir() + "/d01-x01-y02", *num35, *denom35);
00126       hf.destroy(num35);
00127       hf.destroy(denom35);
00128       //
00129       IHistogram1D* num25 = hf.subtract("/num25", *_h_dsigplus_deta_25, *_h_dsigminus_deta_25);
00130       num25->scale(100.);
00131       IHistogram1D* denom25 = hf.add("/denom25", *_h_dsigplus_deta_25, *_h_dsigminus_deta_25);
00132       assert(num25 && denom25);
00133       hf.divide(histoDir() + "/d01-x01-y03", *num25, *denom25);
00134       hf.destroy(num25);
00135       hf.destroy(denom25);
00136 
00137       // Delete raw histos
00138       hf.destroy(_h_dsigplus_deta_25_35);
00139       hf.destroy(_h_dsigminus_deta_25_35);
00140       hf.destroy(_h_dsigplus_deta_35);
00141       hf.destroy(_h_dsigminus_deta_35);
00142       hf.destroy(_h_dsigplus_deta_25);
00143       hf.destroy(_h_dsigminus_deta_25);
00144     }
00145 
00146     //@}
00147 
00148 
00149   private:
00150 
00151     /// @name Histograms
00152     //@{
00153     AIDA::IHistogram1D *_h_dsigplus_deta_25_35, *_h_dsigminus_deta_25_35;
00154     AIDA::IHistogram1D *_h_dsigplus_deta_35, *_h_dsigminus_deta_35;
00155     AIDA::IHistogram1D *_h_dsigplus_deta_25, *_h_dsigminus_deta_25;
00156     //@}
00157 
00158   };
00159 
00160 
00161   // This global object acts as a hook for the plugin system
00162   AnalysisBuilder<D0_2008_S7837160> plugin_D0_2008_S7837160;
00163 
00164 }