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