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         const 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           pmother = particles(ivertex, HepMC::parents)[0]; // first mother particle
00042           int mother_pid = abs(pmother->pdg_id());
00043           if (mother_pid==PID::K0S || mother_pid==PID::LAMBDA) {
00044             prompt = false;
00045             break;
00046           }
00047           else if (mother_pid<6) {
00048             break;
00049           }
00050           ivertex = pmother->production_vertex();
00051         }
00052 
00053 
00054         // momentum in CMS frame
00055         const double mom = cms_boost.transform(p.momentum()).vector3().mod();
00056         const int PdgId = p.abspid();
00057         MSG_DEBUG("pdgID = " << PdgId << " Momentum = " << mom);
00058         switch (PdgId) {
00059         case PID::PIPLUS:
00060           if(prompt) _histPion_no_dec->fill(mom,weight);
00061           _histPion_dec   ->fill(mom,weight);
00062           break;
00063         case PID::KPLUS:
00064           if(prompt) _histKaon_no_dec->fill(mom,weight);
00065           _histKaon_dec   ->fill(mom,weight);
00066           break;
00067         case PID::PROTON:
00068           if(prompt) _histProton_no_dec->fill(mom,weight);
00069           _histProton_dec   ->fill(mom,weight);
00070         default :
00071           break;
00072         }
00073       }
00074     } // analyze
00075 
00076 
00077     void finalize() {
00078 
00079       scale(_histPion_no_dec  ,1./sumOfWeights());
00080       scale(_histKaon_no_dec  ,1./sumOfWeights());
00081       scale(_histProton_no_dec,1./sumOfWeights());
00082       scale(_histPion_dec     ,1./sumOfWeights());
00083       scale(_histKaon_dec     ,1./sumOfWeights());
00084       scale(_histProton_dec   ,1./sumOfWeights());
00085     } // finalize
00086 
00087 
00088     void init() {
00089       addProjection(Beam(), "Beams");
00090       addProjection(ChargedFinalState(), "FS");
00091 
00092       _histPion_no_dec   = bookHisto1D(1,1,1);
00093       _histKaon_no_dec   = bookHisto1D(1,1,2);
00094       _histProton_no_dec = bookHisto1D(1,1,3);
00095       _histPion_dec      = bookHisto1D(2,1,1);
00096       _histKaon_dec      = bookHisto1D(2,1,2);
00097       _histProton_dec    = bookHisto1D(2,1,3);
00098 
00099     } // init
00100 
00101   private:
00102 
00103     //@{
00104     // Histograms for continuum data (sqrt(s) = 10.52 GeV)
00105     // no K_S and Lambda decays
00106     Histo1DPtr _histPion_no_dec;
00107     Histo1DPtr _histKaon_no_dec;
00108     Histo1DPtr _histProton_no_dec;
00109     // including decays
00110     Histo1DPtr _histPion_dec;
00111     Histo1DPtr _histKaon_dec;
00112     Histo1DPtr _histProton_dec;
00113     //@}
00114 
00115   };
00116 
00117 
00118   // The hook for the plugin system
00119   DECLARE_RIVET_PLUGIN(BABAR_2013_I1238276);
00120 
00121 }