OPAL_1994_S2927284.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 OPAL charged particle fragmentation functions 00010 /// @author Peter Richardson 00011 class OPAL_1994_S2927284 : public Analysis { 00012 public: 00013 00014 /// Constructor 00015 OPAL_1994_S2927284() 00016 : Analysis("OPAL_1994_S2927284") 00017 { } 00018 00019 00020 /// @name Analysis methods 00021 //@{ 00022 00023 void analyze(const Event& e) { 00024 00025 // Even if we only generate hadronic events, we still need a cut on numCharged >= 2. 00026 const FinalState& fs = applyProjection<FinalState>(e, "FS"); 00027 if (fs.particles().size() < 2) { 00028 MSG_DEBUG("Failed ncharged cut"); 00029 vetoEvent; 00030 } 00031 MSG_DEBUG("Passed ncharged cut"); 00032 00033 // Get event weight for histo filling 00034 const double weight = e.weight(); 00035 00036 // Get beams and average beam momentum 00037 const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams(); 00038 const double meanBeamMom = ( beams.first.momentum().vector3().mod() + 00039 beams.second.momentum().vector3().mod() ) / 2.0; 00040 MSG_DEBUG("Avg beam momentum = " << meanBeamMom); 00041 00042 foreach (const Particle& p, fs.particles()) { 00043 int id = abs(p.pdgId()); 00044 // charged pions 00045 if (id == PID::PIPLUS) { 00046 _histXpPiPlus->fill(p.momentum().vector3().mod(), weight); 00047 } else if(id == PID::KPLUS) { 00048 _histXpKPlus->fill(p.momentum().vector3().mod(), weight); 00049 } else if(id == PID::PROTON) { 00050 _histXpProton->fill(p.momentum().vector3().mod(), weight); 00051 } 00052 } 00053 } 00054 00055 00056 void init() { 00057 // Projections 00058 addProjection(Beam(), "Beams"); 00059 addProjection(ChargedFinalState(), "FS"); 00060 00061 _histXpPiPlus = bookHisto1D( 1, 1, 1); 00062 _histXpKPlus = bookHisto1D( 2, 1, 1); 00063 _histXpProton = bookHisto1D( 3, 1, 1); 00064 } 00065 00066 00067 /// Finalize 00068 void finalize() { 00069 scale(_histXpPiPlus,1./sumOfWeights()); 00070 scale(_histXpKPlus ,1./sumOfWeights()); 00071 scale(_histXpProton,1./sumOfWeights()); 00072 } 00073 00074 //@} 00075 00076 private: 00077 00078 Histo1DPtr _histXpPiPlus; 00079 Histo1DPtr _histXpKPlus; 00080 Histo1DPtr _histXpProton; 00081 //@} 00082 00083 }; 00084 00085 // The hook for the plugin system 00086 DECLARE_RIVET_PLUGIN(OPAL_1994_S2927284); 00087 00088 } Generated on Thu Feb 6 2014 17:38:46 for The Rivet MC analysis system by ![]() |