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   /// @brief MC validation analysis for inclusive W events
00009   class MC_WINC : public Analysis {
00010   public:
00011 
00012     /// Default constructor
00013     MC_WINC()
00014       : Analysis("MC_WINC")
00015     {    }
00016 
00017 
00018     /// @name Analysis methods
00019     //@{
00020 
00021     /// Book histograms
00022     void init() {
00023       FinalState fs;
00024       WFinder wfinder(fs, EtaIn(-3.5, 3.5) & (Cuts::pT >= 25.0*GeV), PID::ELECTRON, 60.0*GeV, 100.0*GeV, 25.0*GeV, 0.2);
00025       addProjection(wfinder, "WFinder");
00026 
00027       _h_W_mass = bookHisto1D("W_mass", 50, 55.0, 105.0);
00028       _h_W_pT = bookHisto1D("W_pT", logspace(100, 1.0, 0.5*sqrtS()));
00029       _h_W_pT_peak = bookHisto1D("W_pT_peak", 25, 0.0, 125.0);
00030       _h_W_y = bookHisto1D("W_y", 40, -4.0, 4.0);
00031       _h_W_phi = bookHisto1D("W_phi", 25, 0.0, TWOPI);
00032       _h_Wplus_pT = bookHisto1D("Wplus_pT", logspace(25, 10.0, 0.5*sqrtS()));
00033       _h_Wminus_pT = bookHisto1D("Wminus_pT", logspace(25, 10.0, 0.5*sqrtS()));
00034       _h_lepton_pT = bookHisto1D("lepton_pT", logspace(100, 10.0, 0.25*sqrtS()));
00035       _h_lepton_eta = bookHisto1D("lepton_eta", 40, -4.0, 4.0);
00036       _htmp_dsigminus_deta = bookHisto1D("lepton_dsigminus_deta", 20, 0.0, 4.0);
00037       _htmp_dsigplus_deta  = bookHisto1D("lepton_dsigplus_deta", 20, 0.0, 4.0);
00038 
00039       _h_asym = bookScatter2D("W_chargeasymm_eta");
00040       _h_asym_pT = bookScatter2D("W_chargeasymm_pT");
00041     }
00042 
00043 
00044 
00045     /// Do the analysis
00046     void analyze(const Event & e) {
00047       const double weight = e.weight();
00048 
00049       const WFinder& wfinder = applyProjection<WFinder>(e, "WFinder");
00050       if (wfinder.bosons().size() != 1) {
00051         vetoEvent;
00052       }
00053 
00054       double charge3_x_eta = 0;
00055       int charge3 = 0;
00056       FourMomentum emom;
00057       FourMomentum wmom(wfinder.bosons().front().momentum());
00058       _h_W_mass->fill(wmom.mass(), weight);
00059       _h_W_pT->fill(wmom.pT(), weight);
00060       _h_W_pT_peak->fill(wmom.pT(), weight);
00061       _h_W_y->fill(wmom.rapidity(), weight);
00062       _h_W_phi->fill(wmom.azimuthalAngle(), weight);
00063       Particle l=wfinder.constituentLeptons()[0];
00064       _h_lepton_pT->fill(l.pT(), weight);
00065       _h_lepton_eta->fill(l.eta(), weight);
00066       if (PID::threeCharge(l.pdgId()) != 0) {
00067         emom = l.momentum();
00068         charge3_x_eta = PID::threeCharge(l.pdgId()) * emom.eta();
00069         charge3 = PID::threeCharge(l.pdgId());
00070       }
00071       assert(charge3_x_eta != 0);
00072       assert(charge3!=0);
00073       if (emom.Et() > 30/GeV) {
00074         if (charge3_x_eta < 0) {
00075           _htmp_dsigminus_deta->fill(emom.eta(), weight);
00076         } else {
00077           _htmp_dsigplus_deta->fill(emom.eta(), weight);
00078         }
00079       }
00080       if (charge3 < 0) {
00081         _h_Wminus_pT->fill(wmom.pT(), weight);
00082       } else {
00083         _h_Wplus_pT->fill(wmom.pT(), weight);
00084       }
00085     }
00086 
00087 
00088     /// Finalize
00089     void finalize() {
00090       scale(_h_W_mass, crossSection()/sumOfWeights());
00091       scale(_h_W_pT, crossSection()/sumOfWeights());
00092       scale(_h_W_pT_peak, crossSection()/sumOfWeights());
00093       scale(_h_W_y, crossSection()/sumOfWeights());
00094       scale(_h_W_phi, crossSection()/sumOfWeights());
00095       scale(_h_lepton_pT, crossSection()/sumOfWeights());
00096       scale(_h_lepton_eta, crossSection()/sumOfWeights());
00097 
00098       // Construct asymmetry: (dsig+/deta - dsig-/deta) / (dsig+/deta + dsig-/deta) for each Et region
00099       divide(*_htmp_dsigplus_deta - *_htmp_dsigminus_deta,
00100              *_htmp_dsigplus_deta + *_htmp_dsigminus_deta,
00101              _h_asym);
00102 
00103       // // W charge asymmetry vs. pTW: dsig+/dpT / dsig-/dpT
00104       divide(_h_Wplus_pT, _h_Wminus_pT,
00105              _h_asym_pT);
00106 
00107       scale(_h_Wplus_pT, crossSection()/sumOfWeights());
00108       scale(_h_Wminus_pT, crossSection()/sumOfWeights());
00109     }
00110 
00111     //@}
00112 
00113 
00114   private:
00115 
00116     /// @name Histograms
00117     //@{
00118     Histo1DPtr _h_W_mass;
00119     Histo1DPtr _h_W_pT;
00120     Histo1DPtr _h_W_pT_peak;
00121     Histo1DPtr _h_W_y;
00122     Histo1DPtr _h_W_phi;
00123     Histo1DPtr _h_Wplus_pT;
00124     Histo1DPtr _h_Wminus_pT;
00125     Histo1DPtr _h_lepton_pT;
00126     Histo1DPtr _h_lepton_eta;
00127 
00128     Histo1DPtr _htmp_dsigminus_deta;
00129     Histo1DPtr _htmp_dsigplus_deta;
00130 
00131     Scatter2DPtr _h_asym;
00132     Scatter2DPtr _h_asym_pT;
00133     //@}
00134 
00135   };
00136 
00137 
00138 
00139   // The hook for the plugin system
00140   DECLARE_RIVET_PLUGIN(MC_WINC);
00141 
00142 }