OPAL_1993_S2692198.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
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   /// @brief OPAL photon production
00015   /// @author Peter Richardson
00016   class OPAL_1993_S2692198 : public Analysis {
00017   public:
00018 
00019     /// Constructor
00020     OPAL_1993_S2692198() : Analysis("OPAL_1993_S2692198")
00021     {
00022 
00023     }
00024 
00025 
00026     /// @name Analysis methods
00027     //@{
00028 
00029     void analyze(const Event& e) {
00030       // First, veto on leptonic events by requiring at least 4 charged FS particles
00031 //       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(e, "CFS");
00032 //       const size_t numParticles = cfs.particles().size();
00033 
00034 //       if (numParticles < 4) {
00035 //         MSG_DEBUG("Failed ncharged cut");
00036 //         vetoEvent;
00037 //       }
00038 //       MSG_DEBUG("Passed ncharged cut");
00039 
00040       // Get event weight for histo filling
00041       const double weight = e.weight();
00042 
00043       // extract the photons
00044       ParticleVector photons;
00045       ParticleVector nonPhotons;
00046       FourMomentum ptotal;
00047       const FinalState& fs = applyProjection<FinalState>(e, "FS");
00048       foreach (const Particle& p, fs.particles()) {
00049         ptotal+= p.momentum();
00050         if(p.pdgId()==PHOTON) {
00051           photons.push_back(p);
00052         }
00053         else {
00054           nonPhotons.push_back(p);
00055         }
00056       }
00057       // no photon return but still count for normalisation
00058       if(photons.empty()) return;
00059       // definition of the Durham algorithm
00060       fastjet::JetDefinition durham_def(fastjet::ee_kt_algorithm,fastjet::E_scheme,
00061                                         fastjet::Best);
00062       // definition of the JADE algorithm
00063       fastjet::JadePlugin jade;
00064       fastjet::JetDefinition jade_def = fastjet::JetDefinition(&jade);
00065       // now for the weird jet algorithm
00066       double evis = ptotal.mass();
00067       vector<fastjet::PseudoJet> input_particles;
00068       // pseudo jets from the non photons
00069       foreach (const Particle& p,  nonPhotons) {
00070         input_particles.push_back(fastjet::PseudoJet(p.momentum().px(),
00071                                                      p.momentum().py(),
00072                                                      p.momentum().pz(),
00073                                                      p.momentum().E()));
00074       }
00075       // pseudo jets from all bar the first photon
00076       for(unsigned int ix=1;ix<photons.size();++ix) {
00077         input_particles.push_back(fastjet::PseudoJet(photons[ix].momentum().px(),
00078                                                      photons[ix].momentum().py(),
00079                                                      photons[ix].momentum().pz(),
00080                                                      photons[ix].momentum().E()));
00081       }
00082       // now loop over the photons
00083       for(unsigned int ix=0;ix<photons.size();++ix) {
00084         FourMomentum pgamma = photons[ix].momentum();
00085         // run the jet clustering DURHAM
00086         fastjet::ClusterSequence clust_seq(input_particles, durham_def);
00087         // cluster the jets
00088         for (int j = 0; j < _nPhotonDurham->size(); ++j) {
00089           bool accept(true);
00090           double ycut = _nPhotonDurham->point(j)->coordinate(0)->value();
00091           double dcut = sqr(evis)*ycut;
00092           vector<fastjet::PseudoJet> exclusive_jets =
00093             sorted_by_E(clust_seq.exclusive_jets(dcut));
00094           for(unsigned int iy=0;iy<exclusive_jets.size();++iy) {
00095             FourMomentum pjet(momentum(exclusive_jets[iy]));
00096             double cost = pjet.vector3().unit().dot(pgamma.vector3().unit());
00097             double ygamma = 2.*min(sqr(pjet.E()/evis),
00098                                    sqr(pgamma.E()/evis))*(1.-cost);
00099             if(ygamma<ycut) {
00100               accept = false;
00101               break;
00102             }
00103           }
00104           if(!accept) continue;
00105           _nPhotonDurham->point(j)->coordinate(1)->
00106             setValue(_nPhotonDurham->point(j)->coordinate(1)->value()+weight);
00107           int njet = min(4,int(exclusive_jets.size())) - 1;
00108           if(j<_nPhotonJetDurham[njet]->size()) {
00109             _nPhotonJetDurham[njet]->point(j)->coordinate(1)->
00110               setValue(_nPhotonJetDurham[njet]->point(j)->coordinate(1)->value()+weight);
00111           }
00112         }
00113         // run the jet clustering JADE
00114         fastjet::ClusterSequence clust_seq2(input_particles, jade_def);
00115         for (int j = 0; j < _nPhotonJade->size(); ++j) {
00116           bool accept(true);
00117           double ycut = _nPhotonJade->point(j)->coordinate(0)->value();
00118           double dcut = sqr(evis)*ycut;
00119           vector<fastjet::PseudoJet> exclusive_jets =
00120             sorted_by_E(clust_seq2.exclusive_jets(dcut));
00121           for(unsigned int iy=0;iy<exclusive_jets.size();++iy) {
00122             FourMomentum pjet(momentum(exclusive_jets[iy]));
00123             double cost = pjet.vector3().unit().dot(pgamma.vector3().unit());
00124             double ygamma = 2.*pjet.E()*pgamma.E()/sqr(evis)*(1.-cost);
00125             if(ygamma<ycut) {
00126               accept = false;
00127               break;
00128             }
00129           }
00130           if(!accept) continue;
00131           _nPhotonJade->point(j)->coordinate(1)->
00132             setValue(_nPhotonJade->point(j)->coordinate(1)->value()+weight);
00133           int njet = min(4,int(exclusive_jets.size())) - 1;
00134           if(j<_nPhotonJetJade[njet]->size()) {
00135             _nPhotonJetJade[njet]->point(j)->coordinate(1)->
00136               setValue(_nPhotonJetJade[njet]->point(j)->coordinate(1)->value()+weight);
00137           }
00138         }
00139         // add this photon back in for the next interation of the loop
00140         if(ix+1!=photons.size())
00141           input_particles[nonPhotons.size()+ix] =
00142             fastjet::PseudoJet(photons[ix].momentum().px(),photons[ix].momentum().py(),
00143                                photons[ix].momentum().pz(),photons[ix].momentum().E());
00144       }
00145     }
00146 
00147 
00148     void init() {
00149       // Projections
00150       addProjection(FinalState(), "FS");
00151 //       addProjection(ChargedFinalState(), "CFS");
00152 
00153       // Book data sets
00154       _nPhotonJade       = bookDataPointSet(1, 1, 1);
00155       _nPhotonDurham     = bookDataPointSet(2, 1, 1);
00156       for(unsigned int ix=0;ix<4;++ix) {
00157         _nPhotonJetJade  [ix] = bookDataPointSet(3 , 1, 1+ix);
00158         _nPhotonJetDurham[ix] = bookDataPointSet(4 , 1, 1+ix);
00159       }
00160     }
00161 
00162 
00163     /// Finalize
00164     void finalize() {
00165       const double fact = 1000./sumOfWeights();
00166       normaliseDataPointSet(_nPhotonJade      ,fact);
00167       normaliseDataPointSet(_nPhotonDurham    ,fact);
00168       for(unsigned int ix=0;ix<4;++ix) {
00169         normaliseDataPointSet(_nPhotonJetJade  [ix],fact);
00170         normaliseDataPointSet(_nPhotonJetDurham[ix],fact);
00171       }
00172     }
00173 
00174     // normalise a data point set, default function does both x and y AHHH
00175     void normaliseDataPointSet(AIDA::IDataPointSet * points, const double & fact) {
00176       for (int i = 0; i < points->size(); ++i) {
00177         points->point(i)->coordinate(1)->
00178           setValue(points->point(i)->coordinate(1)->value()*fact);
00179       }
00180     }
00181     //@}
00182 
00183   private:
00184 
00185     AIDA::IDataPointSet *_nPhotonJade;
00186     AIDA::IDataPointSet *_nPhotonDurham;
00187     AIDA::IDataPointSet *_nPhotonJetJade  [4];
00188     AIDA::IDataPointSet *_nPhotonJetDurham[4];
00189 
00190   };
00191 
00192 
00193 
00194   // The hook for the plugin system
00195   DECLARE_RIVET_PLUGIN(OPAL_1993_S2692198);
00196 
00197 }