rivet is hosted by Hepforge, IPPP Durham
CMS_2011_S9120041.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include "Rivet/Analysis.hh"
00004 #include "Rivet/Projections/FinalState.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/FastJets.hh"
00007 
00008 using namespace std;
00009 
00010 namespace Rivet {
00011 
00012 
00013   // UE charged particles vs. leading jet
00014   class CMS_2011_S9120041 : public Analysis {
00015   public:
00016 
00017     /// Constructor
00018     CMS_2011_S9120041() : Analysis("CMS_2011_S9120041") {}
00019 
00020 
00021     void init() {
00022       const ChargedFinalState cfs(-2.0, 2.0, 500*MeV);
00023       addProjection(cfs, "CFS");
00024 
00025       const ChargedFinalState cfsforjet(-2.5, 2.5, 500*MeV);
00026       const FastJets jetpro(cfsforjet, FastJets::SISCONE, 0.5);
00027       addProjection(jetpro, "Jets");
00028 
00029       if (fuzzyEquals(sqrtS(), 7.0*TeV)) {
00030         _h_Nch_vs_pT = bookProfile1D(1, 1, 1); // Nch vs. pT_max
00031         _h_Sum_vs_pT = bookProfile1D(2, 1, 1); // sum(pT) vs. pT_max
00032         _h_pT3_Nch   = bookHisto1D(5, 1, 1);   // transverse Nch,     pT_max > 3GeV
00033         _h_pT3_Sum   = bookHisto1D(6, 1, 1);   // transverse sum(pT), pT_max > 3GeV
00034         _h_pT3_pT    = bookHisto1D(7, 1, 1);   // transverse pT,      pT_max > 3GeV
00035         _h_pT20_Nch  = bookHisto1D(8, 1, 1);   // transverse Nch,     pT_max > 20GeV
00036         _h_pT20_Sum  = bookHisto1D(9, 1, 1);   // transverse sum(pT), pT_max > 20GeV
00037         _h_pT20_pT   = bookHisto1D(10, 1, 1);  // transverse pT,      pT_max > 20GeV
00038       }
00039 
00040       if (fuzzyEquals(sqrtS(), 0.9*TeV)) {
00041         _h_Nch_vs_pT = bookProfile1D(3, 1, 1); // Nch vs. pT_max
00042         _h_Sum_vs_pT = bookProfile1D(4, 1, 1); // sum(pT) vs. pT_max
00043         _h_pT3_Nch   = bookHisto1D(11, 1, 1);  // transverse Nch,     pT_max > 3GeV
00044         _h_pT3_Sum   = bookHisto1D(12, 1, 1);  // transverse sum(pT), pT_max > 3GeV
00045         _h_pT3_pT    = bookHisto1D(13, 1, 1);  // transverse pT,      pT_max > 3GeV
00046       }
00047 
00048       sumOfWeights3  = 0.0;
00049       sumOfWeights20 = 0.0;
00050 
00051       _nch_tot_pT3  = 0.0;
00052       _nch_tot_pT20 = 0.0;
00053     }
00054 
00055 
00056     /// Perform the per-event analysis
00057     void analyze(const Event& event) {
00058       const double weight = event.weight();
00059 
00060       // Find the lead jet, applying a restriction that the jets must be within |eta| < 2.
00061       FourMomentum p_lead;
00062       foreach (const Jet& j, applyProjection<FastJets>(event, "Jets").jetsByPt(1.0*GeV)) {
00063         if (j.abseta() < 2.0) {
00064           p_lead = j.momentum();
00065           break;
00066         }
00067       }
00068       if (p_lead.isZero()) vetoEvent;
00069       const double philead = p_lead.phi();
00070       const double pTlead  = p_lead.pT();
00071 
00072       Particles particles = applyProjection<ChargedFinalState>(event, "CFS").particlesByPt();
00073 
00074       int nTransverse = 0;
00075       double ptSumTransverse = 0.;
00076       foreach (const Particle& p, particles) {
00077         double dphi = fabs(deltaPhi(philead, p.phi()));
00078         if (dphi>PI/3. && dphi<PI*2./3.) {   // Transverse region
00079           nTransverse++;
00080 
00081           const double pT = p.pT()/GeV;
00082           ptSumTransverse += pT;
00083 
00084           if (pTlead > 3.0*GeV) _h_pT3_pT->fill(pT, weight);
00085           if (fuzzyEquals(sqrtS(), 7.0*TeV) && pTlead > 20.0*GeV) _h_pT20_pT->fill(pT, weight);
00086         }
00087       }
00088 
00089       const double area = 8./3. * PI;
00090       _h_Nch_vs_pT->fill(pTlead/GeV, 1./area*nTransverse, weight);
00091       _h_Sum_vs_pT->fill(pTlead/GeV, 1./area*ptSumTransverse, weight);
00092       if(pTlead > 3.0*GeV) {
00093         _h_pT3_Nch->fill(nTransverse, weight);
00094         _h_pT3_Sum->fill(ptSumTransverse, weight);
00095         sumOfWeights3 += weight;
00096         _nch_tot_pT3  += weight*nTransverse;
00097       }
00098       if (fuzzyEquals(sqrtS(), 7.0*TeV) && pTlead > 20.0*GeV) {
00099         _h_pT20_Nch->fill(nTransverse, weight);
00100         _h_pT20_Sum->fill(ptSumTransverse, weight);
00101         sumOfWeights20 += weight;
00102         _nch_tot_pT20  += weight*nTransverse;
00103       }
00104     }
00105 
00106 
00107 
00108     /// Normalise histograms etc., after the run
00109     void finalize() {
00110       normalize(_h_pT3_Nch);
00111       normalize(_h_pT3_Sum);
00112       if (sumOfWeights3 != 0.0) normalize(_h_pT3_pT, _nch_tot_pT3 / sumOfWeights3);
00113 
00114       if (fuzzyEquals(sqrtS(), 7.0*TeV)) {
00115         normalize(_h_pT20_Nch);
00116         normalize(_h_pT20_Sum);
00117         if (sumOfWeights20 != 0.0) normalize(_h_pT20_pT, _nch_tot_pT20 / sumOfWeights20);
00118       }
00119     }
00120 
00121 
00122 
00123   private:
00124 
00125     double sumOfWeights3;
00126     double sumOfWeights20;
00127 
00128     double _nch_tot_pT3;
00129     double _nch_tot_pT20;
00130 
00131     Profile1DPtr _h_Nch_vs_pT;
00132     Profile1DPtr _h_Sum_vs_pT;
00133     Histo1DPtr _h_pT3_Nch;
00134     Histo1DPtr _h_pT3_Sum;
00135     Histo1DPtr _h_pT3_pT;
00136     Histo1DPtr _h_pT20_Nch;
00137     Histo1DPtr _h_pT20_Sum;
00138     Histo1DPtr _h_pT20_pT;
00139 
00140   };
00141 
00142 
00143   // This global object acts as a hook for the plugin system
00144   DECLARE_RIVET_PLUGIN(CMS_2011_S9120041);
00145 }
00146