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