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   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 = bookHistogram1D("d01-x01-y01", 5, 0., 10.);
00031       _hist_jetpt = bookHistogram1D("d02-x01-y01", 30, 30.,100.);
00032       _hist_jetptlog = bookHistogram1D("d03-x01-y01", 20, 0.,8.);
00033       _hist_leadingjetpt = bookHistogram1D("d04-x01-y01", 25, 30.,100.);
00034       _hist_secondleadingjetpt = bookHistogram1D("d05-x01-y01", 25, 30.,100.);
00035       _hist_jetphi = bookHistogram1D("d06-x01-y01",24, 0., 6.4);
00036       _hist_jeteta = bookHistogram1D("d07-x01-y01", 30, -6., 6.);
00037       _hist_jetdphi = bookHistogram1D("d08-x01-y01", 24, 0., 6.4);
00038       _hist_jetdeta = bookHistogram1D("d09-x01-y01", 24, 0., 6.);
00039       _hist_chargemultiplicity = bookHistogram1D("d10-x01-y01",30, 0.5, 250.5);
00040       _hist_chargemeanpt = bookHistogram1D("d11-x01-y01", 25, 0., 10.);
00041       _hist_chargept = bookHistogram1D("d12-x01-y01", 32, 0., 25.);
00042       _hist_chargelogpt = bookHistogram1D("d13-x01-y01", 32, 0., 6.);
00043       _hist_chargermspt = bookHistogram1D("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.);
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].momentum().pT(), weight);
00057       _hist_secondleadingjetpt->fill(jets[1].momentum().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.momentum().pT(), weight);
00063         _hist_jetptlog->fill(log(j.momentum().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.)){
00073       _hist_chargemultiplicity->fill(cfs.particles().size(), weight);
00074       foreach(Particle cp, cfs.particles()) {
00075         meanpt= meanpt + cp.momentum().pT();
00076         rmspt = rmspt + (cp.momentum().pT()*cp.momentum().pT());
00077         _hist_chargept->fill(cp.momentum().pT(), weight);
00078         _hist_chargelogpt->fill(log(cp.momentum().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     AIDA::IHistogram1D* _hist_jetcount;
00098     AIDA::IHistogram1D* _hist_jetpt;
00099     AIDA::IHistogram1D* _hist_jetptlog;
00100     AIDA::IHistogram1D* _hist_leadingjetpt;
00101     AIDA::IHistogram1D* _hist_secondleadingjetpt;
00102     AIDA::IHistogram1D* _hist_jetphi;
00103     AIDA::IHistogram1D* _hist_jetdphi;
00104     AIDA::IHistogram1D* _hist_jeteta;
00105     AIDA::IHistogram1D* _hist_jetdeta;
00106     AIDA::IHistogram1D* _hist_chargemultiplicity;
00107     AIDA::IHistogram1D* _hist_chargemeanpt;
00108     AIDA::IHistogram1D* _hist_chargept;
00109     AIDA::IHistogram1D* _hist_chargelogpt;
00110     AIDA::IHistogram1D* _hist_chargermspt;
00111  
00112   };
00113 
00114 
00115 
00116   // This global object acts as a hook for the plugin system
00117   AnalysisBuilder<MC_DIJET> plugin_MC_DIJET;
00118 
00119 }