rivet is hosted by Hepforge, IPPP Durham
BELLE_2001_S4598261.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include <iostream>
00003 #include "Rivet/Analysis.hh"
00004 #include "Rivet/RivetYODA.hh"
00005 #include "Rivet/Tools/ParticleIdUtils.hh"
00006 #include "Rivet/Projections/Beam.hh"
00007 #include "Rivet/Projections/UnstableFinalState.hh"
00008 
00009 namespace Rivet {
00010 
00011 
00012   /// @brief BELLE pi0 spectrum at Upsilon(4S)
00013   /// @author Peter Richardson
00014   class BELLE_2001_S4598261 : public Analysis {
00015   public:
00016 
00017     BELLE_2001_S4598261()
00018       : Analysis("BELLE_2001_S4598261"), _weightSum(0.)
00019     { }
00020 
00021 
00022     void analyze(const Event& e) {
00023       const double weight = e.weight();
00024 
00025       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS");
00026 
00027       // find the upsilons
00028       ParticleVector upsilons;
00029       // first in unstable final state
00030       foreach (const Particle& p, ufs.particles())
00031         if(p.pdgId()==300553) upsilons.push_back(p);
00032       // then in whole event if fails
00033       if(upsilons.empty()) {
00034         foreach (GenParticle* p, Rivet::particles(e.genEvent())) {
00035           if(p->pdg_id()!=300553) continue;
00036           const GenVertex* pv = p->production_vertex();
00037           bool passed = true;
00038           if (pv) {
00039             for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin() ;
00040                  pp != pv->particles_in_const_end() ; ++pp) {
00041               if ( p->pdg_id() == (*pp)->pdg_id() ) {
00042                 passed = false;
00043                 break;
00044               }
00045             }
00046           }
00047           if(passed) upsilons.push_back(Particle(*p));
00048         }
00049       }
00050 
00051       // find an upsilons
00052       foreach (const Particle& p, upsilons) {
00053         _weightSum += weight;
00054         // find the neutral pions from the decay
00055         vector<GenParticle *> pions;
00056         findDecayProducts(p.genParticle(),pions);
00057         LorentzTransform cms_boost(-p.momentum().boostVector());
00058         for(unsigned int ix=0;ix<pions.size();++ix) {
00059           double pcm =
00060             cms_boost.transform(FourMomentum(pions[ix]->momentum())).vector3().mod();
00061           _histdSigDp->fill(pcm,weight);
00062         }
00063         _histMult->fill(0.,double(pions.size())*weight);
00064       }
00065     } // analyze
00066 
00067     void finalize() {
00068 
00069       scale(_histdSigDp, 1./_weightSum);
00070       scale(_histMult  , 1./_weightSum);
00071     } // finalize
00072 
00073 
00074     void init() {
00075       addProjection(UnstableFinalState(), "UFS");
00076 
00077       // spectrum
00078       _histdSigDp = bookHisto1D(1, 1, 1);
00079       // multiplicity
00080       _histMult   = bookHisto1D(2, 1, 1);
00081     } // init
00082 
00083   private:
00084 
00085     //@{
00086     // count of weights
00087     double _weightSum;
00088     /// Histograms
00089     Histo1DPtr _histdSigDp;
00090     Histo1DPtr _histMult;
00091     //@}
00092 
00093     void findDecayProducts(const GenParticle & p,
00094                            vector<GenParticle *> & pions) {
00095       const GenVertex* dv = p.end_vertex();
00096       for (GenVertex::particles_out_const_iterator
00097              pp = dv->particles_out_const_begin();
00098            pp != dv->particles_out_const_end(); ++pp) {
00099         int id = (*pp)->pdg_id();
00100         if(id==111) {
00101           pions.push_back(*pp);
00102         }
00103         else if((*pp)->end_vertex())
00104           findDecayProducts(**pp,pions);
00105       }
00106     }
00107   };
00108 
00109 
00110   // The hook for the plugin system
00111   DECLARE_RIVET_PLUGIN(BELLE_2001_S4598261);
00112 
00113 }