MC_PHOTONJETS.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analyses/MC_JetAnalysis.hh"
00003 #include "Rivet/Projections/LeadingParticlesFinalState.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "Rivet/RivetAIDA.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief MC validation analysis for photon + jets events
00012   class MC_PHOTONJETS : public MC_JetAnalysis {
00013   public:
00014 
00015     /// Default constructor
00016     MC_PHOTONJETS()
00017       : MC_JetAnalysis("MC_PHOTONJETS", 4, "Jets")
00018     {
00019       setNeedsCrossSection(true);
00020     }
00021 
00022 
00023     /// @name Analysis methods
00024     //@{
00025 
00026     /// Book histograms
00027     void init() {
00028       // General FS
00029       FinalState fs(-5.0, 5.0);
00030       addProjection(fs, "FS");
00031 
00032       // Get leading photon
00033       LeadingParticlesFinalState photonfs(FinalState(-1.0, 1.0));
00034       photonfs.addParticleId(PHOTON);
00035       addProjection(photonfs, "LeadingPhoton");
00036 
00037       // FS for jets excludes the leading photon
00038       VetoedFinalState vfs(fs);
00039       vfs.addVetoOnThisFinalState(photonfs);
00040       addProjection(vfs, "JetFS");
00041       FastJets jetpro(vfs, FastJets::KT, 0.7);
00042       addProjection(jetpro, "Jets");
00043 
00044       _h_photon_pT = bookHistogram1D("photon_pT", logBinEdges(50, 1.0, 0.5*sqrtS()));
00045       _h_photon_y = bookHistogram1D("photon_y", 20, -1.0, 1.0);
00046       _h_photon_jet1_deta = bookHistogram1D("photon_jet1_deta", 50, -5.0, 5.0);
00047       _h_photon_jet1_dphi = bookHistogram1D("photon_jet1_dphi", 20, 0.0, M_PI);
00048       _h_photon_jet1_dR = bookHistogram1D("photon_jet1_dR", 25, 0.5, 7.0);
00049 
00050       MC_JetAnalysis::init();
00051     }
00052 
00053 
00054     /// Do the analysis
00055     void analyze(const Event& e) {
00056       // Get the photon
00057       const ParticleVector photons = applyProjection<FinalState>(e, "LeadingPhoton").particles();
00058       if (photons.size() != 1) {
00059         vetoEvent;
00060       }
00061       const FourMomentum photon = photons.front().momentum();
00062 
00063       // Get all charged particles
00064       const FinalState& fs = applyProjection<FinalState>(e, "JetFS");
00065       if (fs.empty()) {
00066         vetoEvent;
00067       }
00068 
00069       // Passed cuts, so get the weight
00070       const double weight = e.weight();
00071 
00072       // Isolate photon by ensuring that a 0.4 cone around it contains less than 7% of the photon's energy
00073       const double egamma = photon.E();
00074       double econe = 0.0;
00075       foreach (const Particle& p, fs.particles()) {
00076         if (deltaR(photon, p.momentum()) < 0.4) {
00077           econe += p.momentum().E();
00078           // Veto as soon as E_cone gets larger
00079           if (econe/egamma > 0.07) {
00080             vetoEvent;
00081           }
00082         }
00083       }
00084 
00085       _h_photon_pT->fill(photon.pT(),weight);
00086       _h_photon_y->fill(photon.rapidity(),weight);
00087 
00088       const FastJets& jetpro = applyProjection<FastJets>(e, "Jets");
00089       const Jets& jets = jetpro.jetsByPt(20.0*GeV);
00090       if (jets.size()>0) {
00091         _h_photon_jet1_deta->fill(photon.eta()-jets[0].momentum().eta(), weight);
00092         _h_photon_jet1_dphi->fill(mapAngle0ToPi(photon.phi()-jets[0].momentum().phi()), weight);
00093         _h_photon_jet1_dR->fill(deltaR(photon, jets[0].momentum()), weight);
00094       }
00095 
00096       MC_JetAnalysis::analyze(e);
00097     }
00098 
00099 
00100     // Finalize
00101     void finalize() {
00102       scale(_h_photon_pT, crossSectionPerEvent());
00103       scale(_h_photon_y, crossSectionPerEvent());
00104       scale(_h_photon_jet1_deta, crossSectionPerEvent());
00105       scale(_h_photon_jet1_dphi, crossSectionPerEvent());
00106       scale(_h_photon_jet1_dR, crossSectionPerEvent());
00107 
00108       MC_JetAnalysis::finalize();
00109     }
00110 
00111     //@}
00112 
00113 
00114   private:
00115 
00116     /// @name Histograms
00117     //@{
00118     AIDA::IHistogram1D * _h_photon_pT;
00119     AIDA::IHistogram1D * _h_photon_y;
00120     AIDA::IHistogram1D * _h_photon_jet1_deta;
00121     AIDA::IHistogram1D * _h_photon_jet1_dphi;
00122     AIDA::IHistogram1D * _h_photon_jet1_dR;
00123     //@}
00124 
00125   };
00126 
00127 
00128 
00129   // This global object acts as a hook for the plugin system
00130   AnalysisBuilder<MC_PHOTONJETS> plugin_MC_PHOTONJETS;
00131 
00132 }