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