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