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 setNeedsCrossSection(true);
00021 }
00022
00023
00024
00025
00026
00027
00028 void init() {
00029 WFinder wfinder(-3.5, 3.5, 25.0*GeV, ELECTRON, 60.0*GeV, 100.0*GeV, 25.0*GeV, 0.2);
00030 addProjection(wfinder, "WFinder");
00031 FastJets jetpro(wfinder.remainingFinalState(), FastJets::KT, 0.7);
00032 addProjection(jetpro, "Jets");
00033
00034 _h_W_mass = bookHistogram1D("W_mass", 50, 55.0, 105.0);
00035 _h_W_pT = bookHistogram1D("W_pT", logBinEdges(100, 1.0, 0.5*sqrtS()));
00036 _h_W_pT_peak = bookHistogram1D("W_pT_peak", 25, 0.0, 25.0);
00037 _h_W_y = bookHistogram1D("W_y", 40, -4.0, 4.0);
00038 _h_W_phi = bookHistogram1D("W_phi", 25, 0.0, TWOPI);
00039 _h_W_jet1_deta = bookHistogram1D("W_jet1_deta", 50, -5.0, 5.0);
00040 _h_W_jet1_dR = bookHistogram1D("W_jet1_dR", 25, 0.5, 7.0);
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.particles().size() != 1) {
00055 vetoEvent;
00056 }
00057 const double weight = e.weight();
00058
00059 int charge3_x_eta = 0;
00060 FourMomentum emom;
00061 FourMomentum wmom(wfinder.particles().front().momentum());
00062 _h_W_mass->fill(wmom.mass(), weight);
00063 _h_W_pT->fill(wmom.pT(), weight);
00064 _h_W_pT_peak->fill(wmom.pT(), weight);
00065 _h_W_y->fill(wmom.rapidity(), weight);
00066 _h_W_phi->fill(wmom.azimuthalAngle(), weight);
00067 foreach (const Particle& l, wfinder.constituentLeptonsFinalState().particles()) {
00068 _h_lepton_pT->fill(l.momentum().pT(), weight);
00069 _h_lepton_eta->fill(l.momentum().eta(), weight);
00070 if (PID::threeCharge(l.pdgId()) != 0) {
00071 emom = l.momentum();
00072 charge3_x_eta = PID::threeCharge(l.pdgId()) * emom.eta();
00073 }
00074 }
00075 assert(charge3_x_eta != 0);
00076 if (emom.Et() > 30/GeV) {
00077 if (charge3_x_eta < 0) {
00078 _htmp_dsigminus_deta->fill(emom.eta(), weight);
00079 } else {
00080 _htmp_dsigplus_deta->fill(emom.eta(), weight);
00081 }
00082 }
00083
00084 const FastJets& jetpro = applyProjection<FastJets>(e, "Jets");
00085 const Jets& jets = jetpro.jetsByPt(20.0*GeV);
00086 if (jets.size() > 0) {
00087 _h_W_jet1_deta->fill(wmom.eta()-jets[0].momentum().eta(), weight);
00088 _h_W_jet1_dR->fill(deltaR(wmom, jets[0].momentum()), weight);
00089 }
00090
00091 MC_JetAnalysis::analyze(e);
00092 }
00093
00094
00095
00096 void finalize() {
00097 scale(_h_W_mass, crossSection()/sumOfWeights());
00098 scale(_h_W_pT, crossSection()/sumOfWeights());
00099 scale(_h_W_pT_peak, crossSection()/sumOfWeights());
00100 scale(_h_W_y, crossSection()/sumOfWeights());
00101 scale(_h_W_phi, crossSection()/sumOfWeights());
00102 scale(_h_W_jet1_deta, crossSection()/sumOfWeights());
00103 scale(_h_W_jet1_dR, crossSection()/sumOfWeights());
00104 scale(_h_lepton_pT, crossSection()/sumOfWeights());
00105 scale(_h_lepton_eta, crossSection()/sumOfWeights());
00106
00107
00108 AIDA::IHistogramFactory& hf = histogramFactory();
00109 IHistogram1D* numtmp = hf.subtract("/numtmp", *_htmp_dsigplus_deta, *_htmp_dsigminus_deta);
00110 IHistogram1D* dentmp = hf.add("/dentmp", *_htmp_dsigplus_deta, *_htmp_dsigminus_deta);
00111 assert(numtmp && dentmp);
00112 hf.divide(histoDir() + "/W_chargeasymm_eta", *numtmp, *dentmp);
00113 hf.destroy(numtmp);
00114 hf.destroy(dentmp);
00115 hf.destroy(_htmp_dsigminus_deta);
00116 hf.destroy(_htmp_dsigplus_deta);
00117
00118 MC_JetAnalysis::finalize();
00119 }
00120
00121
00122
00123
00124 private:
00125
00126
00127
00128 AIDA::IHistogram1D * _h_W_mass;
00129 AIDA::IHistogram1D * _h_W_pT;
00130 AIDA::IHistogram1D * _h_W_pT_peak;
00131 AIDA::IHistogram1D * _h_W_y;
00132 AIDA::IHistogram1D * _h_W_phi;
00133 AIDA::IHistogram1D * _h_W_jet1_deta;
00134 AIDA::IHistogram1D * _h_W_jet1_dR;
00135 AIDA::IHistogram1D * _h_lepton_pT;
00136 AIDA::IHistogram1D * _h_lepton_eta;
00137
00138 AIDA::IHistogram1D * _htmp_dsigminus_deta;
00139 AIDA::IHistogram1D * _htmp_dsigplus_deta;
00140
00141
00142 };
00143
00144
00145
00146
00147 AnalysisBuilder<MC_WJETS> plugin_MC_WJETS;
00148
00149 }