rivet is hosted by Hepforge, IPPP Durham
CMS_2015_I1356998.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FinalState.hh"
00004 
00005 namespace Rivet {
00006 
00007   class CMS_2015_I1356998 : public Analysis {
00008   public:
00009 
00010     CMS_2015_I1356998()
00011       : Analysis("CMS_2015_I1356998"), edge(4.7)
00012     {    }
00013 
00014   public:
00015 
00016     void init() {
00017 
00018       addProjection(FinalState(),"FS");
00019 
00020       _h_noCASTORtag = bookHisto1D(1, 1, 1);
00021       _h_CASTORtag   = bookHisto1D(2, 1, 1);
00022       _h_centralGap  = bookHisto1D(3, 1, 1);
00023       _h_sigmaVis    = bookHisto1D(4, 1, 1);
00024       _h_maxFwdGap   = bookHisto1D(5, 1, 1);
00025     
00026     }
00027 
00028     void analyze(const Event& event) {
00029 
00030     const double weight = event.weight();
00031     const FinalState& fs = applyProjection<FinalState>(event, "FS");
00032 
00033         // A vector containing a lot of eta values
00034     vector<double> detparticles;
00035     detparticles.push_back(-edge);
00036     foreach (const Particle& p, fs.particles(Cuts::pT > 0.2*GeV && Cuts::abseta<edge, cmpMomByEta) ) {
00037           detparticles.push_back(p.momentum().eta());
00038     }
00039     detparticles.push_back(edge);
00040 
00041         // Find maximum gap size
00042     vector <double>::iterator iter;
00043     vector<double> detgaps;
00044     for (iter = detparticles.begin()+1; iter != detparticles.end(); ++iter) {
00045           const double detgap = *iter - *(iter-1);
00046           detgaps.push_back(detgap);
00047     }
00048     double detgapbwd = detgaps.front();
00049     double detgapfwd = detgaps.back();
00050     double detfmax = max(detgapbwd, detgapfwd);
00051 
00052         // Fill rapidity gap histo
00053     if (detfmax != 2*edge ) {
00054           _h_maxFwdGap->fill(detfmax, weight);
00055         }
00056         // Everything that follows has to do with the cross-section measurements
00057 
00058     if (fs.size() < 2) vetoEvent;
00059 
00060         // Gap center calculations
00061     const ParticleVector particlesByRapidity = fs.particles(cmpMomByRap); //ByRapidity();
00062 
00063     vector<double> gaps;
00064     vector<double> midpoints;
00065     for (size_t ip = 1; ip < particlesByRapidity.size(); ++ip) {
00066       const Particle& p1 = particlesByRapidity[ip-1];
00067       const Particle& p2 = particlesByRapidity[ip];
00068       const double gap = p2.momentum().rapidity()  - p1.momentum().rapidity();
00069       const double mid = (p2.momentum().rapidity() + p1.momentum().rapidity()) / 2.;
00070       gaps.push_back(gap);
00071       midpoints.push_back(mid);
00072     }
00073 
00074     int imid = std::distance(gaps.begin(), max_element(gaps.begin(), gaps.end()));
00075     double gapcenter = midpoints[imid];
00076 
00077         // Calculations for cross-sections 
00078     FourMomentum MxFourVector(0.,0.,0.,0.);
00079     FourMomentum MyFourVector(0.,0.,0.,0.);
00080 
00081     foreach(const Particle& p, fs.particles(cmpMomByEta)) {
00082           if (p.momentum().rapidity() > gapcenter) {
00083             MxFourVector += p.momentum();
00084           }
00085           else {
00086             MyFourVector += p.momentum();
00087       }
00088     }
00089 
00090     double Mx = MxFourVector.mass();
00091     double My = MyFourVector.mass();
00092 
00093     const double xix = (Mx*Mx)/(sqrtS()/GeV * sqrtS()/GeV);
00094 
00095     if (log10(My) < 0.5) {
00096           _h_noCASTORtag->fill(log10(xix), weight);
00097           if (log10(xix) > -5.5 && log10(xix) < -2.5) _h_sigmaVis->fill(0.5, weight);
00098     } 
00099         else if (log10(My) < 1.1) {
00100           _h_CASTORtag->fill(log10(xix), weight);
00101           if (log10(xix) > -5.5 && log10(xix) < -2.5) _h_sigmaVis->fill(1.5, weight);
00102     }
00103 
00104         // Central gap x-section
00105     double xigen = (Mx*Mx) * (My*My) / (sqrtS()/GeV * sqrtS()/GeV * 0.93827 * 0.93827); // Proton masses... 
00106     double dy0 = -log(xigen);
00107     
00108     if (dy0 > 3.) {
00109           if (log10(My) > 1.1 && log10(Mx) > 1.1) { 
00110             _h_centralGap->fill(dy0, weight);
00111             _h_sigmaVis->fill(2.5, weight);
00112           }
00113     }
00114 
00115 }
00116 
00117     void finalize() {
00118 
00119       double xs = crossSection()/millibarn/sumOfWeights();
00120        scale(_h_noCASTORtag, xs);
00121        scale(_h_CASTORtag  , xs);
00122        scale(_h_centralGap , xs);
00123        scale(_h_sigmaVis   , xs);
00124        scale(_h_maxFwdGap  , xs);
00125 
00126     }
00127 
00128   private:
00129 
00130     Histo1DPtr _h_noCASTORtag;
00131     Histo1DPtr _h_CASTORtag;
00132     Histo1DPtr _h_centralGap;
00133     Histo1DPtr _h_sigmaVis;
00134     Histo1DPtr _h_maxFwdGap;
00135     double edge;
00136 
00137   };
00138 
00139 
00140   DECLARE_RIVET_PLUGIN(CMS_2015_I1356998);
00141 
00142 }