BABAR_2003_I593379.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 charmonium spectra 00011 /// @author Peter Richardson 00012 class BABAR_2003_I593379 : public Analysis { 00013 public: 00014 00015 BABAR_2003_I593379() 00016 : Analysis("BABAR_2003_I593379"), _weightSum(0.) 00017 { } 00018 00019 00020 void analyze(const Event& e) { 00021 const double weight = e.weight(); 00022 00023 // Find the charmonia 00024 Particles upsilons; 00025 // First in unstable final state 00026 const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS"); 00027 foreach (const Particle& p, ufs.particles()) 00028 if (p.pid() == 300553) upsilons.push_back(p); 00029 // Then in whole event if fails 00030 if (upsilons.empty()) { 00031 foreach (const GenParticle* p, Rivet::particles(e.genEvent())) { 00032 if (p->pdg_id() != 300553) continue; 00033 const GenVertex* pv = p->production_vertex(); 00034 bool passed = true; 00035 if (pv) { 00036 foreach (const GenParticle* pp, particles_in(pv)) { 00037 if ( p->pdg_id() == pp->pdg_id() ) { 00038 passed = false; 00039 break; 00040 } 00041 } 00042 } 00043 if (passed) upsilons.push_back(Particle(*p)); 00044 } 00045 } 00046 00047 // find an upsilons 00048 foreach (const Particle& p, upsilons) { 00049 _weightSum += weight; 00050 // find the charmonium resonances 00051 vector<const GenParticle*> allJpsi, primaryJpsi, Psiprime, 00052 all_chi_c1, all_chi_c2, primary_chi_c1, primary_chi_c2; 00053 findDecayProducts(p.genParticle(), allJpsi, primaryJpsi, Psiprime, 00054 all_chi_c1, all_chi_c2, primary_chi_c1, primary_chi_c2); 00055 LorentzTransform cms_boost(-p.momentum().boostVector()); 00056 for (size_t i = 0; i < allJpsi.size(); i++) { 00057 double pcm = cms_boost.transform(FourMomentum(allJpsi[i]->momentum())).vector3().mod(); 00058 _hist_all_Jpsi->fill(pcm, weight); 00059 } 00060 _mult_JPsi->fill(10.58, weight*double(allJpsi.size())); 00061 for (size_t i = 0; i < primaryJpsi.size(); i++) { 00062 double pcm = cms_boost.transform(FourMomentum(primaryJpsi[i]->momentum())).vector3().mod(); 00063 _hist_primary_Jpsi->fill(pcm, weight); 00064 } 00065 _mult_JPsi_direct->fill(10.58, weight*double(primaryJpsi.size())); 00066 for (size_t i=0; i<Psiprime.size(); i++) { 00067 double pcm = cms_boost.transform(FourMomentum(Psiprime[i]->momentum())).vector3().mod(); 00068 _hist_Psi_prime->fill(pcm, weight); 00069 } 00070 _mult_Psi2S->fill(10.58, weight*double(Psiprime.size())); 00071 for (size_t i = 0; i < all_chi_c1.size(); i++) { 00072 double pcm = cms_boost.transform(FourMomentum(all_chi_c1[i]->momentum())).vector3().mod(); 00073 _hist_chi_c1->fill(pcm, weight); 00074 } 00075 _mult_chi_c1->fill(10.58, weight*double(all_chi_c1.size())); 00076 _mult_chi_c1_direct->fill(10.58, weight*double(primary_chi_c1.size())); 00077 for (size_t i = 0; i < all_chi_c2.size(); i++) { 00078 double pcm = cms_boost.transform(FourMomentum(all_chi_c2[i]->momentum())).vector3().mod(); 00079 _hist_chi_c2->fill(pcm, weight); 00080 } 00081 _mult_chi_c2->fill(10.58, weight*double(all_chi_c2.size())); 00082 _mult_chi_c2_direct->fill(10.58, weight*double(primary_chi_c2.size())); 00083 } 00084 } // analyze 00085 00086 00087 void finalize() { 00088 scale(_hist_all_Jpsi , 0.5*0.1/_weightSum); 00089 scale(_hist_chi_c1 , 0.5*0.1/_weightSum); 00090 scale(_hist_chi_c2 , 0.5*0.1/_weightSum); 00091 scale(_hist_Psi_prime , 0.5*0.1/_weightSum); 00092 scale(_hist_primary_Jpsi , 0.5*0.1/_weightSum); 00093 scale(_mult_JPsi , 0.5*100./_weightSum); 00094 scale(_mult_JPsi_direct , 0.5*100./_weightSum); 00095 scale(_mult_chi_c1 , 0.5*100./_weightSum); 00096 scale(_mult_chi_c1_direct, 0.5*100./_weightSum); 00097 scale(_mult_chi_c2 , 0.5*100./_weightSum); 00098 scale(_mult_chi_c2_direct, 0.5*100./_weightSum); 00099 scale(_mult_Psi2S , 0.5*100./_weightSum); 00100 } // finalize 00101 00102 00103 void init() { 00104 addProjection(UnstableFinalState(), "UFS"); 00105 00106 _mult_JPsi = bookHisto1D(1, 1, 1); 00107 _mult_JPsi_direct = bookHisto1D(1, 1, 2); 00108 _mult_chi_c1 = bookHisto1D(1, 1, 3); 00109 _mult_chi_c1_direct = bookHisto1D(1, 1, 4); 00110 _mult_chi_c2 = bookHisto1D(1, 1, 5); 00111 _mult_chi_c2_direct = bookHisto1D(1, 1, 6); 00112 _mult_Psi2S = bookHisto1D(1, 1, 7); 00113 _hist_all_Jpsi = bookHisto1D(6, 1, 1); 00114 _hist_chi_c1 = bookHisto1D(7, 1, 1); 00115 _hist_chi_c2 = bookHisto1D(7, 1, 2); 00116 _hist_Psi_prime = bookHisto1D(8, 1, 1); 00117 _hist_primary_Jpsi = bookHisto1D(10, 1, 1); 00118 } // init 00119 00120 private: 00121 00122 //@{ 00123 // count of weights 00124 double _weightSum; 00125 /// Histograms 00126 Histo1DPtr _hist_all_Jpsi; 00127 Histo1DPtr _hist_chi_c1; 00128 Histo1DPtr _hist_chi_c2; 00129 Histo1DPtr _hist_Psi_prime; 00130 Histo1DPtr _hist_primary_Jpsi; 00131 00132 Histo1DPtr _mult_JPsi; 00133 Histo1DPtr _mult_JPsi_direct; 00134 Histo1DPtr _mult_chi_c1; 00135 Histo1DPtr _mult_chi_c1_direct; 00136 Histo1DPtr _mult_chi_c2; 00137 Histo1DPtr _mult_chi_c2_direct; 00138 Histo1DPtr _mult_Psi2S; 00139 //@} 00140 00141 void findDecayProducts(const GenParticle* p, 00142 vector<const GenParticle*>& allJpsi, 00143 vector<const GenParticle*>& primaryJpsi, 00144 vector<const GenParticle*>& Psiprime, 00145 vector<const GenParticle*>& all_chi_c1, vector<const GenParticle*>& all_chi_c2, 00146 vector<const GenParticle*>& primary_chi_c1, vector<const GenParticle*>& primary_chi_c2) { 00147 const GenVertex* dv = p->end_vertex(); 00148 bool isOnium = false; 00149 /// @todo Use better looping 00150 for (GenVertex::particles_in_const_iterator pp = dv->particles_in_const_begin() ; pp != dv->particles_in_const_end() ; ++pp) { 00151 int id = (*pp)->pdg_id(); 00152 id = id%1000; 00153 id -= id%10; 00154 id /= 10; 00155 if (id==44) isOnium = true; 00156 } 00157 /// @todo Use better looping 00158 for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { 00159 int id = (*pp)->pdg_id(); 00160 if (id==100443) { 00161 Psiprime.push_back(*pp); 00162 } 00163 else if (id==20443) { 00164 all_chi_c1.push_back(*pp); 00165 if (!isOnium) primary_chi_c1.push_back(*pp); 00166 } 00167 else if (id==445) { 00168 all_chi_c2.push_back(*pp); 00169 if (!isOnium) primary_chi_c2.push_back(*pp); 00170 } 00171 else if (id==443) { 00172 allJpsi.push_back(*pp); 00173 if (!isOnium) primaryJpsi.push_back(*pp); 00174 } 00175 if ((*pp)->end_vertex()) { 00176 findDecayProducts(*pp, allJpsi, primaryJpsi, Psiprime, all_chi_c1, all_chi_c2, primary_chi_c1, primary_chi_c2); 00177 } 00178 } 00179 } 00180 00181 }; 00182 00183 00184 // The hook for the plugin system 00185 DECLARE_RIVET_PLUGIN(BABAR_2003_I593379); 00186 00187 } Generated on Wed Oct 7 2015 12:09:11 for The Rivet MC analysis system by ![]() |