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