MC_PHOTONS.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/RivetYODA.hh" 00004 #include "Rivet/Tools/Logging.hh" 00005 #include "Rivet/Projections/IdentifiedFinalState.hh" 00006 #include "Rivet/Projections/FinalState.hh" 00007 #include "Rivet/Projections/ChargedFinalState.hh" 00008 00009 namespace Rivet { 00010 00011 00012 class MC_PHOTONS : public Analysis { 00013 public: 00014 00015 /// @name Constructors etc. 00016 //@{ 00017 00018 /// Constructor 00019 MC_PHOTONS() 00020 : Analysis("MC_PHOTONS") 00021 { } 00022 00023 //@} 00024 00025 00026 /// @name Analysis methods 00027 //@{ 00028 00029 /// Book histograms and initialise projections before the run 00030 void init() { 00031 IdentifiedFinalState leptons(-5.0, 5.0, 10*GeV); 00032 IdentifiedFinalState photons(-5.0, 5.0); 00033 leptons.acceptChLeptons(); 00034 photons.acceptId(PHOTON); 00035 addProjection(leptons, "lFS"); 00036 addProjection(photons, "gammaFS"); 00037 00038 _h_Ptgamma = bookHisto1D("Ptgamma", logspace(50, 0.01, 30)); 00039 _h_Egamma = bookHisto1D("Egamma", logspace(50, 0.01, 200)); 00040 _h_sumPtgamma = bookHisto1D("sumPtgamma", 50, 0, 100); 00041 _h_sumEgamma = bookHisto1D("sumEgamma", 50, 0, sqrtS()/GeV/5.0); 00042 _h_DelR = bookHisto1D("DeltaR", 50, 0, 2); 00043 _h_DelR_weighted = bookHisto1D("DeltaR_ptweighted", 50, 0, 2); 00044 _h_DelR_R = bookHisto1D("DeltaR_R", 50, 0, 2); 00045 _h_DelR_R_weighted = bookHisto1D("DeltaR_R_ptweighted", 50, 0, 2); 00046 _p_DelR_vs_pTl = bookProfile1D("DeltaR_vs_pTlep", 50, 10, 120); 00047 _p_DelR_weighted_vs_pTl = bookProfile1D("DeltaR_ptweighted_vs_pTlep", 50, 10, 120); 00048 _p_DelR_R_vs_pTl = bookProfile1D("DeltaR_R_vs_pTlep", 50, 10, 120); 00049 _p_DelR_R_weighted_vs_pTl = bookProfile1D("DeltaR_R_ptweighted_vs_pTlep", 50, 10, 120); 00050 _p_sumPtgamma_vs_pTl = bookProfile1D("sumPtGamma_vs_pTlep", 50, 10, 120); 00051 } 00052 00053 00054 /// Perform the per-event analysis 00055 void analyze(const Event& event) { 00056 const double weight = event.weight(); 00057 00058 /// Get photons and leptons 00059 const ParticleVector& photons = applyProjection<FinalState>(event, "gammaFS").particles(); 00060 MSG_DEBUG("Photon multiplicity = " << photons.size()); 00061 const ParticleVector& leptons = applyProjection<FinalState>(event, "lFS").particles(); 00062 MSG_DEBUG("Photon multiplicity = " << leptons.size()); 00063 00064 // Initialise a map of sumPtgamma for each lepton 00065 map<size_t, double> sumpT_per_lep; 00066 for (size_t il = 0; il < leptons.size(); ++il) sumpT_per_lep[il] = 0; 00067 00068 // Calculate photon energies and transverse momenta 00069 double sumPtgamma(0), sumEgamma(0); 00070 foreach (const Particle& p, photons) { 00071 // Individual and summed pTs and energies 00072 double pTgamma = p.momentum().pT()/GeV; 00073 double Egamma = p.momentum().E()/GeV; 00074 _h_Ptgamma->fill(pTgamma, weight); 00075 _h_Egamma->fill(Egamma, weight); 00076 sumPtgamma += pTgamma; 00077 sumEgamma += Egamma; 00078 00079 // Calculate delta R with respect to the nearest lepton 00080 int ilep = -1; 00081 double delR = 10000; 00082 for (size_t il = 0; il < leptons.size(); ++il) { 00083 const double tmpdelR = deltaR(leptons[il].momentum(), p.momentum()); 00084 if (tmpdelR < delR) { 00085 ilep = il; 00086 delR = tmpdelR; 00087 } 00088 } 00089 if (ilep != -1) { 00090 _h_DelR->fill(delR, weight); 00091 _h_DelR_weighted->fill(delR, weight*pTgamma/GeV); 00092 _h_DelR_R->fill(delR, weight/(delR+1e-5)); 00093 _h_DelR_R_weighted->fill(delR, weight*pTgamma/GeV/(delR+1e-5)); 00094 _p_DelR_vs_pTl->fill(leptons[ilep].momentum().pT()/GeV, delR, weight); 00095 _p_DelR_weighted_vs_pTl->fill(leptons[ilep].momentum().pT()/GeV, delR, weight*pTgamma/GeV); 00096 _p_DelR_R_vs_pTl->fill(leptons[ilep].momentum().pT()/GeV, delR, weight/(delR+1e-5)); 00097 _p_DelR_R_weighted_vs_pTl->fill(leptons[ilep].momentum().pT()/GeV, delR, weight*pTgamma/GeV/(delR+1e-5)); 00098 sumpT_per_lep[ilep] += pTgamma; 00099 } 00100 } 00101 00102 // Histogram whole-event photon HT/energy 00103 _h_sumPtgamma->fill(sumPtgamma/GeV, weight); 00104 _h_sumEgamma->fill(sumEgamma/GeV, weight); 00105 00106 // Histogram per-lepton sum(pT) 00107 for (size_t il = 0; il < leptons.size(); ++il) { 00108 _p_sumPtgamma_vs_pTl->fill(leptons[il].momentum().pT()/GeV, sumpT_per_lep[il]/GeV, weight); 00109 } 00110 00111 } 00112 00113 00114 /// Normalise histograms etc., after the run 00115 void finalize() { 00116 normalize(_h_Ptgamma); 00117 normalize(_h_Egamma); 00118 normalize(_h_sumPtgamma); 00119 normalize(_h_sumEgamma); 00120 normalize(_h_DelR); 00121 normalize(_h_DelR_weighted); 00122 normalize(_h_DelR_R); 00123 normalize(_h_DelR_R_weighted); 00124 } 00125 00126 //@} 00127 00128 00129 private: 00130 00131 /// @name Histograms 00132 //@{ 00133 Histo1DPtr _h_Ptgamma, _h_Egamma; 00134 Histo1DPtr _h_sumPtgamma, _h_sumEgamma; 00135 Histo1DPtr _h_DelR, _h_DelR_weighted; 00136 Histo1DPtr _h_DelR_R, _h_DelR_R_weighted; 00137 Profile1DPtr _p_DelR_vs_pTl, _p_DelR_weighted_vs_pTl; 00138 Profile1DPtr _p_DelR_R_vs_pTl, _p_DelR_R_weighted_vs_pTl; 00139 Profile1DPtr _p_sumPtgamma_vs_pTl; 00140 //@} 00141 00142 }; 00143 00144 00145 // The hook for the plugin system 00146 DECLARE_RIVET_PLUGIN(MC_PHOTONS); 00147 00148 00149 } Generated on Fri Dec 21 2012 15:03:41 for The Rivet MC analysis system by ![]() |