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