MC_HFJETS.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/FastJets.hh" 00004 #include "Rivet/Projections/FinalState.hh" 00005 #include "Rivet/Projections/UnstableFinalState.hh" 00006 #include "Rivet/Projections/PrimaryHadrons.hh" 00007 #include "Rivet/Projections/HeavyHadrons.hh" 00008 00009 namespace Rivet { 00010 00011 00012 00013 00014 class MC_HFJETS : public Analysis { 00015 public: 00016 00017 /// Constructor 00018 MC_HFJETS() 00019 : Analysis("MC_HFJETS") 00020 { } 00021 00022 00023 public: 00024 00025 /// @name Analysis methods 00026 //@{ 00027 00028 /// Book histograms and initialise projections before the run 00029 void init() { 00030 00031 FastJets fj(FinalState(-5, 5), FastJets::ANTIKT, 0.6); 00032 fj.useInvisibles(); 00033 addProjection(fj, "Jets"); 00034 addProjection(HeavyHadrons(Cuts::abseta < 5 && Cuts::pT > 500*MeV), "BCHadrons"); 00035 00036 _h_ptCJetLead = bookHisto1D("ptCJetLead", linspace(5, 0, 20, false) + logspace(25, 20, 200)); 00037 _h_ptCHadrLead = bookHisto1D("ptCHadrLead", linspace(5, 0, 10, false) + logspace(25, 10, 200)); 00038 _h_ptFracC = bookHisto1D("ptfracC", 50, 0, 1.5); 00039 _h_eFracC = bookHisto1D("efracC", 50, 0, 1.5); 00040 00041 _h_ptBJetLead = bookHisto1D("ptBJetLead", linspace(5, 0, 20, false) + logspace(25, 20, 200)); 00042 _h_ptBHadrLead = bookHisto1D("ptBHadrLead", linspace(5, 0, 10, false) + logspace(25, 10, 200)); 00043 _h_ptFracB = bookHisto1D("ptfracB", 50, 0, 1.5); 00044 _h_eFracB = bookHisto1D("efracB", 50, 0, 1.5); 00045 } 00046 00047 00048 /// Perform the per-event analysis 00049 void analyze(const Event& event) { 00050 const double weight = event.weight(); 00051 00052 // Get jets and heavy hadrons 00053 const Jets& jets = applyProjection<JetAlg>(event, "Jets").jetsByPt(); 00054 const Particles bhadrons = sortByPt(applyProjection<HeavyHadrons>(event, "BCHadrons").bHadrons()); 00055 const Particles chadrons = sortByPt(applyProjection<HeavyHadrons>(event, "BCHadrons").cHadrons()); 00056 MSG_DEBUG("# b hadrons = " << bhadrons.size() << ", # c hadrons = " << chadrons.size()); 00057 00058 // Max HF hadron--jet axis dR to be regarded as a jet tag 00059 const double MAX_DR = 0.3; 00060 00061 // Tag the leading b and c jets with a deltaR < 0.3 match 00062 // b-tagged jet are excluded from also being considered as c-tagged 00063 /// @todo Do this again with the ghost match? 00064 MSG_DEBUG("Getting b/c-tags"); 00065 bool gotLeadingB = false, gotLeadingC = false;; 00066 foreach (const Jet& j, jets) { 00067 if (!gotLeadingB) { 00068 FourMomentum leadBJet, leadBHadr; 00069 double dRmin = MAX_DR; 00070 foreach (const Particle& b, bhadrons) { 00071 const double dRcand = min(dRmin, deltaR(j, b)); 00072 if (dRcand < dRmin) { 00073 dRmin = dRcand; 00074 leadBJet = j.momentum(); 00075 leadBHadr = b.momentum(); 00076 MSG_DEBUG("New closest b-hadron jet tag candidate: dR = " << dRmin 00077 << " for jet pT = " << j.pT()/GeV << " GeV, " 00078 << " b hadron pT = " << b.pT()/GeV << " GeV, PID = " << b.pid()); 00079 } 00080 } 00081 if (dRmin < MAX_DR) { 00082 // A jet has been tagged, so fill the histos and break the loop 00083 _h_ptBJetLead->fill(leadBJet.pT()/GeV, weight); 00084 _h_ptBHadrLead->fill(leadBHadr.pT()/GeV, weight); 00085 _h_ptFracB->fill(leadBHadr.pT() / leadBJet.pT(), weight); 00086 _h_eFracB->fill(leadBHadr.E() / leadBJet.E(), weight); 00087 gotLeadingB = true; 00088 continue; // escape this loop iteration so the same jet isn't c-tagged 00089 } 00090 } 00091 if (!gotLeadingC) { 00092 FourMomentum leadCJet, leadCHadr; 00093 double dRmin = MAX_DR; 00094 foreach (const Particle& c, chadrons) { 00095 const double dRcand = min(dRmin, deltaR(j, c)); 00096 if (dRcand < dRmin) { 00097 dRmin = dRcand; 00098 leadCJet = j.momentum(); 00099 leadCHadr = c.momentum(); 00100 MSG_DEBUG("New closest c-hadron jet tag candidate: dR = " << dRmin 00101 << " for jet pT = " << j.pT()/GeV << " GeV, " 00102 << " c hadron pT = " << c.pT()/GeV << " GeV, PID = " << c.pid()); 00103 } 00104 } 00105 if (dRmin < MAX_DR) { 00106 // A jet has been tagged, so fill the histos and break the loop 00107 _h_ptCJetLead->fill(leadCJet.pT()/GeV, weight); 00108 _h_ptCHadrLead->fill(leadCHadr.pT()/GeV, weight); 00109 _h_ptFracC->fill(leadCHadr.pT() / leadCJet.pT(), weight); 00110 _h_eFracC->fill(leadCHadr.E() / leadCJet.E(), weight); 00111 gotLeadingB = true; 00112 } 00113 } 00114 // If we've found both a leading b and a leading c jet, break the loop over jets 00115 if (gotLeadingB && gotLeadingC) break; 00116 } 00117 00118 } 00119 00120 00121 /// Normalise histograms etc., after the run 00122 void finalize() { 00123 normalize(_h_ptCJetLead); 00124 normalize(_h_ptCHadrLead); 00125 normalize(_h_ptFracC); 00126 normalize(_h_eFracC); 00127 normalize(_h_ptBJetLead); 00128 normalize(_h_ptBHadrLead); 00129 normalize(_h_ptFracB); 00130 normalize(_h_eFracB); 00131 } 00132 00133 //@} 00134 00135 private: 00136 00137 /// @name Histograms 00138 //@{ 00139 Histo1DPtr _h_ptCJetLead, _h_ptCHadrLead, _h_ptFracC, _h_eFracC; 00140 Histo1DPtr _h_ptBJetLead, _h_ptBHadrLead, _h_ptFracB, _h_eFracB; 00141 //@} 00142 00143 00144 }; 00145 00146 00147 00148 // The hook for the plugin system 00149 DECLARE_RIVET_PLUGIN(MC_HFJETS); 00150 00151 } Generated on Wed Oct 7 2015 12:09:13 for The Rivet MC analysis system by ![]() |