rivet is hosted by Hepforge, IPPP Durham
CMS_2013_I1218372.cc
Go to the documentation of this file.
00001 // Samantha Dooling DESY
00002 // February 2012
00003 //
00004 // -*- C++ -*-
00005 // =============================
00006 //
00007 // Ratio of the energy deposited in the pseudorapditiy range
00008 // -6.6 < eta < -5.2 for events with a charged particle jet
00009 //
00010 // =============================
00011 #include "Rivet/Analysis.hh"
00012 #include "Rivet/Projections/FinalState.hh"
00013 #include "Rivet/Projections/ChargedFinalState.hh"
00014 #include "Rivet/Projections/FastJets.hh"
00015 #include "Rivet/Projections/Beam.hh"
00016 #include "Rivet/Projections/VetoedFinalState.hh"
00017 
00018 namespace Rivet {
00019 
00020 
00021   class CMS_2013_I1218372 : public Analysis {
00022   public:
00023 
00024   /// Constructor
00025   CMS_2013_I1218372()
00026     : Analysis("CMS_2013_I1218372")
00027     { }
00028 
00029     void init() {
00030 
00031       // gives the range of eta and min pT for the final state from which I get the jets
00032       FastJets jetpro (ChargedFinalState(-2.5, 2.5, 0.3*GeV), FastJets::ANTIKT, 0.5);
00033       addProjection(jetpro, "Jets");
00034 
00035       // skip Neutrinos and Muons
00036       VetoedFinalState fsv(FinalState(-7.0, -4.0, 0.*GeV));
00037       fsv.vetoNeutrinos();
00038       fsv.addVetoPairId(PID::MUON);
00039       addProjection(fsv, "fsv");
00040 
00041       // for the hadron level selection
00042       VetoedFinalState sfsv(FinalState(-MAXRAPIDITY, MAXRAPIDITY, 0.*GeV));
00043       sfsv.vetoNeutrinos();
00044       sfsv.addVetoPairId(PID::MUON);
00045       addProjection(sfsv, "sfsv");
00046 
00047       //counters
00048       passedSumOfWeights = 0.;
00049       inclEflow = 0.;
00050 
00051       // Temporary histograms to fill the energy flow for leading jet events.
00052       // Ratios are calculated in finalyze().
00053       int id = 0;
00054       if (fuzzyEquals(sqrtS()/GeV,  900, 1e-3)) id=1;
00055       if (fuzzyEquals(sqrtS()/GeV, 2760, 1e-3)) id=2;
00056       if (fuzzyEquals(sqrtS()/GeV, 7000, 1e-3)) id=3;
00057       _h_ratio  = bookScatter2D(id, 1, 1);
00058       _tmp_jet  = bookHisto1D  (id, 1, 1, "eflow_jet");  // Leading jet energy flow in pt
00059       _tmp_njet = bookHisto1D  (id, 1, 1, "number_jet"); // Number of events in pt
00060     }
00061 
00062 
00063     /// Perform the per-event analysis
00064     void analyze(const Event& event) {
00065 
00066       const double weight = event.weight();
00067 
00068       // Skip if the event is empty
00069       const FinalState& fsv = applyProjection<FinalState>(event, "fsv");
00070       if (fsv.empty()) vetoEvent;
00071 
00072       // ====================== Minimum Bias selection
00073 
00074       const FinalState& sfsv = applyProjection<FinalState>(event, "sfsv");
00075       Particles parts = sfsv.particlesByRapidity();
00076       if (parts.empty()) vetoEvent;
00077 
00078       // find dymax
00079       double dymax = 0;
00080       int gap_pos  = -1;
00081       for (size_t i=0; i < parts.size()-1; ++i) {
00082         double dy = parts[i+1].rapidity() - parts[i].rapidity();
00083         if (dy > dymax) {
00084           dymax     = dy;
00085           gap_pos = i;
00086         }
00087       }
00088 
00089       // calculate mx2 and my2
00090       FourMomentum xmom;
00091       for (int i=0; i<=gap_pos; ++i) {
00092         xmom += parts[i].momentum();
00093       }
00094       double mx2 = xmom.mass2();
00095       if (mx2<0) vetoEvent;
00096 
00097       FourMomentum ymom;
00098       for (size_t i=gap_pos+1; i<parts.size(); ++i) {
00099         ymom += parts[i].momentum();
00100       }
00101       double my2 = ymom.mass2();
00102       if (my2<0) vetoEvent;
00103 
00104       // calculate xix and xiy and xidd
00105       double xix  = mx2 / sqr(sqrtS());
00106       double xiy  = my2 / sqr(sqrtS());
00107       double xidd = mx2*my2 / sqr(sqrtS()*0.938*GeV);
00108 
00109       // combine the selection: xi cuts
00110       bool passedHadronCuts = false;
00111       if (fuzzyEquals(sqrtS()/GeV,  900, 1e-3) && (xix > 0.1  || xiy > 0.4 || xidd > 0.5)) passedHadronCuts = true;
00112       if (fuzzyEquals(sqrtS()/GeV, 2760, 1e-3) && (xix > 0.07 || xiy > 0.2 || xidd > 0.5)) passedHadronCuts = true;
00113       if (fuzzyEquals(sqrtS()/GeV, 7000, 1e-3) && (xix > 0.04 || xiy > 0.1 || xidd > 0.5)) passedHadronCuts = true;
00114       if (!passedHadronCuts) vetoEvent;
00115 
00116       //  ============================== MINIMUM BIAS EVENTS
00117 
00118       // loop over particles to calculate the energy
00119       passedSumOfWeights += weight;
00120 
00121       foreach (const Particle& p, fsv.particles()) {
00122         if (-5.2 > p.eta() && p.eta() > -6.6) inclEflow += weight*p.momentum().E()/GeV;
00123       }
00124 
00125       //  ============================== JET EVENTS
00126 
00127       const FastJets& jetpro = applyProjection<FastJets>(event, "Jets");
00128       const Jets& jets = jetpro.jetsByPt(1.0*GeV);
00129       if (jets.size()<1) vetoEvent;
00130 
00131       if (fabs(jets[0].eta()) < 2.0) {
00132         _tmp_njet->fill(jets[0].pT()/GeV, weight);
00133 
00134         // energy flow
00135         foreach (const Particle& p, fsv.particles()) {
00136           if (p.eta() > -6.6 && p.eta() < -5.2) {  // ask for the CASTOR region
00137             _tmp_jet->fill(jets[0].pT()/GeV, weight * p.momentum().E()/GeV);
00138           }
00139         }
00140       }
00141 
00142     }// analysis
00143 
00144     void finalize() {
00145       scale(_tmp_jet, passedSumOfWeights/inclEflow);
00146       divide(_tmp_jet, _tmp_njet, _h_ratio);
00147     }
00148 
00149   private:
00150     // counters
00151     double passedSumOfWeights;
00152     double inclEflow;
00153 
00154     // histograms
00155     Scatter2DPtr _h_ratio;
00156     Histo1DPtr   _tmp_jet;
00157     Histo1DPtr   _tmp_njet;
00158   };
00159 
00160 
00161   // The hook for the plugin system
00162   DECLARE_RIVET_PLUGIN(CMS_2013_I1218372);
00163 
00164 }