MC_PHOTONJETUE.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/ChargedFinalState.hh" 00004 #include "Rivet/Projections/IdentifiedFinalState.hh" 00005 #include "Rivet/Projections/FastJets.hh" 00006 00007 namespace Rivet { 00008 00009 00010 /// @brief MC validation analysis for underlying event in jet + isolated photon events 00011 /// @author Andy Buckley 00012 class MC_PHOTONJETUE : public Analysis { 00013 public: 00014 00015 /// Constructor 00016 MC_PHOTONJETUE() 00017 : Analysis("MC_PHOTONJETUE") 00018 { } 00019 00020 00021 /// @name Analysis methods 00022 //@{ 00023 00024 // Book histograms and projections 00025 void init() { 00026 // Final state for the jet finding 00027 const FinalState fsj(-4.0, 4.0, 0.1*GeV); 00028 addProjection(fsj, "FSJ"); 00029 addProjection(FastJets(fsj, FastJets::ANTIKT, 0.7), "Jets"); 00030 00031 // Charged final state for the distributions 00032 const ChargedFinalState cfs(-2.0, 2.0, 0.2*GeV); 00033 addProjection(cfs, "Tracks"); 00034 00035 // Photons (for isolation) 00036 const FinalState fsp(-2.0, 2.0, 20.0*GeV); 00037 IdentifiedFinalState photonfs(fsp); 00038 photonfs.acceptId(PID::PHOTON); 00039 addProjection(photonfs, "Photons"); 00040 00041 // Histograms 00042 _hist_jetgamma_dR = bookHisto1D("gammajet-dR", 52, 0.0, 5.2); 00043 _hist_jetgamma_dphi = bookHisto1D("gammajet-dphi", 50, 0.0, PI); 00044 // 00045 const double MAXPT1 = 50.0; 00046 _hist_pnchg_jet = bookProfile1D("trans-nchg-jet", 50, 0.0, MAXPT1); 00047 _hist_pmaxnchg_jet = bookProfile1D("trans-maxnchg-jet", 50, 0.0, MAXPT1); 00048 _hist_pminnchg_jet = bookProfile1D("trans-minnchg-jet", 50, 0.0, MAXPT1); 00049 _hist_pcptsum_jet = bookProfile1D("trans-ptsum-jet", 50, 0.0, MAXPT1); 00050 _hist_pmaxcptsum_jet = bookProfile1D("trans-maxptsum-jet", 50, 0.0, MAXPT1); 00051 _hist_pmincptsum_jet = bookProfile1D("trans-minptsum-jet", 50, 0.0, MAXPT1); 00052 _hist_pcptave_jet = bookProfile1D("trans-ptavg-jet", 50, 0.0, MAXPT1); 00053 // 00054 _hist_pnchg_gamma = bookProfile1D("trans-nchg-gamma", 50, 0.0, MAXPT1); 00055 _hist_pmaxnchg_gamma = bookProfile1D("trans-maxnchg-gamma", 50, 0.0, MAXPT1); 00056 _hist_pminnchg_gamma = bookProfile1D("trans-minnchg-gamma", 50, 0.0, MAXPT1); 00057 _hist_pcptsum_gamma = bookProfile1D("trans-ptsum-gamma", 50, 0.0, MAXPT1); 00058 _hist_pmaxcptsum_gamma = bookProfile1D("trans-maxptsum-gamma", 50, 0.0, MAXPT1); 00059 _hist_pmincptsum_gamma = bookProfile1D("trans-minptsum-gamma", 50, 0.0, MAXPT1); 00060 _hist_pcptave_gamma = bookProfile1D("trans-ptavg-gamma", 50, 0.0, MAXPT1); 00061 } 00062 00063 00064 // Do the analysis 00065 void analyze(const Event& evt) { 00066 00067 // Get jets 00068 const Jets jets = applyProjection<FastJets>(evt, "Jets").jetsByPt(); 00069 MSG_DEBUG("Jet multiplicity = " << jets.size()); 00070 if (jets.size() < 1) { 00071 MSG_DEBUG("No jets found"); 00072 vetoEvent; 00073 } 00074 00075 // Get leading jet properties 00076 const FourMomentum pjet = jets.front().momentum(); 00077 const double jeteta = pjet.eta(); 00078 const double jetphi = pjet.phi(); 00079 const double jetpT = pjet.pT(); 00080 MSG_DEBUG("Leading jet: pT = " << jetpT/GeV << " GeV" 00081 << ", eta = " << jeteta 00082 << ", phi = " << jetphi); 00083 00084 // Require the leading jet to be within |eta| < 2 00085 if (fabs(jeteta) > 2) { 00086 MSG_DEBUG("Failed leading jet eta cut"); 00087 vetoEvent; 00088 } 00089 00090 // Get the leading photon 00091 const FinalState& photonfs = applyProjection<FinalState>(evt, "Photons"); 00092 if (photonfs.size() < 1) { 00093 MSG_DEBUG("No hard photons found"); 00094 vetoEvent; 00095 } 00096 const FourMomentum pgamma = photonfs.particlesByPt().front().momentum(); 00097 00098 // Check that leading photon is isolated from jets 00099 bool isolated = true; 00100 foreach (const Jet& j, jets) { 00101 if (deltaR(j.momentum(), pgamma) < 0.1) { 00102 isolated = false; 00103 break; 00104 } 00105 } 00106 if (!isolated) { 00107 MSG_DEBUG("Leading photon is not isolated from jets"); 00108 vetoEvent; 00109 } 00110 00111 // Get leading photon properties 00112 const double gammaeta = pgamma.eta(); 00113 const double gammaphi = pgamma.phi(); 00114 const double gammapT = pgamma.pT(); 00115 MSG_DEBUG("Leading photon: pT = " << gammapT/GeV << " GeV" 00116 << ", eta = " << gammaeta 00117 << ", phi = " << gammaphi); 00118 00119 // Get the event weight 00120 const double weight = evt.weight(); 00121 00122 // Fill jet1-photon separation histos 00123 const double dR_jetgamma = deltaR(pgamma, pjet); 00124 _hist_jetgamma_dR->fill(dR_jetgamma, weight); 00125 const double dPhi_jetgamma = deltaPhi(gammaphi, jetphi); 00126 _hist_jetgamma_dphi->fill(dPhi_jetgamma, weight); 00127 00128 /// Cut on back-to-backness of jet-photon 00129 if (dPhi_jetgamma < 0.5) vetoEvent; 00130 00131 /// @todo Plot evolution of UE as a function of jet-photon angle 00132 /// @todo Plot evolution of UE as a function of photon pT 00133 00134 // Get the final states to work with for filling the distributions 00135 const FinalState& cfs = applyProjection<ChargedFinalState>(evt, "Tracks"); 00136 00137 // Whole-event counters 00138 unsigned int numOverall(0); 00139 double ptSumOverall(0.0), ptMaxOverall(0.0); 00140 // Jet-oriented counters 00141 unsigned int numToward_jet(0), numTrans1_jet(0), numTrans2_jet(0), numAway_jet(0); 00142 double ptSumToward_jet(0.0), ptSumTrans1_jet(0.0), ptSumTrans2_jet(0.0), ptSumAway_jet(0.0); 00143 double ptMaxToward_jet(0.0), ptMaxTrans1_jet(0.0), ptMaxTrans2_jet(0.0), ptMaxAway_jet(0.0); 00144 // Photon-oriented counters 00145 unsigned int numToward_gamma(0), numTrans1_gamma(0), numTrans2_gamma(0), numAway_gamma(0); 00146 double ptSumToward_gamma(0.0), ptSumTrans1_gamma(0.0), ptSumTrans2_gamma(0.0), ptSumAway_gamma(0.0); 00147 double ptMaxToward_gamma(0.0), ptMaxTrans1_gamma(0.0), ptMaxTrans2_gamma(0.0), ptMaxAway_gamma(0.0); 00148 00149 // Calculate all the charged stuff 00150 foreach (const Particle& p, cfs.particles()) { 00151 ++numOverall; 00152 const double pT = p.pT(); 00153 ptSumOverall += pT; 00154 if (pT > ptMaxOverall) ptMaxOverall = pT; 00155 00156 // Increment jet-oriented variables 00157 const double dPhi_jet = jetphi - p.momentum().phi(); 00158 if (fabs(dPhi_jet) < PI/3.0) { 00159 ptSumToward_jet += pT; 00160 ++numToward_jet; 00161 if (pT > ptMaxToward_jet) ptMaxToward_jet = pT; 00162 } 00163 else if (fabs(dPhi_jet) < 2*PI/3.0) { 00164 if (sign(dPhi_jet) == MINUS) { 00165 ptSumTrans1_jet += pT; 00166 ++numTrans1_jet; 00167 if (pT > ptMaxTrans1_jet) ptMaxTrans1_jet = pT; 00168 } else { 00169 ptSumTrans2_jet += pT; 00170 ++numTrans2_jet; 00171 if (pT > ptMaxTrans2_jet) ptMaxTrans2_jet = pT; 00172 } 00173 } 00174 else { 00175 ptSumAway_jet += pT; 00176 ++numAway_jet; 00177 if (pT > ptMaxAway_jet) ptMaxAway_jet = pT; 00178 } 00179 00180 00181 // Increment photon-oriented variables 00182 const double dPhi_gamma = gammaphi - p.momentum().phi(); 00183 if (fabs(dPhi_gamma) < PI/3.0) { 00184 ptSumToward_gamma += pT; 00185 ++numToward_gamma; 00186 if (pT > ptMaxToward_gamma) ptMaxToward_gamma = pT; 00187 } 00188 else if (fabs(dPhi_gamma) < 2*PI/3.0) { 00189 if (sign(dPhi_gamma) == MINUS) { 00190 ptSumTrans1_gamma += pT; 00191 ++numTrans1_gamma; 00192 if (pT > ptMaxTrans1_gamma) ptMaxTrans1_gamma = pT; 00193 } else { 00194 ptSumTrans2_gamma += pT; 00195 ++numTrans2_gamma; 00196 if (pT > ptMaxTrans2_gamma) ptMaxTrans2_gamma = pT; 00197 } 00198 } 00199 else { 00200 ptSumAway_gamma += pT; 00201 ++numAway_gamma; 00202 if (pT > ptMaxAway_gamma) ptMaxAway_gamma = pT; 00203 } 00204 00205 00206 } 00207 00208 00209 // Fill the histograms 00210 _hist_pnchg_jet->fill(jetpT/GeV, (numTrans1_jet+numTrans2_jet)/(4*PI/3), weight); 00211 _hist_pmaxnchg_jet->fill(jetpT/GeV, (numTrans1_jet>numTrans2_jet ? numTrans1_jet : numTrans2_jet)/(2*PI/3), weight); 00212 _hist_pminnchg_jet->fill(jetpT/GeV, (numTrans1_jet<numTrans2_jet ? numTrans1_jet : numTrans2_jet)/(2*PI/3), weight); 00213 _hist_pcptsum_jet->fill(jetpT/GeV, (ptSumTrans1_jet+ptSumTrans2_jet)/GeV/(4*PI/3), weight); 00214 _hist_pmaxcptsum_jet->fill(jetpT/GeV, (ptSumTrans1_jet>ptSumTrans2_jet ? ptSumTrans1_jet : ptSumTrans2_jet)/GeV/(2*PI/3), weight); 00215 _hist_pmincptsum_jet->fill(jetpT/GeV, (ptSumTrans1_jet<ptSumTrans2_jet ? ptSumTrans1_jet : ptSumTrans2_jet)/GeV/(2*PI/3), weight); 00216 if ((numTrans1_jet+numTrans2_jet) > 0) { 00217 _hist_pcptave_jet->fill(jetpT/GeV, (ptSumTrans1_jet+ptSumTrans2_jet)/GeV/(numTrans1_jet+numTrans2_jet), weight); 00218 } 00219 // 00220 _hist_pnchg_gamma->fill(gammapT/GeV, (numTrans1_gamma+numTrans2_gamma)/(4*PI/3), weight); 00221 _hist_pmaxnchg_gamma->fill(gammapT/GeV, (numTrans1_gamma>numTrans2_gamma ? numTrans1_gamma : numTrans2_gamma)/(2*PI/3), weight); 00222 _hist_pminnchg_gamma->fill(gammapT/GeV, (numTrans1_gamma<numTrans2_gamma ? numTrans1_gamma : numTrans2_gamma)/(2*PI/3), weight); 00223 _hist_pcptsum_gamma->fill(gammapT/GeV, (ptSumTrans1_gamma+ptSumTrans2_gamma)/GeV/(4*PI/3), weight); 00224 _hist_pmaxcptsum_gamma->fill(gammapT/GeV, (ptSumTrans1_gamma>ptSumTrans2_gamma ? ptSumTrans1_gamma : ptSumTrans2_gamma)/GeV/(2*PI/3), weight); 00225 _hist_pmincptsum_gamma->fill(gammapT/GeV, (ptSumTrans1_gamma<ptSumTrans2_gamma ? ptSumTrans1_gamma : ptSumTrans2_gamma)/GeV/(2*PI/3), weight); 00226 if ((numTrans1_gamma+numTrans2_gamma) > 0) { 00227 _hist_pcptave_gamma->fill(gammapT/GeV, (ptSumTrans1_gamma+ptSumTrans2_gamma)/GeV/(numTrans1_gamma+numTrans2_gamma), weight); 00228 } 00229 00230 } 00231 00232 00233 void finalize() { 00234 // 00235 } 00236 00237 00238 private: 00239 00240 Histo1DPtr _hist_jetgamma_dR; 00241 Histo1DPtr _hist_jetgamma_dphi; 00242 00243 Profile1DPtr _hist_pnchg_jet, _hist_pnchg_gamma; 00244 Profile1DPtr _hist_pmaxnchg_jet, _hist_pmaxnchg_gamma; 00245 Profile1DPtr _hist_pminnchg_jet, _hist_pminnchg_gamma; 00246 Profile1DPtr _hist_pcptsum_jet, _hist_pcptsum_gamma; 00247 Profile1DPtr _hist_pmaxcptsum_jet, _hist_pmaxcptsum_gamma; 00248 Profile1DPtr _hist_pmincptsum_jet, _hist_pmincptsum_gamma; 00249 Profile1DPtr _hist_pcptave_jet, _hist_pcptave_gamma; 00250 00251 }; 00252 00253 00254 00255 // The hook for the plugin system 00256 DECLARE_RIVET_PLUGIN(MC_PHOTONJETUE); 00257 00258 } Generated on Fri Oct 25 2013 12:41:46 for The Rivet MC analysis system by ![]() |