00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Projections/FinalState.hh"
00005 #include "Rivet/Projections/IdentifiedFinalState.hh"
00006 #include "Rivet/Tools/Logging.hh"
00007
00008 namespace Rivet {
00009
00010
00011
00012 class MC_DIPHOTON : public Analysis {
00013 public:
00014
00015
00016 MC_DIPHOTON() : Analysis("MC_DIPHOTON") {
00017 setNeedsCrossSection(true);
00018 }
00019
00020
00021
00022
00023
00024 void init() {
00025 FinalState fs;
00026 addProjection(fs, "FS");
00027
00028 IdentifiedFinalState ifs(-2.0, 2.0, 20.0*GeV);
00029 ifs.acceptId(PHOTON);
00030 addProjection(ifs, "IFS");
00031
00032 _h_m_PP = bookHistogram1D("m_PP", logBinEdges(50, 1.0, 0.25*sqrtS()));
00033 _h_pT_PP = bookHistogram1D("pT_PP", logBinEdges(50, 1.0, 0.25*sqrtS()));
00034 _h_dphi_PP = bookHistogram1D("dphi_PP", 20, 0.0, M_PI);
00035 }
00036
00037
00038 void analyze(const Event& event) {
00039 const double weight = event.weight();
00040
00041 ParticleVector photons = applyProjection<IdentifiedFinalState>(event, "IFS").particles();
00042
00043 if (photons.size() < 2) {
00044 vetoEvent;
00045 }
00046
00047
00048 ParticleVector isolated_photons;
00049 ParticleVector fs = applyProjection<FinalState>(event, "FS").particles();
00050 foreach (const Particle& photon, photons) {
00051 FourMomentum mom_in_cone;
00052 double eta_P = photon.momentum().eta();
00053 double phi_P = photon.momentum().phi();
00054 foreach (const Particle& p, fs) {
00055 if (deltaR(eta_P, phi_P, p.momentum().eta(), p.momentum().phi()) < 0.4) {
00056 mom_in_cone += p.momentum();
00057 }
00058 }
00059 if (mom_in_cone.Et()-photon.momentum().Et() < 1.0*GeV) {
00060 isolated_photons.push_back(photon);
00061 }
00062 }
00063
00064 if (isolated_photons.size() != 2) {
00065 vetoEvent;
00066 }
00067
00068 FourMomentum mom_PP = isolated_photons[0].momentum() + isolated_photons[1].momentum();
00069 _h_m_PP->fill(mom_PP.mass(), weight);
00070 _h_pT_PP->fill(mom_PP.pT(), weight);
00071 _h_dphi_PP->fill(mapAngle0ToPi(isolated_photons[0].momentum().phi()-
00072 isolated_photons[1].momentum().phi())/M_PI, weight);
00073 }
00074
00075
00076 void finalize() {
00077 scale(_h_m_PP, crossSection()/sumOfWeights());
00078 scale(_h_pT_PP, crossSection()/sumOfWeights());
00079 scale(_h_dphi_PP, crossSection()/sumOfWeights());
00080 }
00081
00082
00083
00084
00085 private:
00086
00087
00088
00089 AIDA::IHistogram1D* _h_m_PP;
00090 AIDA::IHistogram1D* _h_pT_PP;
00091 AIDA::IHistogram1D* _h_dphi_PP;
00092
00093
00094
00095 };
00096
00097
00098
00099
00100 AnalysisBuilder<MC_DIPHOTON> plugin_MC_DIPHOTON;
00101
00102 }
00103