rivet is hosted by Hepforge, IPPP Durham
BABAR_2013_I1238276.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/ChargedFinalState.hh"
00006 #include "Rivet/Tools/ParticleIdUtils.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief BaBar pion, kaon and proton production in the continuum
00012   /// @author Peter Richardson
00013   class BABAR_2013_I1238276 : public Analysis {
00014   public:
00015 
00016     BABAR_2013_I1238276()
00017       : Analysis("BABAR_2013_I1238276")
00018     { }
00019 
00020 
00021     void analyze(const Event& e) {
00022       const double weight = e.weight();
00023 
00024       // Loop through charged FS particles and look for charmed mesons/baryons
00025       const ChargedFinalState& fs = applyProjection<ChargedFinalState>(e, "FS");
00026 
00027       const Beam beamproj = applyProjection<Beam>(e, "Beams");
00028       const ParticlePair& beams = beamproj.beams();
00029       FourMomentum mom_tot = beams.first.momentum() + beams.second.momentum();
00030       LorentzTransform cms_boost(-mom_tot.boostVector());
00031       MSG_DEBUG("CMS Energy sqrt s = " << beamproj.sqrtS());
00032 
00033       foreach (const Particle& p, fs.particles()) {
00034     // check if prompt or not
00035     const GenParticle* pmother = p.genParticle();
00036     GenVertex* ivertex = pmother->production_vertex();
00037     bool prompt = true;
00038     while (ivertex) {
00039       int n_inparts = ivertex->particles_in_size();
00040       if(n_inparts<1) break;
00041       const HepMC::GenVertex::particles_in_const_iterator iPart_invtx = ivertex->particles_in_const_begin();
00042       pmother = (*iPart_invtx);                   // first mother particle
00043       int mother_pid = abs(pmother->pdg_id());
00044       if(mother_pid==PID::K0S || mother_pid==PID::LAMBDA) {
00045         prompt = false;
00046         break;
00047       }
00048       else if (mother_pid<6) {
00049         break;
00050       }
00051       ivertex = pmother->production_vertex();
00052     }
00053 
00054 
00055         // momentum in CMS frame
00056         const double mom = cms_boost.transform(p.momentum()).vector3().mod();
00057         const int PdgId = p.abspid();
00058         MSG_DEBUG("pdgID = " << PdgId << " Momentum = " << mom);
00059         switch (PdgId) {
00060     case PID::PIPLUS:
00061       if(prompt) _histPion_no_dec->fill(mom,weight);
00062       _histPion_dec   ->fill(mom,weight);
00063       break;
00064     case PID::KPLUS:
00065       if(prompt) _histKaon_no_dec->fill(mom,weight);
00066       _histKaon_dec   ->fill(mom,weight);
00067       break;
00068     case PID::PROTON:
00069       if(prompt) _histProton_no_dec->fill(mom,weight);
00070       _histProton_dec   ->fill(mom,weight);
00071     default :
00072       break;
00073         }
00074       }
00075     } // analyze
00076 
00077 
00078     void finalize() {
00079 
00080       scale(_histPion_no_dec  ,1./sumOfWeights());
00081       scale(_histKaon_no_dec  ,1./sumOfWeights());
00082       scale(_histProton_no_dec,1./sumOfWeights());
00083       scale(_histPion_dec     ,1./sumOfWeights());
00084       scale(_histKaon_dec     ,1./sumOfWeights());
00085       scale(_histProton_dec   ,1./sumOfWeights());
00086     } // finalize
00087 
00088 
00089     void init() {
00090       addProjection(Beam(), "Beams");
00091       addProjection(ChargedFinalState(), "FS");
00092 
00093       _histPion_no_dec   = bookHisto1D(1,1,1);
00094       _histKaon_no_dec   = bookHisto1D(1,1,2);
00095       _histProton_no_dec = bookHisto1D(1,1,3);
00096       _histPion_dec      = bookHisto1D(2,1,1);
00097       _histKaon_dec      = bookHisto1D(2,1,2);
00098       _histProton_dec    = bookHisto1D(2,1,3);
00099 
00100     } // init
00101 
00102   private:
00103 
00104     //@{
00105     // Histograms for continuum data (sqrt(s) = 10.52 GeV)
00106     // no K_S and Lambda decays
00107     Histo1DPtr _histPion_no_dec;
00108     Histo1DPtr _histKaon_no_dec;
00109     Histo1DPtr _histProton_no_dec;
00110     // including decays
00111     Histo1DPtr _histPion_dec;
00112     Histo1DPtr _histKaon_dec;
00113     Histo1DPtr _histProton_dec;
00114     //@}
00115 
00116   };
00117 
00118 
00119   // The hook for the plugin system
00120   DECLARE_RIVET_PLUGIN(BABAR_2013_I1238276);
00121 
00122 }