rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1118269.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Particle.hh"
00004 
00005 namespace Rivet {
00006 
00007   class ATLAS_2012_I1118269 : public Analysis {
00008   public:
00009 
00010     ATLAS_2012_I1118269() : Analysis("ATLAS_2012_I1118269")
00011     {  }
00012 
00013     void init() {
00014       _h_sigma_vs_pt  = bookHisto1D(1, 1, 1);
00015       _h_sigma_vs_eta = bookHisto1D(2, 1, 1);
00016     }
00017 
00018     /// Perform the per-event analysis
00019     void analyze(const Event& event) {
00020       double weight = event.weight();
00021 
00022       Particles bhadrons;
00023       foreach (const GenParticle* p, particles(event.genEvent())) {
00024 
00025         if (!( PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) ) continue;
00026 
00027         const GenVertex* dv = p->end_vertex();
00028 
00029         /// @todo In future, convert to use built-in 'last B hadron' function
00030         bool hasBdaughter = false;
00031         if ( PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) { // b-hadron selection
00032           if (dv) {
00033             for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ; pp != dv->particles_out_const_end() ; ++pp) {
00034               if ( PID::isHadron( (*pp)->pdg_id() ) && PID::hasBottom( (*pp)->pdg_id()) ) {
00035                 hasBdaughter = true;
00036               }
00037             }
00038           }
00039         }
00040         if (hasBdaughter) continue;
00041 
00042         bhadrons += Particle(*p);
00043       }
00044 
00045       foreach (const Particle& particle, bhadrons) {
00046         double eta = particle.eta();
00047         double pt = particle.pT();
00048 
00049         if (!(inRange(eta, -2.5, 2.5))) continue;
00050         if (pt < 9.*GeV) continue;
00051 
00052         _h_sigma_vs_pt->fill(pt, weight);
00053         _h_sigma_vs_eta->fill(fabs(eta), weight);
00054 
00055       }
00056 
00057     }
00058 
00059 
00060     void finalize() {
00061       scale(_h_sigma_vs_pt,  crossSection()/nanobarn/sumOfWeights());
00062       scale(_h_sigma_vs_eta, crossSection()/microbarn/sumOfWeights());
00063     }
00064 
00065 
00066   private:
00067 
00068     Histo1DPtr _h_sigma_vs_pt;
00069     Histo1DPtr _h_sigma_vs_eta;
00070 
00071   };
00072 
00073 
00074   // Hook for the plugin system
00075   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1118269);
00076 
00077 }