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_Wplus_pT = bookHistogram1D("Wplus_pT", logBinEdges(25, 10.0, 0.5*sqrtS()));
00042 _h_Wminus_pT = bookHistogram1D("Wminus_pT", logBinEdges(25, 10.0, 0.5*sqrtS()));
00043 _h_lepton_pT = bookHistogram1D("lepton_pT", logBinEdges(100, 10.0, 0.25*sqrtS()));
00044 _h_lepton_eta = bookHistogram1D("lepton_eta", 40, -4.0, 4.0);
00045 _htmp_dsigminus_deta = bookHistogram1D("lepton_dsigminus_deta", 20, 0.0, 4.0);
00046 _htmp_dsigplus_deta = bookHistogram1D("lepton_dsigplus_deta", 20, 0.0, 4.0);
00047
00048 MC_JetAnalysis::init();
00049 }
00050
00051
00052
00053
00054 void analyze(const Event & e) {
00055 const WFinder& wfinder = applyProjection<WFinder>(e, "WFinder");
00056 if (wfinder.bosons().size() != 1) {
00057 vetoEvent;
00058 }
00059 const double weight = e.weight();
00060
00061 double charge3_x_eta = 0;
00062 int charge3 = 0;
00063 FourMomentum emom;
00064 FourMomentum wmom(wfinder.bosons().front().momentum());
00065 _h_W_mass->fill(wmom.mass(), weight);
00066 _h_W_pT->fill(wmom.pT(), weight);
00067 _h_W_pT_peak->fill(wmom.pT(), weight);
00068 _h_W_y->fill(wmom.rapidity(), weight);
00069 _h_W_phi->fill(wmom.azimuthalAngle(), weight);
00070 Particle l=wfinder.constituentLeptons()[0];
00071 _h_lepton_pT->fill(l.momentum().pT(), weight);
00072 _h_lepton_eta->fill(l.momentum().eta(), weight);
00073 if (PID::threeCharge(l.pdgId()) != 0) {
00074 emom = l.momentum();
00075 charge3_x_eta = PID::threeCharge(l.pdgId()) * emom.eta();
00076 charge3 = PID::threeCharge(l.pdgId());
00077 }
00078 assert(charge3_x_eta != 0);
00079 assert(charge3!=0);
00080 if (emom.Et() > 30/GeV) {
00081 if (charge3_x_eta < 0) {
00082 _htmp_dsigminus_deta->fill(emom.eta(), weight);
00083 } else {
00084 _htmp_dsigplus_deta->fill(emom.eta(), weight);
00085 }
00086 }
00087 if (charge3 < 0) {
00088 _h_Wminus_pT->fill(wmom.pT(), weight);
00089 } else {
00090 _h_Wplus_pT->fill(wmom.pT(), weight);
00091 }
00092
00093 const FastJets& jetpro = applyProjection<FastJets>(e, "Jets");
00094 const Jets& jets = jetpro.jetsByPt(20.0*GeV);
00095 if (jets.size() > 0) {
00096 _h_W_jet1_deta->fill(wmom.eta()-jets[0].momentum().eta(), weight);
00097 _h_W_jet1_dR->fill(deltaR(wmom, jets[0].momentum()), weight);
00098 }
00099
00100 MC_JetAnalysis::analyze(e);
00101 }
00102
00103
00104
00105 void finalize() {
00106 scale(_h_W_mass, crossSection()/sumOfWeights());
00107 scale(_h_W_pT, crossSection()/sumOfWeights());
00108 scale(_h_W_pT_peak, crossSection()/sumOfWeights());
00109 scale(_h_W_y, crossSection()/sumOfWeights());
00110 scale(_h_W_phi, crossSection()/sumOfWeights());
00111 scale(_h_W_jet1_deta, crossSection()/sumOfWeights());
00112 scale(_h_W_jet1_dR, crossSection()/sumOfWeights());
00113 scale(_h_lepton_pT, crossSection()/sumOfWeights());
00114 scale(_h_lepton_eta, crossSection()/sumOfWeights());
00115
00116
00117 AIDA::IHistogramFactory& hf = histogramFactory();
00118 IHistogram1D* numtmp = hf.subtract("/numtmp", *_htmp_dsigplus_deta, *_htmp_dsigminus_deta);
00119 IHistogram1D* dentmp = hf.add("/dentmp", *_htmp_dsigplus_deta, *_htmp_dsigminus_deta);
00120 assert(numtmp && dentmp);
00121 hf.divide(histoDir() + "/W_chargeasymm_eta", *numtmp, *dentmp);
00122 hf.destroy(numtmp);
00123 hf.destroy(dentmp);
00124 hf.destroy(_htmp_dsigminus_deta);
00125 hf.destroy(_htmp_dsigplus_deta);
00126
00127
00128 hf.divide(histoDir() + "/W_chargeasymm_pT", *_h_Wplus_pT, *_h_Wminus_pT);
00129 scale(_h_Wplus_pT, crossSection()/sumOfWeights());
00130 scale(_h_Wminus_pT, crossSection()/sumOfWeights());
00131
00132 MC_JetAnalysis::finalize();
00133 }
00134
00135
00136
00137
00138 private:
00139
00140
00141
00142 AIDA::IHistogram1D * _h_W_mass;
00143 AIDA::IHistogram1D * _h_W_pT;
00144 AIDA::IHistogram1D * _h_W_pT_peak;
00145 AIDA::IHistogram1D * _h_W_y;
00146 AIDA::IHistogram1D * _h_W_phi;
00147 AIDA::IHistogram1D * _h_W_jet1_deta;
00148 AIDA::IHistogram1D * _h_W_jet1_dR;
00149 AIDA::IHistogram1D * _h_Wplus_pT;
00150 AIDA::IHistogram1D * _h_Wminus_pT;
00151 AIDA::IHistogram1D * _h_lepton_pT;
00152 AIDA::IHistogram1D * _h_lepton_eta;
00153
00154 AIDA::IHistogram1D * _htmp_dsigminus_deta;
00155 AIDA::IHistogram1D * _htmp_dsigplus_deta;
00156
00157
00158 };
00159
00160
00161
00162
00163 AnalysisBuilder<MC_WJETS> plugin_MC_WJETS;
00164
00165 }