rivet is hosted by Hepforge, IPPP Durham
ARGUS_1993_S2653028.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 #include "Rivet/ParticleName.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief BELLE pi+/-, K+/- and proton/antiproton spectrum at Upsilon(4S)
00012   /// @author Peter Richardson
00013   class ARGUS_1993_S2653028 : public Analysis {
00014   public:
00015 
00016     ARGUS_1993_S2653028()
00017       : Analysis("ARGUS_1993_S2653028"), _weightSum(0.)
00018     { }
00019 
00020 
00021     void analyze(const Event& e) {
00022       const double weight = e.weight();
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.pid() == 300553) upsilons.push_back(p);
00030       }
00031       // Then in whole event if that failed
00032       if (upsilons.empty()) {
00033         foreach (const GenParticle* p, particles(e.genEvent())) {
00034           if (p->pdg_id() != 300553) continue;
00035           const GenVertex* pv = p->production_vertex();
00036           bool passed = true;
00037           if (pv) {
00038             foreach (const GenParticle* pp, particles_in(pv)) {
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 upsilon
00050       foreach (const Particle& p, upsilons) {
00051         _weightSum += weight;
00052         vector<GenParticle *> pionsA,pionsB,protonsA,protonsB,kaons;
00053         // Find the decay products we want
00054         findDecayProducts(p.genParticle(), pionsA, pionsB, protonsA, protonsB, kaons);
00055         LorentzTransform cms_boost;
00056         if (p.p3().mod() > 1*MeV)
00057           cms_boost = LorentzTransform(-p.momentum().boostVector());
00058         for (size_t ix = 0; ix < pionsA.size(); ++ix) {
00059           FourMomentum ptemp(pionsA[ix]->momentum());
00060           FourMomentum p2 = cms_boost.transform(ptemp);
00061           double pcm = cms_boost.transform(ptemp).vector3().mod();
00062           _histPiA->fill(pcm,weight);
00063         }
00064         _multPiA->fill(10.58,double(pionsA.size())*weight);
00065         for (size_t ix = 0; ix < pionsB.size(); ++ix) {
00066           double pcm = cms_boost.transform(FourMomentum(pionsB[ix]->momentum())).vector3().mod();
00067           _histPiB->fill(pcm,weight);
00068         }
00069         _multPiB->fill(10.58,double(pionsB.size())*weight);
00070         for (size_t ix = 0; ix < protonsA.size(); ++ix) {
00071           double pcm = cms_boost.transform(FourMomentum(protonsA[ix]->momentum())).vector3().mod();
00072           _histpA->fill(pcm,weight);
00073         }
00074         _multpA->fill(10.58,double(protonsA.size())*weight);
00075         for (size_t ix = 0; ix < protonsB.size(); ++ix) {
00076           double pcm = cms_boost.transform(FourMomentum(protonsB[ix]->momentum())).vector3().mod();
00077           _histpB->fill(pcm,weight);
00078         }
00079         _multpB->fill(10.58,double(protonsB.size())*weight);
00080         for (size_t ix = 0 ;ix < kaons.size(); ++ix) {
00081           double pcm = cms_boost.transform(FourMomentum(kaons[ix]->momentum())).vector3().mod();
00082           _histKA->fill(pcm,weight);
00083           _histKB->fill(pcm,weight);
00084         }
00085         _multK->fill(10.58,double(kaons.size())*weight);
00086       }
00087     }
00088 
00089 
00090     void finalize() {
00091       if (_weightSum > 0.) {
00092         scale(_histPiA, 1./_weightSum);
00093         scale(_histPiB, 1./_weightSum);
00094         scale(_histKA , 1./_weightSum);
00095         scale(_histKB , 1./_weightSum);
00096         scale(_histpA , 1./_weightSum);
00097         scale(_histpB , 1./_weightSum);
00098         scale(_multPiA, 1./_weightSum);
00099         scale(_multPiB, 1./_weightSum);
00100         scale(_multK  , 1./_weightSum);
00101         scale(_multpA , 1./_weightSum);
00102         scale(_multpB , 1./_weightSum);
00103       }
00104     }
00105 
00106 
00107     void init() {
00108       addProjection(UnstableFinalState(), "UFS");
00109 
00110       // spectra
00111       _histPiA = bookHisto1D(1, 1, 1);
00112       _histPiB = bookHisto1D(2, 1, 1);
00113       _histKA  = bookHisto1D(3, 1, 1);
00114       _histKB  = bookHisto1D(6, 1, 1);
00115       _histpA  = bookHisto1D(4, 1, 1);
00116       _histpB  = bookHisto1D(5, 1, 1);
00117       // multiplicities
00118       _multPiA = bookHisto1D( 7, 1, 1);
00119       _multPiB = bookHisto1D( 8, 1, 1);
00120       _multK   = bookHisto1D( 9, 1, 1);
00121       _multpA  = bookHisto1D(10, 1, 1);
00122       _multpB  = bookHisto1D(11, 1, 1);
00123     } // init
00124 
00125 
00126   private:
00127 
00128     //@{
00129     /// Count of weights
00130     double _weightSum;
00131     /// Spectra
00132     Histo1DPtr _histPiA, _histPiB, _histKA, _histKB, _histpA, _histpB;
00133     /// Multiplicities
00134     Histo1DPtr _multPiA, _multPiB, _multK, _multpA, _multpB;
00135     //@}
00136 
00137     void findDecayProducts(const GenParticle* p,
00138                            vector<GenParticle*>& pionsA, vector<GenParticle*>& pionsB,
00139                            vector<GenParticle*>& protonsA, vector<GenParticle*>& protonsB,
00140                            vector<GenParticle*>& kaons)
00141     {
00142       int parentId = p->pdg_id();
00143       const GenVertex* dv = p->end_vertex();
00144       /// @todo Use better looping
00145       for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) {
00146         int id = abs((*pp)->pdg_id());
00147         if (id == PID::PIPLUS) {
00148           if (parentId != PID::LAMBDA && parentId != PID::K0S) {
00149             pionsA.push_back(*pp);
00150             pionsB.push_back(*pp);
00151           }
00152           else
00153             pionsB.push_back(*pp);
00154         }
00155         else if (id == PID::PROTON) {
00156           if (parentId != PID::LAMBDA && parentId != PID::K0S) {
00157             protonsA.push_back(*pp);
00158             protonsB.push_back(*pp);
00159           }
00160           else
00161             protonsB.push_back(*pp);
00162         }
00163         else if (id == PID::KPLUS) {
00164           kaons.push_back(*pp);
00165         }
00166         else if ((*pp)->end_vertex())
00167           findDecayProducts(*pp, pionsA, pionsB, protonsA, protonsB, kaons);
00168       }
00169     }
00170   };
00171 
00172 
00173   // The hook for the plugin system
00174   DECLARE_RIVET_PLUGIN(ARGUS_1993_S2653028);
00175 
00176 }