rivet is hosted by Hepforge, IPPP Durham
MC_DIJET.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FinalState.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Projections/FastJets.hh"
00006 
00007 namespace Rivet {
00008 
00009   
00010 
00011 
00012   /// @brief MC validation analysis for di-jet events
00013   class MC_DIJET : public Analysis {
00014   public:
00015 
00016     /// Default constructor
00017     MC_DIJET() : Analysis("MC_DIJET")
00018     {    }
00019 
00020 
00021     /// @name Analysis methods
00022     //@{
00023 
00024     void init() {
00025       FinalState fs(-4, 4, 0.5*GeV);
00026       ChargedFinalState cfs(fs);
00027       addProjection(fs, "FS");
00028       addProjection(cfs, "CFS");
00029       addProjection(FastJets(fs, FastJets::ANTIKT, 0.7), "Jets");
00030       addProjection(FastJets(cfs, FastJets::ANTIKT, 0.7), "ChargedJets");
00031 
00032       _hist_jetcount = bookHisto1D("d01-x01-y01", 5, 0., 10.);
00033       _hist_jetpt = bookHisto1D("d02-x01-y01", 30, 30.,100.);
00034       _hist_jetptlog = bookHisto1D("d03-x01-y01", 20, 0.,8.);
00035       _hist_leadingjetpt = bookHisto1D("d04-x01-y01", 25, 30.,100.);
00036       _hist_secondleadingjetpt = bookHisto1D("d05-x01-y01", 25, 30.,100.);
00037       _hist_jetphi = bookHisto1D("d06-x01-y01",24, 0., 6.4);
00038       _hist_jeteta = bookHisto1D("d07-x01-y01", 30, -6., 6.);
00039       _hist_jetdphi = bookHisto1D("d08-x01-y01", 24, 0., 6.4);
00040       _hist_jetdeta = bookHisto1D("d09-x01-y01", 24, 0., 6.);
00041       _hist_chargemultiplicity = bookHisto1D("d10-x01-y01",30, 0.5, 250.5);
00042       _hist_chargemeanpt = bookHisto1D("d11-x01-y01", 25, 0., 10.);
00043       _hist_chargept = bookHisto1D("d12-x01-y01", 32, 0., 25.);
00044       _hist_chargelogpt = bookHisto1D("d13-x01-y01", 32, 0., 6.);
00045       _hist_chargermspt = bookHisto1D("d14-x01-y01", 32, 0., 10.);
00046     }
00047 
00048 
00049     void analyze(const Event& event) {
00050       const FastJets& fastjets = applyProjection<FastJets>(event, "Jets");
00051       const Jets jets = fastjets.jetsByPt(20.*GeV);
00052       const double weight = event.weight();
00053 
00054       if (jets.size() < 2 || jets.size() >= 3) vetoEvent;
00055       const double angle = fabs(jets[1].phi() - jets[0].phi());
00056       const double prapidity = fabs(jets[1].eta() - jets[0].eta());
00057       _hist_jetcount->fill(jets.size(), weight);
00058       _hist_leadingjetpt->fill(jets[0].pT(), weight);
00059       _hist_secondleadingjetpt->fill(jets[1].pT(), weight);
00060       _hist_jetdphi->fill(angle , weight);
00061       _hist_jetdeta->fill(prapidity, weight);
00062 
00063       foreach(Jet j, fastjets.jetsByPt(20.*GeV)) {
00064         _hist_jetpt->fill(j.pT(), weight);
00065         _hist_jetptlog->fill(log(j.pT()), weight);
00066         _hist_jetphi->fill(j.phi(), weight);
00067         _hist_jeteta->fill(j.eta(), weight);
00068       }
00069 
00070       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS");
00071       // const FastJets& cfastjets = applyProjection<FastJets>(event, "ChargedJets");
00072       double meanpt(0), rmspt(0);
00073       /// @todo Add jets
00074       // foreach(Jet cj, cfastjets.jetsByPt(20.*GeV)){
00075       _hist_chargemultiplicity->fill(cfs.particles().size(), weight);
00076       foreach(Particle cp, cfs.particles()) {
00077         meanpt= meanpt + cp.pT();
00078         rmspt = rmspt + (cp.pT()*cp.pT());
00079         _hist_chargept->fill(cp.pT(), weight);
00080         _hist_chargelogpt->fill(log(cp.pT()), weight);
00081       }
00082       meanpt = meanpt / cfs.particles().size();
00083       _hist_chargemeanpt->fill(meanpt, weight);
00084       rmspt = sqrt(rmspt / cfs.particles().size());
00085       _hist_chargermspt->fill(rmspt, weight);
00086       // }
00087     }
00088 
00089 
00090     void finalize() {
00091       /// @todo Normalise!
00092     }
00093 
00094     //@}
00095 
00096 
00097   private:
00098 
00099     Histo1DPtr _hist_jetcount;
00100     Histo1DPtr _hist_jetpt;
00101     Histo1DPtr _hist_jetptlog;
00102     Histo1DPtr _hist_leadingjetpt;
00103     Histo1DPtr _hist_secondleadingjetpt;
00104     Histo1DPtr _hist_jetphi;
00105     Histo1DPtr _hist_jetdphi;
00106     Histo1DPtr _hist_jeteta;
00107     Histo1DPtr _hist_jetdeta;
00108     Histo1DPtr _hist_chargemultiplicity;
00109     Histo1DPtr _hist_chargemeanpt;
00110     Histo1DPtr _hist_chargept;
00111     Histo1DPtr _hist_chargelogpt;
00112     Histo1DPtr _hist_chargermspt;
00113 
00114   };
00115 
00116 
00117 
00118   // The hook for the plugin system
00119   DECLARE_RIVET_PLUGIN(MC_DIJET);
00120 
00121 }