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(-2.1, 2.1, 6.0*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 int nb = 0; 00035 foreach (const GenParticle* p, particles(event.genEvent())) { 00036 if (abs(p->pdg_id()) == PID::BQUARK) nb += 1; 00037 } 00038 if (nb == 0) vetoEvent; 00039 nbtot += weight; 00040 00041 // Event must contain a muon 00042 Particles muons = applyProjection<IdentifiedFinalState>(event, "IFS").particlesByPt(); 00043 if (muons.size() < 1) vetoEvent; 00044 nbmutot += weight; 00045 00046 FourMomentum pmu = muons[0].momentum(); 00047 _h_total->fill( 7000/GeV, weight); 00048 _h_mupt->fill( pmu.pT()/GeV, weight); 00049 _h_mueta->fill( pmu.eta()/GeV, weight); 00050 } 00051 00052 00053 /// Normalise histograms etc., after the run 00054 void finalize() { 00055 scale(_h_total, crossSection()/microbarn/sumOfWeights()); 00056 scale(_h_mupt, crossSection()/nanobarn/sumOfWeights()); 00057 scale(_h_mueta, crossSection()/nanobarn/sumOfWeights()); 00058 } 00059 00060 00061 private: 00062 00063 double nbtot, nbmutot; 00064 00065 Histo1DPtr _h_total; 00066 Histo1DPtr _h_mupt; 00067 Histo1DPtr _h_mueta; 00068 00069 }; 00070 00071 00072 // Hook for the plugin system 00073 DECLARE_RIVET_PLUGIN(CMS_2011_S8941262); 00074 00075 } Generated on Tue Sep 30 2014 19:45:43 for The Rivet MC analysis system by ![]() |