rivet is hosted by Hepforge, IPPP Durham
BELLE_2015_I1397632.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 BELLE_2015_I1397632 : public Analysis {
00010   public:
00011 
00012     /// Constructor
00013     DEFAULT_RIVET_ANALYSIS_CTOR(BELLE_2015_I1397632);
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 
00024       declare(UnstableFinalState(), "UFS");
00025 
00026       // Book histograms
00027       _h_B_Denu      = bookHisto1D(1, 1, 1);
00028       _h_B_Dmunu     = bookHisto1D(1, 1, 2);
00029       _h_B_Deplusnu  = bookHisto1D(1, 1, 3);
00030       _h_B_Dmuplusnu = bookHisto1D(1, 1, 4);
00031     }
00032 
00033     // Check for explicit decay into pdgids
00034     bool isSemileptonicDecay(const Particle& mother, vector<int> ids) {
00035       // Trivial check to ignore any other decays but the one in question modulo photons
00036       const Particles children = mother.children(Cuts::pid!=PID::PHOTON);
00037       if (children.size()!=ids.size()) return false;
00038       // Check for the explicit decay
00039       return all(ids, [&](int i){return count(children, hasPID(i))==1;});
00040     }
00041     
00042     // Calculate the recoil w using mother and daugher meson
00043     double recoilW(const Particle& B, int mesonID) {
00044       // TODO why does that not work with const?
00045       Particle D = filter_select(B.children(), Cuts::pid==mesonID)[0];
00046       FourMomentum q = B.mom() - D.mom();
00047       return (B.mom()*B.mom() + D.mom()*D.mom() - q*q )/ (2. * sqrt(B.mom()*B.mom()) * sqrt(D.mom()*D.mom()) );
00048     }
00049 
00050 
00051     /// Perform the per-event analysis
00052     void analyze(const Event& event) {
00053       // Get B0 Mesons
00054       foreach(const Particle& p, apply<UnstableFinalState>(event, "UFS").particles(Cuts::pid==PID::B0)) {
00055         if (isSemileptonicDecay(p, {PID::DMINUS,PID::POSITRON,PID::NU_E})) _h_B_Denu->fill( recoilW(p, PID::DMINUS), event.weight());
00056         if (isSemileptonicDecay(p, {PID::DMINUS,PID::ANTIMUON,PID::NU_MU})) _h_B_Dmunu->fill(recoilW(p, PID::DMINUS), event.weight());
00057       }
00058       // Get B+ Mesons
00059       foreach(const Particle& p, apply<UnstableFinalState>(event, "UFS").particles(Cuts::pid==PID::BPLUS)) {
00060         if (isSemileptonicDecay(p, {PID::D0BAR,PID::POSITRON,PID::NU_E})) _h_B_Deplusnu->fill( recoilW(p, PID::D0BAR), event.weight());
00061         if (isSemileptonicDecay(p, {PID::D0BAR,PID::ANTIMUON,PID::NU_MU})) _h_B_Dmuplusnu->fill(recoilW(p, PID::D0BAR), event.weight());
00062       }
00063     }
00064 
00065 
00066     /// Normalise histograms etc., after the run
00067     void finalize() {
00068 
00069       normalize(_h_B_Denu);     
00070       normalize(_h_B_Dmunu);    
00071       normalize(_h_B_Deplusnu); 
00072       normalize(_h_B_Dmuplusnu);
00073 
00074     }
00075 
00076     //@}
00077 
00078 
00079   private:
00080 
00081 
00082     /// @name Histograms
00083     //@{
00084     Histo1DPtr _h_B_Denu;
00085     Histo1DPtr _h_B_Dmunu;
00086     Histo1DPtr _h_B_Deplusnu;
00087     Histo1DPtr _h_B_Dmuplusnu;
00088     //@}
00089 
00090 
00091   };
00092 
00093 
00094   // The hook for the plugin system
00095   DECLARE_RIVET_PLUGIN(BELLE_2015_I1397632);
00096 
00097 
00098 }