rivet is hosted by Hepforge, IPPP Durham
LHCB_2010_I867355.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Particle.hh"
00004 
00005 
00006 namespace Rivet {
00007 
00008   class LHCB_2010_I867355 : public Analysis {
00009   public:
00010 
00011     LHCB_2010_I867355() : Analysis("LHCB_2010_I867355")
00012     {  }
00013 
00014     void init() {
00015 
00016       //@ Results are presented for two different fragmentation functions, LEP and Tevatron. Therefore, we have two sets of histograms.
00017       _h_sigma_vs_eta_lep = bookHisto1D(1, 1, 1);
00018       _h_sigma_vs_eta_tvt = bookHisto1D(1, 1, 2);
00019       _h_sigma_total_lep  = bookHisto1D(2, 1, 1);
00020       _h_sigma_total_tvt  = bookHisto1D(2, 1, 2);
00021 
00022     }
00023 
00024     /// Perform the per-event analysis
00025     void analyze(const Event& event) {
00026       double weight = event.weight();
00027 
00028       Particles bhadrons;
00029       foreach (const GenParticle* p, particles(event.genEvent())) {
00030         if (!( PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) ) continue;
00031 
00032         const GenVertex* dv = p->end_vertex();
00033 
00034         bool hasBdaughter = false;
00035         if ( PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) { // selecting b-hadrons
00036           if (dv) {
00037             for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ; pp != dv->particles_out_const_end() ; ++pp) {
00038               if (PID::isHadron( (*pp)->pdg_id() ) && PID::hasBottom( (*pp)->pdg_id() )) {
00039                 hasBdaughter = true;
00040               }
00041             }
00042           }
00043         }
00044         if (hasBdaughter) continue; // continue if the daughter is another b-hadron
00045 
00046         bhadrons += Particle(*p);
00047       }
00048 
00049       foreach (const Particle& particle, bhadrons) {
00050 
00051         // take fabs() to use full statistics and then multiply weight by 0.5 because LHCb is single-sided
00052         double eta = fabs(particle.eta());
00053 
00054         _h_sigma_vs_eta_lep->fill( eta, 0.5*weight );
00055         _h_sigma_vs_eta_tvt->fill( eta, 0.5*weight );
00056 
00057         _h_sigma_total_lep->fill( eta, 0.5*weight ); // histogram for full kinematic range
00058         _h_sigma_total_tvt->fill( eta, 0.5*weight ); // histogram for full kinematic range
00059 
00060       }
00061 
00062     }
00063 
00064 
00065     void finalize() {
00066       double norm = crossSection()/microbarn/sumOfWeights();
00067       double binwidth = 4.;  // integrated over full rapidity space from 2 to 6.
00068 
00069       // to get the avergae of b and bbar, we scale with 0.5
00070       scale(_h_sigma_vs_eta_lep, 0.5*norm);
00071       scale(_h_sigma_vs_eta_tvt, 0.5*norm);
00072       scale(_h_sigma_total_lep, 0.5*norm*binwidth);
00073       scale(_h_sigma_total_tvt, 0.5*norm*binwidth);
00074     }
00075 
00076 
00077   private:
00078 
00079     Histo1DPtr _h_sigma_total_lep;
00080     Histo1DPtr _h_sigma_total_tvt;
00081     Histo1DPtr _h_sigma_vs_eta_lep;
00082     Histo1DPtr _h_sigma_vs_eta_tvt;
00083 
00084   };
00085 
00086 
00087   // Hook for the plugin system
00088   DECLARE_RIVET_PLUGIN(LHCB_2010_I867355);
00089 
00090 }