00001
00002 #include "Rivet/Analyses/MC_JetAnalysis.hh"
00003 #include "Rivet/Projections/WFinder.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "Rivet/RivetAIDA.hh"
00007 #include "Rivet/Tools/ParticleIdUtils.hh"
00008
00009 namespace Rivet {
00010
00011
00012
00013 class MC_WJETS : public MC_JetAnalysis {
00014 public:
00015
00016
00017 MC_WJETS()
00018 : MC_JetAnalysis("MC_WJETS", 4, "Jets")
00019 { }
00020
00021
00022
00023
00024
00025
00026 void init() {
00027 WFinder wfinder(-3.5, 3.5, 25.0*GeV, ELECTRON, 60.0*GeV, 100.0*GeV, 25.0*GeV, 0.2);
00028 addProjection(wfinder, "WFinder");
00029 FastJets jetpro(wfinder.remainingFinalState(), FastJets::KT, 0.7);
00030 addProjection(jetpro, "Jets");
00031
00032 _h_W_mass = bookHistogram1D("W_mass", 50, 55.0, 105.0);
00033 _h_W_pT = bookHistogram1D("W_pT", logBinEdges(100, 1.0, 0.5*sqrtS()));
00034 _h_W_pT_peak = bookHistogram1D("W_pT_peak", 25, 0.0, 125.0);
00035 _h_W_y = bookHistogram1D("W_y", 40, -4.0, 4.0);
00036 _h_W_phi = bookHistogram1D("W_phi", 25, 0.0, TWOPI);
00037 _h_W_jet1_deta = bookHistogram1D("W_jet1_deta", 50, -5.0, 5.0);
00038 _h_W_jet1_dR = bookHistogram1D("W_jet1_dR", 25, 0.5, 7.0);
00039 _h_Wplus_pT = bookHistogram1D("Wplus_pT", logBinEdges(25, 10.0, 0.5*sqrtS()));
00040 _h_Wminus_pT = bookHistogram1D("Wminus_pT", logBinEdges(25, 10.0, 0.5*sqrtS()));
00041 _h_lepton_pT = bookHistogram1D("lepton_pT", logBinEdges(100, 10.0, 0.25*sqrtS()));
00042 _h_lepton_eta = bookHistogram1D("lepton_eta", 40, -4.0, 4.0);
00043 _htmp_dsigminus_deta = bookHistogram1D("lepton_dsigminus_deta", 20, 0.0, 4.0);
00044 _htmp_dsigplus_deta = bookHistogram1D("lepton_dsigplus_deta", 20, 0.0, 4.0);
00045
00046 MC_JetAnalysis::init();
00047 }
00048
00049
00050
00051
00052 void analyze(const Event & e) {
00053 const WFinder& wfinder = applyProjection<WFinder>(e, "WFinder");
00054 if (wfinder.bosons().size() != 1) {
00055 vetoEvent;
00056 }
00057 const double weight = e.weight();
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.azimuthalAngle(), weight);
00068 Particle l=wfinder.constituentLeptons()[0];
00069 _h_lepton_pT->fill(l.momentum().pT(), weight);
00070 _h_lepton_eta->fill(l.momentum().eta(), weight);
00071 if (PID::threeCharge(l.pdgId()) != 0) {
00072 emom = l.momentum();
00073 charge3_x_eta = PID::threeCharge(l.pdgId()) * emom.eta();
00074 charge3 = PID::threeCharge(l.pdgId());
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 const FastJets& jetpro = applyProjection<FastJets>(e, "Jets");
00092 const Jets& jets = jetpro.jetsByPt(20.0*GeV);
00093 if (jets.size() > 0) {
00094 _h_W_jet1_deta->fill(wmom.eta()-jets[0].momentum().eta(), weight);
00095 _h_W_jet1_dR->fill(deltaR(wmom, jets[0].momentum()), weight);
00096 }
00097
00098 MC_JetAnalysis::analyze(e);
00099 }
00100
00101
00102
00103 void finalize() {
00104 scale(_h_W_mass, crossSection()/sumOfWeights());
00105 scale(_h_W_pT, crossSection()/sumOfWeights());
00106 scale(_h_W_pT_peak, crossSection()/sumOfWeights());
00107 scale(_h_W_y, crossSection()/sumOfWeights());
00108 scale(_h_W_phi, crossSection()/sumOfWeights());
00109 scale(_h_W_jet1_deta, crossSection()/sumOfWeights());
00110 scale(_h_W_jet1_dR, crossSection()/sumOfWeights());
00111 scale(_h_lepton_pT, crossSection()/sumOfWeights());
00112 scale(_h_lepton_eta, crossSection()/sumOfWeights());
00113
00114
00115 AIDA::IHistogramFactory& hf = histogramFactory();
00116 IHistogram1D* numtmp = hf.subtract("/numtmp", *_htmp_dsigplus_deta, *_htmp_dsigminus_deta);
00117 IHistogram1D* dentmp = hf.add("/dentmp", *_htmp_dsigplus_deta, *_htmp_dsigminus_deta);
00118 assert(numtmp && dentmp);
00119 hf.divide(histoDir() + "/W_chargeasymm_eta", *numtmp, *dentmp);
00120 hf.destroy(numtmp);
00121 hf.destroy(dentmp);
00122 hf.destroy(_htmp_dsigminus_deta);
00123 hf.destroy(_htmp_dsigplus_deta);
00124
00125
00126 hf.divide(histoDir() + "/W_chargeasymm_pT", *_h_Wplus_pT, *_h_Wminus_pT);
00127 scale(_h_Wplus_pT, crossSection()/sumOfWeights());
00128 scale(_h_Wminus_pT, crossSection()/sumOfWeights());
00129
00130 MC_JetAnalysis::finalize();
00131 }
00132
00133
00134
00135
00136 private:
00137
00138
00139
00140 AIDA::IHistogram1D * _h_W_mass;
00141 AIDA::IHistogram1D * _h_W_pT;
00142 AIDA::IHistogram1D * _h_W_pT_peak;
00143 AIDA::IHistogram1D * _h_W_y;
00144 AIDA::IHistogram1D * _h_W_phi;
00145 AIDA::IHistogram1D * _h_W_jet1_deta;
00146 AIDA::IHistogram1D * _h_W_jet1_dR;
00147 AIDA::IHistogram1D * _h_Wplus_pT;
00148 AIDA::IHistogram1D * _h_Wminus_pT;
00149 AIDA::IHistogram1D * _h_lepton_pT;
00150 AIDA::IHistogram1D * _h_lepton_eta;
00151
00152 AIDA::IHistogram1D * _htmp_dsigminus_deta;
00153 AIDA::IHistogram1D * _htmp_dsigplus_deta;
00154
00155
00156 };
00157
00158
00159
00160
00161 DECLARE_RIVET_PLUGIN(MC_WJETS);
00162
00163 }