rivet is hosted by Hepforge, IPPP Durham
MC_ZINC.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/ZFinder.hh"
00004 
00005 namespace Rivet {
00006 
00007 
00008 
00009   /// @brief MC validation analysis for Z events
00010   class MC_ZINC : public Analysis {
00011   public:
00012 
00013     /// Default constructor
00014     MC_ZINC(string name="MC_ZINC")
00015          : Analysis(name) {
00016          _dR=0.2;
00017          _lepton=PID::ELECTRON;
00018      }
00019 
00020 
00021     /// @name Analysis methods
00022     //@{
00023 
00024     /// Book histograms
00025     void init() {
00026       FinalState fs;
00027       Cut cut = Cuts::abseta < 3.5 && Cuts::pT > 25*GeV;
00028       ZFinder zfinder(fs, cut, _lepton, 65.0*GeV, 115.0*GeV, _dR, ZFinder::CLUSTERNODECAY, ZFinder::TRACK);
00029       addProjection(zfinder, "ZFinder");
00030 
00031       _h_Z_mass = bookHisto1D("Z_mass", 50, 66.0, 116.0);
00032       _h_Z_pT = bookHisto1D("Z_pT", logspace(100, 1.0, 0.5*(sqrtS()>0.?sqrtS():14000.)/GeV));
00033       _h_Z_pT_peak = bookHisto1D("Z_pT_peak", 25, 0.0, 25.0);
00034       _h_Z_y = bookHisto1D("Z_y", 40, -4.0, 4.0);
00035       _h_Z_phi = bookHisto1D("Z_phi", 25, 0.0, TWOPI);
00036       _h_lepton_pT = bookHisto1D("lepton_pT", logspace(100, 10.0, 0.25*(sqrtS()>0.?sqrtS():14000.)/GeV));
00037       _h_lepton_eta = bookHisto1D("lepton_eta", 40, -4.0, 4.0);
00038 
00039     }
00040 
00041 
00042 
00043     /// Do the analysis
00044     void analyze(const Event & e) {
00045       const ZFinder& zfinder = applyProjection<ZFinder>(e, "ZFinder");
00046       if (zfinder.bosons().size()!=1) {
00047         vetoEvent;
00048       }
00049       const double weight = e.weight();
00050 
00051       FourMomentum zmom(zfinder.bosons()[0].momentum());
00052       _h_Z_mass->fill(zmom.mass()/GeV, weight);
00053       _h_Z_pT->fill(zmom.pT()/GeV, weight);
00054       _h_Z_pT_peak->fill(zmom.pT()/GeV, weight);
00055       _h_Z_y->fill(zmom.rapidity(), weight);
00056       _h_Z_phi->fill(zmom.phi(), weight);
00057       foreach (const Particle& l, zfinder.constituents()) {
00058         _h_lepton_pT->fill(l.pT()/GeV, weight);
00059         _h_lepton_eta->fill(l.eta(), weight);
00060       }
00061     }
00062 
00063 
00064     /// Finalize
00065     void finalize() {
00066       const double s = crossSection()/picobarn/sumOfWeights();
00067       scale(_h_Z_mass, s);
00068       scale(_h_Z_pT, s);
00069       scale(_h_Z_pT_peak, s);
00070       scale(_h_Z_y, s);
00071       scale(_h_Z_phi, s);
00072       scale(_h_lepton_pT, s);
00073       scale(_h_lepton_eta, s);
00074     }
00075 
00076     //@}
00077 
00078 
00079   protected:
00080 
00081     /// @name Parameters for specialised e/mu and dressed/bare subclassing
00082     //@{
00083     double _dR;
00084     PdgId _lepton;
00085     //@}
00086 
00087 
00088   private:
00089 
00090     /// @name Histograms
00091     //@{
00092     Histo1DPtr _h_Z_mass;
00093     Histo1DPtr _h_Z_pT;
00094     Histo1DPtr _h_Z_pT_peak;
00095     Histo1DPtr _h_Z_y;
00096     Histo1DPtr _h_Z_phi;
00097     Histo1DPtr _h_lepton_pT;
00098     Histo1DPtr _h_lepton_eta;
00099     //@}
00100 
00101   };
00102 
00103 
00104 
00105   struct MC_ZINC_EL : public MC_ZINC {
00106     MC_ZINC_EL() : MC_ZINC("MC_ZINC_EL") {
00107       _dR = 0.2;
00108       _lepton = PID::ELECTRON;
00109     }
00110   };
00111 
00112   struct MC_ZINC_EL_BARE : public MC_ZINC {
00113     MC_ZINC_EL_BARE() : MC_ZINC("MC_ZINC_EL_BARE") {
00114       _dR = 0;
00115       _lepton = PID::ELECTRON;
00116     }
00117   };
00118 
00119   struct MC_ZINC_MU : public MC_ZINC {
00120     MC_ZINC_MU() : MC_ZINC("MC_ZINC_MU") {
00121       _dR = 0.2;
00122       _lepton = PID::MUON;
00123     }
00124   };
00125 
00126   struct MC_ZINC_MU_BARE : public MC_ZINC {
00127     MC_ZINC_MU_BARE() : MC_ZINC("MC_ZINC_MU_BARE") {
00128       _dR = 0;
00129       _lepton = PID::MUON;
00130     }
00131   };
00132 
00133 
00134 
00135   // The hooks for the plugin system
00136   DECLARE_RIVET_PLUGIN(MC_ZINC);
00137   DECLARE_RIVET_PLUGIN(MC_ZINC_EL);
00138   DECLARE_RIVET_PLUGIN(MC_ZINC_EL_BARE);
00139   DECLARE_RIVET_PLUGIN(MC_ZINC_MU);
00140   DECLARE_RIVET_PLUGIN(MC_ZINC_MU_BARE);
00141 
00142 
00143 }