rivet is hosted by Hepforge, IPPP Durham
CMS_2015_I1385107.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FinalState.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Projections/FastJets.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// CMS UE charged particles vs. leading jet at 2.76 TeV
00011   class CMS_2015_I1385107 : public Analysis {
00012   public:
00013     /// Constructor
00014     CMS_2015_I1385107() : Analysis("CMS_2015_I1385107"),
00015                           ETACUT(2.0),
00016                           AREATOT(2*ETACUT * 2*M_PI),
00017                           AREA3(AREATOT / 3.),
00018                           AREA6(AREATOT / 6.)
00019     {   }
00020 
00021 
00022     /// Book histograms and initialise projections before the run
00023     void init() {
00024 
00025       const ChargedFinalState cfs(Cuts::abseta < 2 && Cuts::pT > 500*MeV);
00026       addProjection(cfs, "CFS");
00027 
00028       const ChargedFinalState cfsforjet(Cuts::abseta < 2.5 && Cuts::pT > 500*MeV);
00029       const FastJets jetpro(cfsforjet, FastJets::SISCONE, 0.5);
00030       addProjection(jetpro, "Jets");
00031 
00032       _h_Nch_TransAVE_vs_pT = bookProfile1D(1, 1, 1); // Nch vs. pT_max      (TransAVE)
00033       _h_Sum_TransAVE_vs_pT = bookProfile1D(2, 1, 1); // sum(pT) vs. pT_max  (TransAVE)
00034       _h_Nch_TransMAX_vs_pT = bookProfile1D(3, 1, 1); // Nch vs. pT_max      (TransMAX)
00035       _h_Sum_TransMAX_vs_pT = bookProfile1D(4, 1, 1); // sum(pT) vs. pT_max  (TransMAX)
00036       _h_Nch_TransMIN_vs_pT = bookProfile1D(5, 1, 1); // Nch vs. pT_max      (TransMIN)
00037       _h_Sum_TransMIN_vs_pT = bookProfile1D(6, 1, 1); // sum(pT) vs. pT_max  (TransMIN)
00038       _h_Nch_TransDIF_vs_pT = bookProfile1D(7, 1, 1); // Nch vs. pT_max      (TransDIF)
00039       _h_Sum_TransDIF_vs_pT = bookProfile1D(8, 1, 1); // sum(pT) vs. pT_max  (TransDIF)
00040     }
00041 
00042 
00043     /// Local definition of a signed dphi, for use in differentating L and R trans regions
00044     double signedDeltaPhi(double jetphi, double partphi) {
00045       double delta = partphi - jetphi;
00046       while (delta <= -PI) delta += 2 * PI;
00047       while (delta > PI) delta -= 2 * PI;
00048       return delta;
00049     }
00050 
00051     /// Perform the per-event analysis
00052     void analyze(const Event& event) {
00053 
00054       // Find the lead jet, applying a restriction that the jets must be within |eta| < 2.
00055       FourMomentum p_lead;
00056       foreach (const Jet& j, applyProjection<FastJets>(event, "Jets").jetsByPt(1*GeV)) {
00057         if (j.abseta() < 2.0) {
00058           p_lead = j.momentum();
00059           break;
00060         }
00061       }
00062       if (p_lead.isZero()) vetoEvent;
00063       const double phi_lead = p_lead.phi();
00064       const double pT_lead  = p_lead.pT();
00065 
00066       // Loop on charged particles and separate Left and Right transverse regions
00067       Particles particles = applyProjection<ChargedFinalState>(event, "CFS").particlesByPt();
00068       int nch_TransLeft = 0, nch_TransRight = 0;
00069       double ptSum_TransLeft = 0., ptSum_TransRight = 0.;
00070       foreach (const Particle& p, particles) {
00071         const double dphi = signedDeltaPhi(phi_lead, p.momentum().phi());
00072         if (!inRange(fabs(dphi), PI/3, 2*PI/3.)) continue; //< only fill trans regions
00073         if (dphi < 0) {  // Transverse Right region
00074           nch_TransRight += 1;
00075           ptSum_TransRight += p.pT() / GeV;
00076         } else if (dphi > 0) {  // Transverse Left region
00077           nch_TransLeft += 1;
00078           ptSum_TransLeft += p.pT() / GeV;
00079         }
00080       }
00081 
00082       // Translate to min and max (+sum and diff) Transverse regions
00083       const int nch_TransMIN = std::min(nch_TransLeft, nch_TransRight);
00084       const int nch_TransMAX = std::max(nch_TransLeft, nch_TransRight);
00085       const int nch_TransSUM = nch_TransMAX + nch_TransMIN;
00086       const int nch_TransDIF = nch_TransMAX - nch_TransMIN;
00087       //
00088       const double ptSum_TransMIN = std::min(ptSum_TransLeft, ptSum_TransRight);
00089       const double ptSum_TransMAX = std::max(ptSum_TransLeft, ptSum_TransRight);
00090       const double ptSum_TransSUM = ptSum_TransMAX + ptSum_TransMIN;
00091       const double ptSum_TransDIF = ptSum_TransMAX - ptSum_TransMIN;
00092 
00093       // Fill profiles
00094       const double weight = event.weight();
00095       _h_Nch_TransMIN_vs_pT->fill(pT_lead/GeV, 1/AREA6 * nch_TransMIN, weight);
00096       _h_Sum_TransMIN_vs_pT->fill(pT_lead/GeV, 1/AREA6 * ptSum_TransMIN, weight);
00097       //
00098       _h_Nch_TransMAX_vs_pT->fill(pT_lead/GeV, 1/AREA6 * nch_TransMAX, weight);
00099       _h_Sum_TransMAX_vs_pT->fill(pT_lead/GeV, 1/AREA6 * ptSum_TransMAX, weight);
00100       //
00101       _h_Nch_TransAVE_vs_pT->fill(pT_lead/GeV, 1/AREA3 * nch_TransSUM, weight);
00102       _h_Sum_TransAVE_vs_pT->fill(pT_lead/GeV, 1/AREA3 * ptSum_TransSUM, weight);
00103       //
00104       _h_Nch_TransDIF_vs_pT->fill(pT_lead/GeV, 1/AREA6 * nch_TransDIF, weight);
00105       _h_Sum_TransDIF_vs_pT->fill(pT_lead/GeV, 1/AREA6 * ptSum_TransDIF, weight);
00106     }
00107 
00108 
00109   private:
00110 
00111     // Data members like post-cuts event weight counters go here
00112     const double ETACUT, AREATOT, AREA3, AREA6;
00113 
00114     /// Histograms
00115     Profile1DPtr _h_Nch_TransAVE_vs_pT, _h_Sum_TransAVE_vs_pT;
00116     Profile1DPtr _h_Nch_TransDIF_vs_pT, _h_Sum_TransDIF_vs_pT;
00117     Profile1DPtr _h_Nch_TransMIN_vs_pT, _h_Sum_TransMIN_vs_pT;
00118     Profile1DPtr _h_Nch_TransMAX_vs_pT, _h_Sum_TransMAX_vs_pT;
00119 
00120   };
00121 
00122 
00123   // The hook for the plugin system
00124   DECLARE_RIVET_PLUGIN(CMS_2015_I1385107);
00125 
00126 }