CMS_2011_S8941262.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/IdentifiedFinalState.hh" 00004 #include "Rivet/Particle.hh" 00005 00006 namespace Rivet { 00007 00008 00009 class CMS_2011_S8941262 : public Analysis { 00010 public: 00011 00012 /// Constructor 00013 CMS_2011_S8941262() : Analysis("CMS_2011_S8941262") { } 00014 00015 00016 /// Book histograms and initialise projections before the run 00017 void init() { 00018 _h_total = bookHisto1D(1, 1, 1); 00019 _h_mupt = bookHisto1D(2, 1, 1); 00020 _h_mueta = bookHisto1D(3, 1, 1); 00021 nbtot=0.; nbmutot=0.; 00022 00023 IdentifiedFinalState ifs(Cuts::abseta < 2.1 && Cuts::pT > 6*GeV); 00024 ifs.acceptIdPair(PID::MUON); 00025 addProjection(ifs, "IFS"); 00026 } 00027 00028 00029 /// Perform the per-event analysis 00030 void analyze(const Event& event) { 00031 const double weight = event.weight(); 00032 00033 // a b-quark must have been produced 00034 /// @todo Ouch. Use hadron tagging... 00035 int nb = 0; 00036 foreach (const GenParticle* p, particles(event.genEvent())) { 00037 if (abs(p->pdg_id()) == PID::BQUARK) nb += 1; 00038 } 00039 if (nb == 0) vetoEvent; 00040 nbtot += weight; 00041 00042 // Event must contain a muon 00043 Particles muons = applyProjection<IdentifiedFinalState>(event, "IFS").particlesByPt(); 00044 if (muons.size() < 1) vetoEvent; 00045 nbmutot += weight; 00046 00047 FourMomentum pmu = muons[0].momentum(); 00048 _h_total->fill( 7000/GeV, weight); 00049 _h_mupt->fill( pmu.pT()/GeV, weight); 00050 _h_mueta->fill( pmu.eta()/GeV, weight); 00051 } 00052 00053 00054 /// Normalise histograms etc., after the run 00055 void finalize() { 00056 scale(_h_total, crossSection()/microbarn/sumOfWeights()); 00057 scale(_h_mupt, crossSection()/nanobarn/sumOfWeights()); 00058 scale(_h_mueta, crossSection()/nanobarn/sumOfWeights()); 00059 } 00060 00061 00062 private: 00063 00064 double nbtot, nbmutot; 00065 00066 Histo1DPtr _h_total; 00067 Histo1DPtr _h_mupt; 00068 Histo1DPtr _h_mueta; 00069 00070 }; 00071 00072 00073 // Hook for the plugin system 00074 DECLARE_RIVET_PLUGIN(CMS_2011_S8941262); 00075 00076 } Generated on Tue Mar 24 2015 17:35:26 for The Rivet MC analysis system by ![]() |