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