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