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/FastJets.hh"
00009 #include "fastjet/JadePlugin.hh"
00010
00011 namespace Rivet {
00012
00013
00014
00015
00016 class OPAL_1993_S2692198 : public Analysis {
00017 public:
00018
00019
00020 OPAL_1993_S2692198() : Analysis("OPAL_1993_S2692198")
00021 {
00022 setBeams(ELECTRON, POSITRON);
00023
00024 }
00025
00026
00027
00028
00029
00030 void analyze(const Event& e) {
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 const double weight = e.weight();
00043
00044
00045 ParticleVector photons;
00046 ParticleVector nonPhotons;
00047 FourMomentum ptotal;
00048 const FinalState& fs = applyProjection<FinalState>(e, "FS");
00049 foreach (const Particle& p, fs.particles()) {
00050 ptotal+= p.momentum();
00051 if(p.pdgId()==PHOTON) {
00052 photons.push_back(p);
00053 }
00054 else {
00055 nonPhotons.push_back(p);
00056 }
00057 }
00058
00059 if(photons.empty()) return;
00060
00061 fastjet::JetDefinition durham_def(fastjet::ee_kt_algorithm,fastjet::E_scheme,
00062 fastjet::Best);
00063
00064 fastjet::JadePlugin jade;
00065 fastjet::JetDefinition jade_def = fastjet::JetDefinition(&jade);
00066
00067 double evis = ptotal.mass();
00068 vector<fastjet::PseudoJet> input_particles;
00069
00070 foreach (const Particle& p, nonPhotons) {
00071 input_particles.push_back(fastjet::PseudoJet(p.momentum().px(),
00072 p.momentum().py(),
00073 p.momentum().pz(),
00074 p.momentum().E()));
00075 }
00076
00077 for(unsigned int ix=1;ix<photons.size();++ix) {
00078 input_particles.push_back(fastjet::PseudoJet(photons[ix].momentum().px(),
00079 photons[ix].momentum().py(),
00080 photons[ix].momentum().pz(),
00081 photons[ix].momentum().E()));
00082 }
00083
00084 for(unsigned int ix=0;ix<photons.size();++ix) {
00085 FourMomentum pgamma = photons[ix].momentum();
00086
00087 fastjet::ClusterSequence clust_seq(input_particles, durham_def);
00088
00089 for (int j = 0; j < _nPhotonDurham->size(); ++j) {
00090 bool accept(true);
00091 double ycut = _nPhotonDurham->point(j)->coordinate(0)->value();
00092 double dcut = sqr(evis)*ycut;
00093 vector<fastjet::PseudoJet> exclusive_jets =
00094 sorted_by_E(clust_seq.exclusive_jets(dcut));
00095 for(unsigned int iy=0;iy<exclusive_jets.size();++iy) {
00096 FourMomentum pjet(momentum(exclusive_jets[iy]));
00097 double cost = pjet.vector3().unit().dot(pgamma.vector3().unit());
00098 double ygamma = 2.*min(sqr(pjet.E()/evis),
00099 sqr(pgamma.E()/evis))*(1.-cost);
00100 if(ygamma<ycut) {
00101 accept = false;
00102 break;
00103 }
00104 }
00105 if(!accept) continue;
00106 _nPhotonDurham->point(j)->coordinate(1)->
00107 setValue(_nPhotonDurham->point(j)->coordinate(1)->value()+weight);
00108 int njet = min(4,int(exclusive_jets.size())) - 1;
00109 if(j<_nPhotonJetDurham[njet]->size()) {
00110 _nPhotonJetDurham[njet]->point(j)->coordinate(1)->
00111 setValue(_nPhotonJetDurham[njet]->point(j)->coordinate(1)->value()+weight);
00112 }
00113 }
00114
00115 fastjet::ClusterSequence clust_seq2(input_particles, jade_def);
00116 for (int j = 0; j < _nPhotonJade->size(); ++j) {
00117 bool accept(true);
00118 double ycut = _nPhotonJade->point(j)->coordinate(0)->value();
00119 double dcut = sqr(evis)*ycut;
00120 vector<fastjet::PseudoJet> exclusive_jets =
00121 sorted_by_E(clust_seq2.exclusive_jets(dcut));
00122 for(unsigned int iy=0;iy<exclusive_jets.size();++iy) {
00123 FourMomentum pjet(momentum(exclusive_jets[iy]));
00124 double cost = pjet.vector3().unit().dot(pgamma.vector3().unit());
00125 double ygamma = 2.*pjet.E()*pgamma.E()/sqr(evis)*(1.-cost);
00126 if(ygamma<ycut) {
00127 accept = false;
00128 break;
00129 }
00130 }
00131 if(!accept) continue;
00132 _nPhotonJade->point(j)->coordinate(1)->
00133 setValue(_nPhotonJade->point(j)->coordinate(1)->value()+weight);
00134 int njet = min(4,int(exclusive_jets.size())) - 1;
00135 if(j<_nPhotonJetJade[njet]->size()) {
00136 _nPhotonJetJade[njet]->point(j)->coordinate(1)->
00137 setValue(_nPhotonJetJade[njet]->point(j)->coordinate(1)->value()+weight);
00138 }
00139 }
00140
00141 if(ix+1!=photons.size())
00142 input_particles[nonPhotons.size()+ix] =
00143 fastjet::PseudoJet(photons[ix].momentum().px(),photons[ix].momentum().py(),
00144 photons[ix].momentum().pz(),photons[ix].momentum().E());
00145 }
00146 }
00147
00148
00149 void init() {
00150
00151 addProjection(FinalState(), "FS");
00152
00153
00154
00155 _nPhotonJade = bookDataPointSet(1, 1, 1);
00156 _nPhotonDurham = bookDataPointSet(2, 1, 1);
00157 for(unsigned int ix=0;ix<4;++ix) {
00158 _nPhotonJetJade [ix] = bookDataPointSet(3 , 1, 1+ix);
00159 _nPhotonJetDurham[ix] = bookDataPointSet(4 , 1, 1+ix);
00160 }
00161 }
00162
00163
00164
00165 void finalize() {
00166 const double fact = 1000./sumOfWeights();
00167 normaliseDataPointSet(_nPhotonJade ,fact);
00168 normaliseDataPointSet(_nPhotonDurham ,fact);
00169 for(unsigned int ix=0;ix<4;++ix) {
00170 normaliseDataPointSet(_nPhotonJetJade [ix],fact);
00171 normaliseDataPointSet(_nPhotonJetDurham[ix],fact);
00172 }
00173 }
00174
00175
00176 void normaliseDataPointSet(AIDA::IDataPointSet * points, const double & fact) {
00177 for (int i = 0; i < points->size(); ++i) {
00178 points->point(i)->coordinate(1)->
00179 setValue(points->point(i)->coordinate(1)->value()*fact);
00180 }
00181 }
00182
00183
00184 private:
00185
00186 AIDA::IDataPointSet *_nPhotonJade;
00187 AIDA::IDataPointSet *_nPhotonDurham;
00188 AIDA::IDataPointSet *_nPhotonJetJade [4];
00189 AIDA::IDataPointSet *_nPhotonJetDurham[4];
00190
00191 };
00192
00193
00194
00195
00196 AnalysisBuilder<OPAL_1993_S2692198> plugin_OPAL_1993_S2692198;
00197
00198 }