MC_DIJET.cc

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