rivet is hosted by Hepforge, IPPP Durham
CMS_2013_I1258128.cc
Go to the documentation of this file.
00001 #include "Rivet/Analysis.hh"
00002 #include "Rivet/Tools/BinnedHistogram.hh"
00003 #include "Rivet/Projections/FinalState.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Projections/ZFinder.hh"
00006 #include "Rivet/Projections/Thrust.hh"
00007 #include "Rivet/Projections/LeadingParticlesFinalState.hh"
00008 
00009 namespace Rivet {
00010 
00011   using namespace Cuts;
00012 
00013 
00014   /// CMS Z rapidity measurement
00015   class CMS_2013_I1258128 : public Analysis {
00016   public:
00017 
00018     // Constructor
00019     CMS_2013_I1258128()
00020       : Analysis("CMS_2013_I1258128")
00021     {    }
00022 
00023 
00024     void init() {
00025       // Full final state
00026       const FinalState fs(-5.0, 5.0);
00027       addProjection(fs, "FS");
00028 
00029       // Z finders for electrons and muons
00030       Cut cuts = etaIn(-2.1,2.1) & (pT >= 20.0*GeV);
00031       const ZFinder zfe(fs, cuts, PID::ELECTRON, 76*GeV, 106*GeV);
00032       const ZFinder zfm(fs, cuts, PID::MUON, 76*GeV, 106*GeV);
00033       addProjection(zfe, "ZFE");
00034       addProjection(zfm, "ZFM");
00035 
00036       // Try to get the leading photon
00037       LeadingParticlesFinalState photonfs(FinalState(-2.5, 2.5, 40.0*GeV));
00038       photonfs.addParticleId(PID::PHOTON);
00039       addProjection(photonfs, "LeadingPhoton");
00040 
00041       // Jets
00042       const FastJets jets(fs, FastJets::ANTIKT, 0.5);
00043       addProjection(jets, "JETS");
00044 
00045       // Histograms
00046       _hist1YZ      = bookHisto1D(1, 1, 1);
00047       _hist1YJet    = bookHisto1D(2, 1, 1);
00048       _hist1YSum    = bookHisto1D(3, 1, 1);
00049       _hist1YDif    = bookHisto1D(4, 1, 1);
00050       _hist2YPhoton = bookHisto1D(5, 1, 1);
00051       _hist2YJet    = bookHisto1D(6, 1, 1);
00052       _hist2YSum    = bookHisto1D(7, 1, 1);
00053       _hist2YDif    = bookHisto1D(8, 1, 1);
00054     }
00055 
00056 
00057     void makeZCut(const Event& event) {
00058       // Apply the Z finders and veto if no Z found
00059       const ZFinder& zfe = applyProjection<ZFinder>(event, "ZFE");
00060       const ZFinder& zfm = applyProjection<ZFinder>(event, "ZFM");
00061       if (zfe.empty() && zfm.empty()) vetoEvent;
00062 
00063       // Choose the Z candidate
00064       const ParticleVector& z = (!zfm.empty()) ? zfm.bosons() : zfe.bosons();
00065       const ParticleVector& clusteredConstituents = (!zfm.empty()) ? zfm.constituents() : zfe.constituents();
00066 
00067       // Insist that the Z is in a high-pT (boosted) regime
00068       if (z[0].pT() < 40*GeV) return;
00069 
00070       // Build the jets
00071       const FastJets& jetfs = applyProjection<FastJets>(event, "JETS");
00072       Jets jets = jetfs.jetsByPt(30.*GeV, MAXDOUBLE, -2.4, 2.4);
00073       if (jets.empty()) return;
00074 
00075       // Clean the jets against the lepton candidates with a DeltaR cut of 0.5
00076       std::vector<const Jet*> cleanedJets;
00077       foreach (const Jet& j, jets) {
00078         bool isolated = true;
00079         foreach (const Particle& p, clusteredConstituents) {
00080           if (deltaR(p.momentum(), j.momentum()) < 0.5) {
00081             isolated = false;
00082             break;
00083           }
00084         }
00085         if (isolated) cleanedJets.push_back(&j);
00086       }
00087       // Require exactly 1 isolated jet
00088       if (cleanedJets.size() != 1) return;
00089 
00090       // Fill histos
00091       const double weight = event.weight();
00092       const double yz = z[0].rapidity();
00093       const double yjet = cleanedJets[0]->momentum().rapidity();
00094       _hist1YZ->fill(fabs(yz), weight);
00095       _hist1YJet->fill(fabs(yjet), weight);
00096       _hist1YSum->fill(0.5*fabs(yz + yjet), weight);
00097       _hist1YDif->fill(0.5*fabs(yz - yjet), weight);
00098     }
00099 
00100 
00101     void makePhotonCut(const Event& event) {
00102         // Get the photon
00103         const FinalState& photonfs = applyProjection<FinalState>(event, "LeadingPhoton");
00104         if (photonfs.particles().size() < 1) return;
00105         const Particle& photon = photonfs.particles().front();
00106         if (photon.pT() < 40*GeV) return;
00107         if (fabs(photon.eta()) > 1.4442 ) return;
00108 
00109       // Build the jets
00110       const FastJets& jetfs = applyProjection<FastJets>(event, "JETS");
00111       Jets jets = jetfs.jetsByPt(30.*GeV, MAXDOUBLE, -2.4, 2.4);
00112       if (jets.empty()) return;
00113 
00114       // Clean the jets against the photon candidate with a DeltaR cut of 0.5
00115       std::vector<const Jet*> cleanedJets;
00116       foreach (const Jet& j, jets)
00117         if (deltaR(photon.momentum(), j.momentum()) > 0.5)
00118           cleanedJets.push_back(&j);
00119       // Require exactly 1 jet
00120       if (cleanedJets.size() != 1) return;
00121 
00122       // Fill histos
00123       const double weight = event.weight();
00124       const double ypho = photon.rapidity();
00125       const double yjet = cleanedJets[0]->momentum().rapidity();
00126       _hist2YPhoton->fill(fabs(ypho), weight);
00127       _hist2YJet->fill(fabs(yjet), weight);
00128       _hist2YSum->fill(0.5*fabs(ypho + yjet), weight);
00129       _hist2YDif->fill(0.5*fabs(ypho - yjet), weight);
00130     }
00131 
00132 
00133     void analyze(const Event& event) {
00134       makeZCut(event);
00135       makePhotonCut(event);
00136     }
00137 
00138 
00139     void finalize() {
00140       normalizeByContents(_hist1YZ);
00141       normalizeByContents(_hist1YJet);
00142       normalizeByContents(_hist1YSum);
00143       normalizeByContents(_hist1YDif);
00144       normalizeByContents(_hist2YPhoton);
00145       normalizeByContents(_hist2YJet);
00146       normalizeByContents(_hist2YSum);
00147       normalizeByContents(_hist2YDif);
00148     }
00149 
00150 
00151     // The CMS normalization in this analysis is that the sum over bin contents
00152     // is equal to 1. This function normalizes to area = area*bin_width.  /
00153     // @note This is a strange definition... why?
00154     void normalizeByContents(Histo1DPtr h) {
00155       normalize(h, h->bin(0).xWidth());
00156     }
00157 
00158 
00159   private:
00160 
00161     Histo1DPtr _hist1YZ, _hist1YJet, _hist1YSum, _hist1YDif;
00162     Histo1DPtr _hist2YPhoton, _hist2YJet, _hist2YSum, _hist2YDif;
00163 
00164   };
00165 
00166 
00167   // Plugin system hook
00168   DECLARE_RIVET_PLUGIN(CMS_2013_I1258128);
00169 
00170 }