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