rivet is hosted by Hepforge, IPPP Durham
CMS_2013_I1209721.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 
00008 namespace Rivet {
00009 
00010   
00011 
00012 
00013   /// CMS Z+jets delta(phi) and jet thrust measurement at 7 TeV
00014   class CMS_2013_I1209721 : public Analysis {
00015   public:
00016 
00017     CMS_2013_I1209721()
00018       : Analysis("CMS_2013_I1209721")
00019     {    }
00020 
00021 
00022     /// Book projections and histograms
00023     void init() {
00024       // Full final state
00025       const FinalState fs(-5.0,5.0);
00026       addProjection(fs, "FS");
00027       // Z finders for electrons and muons
00028       Cut cuts = Cuts::abseta < 2.4 && Cuts::pT > 20*GeV;
00029       const ZFinder zfe(fs, cuts, PID::ELECTRON, 71*GeV, 111*GeV);
00030       const ZFinder zfm(fs, cuts, PID::MUON,     71*GeV, 111*GeV);
00031       addProjection(zfe, "ZFE");
00032       addProjection(zfm, "ZFM");
00033       // Jets
00034       const FastJets jets(fs, FastJets::ANTIKT, 0.5);
00035       addProjection(jets, "JETS");
00036 
00037       // Book histograms from data
00038       for (size_t i = 0; i < 2; ++i) {
00039         _histDeltaPhiZJ1_1[i]  = bookHisto1D(1+i*9, 1, 1);
00040         _histDeltaPhiZJ1_2[i]  = bookHisto1D(2+i*9, 1, 1);
00041         _histDeltaPhiZJ1_3[i]  = bookHisto1D(4+i*9, 1, 1);
00042         _histDeltaPhiZJ2_3[i]  = bookHisto1D(5+i*9, 1, 1);
00043         _histDeltaPhiZJ3_3[i]  = bookHisto1D(3+i*9, 1, 1);
00044         _histDeltaPhiJ1J2_3[i] = bookHisto1D(6+i*9, 1, 1);
00045         _histDeltaPhiJ1J3_3[i] = bookHisto1D(7+i*9, 1, 1);
00046         _histDeltaPhiJ2J3_3[i] = bookHisto1D(8+i*9, 1, 1);
00047         _histTransvThrust[i]   = bookHisto1D(9+i*9, 1, 1);
00048       }
00049     }
00050 
00051 
00052     void analyze(const Event& event) {
00053       const double weight = event.weight();
00054 
00055       // Apply the Z finders
00056       const ZFinder& zfe = applyProjection<ZFinder>(event, "ZFE");
00057       const ZFinder& zfm = applyProjection<ZFinder>(event, "ZFM");
00058 
00059       // Choose the Z candidate (there must be one)
00060       if (zfe.empty() && zfm.empty()) vetoEvent;
00061       const ParticleVector& z = !zfm.empty() ? zfm.bosons() : zfe.bosons();
00062       const ParticleVector& leptons = !zfm.empty() ? zfm.constituents() : zfe.constituents();
00063 
00064       // Determine whether we are in the boosted regime
00065       const bool is_boosted = (z[0].pT() > 150*GeV);
00066 
00067       // Build the jets
00068       const FastJets& jetfs = applyProjection<FastJets>(event, "JETS");
00069       const Jets& jets = jetfs.jetsByPt(Cuts::pT > 50*GeV && Cuts::abseta < 2.5);
00070 
00071       // Clean the jets against the lepton candidates, as in the paper, with a deltaR cut of 0.4 against the clustered leptons
00072       vector<const Jet*> cleanedJets;
00073       for (size_t i = 0; i < jets.size(); ++i) {
00074         bool isolated = true;
00075         for (size_t j = 0; j < 2; ++j) {
00076           if (deltaR(leptons[j], jets[i]) < 0.4) {
00077             isolated = false;
00078             break;
00079           }
00080         }
00081         if (isolated) cleanedJets.push_back(&jets[i]);
00082       }
00083 
00084       // Require at least 1 jet
00085       const unsigned int Njets = cleanedJets.size();
00086       if (Njets < 1) vetoEvent;
00087 
00088       // Now compute the thrust
00089       // Collect Z and jets transverse momenta to calculate transverse thrust
00090       vector<Vector3> momenta;
00091       momenta.clear();
00092       Vector3 mom = z[0].p3();
00093       mom.setZ(0);
00094       momenta.push_back(mom);
00095 
00096       for (size_t i = 0; i < cleanedJets.size(); ++i) {
00097         Vector3 mj = cleanedJets[i]->momentum().p3();
00098         mj.setZ(0);
00099         momenta.push_back(mj);
00100       }
00101 
00102       if (momenta.size() <= 2){
00103         // We need to use a ghost so that Thrust.calc() doesn't return 1.
00104         momenta.push_back(Vector3(0.0000001,0.0000001,0.));
00105       }
00106 
00107       // Define a macro to appropriately fill both unboosted and boosted histo versions
00108       #define FILLx2(HNAME, VAL) do { double x = VAL; for (size_t i = 0; i < 2; ++i) { \
00109         if (i == 0 || is_boosted) HNAME[i]->fill(x, weight); } } while(0)
00110 
00111       Thrust thrust; thrust.calc(momenta);
00112       const double T = thrust.thrust();
00113       FILLx2(_histTransvThrust, log(max(1-T, 1e-6)));
00114 
00115       const double dphiZJ1 = deltaPhi(z[0], *cleanedJets[0]);
00116       FILLx2(_histDeltaPhiZJ1_1, dphiZJ1);
00117       if (Njets > 1) {
00118         FILLx2(_histDeltaPhiZJ1_2, dphiZJ1);
00119         if (Njets > 2) {
00120           FILLx2(_histDeltaPhiZJ1_3, dphiZJ1);
00121           FILLx2(_histDeltaPhiZJ2_3, deltaPhi(z[0], *cleanedJets[1]));
00122           FILLx2(_histDeltaPhiZJ3_3, deltaPhi(z[0], *cleanedJets[2]));
00123           FILLx2(_histDeltaPhiJ1J2_3, deltaPhi(*cleanedJets[0], *cleanedJets[1]));
00124           FILLx2(_histDeltaPhiJ1J3_3, deltaPhi(*cleanedJets[0], *cleanedJets[2]));
00125           FILLx2(_histDeltaPhiJ2J3_3, deltaPhi(*cleanedJets[1], *cleanedJets[2]));
00126         }
00127       }
00128     }
00129 
00130 
00131     /// Normalizations
00132     /// @note Most of these data normalizations neglect the overflow bins
00133     void finalize() {
00134       for (size_t i = 0; i < 2; ++i) {
00135         normalize(_histDeltaPhiZJ1_1[i], 1, false);
00136         normalize(_histDeltaPhiZJ1_2[i], 1, false);
00137         normalize(_histDeltaPhiZJ1_3[i], 1, false);
00138         normalize(_histDeltaPhiZJ2_3[i], 1, false);
00139         normalize(_histDeltaPhiZJ3_3[i], 1, false);
00140         normalize(_histDeltaPhiJ1J2_3[i], 1, false);
00141         normalize(_histDeltaPhiJ1J3_3[i], 1, false);
00142         normalize(_histDeltaPhiJ2J3_3[i], 1, false);
00143         normalize(_histTransvThrust[i]);
00144       }
00145     }
00146 
00147 
00148   private:
00149 
00150     // Arrays of unboosted/boosted histos
00151     Histo1DPtr _histDeltaPhiZJ1_1[2];
00152     Histo1DPtr _histDeltaPhiZJ1_2[2];
00153     Histo1DPtr _histDeltaPhiZJ1_3[2];
00154     Histo1DPtr _histDeltaPhiZJ2_3[2];
00155     Histo1DPtr _histDeltaPhiZJ3_3[2];
00156     Histo1DPtr _histDeltaPhiJ1J2_3[2];
00157     Histo1DPtr _histDeltaPhiJ1J3_3[2];
00158     Histo1DPtr _histDeltaPhiJ2J3_3[2];
00159     Histo1DPtr _histTransvThrust[2];
00160 
00161   };
00162 
00163 
00164   DECLARE_RIVET_PLUGIN(CMS_2013_I1209721);
00165 
00166 }