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