D0_2010_S8821313.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Tools/BinnedHistogram.hh"
00006 #include "Rivet/Tools/ParticleIdUtils.hh"
00007 #include "Rivet/Projections/FinalState.hh"
00008 #include "Rivet/Projections/ZFinder.hh"
00009 
00010 
00011 namespace Rivet {
00012 
00013 
00014   class D0_2010_S8821313 : public Analysis {
00015   public:
00016 
00017     /// @name Constructors etc.
00018     //@{
00019 
00020     /// Constructor
00021     D0_2010_S8821313()
00022       : Analysis("D0_2010_S8821313")
00023     {
00024       setNeedsCrossSection(false);
00025     }
00026 
00027     //@}
00028 
00029 
00030   public:
00031 
00032     /// @name Analysis methods
00033     //@{
00034 
00035     /// Book histograms and initialise projections before the run
00036     void init() {
00037 
00038       /// Initialise and register projections
00039       vector<pair<double, double> > etaRanges_ee;
00040       etaRanges_ee.push_back(make_pair(-3.0, -1.5));
00041       etaRanges_ee.push_back(make_pair(-1.1, 1.1));
00042       etaRanges_ee.push_back(make_pair(1.5, 3.0));
00043       ZFinder zfinder_ee(etaRanges_ee, 20.0*GeV, ELECTRON, 70.0*GeV, 110.0*GeV, 0.2, true, true);
00044       addProjection(zfinder_ee, "zfinder_ee");
00045 
00046       ZFinder zfinder_mm(-2.0, 2.0, 15.0*GeV, MUON, 70.0*GeV, 110.0*GeV, 0.0, false, false);
00047       addProjection(zfinder_mm, "zfinder_mm");
00048 
00049       /// Book histograms here
00050       _h_phistar_ee.addHistogram(0.0, 1.0, bookHistogram1D(1, 1, 1));
00051       _h_phistar_ee.addHistogram(1.0, 2.0, bookHistogram1D(1, 1, 2));
00052       _h_phistar_ee.addHistogram(2.0, 10.0, bookHistogram1D(1, 1, 3));
00053 
00054       _h_phistar_mm.addHistogram(0.0, 1.0, bookHistogram1D(2, 1, 1));
00055       _h_phistar_mm.addHistogram(1.0, 2.0, bookHistogram1D(2, 1, 2));
00056     }
00057 
00058 
00059     /// Perform the per-event analysis
00060     void analyze(const Event& event) {
00061       const double weight = event.weight();
00062 
00063       const ZFinder& zfinder_ee = applyProjection<ZFinder>(event, "zfinder_ee");
00064       if (zfinder_ee.bosons().size()==1) {
00065         ParticleVector ee=zfinder_ee.constituents();
00066         std::sort(ee.begin(), ee.end(), cmpParticleByPt);
00067         FourMomentum eminus=PID::threeCharge(ee[0].pdgId())<0.0?ee[0].momentum():ee[1].momentum();
00068         FourMomentum eplus=PID::threeCharge(ee[0].pdgId())<0.0?ee[1].momentum():ee[0].momentum();
00069         double phi_acop=M_PI-mapAngle0ToPi(eminus.phi()-eplus.phi());
00070         double costhetastar=tanh((eminus.eta()-eplus.eta())/2.0);
00071         double sin2thetastar=1.0-sqr(costhetastar);
00072         if (sin2thetastar<0.0) sin2thetastar=0.0;
00073         double phistar=tan(phi_acop/2.0)*sqrt(sin2thetastar);
00074 
00075         FourMomentum Zmom=zfinder_ee.bosons()[0].momentum();
00076         _h_phistar_ee.fill(Zmom.rapidity(), phistar, weight);
00077       }
00078 
00079       const ZFinder& zfinder_mm = applyProjection<ZFinder>(event, "zfinder_mm");
00080       if (zfinder_mm.bosons().size()==1) {
00081         ParticleVector mm=zfinder_mm.constituents();
00082         std::sort(mm.begin(), mm.end(), cmpParticleByPt);
00083         FourMomentum mminus=PID::threeCharge(mm[0].pdgId())<0.0?mm[0].momentum():mm[1].momentum();
00084         FourMomentum mplus=PID::threeCharge(mm[0].pdgId())<0.0?mm[1].momentum():mm[0].momentum();
00085         double phi_acop=M_PI-mapAngle0ToPi(mminus.phi()-mplus.phi());
00086         double costhetastar=tanh((mminus.eta()-mplus.eta())/2.0);
00087         double sin2thetastar=1.0-sqr(costhetastar);
00088         if (sin2thetastar<0.0) sin2thetastar=0.0;
00089         double phistar=tan(phi_acop/2.0)*sqrt(sin2thetastar);
00090 
00091         FourMomentum Zmom=zfinder_mm.bosons()[0].momentum();
00092         _h_phistar_mm.fill(Zmom.rapidity(), phistar, weight);
00093       }
00094     }
00095 
00096 
00097     /// Normalise histograms etc., after the run
00098     void finalize() {
00099       foreach (AIDA::IHistogram1D* hist, _h_phistar_ee.getHistograms()) {
00100         normalize(hist, 1.0);
00101       }
00102       foreach (AIDA::IHistogram1D* hist, _h_phistar_mm.getHistograms()) {
00103         normalize(hist, 1.0);
00104       }
00105     }
00106 
00107     //@}
00108 
00109 
00110   private:
00111 
00112     // Data members like post-cuts event weight counters go here
00113 
00114 
00115   private:
00116 
00117     /// @name Histograms
00118     //@{
00119 
00120     BinnedHistogram<double> _h_phistar_ee;
00121     BinnedHistogram<double> _h_phistar_mm;
00122     //@}
00123 
00124 
00125   };
00126 
00127 
00128 
00129   // This global object acts as a hook for the plugin system
00130   AnalysisBuilder<D0_2010_S8821313> plugin_D0_2010_S8821313;
00131 
00132 
00133 }