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