rivet is hosted by Hepforge, IPPP Durham
ATLAS_2016_I1419070.cc
Go to the documentation of this file.
00001 #include "Rivet/Analysis.hh"
00002 #include "Rivet/Projections/FinalState.hh"
00003 #include "Rivet/Projections/FastJets.hh"
00004 
00005 namespace Rivet {
00006 
00007   class ATLAS_2016_I1419070 : public Analysis {
00008 
00009   public:
00010   
00011     /// Constructor
00012     ATLAS_2016_I1419070() : Analysis("ATLAS_2016_I1419070")
00013     {  }
00014   
00015   public:
00016 
00017     void init() {
00018 
00019       addProjection(FastJets(FinalState(), FastJets::ANTIKT, 0.4), "Jets");
00020 
00021       forward_500MeV = bookProfile1D(1, 1, 1);
00022       forward_2GeV   = bookProfile1D(2, 1, 1);
00023       forward_5GeV   = bookProfile1D(3, 1, 1);
00024 
00025       central_500MeV = bookProfile1D(4, 1, 1);
00026       central_2GeV   = bookProfile1D(5, 1, 1);
00027       central_5GeV   = bookProfile1D(6, 1, 1);
00028 
00029       diff_500MeV = bookScatter2D("d07-x01-y01", true);
00030       diff_2GeV   = bookScatter2D("d08-x01-y01", true);
00031       diff_5GeV   = bookScatter2D("d09-x01-y01", true);
00032 
00033       sum_500MeV = bookScatter2D("d10-x01-y01", true);
00034       sum_2GeV   = bookScatter2D("d11-x01-y01", true);
00035       sum_5GeV   = bookScatter2D("d12-x01-y01", true);
00036 
00037     }
00038   
00039     /// Perform the per-event analysis
00040     void analyze(const Event& event) {
00041       const double weight = event.weight();
00042       
00043       Jets m_goodJets = applyProjection<JetAlg>(event, "Jets").jetsByPt(Cuts::pT > 25*GeV && Cuts::abseta < 2.1);
00044 
00045       if (m_goodJets.size() < 2)        vetoEvent;
00046       if (m_goodJets[0].pT() < 50*GeV)  vetoEvent;
00047       if (m_goodJets[1].pT() < 50*GeV)  vetoEvent;
00048       if (fabs(1.0 - m_goodJets[0].pT()/m_goodJets[1].pT()) > 0.5)  vetoEvent;
00049 
00050       bool check = m_goodJets[0].abseta() < m_goodJets[1].abseta();
00051       int pos_f = int(check);
00052       int pos_c = int(!check);
00053 
00054       double pt500MeV_f = CalculateNCharge(m_goodJets[pos_f], 0.5);
00055       double pt2GeV_f   = CalculateNCharge(m_goodJets[pos_f], 2.0);
00056       double pt5GeV_f   = CalculateNCharge(m_goodJets[pos_f], 5.0);
00057       double pT_f = m_goodJets[pos_f].pT();
00058       
00059       double pt500MeV_c = CalculateNCharge(m_goodJets[pos_c], 0.5);
00060       double pt2GeV_c   = CalculateNCharge(m_goodJets[pos_c], 2.0);
00061       double pt5GeV_c   = CalculateNCharge(m_goodJets[pos_c], 5.0);
00062       double pT_c = m_goodJets[pos_c].pT();
00063 
00064       forward_500MeV->fill(pT_f, pt500MeV_f, weight);
00065       forward_2GeV->fill(  pT_f, pt2GeV_f,   weight);
00066       forward_5GeV->fill(  pT_f, pt5GeV_f,   weight);
00067 
00068       central_500MeV->fill(pT_c, pt500MeV_c, weight);
00069       central_2GeV->fill(  pT_c, pt2GeV_c,   weight);
00070       central_5GeV->fill(  pT_c, pt5GeV_c,   weight);
00071     }
00072   
00073     double CalculateNCharge(Jet& jet, double pTcut=0.5) {
00074       unsigned int ncharge = 0;
00075       foreach (const Particle& p, jet.particles()) {
00076         if (p.pT() < pTcut)  continue;
00077         if (p.threeCharge())  ++ncharge;
00078       }
00079       if (ncharge > 60)  ncharge = 60;
00080       return double(ncharge);
00081     }
00082   
00083     /// Normalise histograms etc., after the run
00084     void finalize() {
00085     
00086       if (numEvents() > 2) {
00087         for (unsigned int i = 0; i < forward_500MeV->numBins(); ++i) {
00088           ProfileBin1D bsum  = central_500MeV->bin(i) + forward_500MeV->bin(i);
00089           ProfileBin1D bsum2 = central_2GeV->bin(i) + forward_2GeV->bin(i);
00090           ProfileBin1D bsum5 = central_5GeV->bin(i) + forward_5GeV->bin(i);
00091           ProfileBin1D bdiff  = central_500MeV->bin(i) - forward_500MeV->bin(i);
00092           ProfileBin1D bdiff2 = central_2GeV->bin(i) - forward_2GeV->bin(i);
00093           ProfileBin1D bdiff5 = central_5GeV->bin(i) - forward_5GeV->bin(i);
00094 
00095           double ydiff  = central_500MeV->bin(i).numEntries()? central_500MeV->bin(i).mean() : 0.0;
00096           double ydiff2 = central_2GeV->bin(i).numEntries()?   central_2GeV->bin(i).mean()   : 0.0;
00097           double ydiff5 = central_5GeV->bin(i).numEntries()?   central_5GeV->bin(i).mean()   : 0.0;
00098           ydiff  -= forward_500MeV->bin(i).numEntries()? forward_500MeV->bin(i).mean() : 0.0;
00099           ydiff2 -= forward_2GeV->bin(i).numEntries()?   forward_2GeV->bin(i).mean()   : 0.0;
00100           ydiff5 -= forward_5GeV->bin(i).numEntries()?   forward_5GeV->bin(i).mean()   : 0.0;
00101 
00102           double yerr  = bsum.numEntries()?  bsum.stdErr()  : 0.0;
00103           double yerr2 = bsum2.numEntries()? bsum2.stdErr() : 0.0;
00104           double yerr5 = bsum5.numEntries()? bsum5.stdErr() : 0.0;
00105 
00106             diff_500MeV->point(i).setY(ydiff, yerr);
00107           diff_2GeV->point(i).setY(ydiff2, yerr2);
00108           diff_5GeV->point(i).setY(ydiff5, yerr5);
00109 
00110           sum_500MeV->point(i).setY(bsum.numEntries()? bsum.mean() : 0.0, yerr);
00111           sum_2GeV->point(i).setY(bsum2.numEntries()? bsum2.mean() : 0.0, yerr2);
00112           sum_5GeV->point(i).setY(bsum5.numEntries()? bsum5.mean() : 0.0, yerr5);
00113         }
00114       }
00115 
00116     }
00117 
00118 
00119   private:
00120   
00121     Profile1DPtr forward_500MeV;
00122     Profile1DPtr forward_2GeV;
00123     Profile1DPtr forward_5GeV;
00124 
00125     Profile1DPtr central_500MeV;
00126     Profile1DPtr central_2GeV;
00127     Profile1DPtr central_5GeV;
00128 
00129     Scatter2DPtr sum_500MeV;
00130     Scatter2DPtr sum_2GeV;
00131     Scatter2DPtr sum_5GeV;
00132 
00133     Scatter2DPtr diff_500MeV;
00134     Scatter2DPtr diff_2GeV;
00135     Scatter2DPtr diff_5GeV;
00136   
00137   };
00138 
00139   // The hook for the plugin system
00140   DECLARE_RIVET_PLUGIN(ATLAS_2016_I1419070);
00141 }