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