ALEPH_1999_S4193598.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/RivetYODA.hh" 00004 #include "Rivet/Tools/Logging.hh" 00005 #include "Rivet/Projections/Beam.hh" 00006 #include "HepMC/GenParticle.h" 00007 #include "HepMC/GenVertex.h" 00008 #include "Rivet/Projections/ChargedFinalState.hh" 00009 #include "Rivet/Projections/UnstableFinalState.hh" 00010 00011 00012 bool hasDecayedTo(const HepMC::GenParticle* p, int id1, int id2) { 00013 bool decision = false; 00014 HepMC::GenVertex* decV = p->end_vertex(); 00015 std::vector<int> decids; 00016 if (decV->particles_out_size() == 2) { 00017 for (HepMC::GenVertex::particles_out_const_iterator pp = decV->particles_out_const_begin() ; 00018 pp != decV->particles_out_const_end() ; ++pp) { 00019 decids.push_back(abs((*pp)->pdg_id())); 00020 } 00021 if ( (decids[0] == abs(id1) && decids[1] == abs(id2)) || (decids[1] == abs(id1) && decids[0] == abs(id2)) ) decision = true; 00022 00023 }; 00024 return decision; 00025 } 00026 00027 bool hasDecayedTo(const Rivet::Particle& p, int id1, int id2) { 00028 return hasDecayedTo(p.genParticle(), id1, id2); 00029 } 00030 00031 00032 namespace Rivet { 00033 00034 00035 class ALEPH_1999_S4193598 : public Analysis { 00036 public: 00037 00038 /// @name Constructors etc. 00039 //@{ 00040 00041 /// Constructor 00042 ALEPH_1999_S4193598() 00043 : Analysis("ALEPH_1999_S4193598") 00044 { 00045 _sumWpassed = 0.0; 00046 } 00047 00048 //@} 00049 00050 00051 public: 00052 00053 /// Book histograms and initialise projections before the run 00054 void init() { 00055 addProjection(Beam(), "Beams"); 00056 addProjection(UnstableFinalState(), "UFS"); 00057 addProjection(ChargedFinalState(), "CFS"); 00058 00059 _h_Xe_Ds = bookHisto1D(1, 1, 1); 00060 } 00061 00062 00063 /// Perform the per-event analysis 00064 void analyze(const Event& event) { 00065 const double weight = event.weight(); 00066 00067 // Trigger condition 00068 const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS"); 00069 if (cfs.size() < 5) vetoEvent; 00070 00071 _sumWpassed += weight; 00072 00073 const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(event, "UFS"); 00074 00075 // Get beams and average beam momentum 00076 const ParticlePair& beams = applyProjection<Beam>(event, "Beams").beams(); 00077 const double meanBeamMom = ( beams.first.momentum().vector3().mod() + 00078 beams.second.momentum().vector3().mod() ) / 2.0/GeV; 00079 00080 foreach (const Particle& p, ufs.particles()) { 00081 const PdgId pid = abs(p.pdgId()); 00082 00083 switch (pid) { 00084 case 413: 00085 00086 // Accept all D*+- decays. Normalisation to D0 + pi+- in finalize() 00087 00088 // Scaled energy. 00089 const double energy = p.momentum().E()/GeV; 00090 const double scaledEnergy = energy/meanBeamMom; 00091 _h_Xe_Ds->fill(scaledEnergy, weight); 00092 00093 break; 00094 } 00095 } 00096 } 00097 00098 00099 /// Normalise histograms etc., after the run 00100 void finalize() { 00101 00102 // Scale to the product of branching fractions D0*->D0 pi x D0->Kpi(charged) 00103 // Numbers are taken from PDG 2010 00104 scale(_h_Xe_Ds, 0.677*0.0389/_sumWpassed); 00105 00106 } 00107 00108 private: 00109 double _sumWpassed; 00110 00111 private: 00112 00113 Histo1DPtr _h_Xe_Ds; 00114 00115 }; 00116 00117 00118 00119 // The hook for the plugin system 00120 DECLARE_RIVET_PLUGIN(ALEPH_1999_S4193598); 00121 00122 } Generated on Fri Dec 21 2012 15:03:38 for The Rivet MC analysis system by ![]() |