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