rivet is hosted by Hepforge, IPPP Durham
CDF_2012_NOTE10874.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 
00007 
00008 
00009 namespace Rivet {
00010 
00011 
00012   class CDF_2012_NOTE10874 : public Analysis {
00013   public:
00014 
00015     CDF_2012_NOTE10874()
00016       : Analysis("CDF_2012_NOTE10874")
00017     {}
00018 
00019 
00020   public:
00021 
00022     void init() {
00023       const ChargedFinalState cfs(-1.0, 1.0, 0.5*GeV);
00024       addProjection(cfs, "CFS");
00025 
00026       int isqrts = -1;
00027       if (fuzzyEquals(sqrtS(), 300*GeV)) isqrts = 1;
00028       else if (fuzzyEquals(sqrtS(), 900*GeV)) isqrts = 2;
00029       else if (fuzzyEquals(sqrtS(), 1960*GeV)) isqrts = 3;
00030       assert(isqrts >= 0);
00031 
00032       _h_nch_transverse = bookProfile1D(1,1,isqrts);
00033       _h_ptSumDen = bookProfile1D(2,1,isqrts);
00034       _h_avePt = bookProfile1D(3,1,isqrts);
00035     }
00036 
00037     // Little helper function to identify Delta(phi) regions
00038     inline int region_index(double dphi) {
00039       assert(inRange(dphi, 0.0, PI, CLOSED, CLOSED));
00040       if (dphi < PI/3.0) return 0;
00041       if (dphi < 2*PI/3.0) return 1;
00042       return 2;
00043     }
00044 
00045 
00046     void analyze(const Event& event) {
00047       const double weight = event.weight();
00048 
00049       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS");
00050       if (cfs.size() < 1) {
00051         vetoEvent;
00052       }
00053 
00054       ParticleVector particles = cfs.particlesByPt();
00055       Particle p_lead = particles[0];
00056       const double philead = p_lead.momentum().phi();
00057       const double pTlead  = p_lead.momentum().pT();
00058 
00059       int    tNch = 0;
00060       double ptSum = 0.0;
00061       foreach (const Particle& p, particles) {
00062         const double pT = p.momentum().pT();
00063         const double dPhi = deltaPhi(philead, p.momentum().phi());
00064         const int ir = region_index(dPhi);
00065         if (ir==1) {
00066           tNch++;
00067           ptSum += pT;
00068         }
00069       }
00070 
00071       const double dEtadPhi = 4.0*PI/3.0;
00072 
00073       _h_nch_transverse->fill(pTlead/GeV, tNch/dEtadPhi, weight);
00074       _h_ptSumDen->fill(pTlead/GeV, ptSum/dEtadPhi, weight);
00075 
00076       if (tNch > 0) {
00077         _h_avePt->fill(pTlead/GeV, ptSum/tNch, weight);
00078       }
00079     }
00080 
00081 
00082     void finalize() {
00083     }
00084 
00085 
00086   private:
00087 
00088     Profile1DPtr _h_nch_transverse, _h_ptSumDen, _h_avePt;
00089 
00090   };
00091 
00092 
00093   // The hook for the plugin system
00094   DECLARE_RIVET_PLUGIN(CDF_2012_NOTE10874);
00095 
00096 }