rivet is hosted by Hepforge, IPPP Durham
BABAR_2015_I1334693.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_2015_I1334693 : public Analysis {
00010   public:
00011 
00012     /// Constructor
00013     DEFAULT_RIVET_ANALYSIS_CTOR(BABAR_2015_I1334693);
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 
00031     // Calculate the Q2 using mother and daugher meson
00032     double q2(const Particle& B, int mesonID) {
00033       FourMomentum q = B.mom() - filter_select(B.children(), Cuts::pid==mesonID)[0];
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       // Loop over D0 mesons
00049       foreach(const Particle& p, apply<UnstableFinalState>(event, "UFS").particles(Cuts::pid==PID::D0)) {
00050         if (isSemileptonicDecay(p, {PID::PIMINUS, PID::POSITRON, PID::NU_E})) {
00051           _h_q2->fill(q2(p, PID::PIMINUS), event.weight());
00052         }
00053       }
00054     }
00055 
00056 
00057     /// Normalise histograms etc., after the run
00058     void finalize() {
00059 
00060       normalize(_h_q2, 375.4); // normalize to data
00061 
00062     }
00063 
00064     //@}
00065 
00066 
00067   private:
00068 
00069 
00070     /// @name Histograms
00071     //@{
00072     Histo1DPtr _h_q2;
00073     //@}
00074 
00075 
00076   };
00077 
00078 
00079   // The hook for the plugin system
00080   DECLARE_RIVET_PLUGIN(BABAR_2015_I1334693);
00081 
00082 
00083 }