DELPHI_2002_069_CONF_603.cc
Go to the documentation of this file.00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/ParticleIdUtils.hh"
00005 #include "Rivet/Projections/Beam.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/ChargedFinalState.hh"
00008
00009
00010
00011 #define IS_PARTON_PDGID(id) ( abs(id) <= 100 && abs(id) != 22 && (abs(id) < 11 || abs(id) > 18) )
00012 #define IS_BHADRON_PDGID(id) ( ((abs(id)/100)%10 == 5) || (abs(id) >= 5000 && abs(id) <= 5999) )
00013
00014 namespace Rivet {
00015
00016
00017
00018
00019 class DELPHI_2002_069_CONF_603 : public Analysis {
00020 public:
00021
00022
00023 DELPHI_2002_069_CONF_603()
00024 : Analysis("DELPHI_2002_069_CONF_603")
00025 {
00026 setBeams(ELECTRON, POSITRON);
00027 }
00028
00029
00030
00031
00032
00033
00034 void init() {
00035 addProjection(Beam(), "Beams");
00036 addProjection(ChargedFinalState(), "FS");
00037
00038 _histXbprim = bookHistogram1D(1, 1, 1);
00039 _histXbweak = bookHistogram1D(2, 1, 1);
00040 _histMeanXbprim = bookProfile1D(4, 1, 1);
00041 _histMeanXbweak = bookProfile1D(5, 1, 1);
00042 }
00043
00044
00045 void analyze(const Event& e) {
00046 const FinalState& fs = applyProjection<FinalState>(e, "FS");
00047 const size_t numParticles = fs.particles().size();
00048
00049
00050 if (numParticles < 2) {
00051 getLog() << Log::DEBUG << "Failed ncharged cut" << endl;
00052 vetoEvent;
00053 }
00054 getLog() << Log::DEBUG << "Passed ncharged cut" << endl;
00055
00056
00057 const double weight = e.weight();
00058
00059
00060 const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
00061 const double meanBeamMom = ( beams.first.momentum().vector3().mod() +
00062 beams.second.momentum().vector3().mod() ) / 2.0;
00063 getLog() << Log::DEBUG << "Avg beam momentum = " << meanBeamMom << endl;
00064
00065
00066 foreach (const GenParticle* p, particles(e.genEvent())) {
00067 const GenVertex* pv = p->production_vertex();
00068 const GenVertex* dv = p->end_vertex();
00069 if (IS_BHADRON_PDGID(p->pdg_id())) {
00070 const double xp = p->momentum().e()/meanBeamMom;
00071
00072
00073 if (pv) {
00074 bool is_primary = false;
00075 for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin(); pp != pv->particles_in_const_end() ; ++pp) {
00076 if (IS_PARTON_PDGID((*pp)->pdg_id())) is_primary = true;
00077 }
00078 if (is_primary) {
00079 _histXbprim->fill(xp, weight);
00080 _histMeanXbprim->fill(_histMeanXbprim->binMean(0), xp, weight);
00081 }
00082 }
00083
00084
00085 if (dv) {
00086 bool is_weak = true;
00087 for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ;
00088 pp != dv->particles_out_const_end() ; ++pp) {
00089 if (IS_BHADRON_PDGID((*pp)->pdg_id())) {
00090 is_weak = false;
00091 }
00092 }
00093 if (is_weak) {
00094 _histXbweak->fill(xp, weight);
00095 _histMeanXbweak->fill(_histMeanXbweak->binMean(0), xp, weight);
00096 }
00097 }
00098
00099 }
00100 }
00101 }
00102
00103
00104
00105 void finalize() {
00106 normalize(_histXbprim);
00107 normalize(_histXbweak);
00108 }
00109
00110
00111 private:
00112
00113
00114
00115
00116
00117 AIDA::IHistogram1D *_histXbprim;
00118 AIDA::IHistogram1D *_histXbweak;
00119
00120 AIDA::IProfile1D *_histMeanXbprim;
00121 AIDA::IProfile1D *_histMeanXbweak;
00122
00123
00124
00125 };
00126
00127
00128
00129
00130 AnalysisBuilder<DELPHI_2002_069_CONF_603> plugin_DELPHI_2002_069_CONF_603;
00131
00132 }