rivet is hosted by Hepforge, IPPP Durham
BELLE_2008_I786560.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include <iostream>
00003 #include "Rivet/Analysis.hh"
00004 #include "Rivet/Projections/UnstableFinalState.hh"
00005 #include "Rivet/ParticleName.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// @brief BELLE tau lepton to pi pi
00011   /// @author Peter Richardson
00012   class BELLE_2008_I786560 : public Analysis {
00013   public:
00014 
00015     BELLE_2008_I786560()
00016       : Analysis("BELLE_2008_I786560"),
00017         _weight_total(0),
00018         _weight_pipi(0)
00019     {   }
00020 
00021 
00022     void init() {
00023       addProjection(UnstableFinalState(), "UFS");
00024       _hist_pipi = bookHisto1D( 1, 1, 1);
00025     }
00026 
00027 
00028     void analyze(const Event& e) {
00029       // Find the taus
00030       Particles taus;
00031       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS");
00032       foreach (const Particle& p, ufs.particles()) {
00033         if (p.abspid() != PID::TAU) continue;
00034         _weight_total += 1.;
00035         Particles pip, pim, pi0;
00036         unsigned int nstable = 0;
00037         // get the boost to the rest frame
00038         LorentzTransform cms_boost;
00039         if (p.p3().mod() > 1*MeV)
00040           cms_boost = LorentzTransform(-p.momentum().boostVector());
00041         // find the decay products we want
00042         findDecayProducts(p.genParticle(), nstable, pip, pim, pi0);
00043         if (p.pid() < 0) {
00044           swap(pip, pim);
00045         }
00046         if (nstable != 3) continue;
00047         // pipi
00048         if (pim.size() == 1 && pi0.size() == 1) {
00049           _weight_pipi += 1.;
00050           _hist_pipi->fill((pi0[0].momentum()+pim[0].momentum()).mass2(),1.);
00051         }
00052       }
00053     }
00054 
00055 
00056     void finalize() {
00057       if (_weight_pipi > 0.) scale(_hist_pipi, 1./_weight_pipi);
00058     }
00059 
00060 
00061   private:
00062 
00063     //@{
00064 
00065     // Histograms
00066     Histo1DPtr _hist_pipi;
00067 
00068     // Weights counters
00069     double _weight_total, _weight_pipi;
00070 
00071     //@}
00072 
00073     void findDecayProducts(const GenParticle* p,
00074                            unsigned int & nstable,
00075                            Particles& pip, Particles& pim,
00076                            Particles& pi0) {
00077       const GenVertex* dv = p->end_vertex();
00078       /// @todo Use better looping
00079       for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) {
00080         int id = (*pp)->pdg_id();
00081         if (id == PID::PI0 ) {
00082           pi0.push_back(Particle(**pp));
00083           ++nstable;
00084     }
00085         else if (id == PID::K0S)
00086           ++nstable;
00087         else if (id == PID::PIPLUS) {
00088           pip.push_back(Particle(**pp));
00089           ++nstable;
00090         }
00091         else if (id == PID::PIMINUS) {
00092           pim.push_back(Particle(**pp));
00093           ++nstable;
00094         }
00095         else if (id == PID::KPLUS) {
00096           ++nstable;
00097         }
00098         else if (id == PID::KMINUS) {
00099           ++nstable;
00100         }
00101         else if ((*pp)->end_vertex()) {
00102           findDecayProducts(*pp, nstable, pip, pim, pi0);
00103         }
00104         else
00105           ++nstable;
00106       }
00107     }
00108   };
00109 
00110 
00111   // The hook for the plugin system
00112   DECLARE_RIVET_PLUGIN(BELLE_2008_I786560);
00113 
00114 }