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, 25.0*GeV, ELECTRON, 60.0*GeV, 100.0*GeV, 25.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.bosons().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=wf.constituentLeptons()[0].momentum();
00066       int chg_e = PID::threeCharge(wf.constituentLeptons()[0].pdgId());
00067       if (p_e.eta() < 0) chg_e *= -1;
00068       assert(chg_e != 0);
00069 
00070       const double weight = event.weight();
00071       const double eta_e = fabs(p_e.eta());
00072       const double et_e = p_e.Et();
00073       if (et_e < 35*GeV) {
00074         // 25 <= ET < 35
00075         if (chg_e < 0) {
00076           _h_dsigminus_deta_25_35->fill(eta_e, weight);
00077         } else {
00078           _h_dsigplus_deta_25_35->fill(eta_e, weight);
00079         }
00080       } else {
00081         // ET >= 35
00082         if (chg_e < 0) {
00083           _h_dsigminus_deta_35->fill(eta_e, weight);
00084         } else {
00085           _h_dsigplus_deta_35->fill(eta_e, weight);
00086         }
00087       }
00088       // Inclusive: ET >= 25
00089       if (chg_e < 0) {
00090         _h_dsigminus_deta_25->fill(eta_e, weight);
00091       } else {
00092         _h_dsigplus_deta_25->fill(eta_e, weight);
00093       }
00094     }
00095 
00096 
00097     /// Finalize
00098     void finalize() {
00099       // Construct asymmetry: (dsig+/deta - dsig-/deta) / (dsig+/deta + dsig-/deta) for each Et region
00100       AIDA::IHistogramFactory& hf = histogramFactory();
00101 
00102       IHistogram1D* num25_35 = hf.subtract("/num25_35", *_h_dsigplus_deta_25_35, *_h_dsigminus_deta_25_35);
00103       num25_35->scale(100.);
00104       IHistogram1D* denom25_35 = hf.add("/denom25_35", *_h_dsigplus_deta_25_35, *_h_dsigminus_deta_25_35);
00105       assert(num25_35 && denom25_35);
00106       hf.divide(histoDir() + "/d01-x01-y01", *num25_35, *denom25_35);
00107       hf.destroy(num25_35);
00108       hf.destroy(denom25_35);
00109       //
00110       IHistogram1D* num35 = hf.subtract("/num35", *_h_dsigplus_deta_35, *_h_dsigminus_deta_35);
00111       num35->scale(100.);
00112       IHistogram1D* denom35 = hf.add("/denom35", *_h_dsigplus_deta_35, *_h_dsigminus_deta_35);
00113       assert(num35 && denom35);
00114       hf.divide(histoDir() + "/d01-x01-y02", *num35, *denom35);
00115       hf.destroy(num35);
00116       hf.destroy(denom35);
00117       //
00118       IHistogram1D* num25 = hf.subtract("/num25", *_h_dsigplus_deta_25, *_h_dsigminus_deta_25);
00119       num25->scale(100.);
00120       IHistogram1D* denom25 = hf.add("/denom25", *_h_dsigplus_deta_25, *_h_dsigminus_deta_25);
00121       assert(num25 && denom25);
00122       hf.divide(histoDir() + "/d01-x01-y03", *num25, *denom25);
00123       hf.destroy(num25);
00124       hf.destroy(denom25);
00125 
00126       // Delete raw histos
00127       hf.destroy(_h_dsigplus_deta_25_35);
00128       hf.destroy(_h_dsigminus_deta_25_35);
00129       hf.destroy(_h_dsigplus_deta_35);
00130       hf.destroy(_h_dsigminus_deta_35);
00131       hf.destroy(_h_dsigplus_deta_25);
00132       hf.destroy(_h_dsigminus_deta_25);
00133     }
00134 
00135     //@}
00136 
00137 
00138   private:
00139 
00140     /// @name Histograms
00141     //@{
00142     AIDA::IHistogram1D *_h_dsigplus_deta_25_35, *_h_dsigminus_deta_25_35;
00143     AIDA::IHistogram1D *_h_dsigplus_deta_35, *_h_dsigminus_deta_35;
00144     AIDA::IHistogram1D *_h_dsigplus_deta_25, *_h_dsigminus_deta_25;
00145     //@}
00146 
00147   };
00148 
00149 
00150   // This global object acts as a hook for the plugin system
00151   AnalysisBuilder<D0_2008_S7837160> plugin_D0_2008_S7837160;
00152 
00153 }