rivet is hosted by Hepforge, IPPP Durham
BABAR_2013_I1116411.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/UnstableFinalState.hh"
00004 
00005 namespace Rivet {
00006 
00007 
00008   /// @brief Add a short analysis description here
00009   class BABAR_2013_I1116411 : public Analysis {
00010   public:
00011 
00012     /// Constructor
00013     DEFAULT_RIVET_ANALYSIS_CTOR(BABAR_2013_I1116411);
00014 
00015 
00016     /// @name Analysis methods
00017     //@{
00018 
00019     /// Book histograms and initialise projections before the run
00020     void init() {
00021 
00022       // Initialise and register projections
00023       declare(UnstableFinalState(), "UFS");
00024 
00025       // Book histograms
00026       _h_q2 = bookHisto1D(1, 1, 1);
00027 
00028     }
00029     
00030     // Calculate the Q2 using mother and daughter charged lepton
00031     double q2(const Particle& B) {
00032       const Particle chlept = filter_select(B.children(), Cuts::pid==PID::POSITRON || Cuts::pid==PID::ANTIMUON)[0];
00033       FourMomentum q = B.mom() - chlept.mom();
00034       return q*q;
00035     }
00036 
00037     // Check for explicit decay into pdgids
00038     bool isSemileptonicDecay(const Particle& mother, vector<int> ids) {
00039       // Trivial check to ignore any other decays but the one in question modulo photons
00040       const Particles children = mother.children(Cuts::pid!=PID::PHOTON);
00041       if (children.size()!=ids.size()) return false;
00042       // Check for the explicit decay
00043       return all(ids, [&](int i){return count(children, hasPID(i))==1;});
00044     }
00045 
00046     /// Perform the per-event analysis
00047     void analyze(const Event& event) {
00048       // Get B+ Mesons
00049       foreach(const Particle& p, apply<UnstableFinalState>(event, "UFS").particles(Cuts::pid==PID::BPLUS)) {
00050         if (isSemileptonicDecay(p, {PID::OMEGA, PID::POSITRON, PID::NU_E}) ||
00051             isSemileptonicDecay(p, {PID::OMEGA, PID::ANTIMUON, PID::NU_MU})) {
00052             _h_q2->fill(q2(p), event.weight());
00053         }
00054       }
00055     }
00056 
00057 
00058     /// Normalise histograms etc., after the run
00059     void finalize() {
00060 
00061       normalize(_h_q2, 1.21); // normalize to BF
00062 
00063     }
00064 
00065     //@}
00066 
00067 
00068   private:
00069 
00070 
00071     /// @name Histograms
00072     //@{
00073     Histo1DPtr _h_q2;
00074     //@}
00075 
00076 
00077   };
00078 
00079 
00080   // The hook for the plugin system
00081   DECLARE_RIVET_PLUGIN(BABAR_2013_I1116411);
00082 
00083 
00084 }