rivet is hosted by Hepforge, IPPP Durham
MC_WINC.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/WFinder.hh"
00004 
00005 namespace Rivet {
00006 
00007 
00008 
00009   /// @brief MC validation analysis for inclusive W events
00010   class MC_WINC : public Analysis {
00011   public:
00012 
00013     /// Default constructor
00014     MC_WINC(string name="MC_WINC")
00015       : Analysis(name)
00016     {
00017          _dR=0.2;
00018          _lepton=PID::ELECTRON;
00019      }
00020 
00021 
00022     /// @name Analysis methods
00023     //@{
00024 
00025     /// Book histograms
00026     void init() {
00027       FinalState fs;
00028       WFinder wfinder(fs, Cuts::abseta < 3.5 && Cuts::pT > 25*GeV, _lepton, 60.0*GeV, 100.0*GeV, 25.0*GeV, _dR);
00029       addProjection(wfinder, "WFinder");
00030 
00031       double sqrts = sqrtS()>0. ? sqrtS() : 14000.;
00032       _h_W_mass = bookHisto1D("W_mass", 50, 55.0, 105.0);
00033       _h_W_pT = bookHisto1D("W_pT", logspace(100, 1.0, 0.5*sqrts));
00034       _h_W_pT_peak = bookHisto1D("W_pT_peak", 25, 0.0, 125.0);
00035       _h_W_y = bookHisto1D("W_y", 40, -4.0, 4.0);
00036       _h_W_phi = bookHisto1D("W_phi", 25, 0.0, TWOPI);
00037       _h_Wplus_pT = bookHisto1D("Wplus_pT", logspace(25, 10.0, 0.5*sqrts));
00038       _h_Wminus_pT = bookHisto1D("Wminus_pT", logspace(25, 10.0, 0.5*sqrts));
00039       _h_lepton_pT = bookHisto1D("lepton_pT", logspace(100, 10.0, 0.25*sqrts));
00040       _h_lepton_eta = bookHisto1D("lepton_eta", 40, -4.0, 4.0);
00041       _htmp_dsigminus_deta = bookHisto1D("lepton_dsigminus_deta", 20, 0.0, 4.0);
00042       _htmp_dsigplus_deta  = bookHisto1D("lepton_dsigplus_deta", 20, 0.0, 4.0);
00043 
00044       _h_asym = bookScatter2D("W_chargeasymm_eta");
00045       _h_asym_pT = bookScatter2D("W_chargeasymm_pT");
00046     }
00047 
00048 
00049 
00050     /// Do the analysis
00051     void analyze(const Event & e) {
00052       const double weight = e.weight();
00053 
00054       const WFinder& wfinder = applyProjection<WFinder>(e, "WFinder");
00055       if (wfinder.bosons().size() != 1) {
00056         vetoEvent;
00057       }
00058 
00059       double charge3_x_eta = 0;
00060       int charge3 = 0;
00061       FourMomentum emom;
00062       FourMomentum wmom(wfinder.bosons().front().momentum());
00063       _h_W_mass->fill(wmom.mass(), weight);
00064       _h_W_pT->fill(wmom.pT(), weight);
00065       _h_W_pT_peak->fill(wmom.pT(), weight);
00066       _h_W_y->fill(wmom.rapidity(), weight);
00067       _h_W_phi->fill(wmom.phi(), weight);
00068       Particle l=wfinder.constituentLeptons()[0];
00069       _h_lepton_pT->fill(l.pT(), weight);
00070       _h_lepton_eta->fill(l.eta(), weight);
00071       if (PID::threeCharge(l.pid()) != 0) {
00072         emom = l.momentum();
00073         charge3_x_eta = PID::threeCharge(l.pid()) * emom.eta();
00074         charge3 = PID::threeCharge(l.pid());
00075       }
00076       assert(charge3_x_eta != 0);
00077       assert(charge3!=0);
00078       if (emom.Et() > 30/GeV) {
00079         if (charge3_x_eta < 0) {
00080           _htmp_dsigminus_deta->fill(emom.eta(), weight);
00081         } else {
00082           _htmp_dsigplus_deta->fill(emom.eta(), weight);
00083         }
00084       }
00085       if (charge3 < 0) {
00086         _h_Wminus_pT->fill(wmom.pT(), weight);
00087       } else {
00088         _h_Wplus_pT->fill(wmom.pT(), weight);
00089       }
00090     }
00091 
00092 
00093     /// Finalize
00094     void finalize() {
00095       scale(_h_W_mass, crossSection()/sumOfWeights());
00096       scale(_h_W_pT, crossSection()/sumOfWeights());
00097       scale(_h_W_pT_peak, crossSection()/sumOfWeights());
00098       scale(_h_W_y, crossSection()/sumOfWeights());
00099       scale(_h_W_phi, crossSection()/sumOfWeights());
00100       scale(_h_lepton_pT, crossSection()/sumOfWeights());
00101       scale(_h_lepton_eta, crossSection()/sumOfWeights());
00102 
00103       // Construct asymmetry: (dsig+/deta - dsig-/deta) / (dsig+/deta + dsig-/deta) for each Et region
00104       divide(*_htmp_dsigplus_deta - *_htmp_dsigminus_deta,
00105              *_htmp_dsigplus_deta + *_htmp_dsigminus_deta,
00106              _h_asym);
00107 
00108       // // W charge asymmetry vs. pTW: dsig+/dpT / dsig-/dpT
00109       divide(_h_Wplus_pT, _h_Wminus_pT,
00110              _h_asym_pT);
00111 
00112       scale(_h_Wplus_pT, crossSection()/picobarn/sumOfWeights());
00113       scale(_h_Wminus_pT, crossSection()/picobarn/sumOfWeights());
00114     }
00115 
00116     //@}
00117 
00118 
00119   protected:
00120 
00121     /// @name Parameters for specialised e/mu and dressed/bare subclassing
00122     //@{
00123     double _dR;
00124     PdgId _lepton;
00125     //@}
00126 
00127 
00128   private:
00129 
00130     /// @name Histograms
00131     //@{
00132     Histo1DPtr _h_W_mass;
00133     Histo1DPtr _h_W_pT;
00134     Histo1DPtr _h_W_pT_peak;
00135     Histo1DPtr _h_W_y;
00136     Histo1DPtr _h_W_phi;
00137     Histo1DPtr _h_Wplus_pT;
00138     Histo1DPtr _h_Wminus_pT;
00139     Histo1DPtr _h_lepton_pT;
00140     Histo1DPtr _h_lepton_eta;
00141 
00142     Histo1DPtr _htmp_dsigminus_deta;
00143     Histo1DPtr _htmp_dsigplus_deta;
00144 
00145     Scatter2DPtr _h_asym;
00146     Scatter2DPtr _h_asym_pT;
00147     //@}
00148 
00149   };
00150 
00151 
00152 
00153   struct MC_WINC_EL : public MC_WINC {
00154     MC_WINC_EL() : MC_WINC("MC_WINC_EL") {
00155       _dR = 0.2;
00156       _lepton = PID::ELECTRON;
00157     }
00158   };
00159 
00160   struct MC_WINC_EL_BARE : public MC_WINC {
00161     MC_WINC_EL_BARE() : MC_WINC("MC_WINC_EL_BARE") {
00162       _dR = 0;
00163       _lepton = PID::ELECTRON;
00164     }
00165   };
00166 
00167   struct MC_WINC_MU : public MC_WINC {
00168     MC_WINC_MU() : MC_WINC("MC_WINC_MU") {
00169       _dR = 0.2;
00170       _lepton = PID::MUON;
00171     }
00172   };
00173 
00174   struct MC_WINC_MU_BARE : public MC_WINC {
00175     MC_WINC_MU_BARE() : MC_WINC("MC_WINC_MU_BARE") {
00176       _dR = 0;
00177       _lepton = PID::MUON;
00178     }
00179   };
00180 
00181 
00182 
00183   // The hooks for the plugin system
00184   DECLARE_RIVET_PLUGIN(MC_WINC);
00185   DECLARE_RIVET_PLUGIN(MC_WINC_EL);
00186   DECLARE_RIVET_PLUGIN(MC_WINC_EL_BARE);
00187   DECLARE_RIVET_PLUGIN(MC_WINC_MU);
00188   DECLARE_RIVET_PLUGIN(MC_WINC_MU_BARE);
00189 
00190 
00191 }