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