rivet is hosted by Hepforge, IPPP Durham
BABAR_2005_S6181155.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 
00007 namespace Rivet {
00008 
00009 
00010   /// @brief BABAR Xi_c baryons from fragmentation
00011   /// @author Peter Richardson
00012   class BABAR_2005_S6181155 : public Analysis {
00013   public:
00014 
00015     BABAR_2005_S6181155()
00016       : Analysis("BABAR_2005_S6181155")
00017     { }
00018 
00019 
00020     void analyze(const Event& e) {
00021       const double weight = e.weight();
00022 
00023       // Loop through unstable FS particles and look for charmed mesons/baryons
00024       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS");
00025 
00026       const Beam beamproj = applyProjection<Beam>(e, "Beams");
00027       const ParticlePair& beams = beamproj.beams();
00028       FourMomentum mom_tot = beams.first.momentum() + beams.second.momentum();
00029       LorentzTransform cms_boost(-mom_tot.boostVector());
00030       const double s = sqr(beamproj.sqrtS());
00031 
00032       const bool onresonance = fuzzyEquals(beamproj.sqrtS(), 10.58, 2E-3);
00033 
00034       foreach (const Particle& p, ufs.particles()) {
00035         // 3-momentum in CMS frame
00036         const double mom = cms_boost.transform(p.momentum()).vector3().mod();
00037         // only looking at Xi_c^0
00038         if(abs(p.pdgId()) != 4132 ) continue;
00039         if (onresonance) {
00040           _histOnResonanceA_norm->fill(mom,weight);
00041           _histOnResonanceB_norm->fill(mom,weight);
00042         }
00043         else {
00044           _histOffResonance_norm->fill(mom,s/sqr(10.58)*weight);
00045         }
00046         MSG_DEBUG("mom = " << mom);
00047         // off-resonance cross section
00048         if(checkDecay(p.genParticle())) {
00049           if (onresonance) {
00050             _histOnResonanceA->fill(mom,weight);
00051             _histOnResonanceB->fill(mom,weight);
00052           }
00053           else {
00054             _histOffResonance->fill(mom,s/sqr(10.58)*weight);
00055             _sigma->fill(10.6,weight);
00056           }
00057         }
00058       }
00059     } // analyze
00060 
00061     void finalize() {
00062       scale(_histOnResonanceA, crossSection()/femtobarn/sumOfWeights());
00063       scale(_histOnResonanceB, crossSection()/femtobarn/sumOfWeights());
00064       scale(_histOffResonance, crossSection()/femtobarn/sumOfWeights());
00065       scale(_sigma           , crossSection()/femtobarn/sumOfWeights());
00066       normalize(_histOnResonanceA_norm);
00067       normalize(_histOnResonanceB_norm);
00068       normalize(_histOffResonance_norm);
00069     } // finalize
00070 
00071 
00072     void init() {
00073       addProjection(Beam(), "Beams");
00074       addProjection(UnstableFinalState(), "UFS");
00075 
00076       _histOnResonanceA = bookHisto1D(1,1,1);
00077       _histOnResonanceB = bookHisto1D(2,1,1);
00078       _histOffResonance = bookHisto1D(2,1,2);
00079       _sigma            = bookHisto1D(3,1,1);
00080       _histOnResonanceA_norm = bookHisto1D(4,1,1);
00081       _histOnResonanceB_norm = bookHisto1D(5,1,1);
00082       _histOffResonance_norm = bookHisto1D(5,1,2);
00083 
00084     } // init
00085 
00086   private:
00087 
00088     //@{
00089     /// Histograms
00090     Histo1DPtr _histOnResonanceA;
00091     Histo1DPtr _histOnResonanceB;
00092     Histo1DPtr _histOffResonance;
00093     Histo1DPtr _sigma           ;
00094     Histo1DPtr _histOnResonanceA_norm;
00095     Histo1DPtr _histOnResonanceB_norm;
00096     Histo1DPtr _histOffResonance_norm;
00097     //@}
00098 
00099     bool checkDecay(const GenParticle* p) {
00100       unsigned int nstable = 0, npip = 0, npim = 0;
00101       unsigned int nXim = 0, nXip = 0;
00102       findDecayProducts(p, nstable, npip, npim, nXip, nXim);
00103       int id = p->pdg_id();
00104       // Xi_c
00105       if (id==4132) {
00106         if (nstable==2 && nXim==1 && npip==1) return true;
00107       }
00108       else if (id==-4132) {
00109         if (nstable==2 && nXip==1 && npim==1) return true;
00110       }
00111       return false;
00112     }
00113 
00114     void findDecayProducts(const GenParticle* p,
00115                            unsigned int& nstable,
00116                            unsigned int& npip, unsigned int& npim,
00117                            unsigned int& nXip, unsigned int& nXim) {
00118       const GenVertex* dv = p->end_vertex();
00119       /// @todo Use better looping
00120       for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) {
00121         int id = (*pp)->pdg_id();
00122         if (id==3312) {
00123           ++nXim;
00124           ++nstable;
00125         } else if (id==-3312) {
00126           ++nXip;
00127           ++nstable;
00128         } else if(id==111||id==221) {
00129           ++nstable;
00130         } else if ((*pp)->end_vertex()) {
00131           findDecayProducts(*pp, nstable, npip, npim, nXip, nXim);
00132         } else {
00133           if     (id !=    22) ++nstable;
00134           if     (id ==   211) ++npip;
00135           else if(id ==  -211) ++npim;
00136         }
00137       }
00138     }
00139 
00140   };
00141 
00142 
00143   // The hook for the plugin system
00144   DECLARE_RIVET_PLUGIN(BABAR_2005_S6181155);
00145 
00146 }