rivet is hosted by Hepforge, IPPP Durham
ATLAS_2011_S8924791.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FastJets.hh"
00004 #include "Rivet/Projections/VetoedFinalState.hh"
00005 #include "Rivet/Projections/VisibleFinalState.hh"
00006 #include "Rivet/Projections/JetShape.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   /// @brief ATLAS jet shape analysis
00012   /// @author Andy Buckley, Judith Katzy, Francesc Vives
00013   class ATLAS_2011_S8924791 : public Analysis {
00014   public:
00015 
00016     /// Constructor
00017     ATLAS_2011_S8924791()
00018       : Analysis("ATLAS_2011_S8924791")
00019     {    }
00020 
00021 
00022     /// @name Analysis methods
00023     //@{
00024 
00025     void init() {
00026       // Set up projections
00027       const FinalState fs(-5.0, 5.0);
00028       addProjection(fs, "FS");
00029       FastJets fj(fs, FastJets::ANTIKT, 0.6);
00030       fj.useInvisibles();
00031       addProjection(fj, "Jets");
00032 
00033       // Specify pT bins
00034       _ptedges += 30.0, 40.0, 60.0, 80.0, 110.0, 160.0, 210.0, 260.0, 310.0, 400.0, 500.0, 600.0;
00035       _yedges  += 0.0, 0.3, 0.8, 1.2, 2.1, 2.8;
00036 
00037       // Register a jet shape projection and histogram for each pT bin
00038       for (size_t i = 0; i < 11; ++i) {
00039         for (size_t j = 0; j < 6; ++j) {
00040           if (i == 8  && j == 4) continue;
00041           if (i == 9  && j == 4) continue;
00042           if (i == 10 && j != 5) continue;
00043 
00044           // Set up projections for each (pT,y) bin
00045           _jsnames_pT[i][j] = "JetShape" + to_str(i) + to_str(j);
00046           const double ylow = (j < 5) ? _yedges[j] : _yedges.front();
00047           const double yhigh = (j < 5) ? _yedges[j+1] : _yedges.back();
00048           const JetShape jsp(fj, 0.0, 0.7, 7, _ptedges[i], _ptedges[i+1], ylow, yhigh, RAPIDITY);
00049           addProjection(jsp, _jsnames_pT[i][j]);
00050 
00051           // Book profile histograms for each (pT,y) bin
00052           _profhistRho_pT[i][j] = bookProfile1D(i+1, j+1, 1);
00053           _profhistPsi_pT[i][j] = bookProfile1D(i+1, j+1, 2);
00054         }
00055       }
00056     }
00057 
00058 
00059 
00060     /// Do the analysis
00061     void analyze(const Event& evt) {
00062 
00063       // Get jets and require at least one to pass pT and y cuts
00064       const Jets jets = applyProjection<FastJets>(evt, "Jets")
00065         .jetsByPt(_ptedges.front()*GeV, _ptedges.back()*GeV, -2.8, 2.8, RAPIDITY);
00066       MSG_DEBUG("Jet multiplicity before cuts = " << jets.size());
00067       if (jets.size() == 0) {
00068         MSG_DEBUG("No jets found in required pT & rapidity range");
00069         vetoEvent;
00070       }
00071       // Calculate and histogram jet shapes
00072       const double weight = evt.weight();
00073 
00074       for (size_t ipt = 0; ipt < 11; ++ipt) {
00075         for (size_t jy = 0; jy < 6; ++jy) {
00076           if (ipt == 8 && jy == 4) continue;
00077           if (ipt == 9 && jy == 4) continue;
00078           if (ipt == 10 && jy != 5) continue;
00079           const JetShape& jsipt = applyProjection<JetShape>(evt, _jsnames_pT[ipt][jy]);
00080           for (size_t ijet = 0; ijet < jsipt.numJets(); ++ijet) {
00081             for (size_t rbin = 0; rbin < jsipt.numBins(); ++rbin) {
00082               const double r_rho = jsipt.rBinMid(rbin);
00083               _profhistRho_pT[ipt][jy]->fill(r_rho, (1./0.1)*jsipt.diffJetShape(ijet, rbin), weight);
00084               const double r_Psi = jsipt.rBinMid(rbin);
00085               _profhistPsi_pT[ipt][jy]->fill(r_Psi, jsipt.intJetShape(ijet, rbin), weight);
00086             }
00087           }
00088         }
00089       }
00090     }
00091 
00092 
00093     // Finalize
00094     void finalize() {
00095     }
00096 
00097     //@}
00098 
00099 
00100   private:
00101 
00102     /// @name Analysis data
00103     //@{
00104 
00105     /// Jet \f$ p_\perp\f$ bins.
00106     vector<double> _ptedges; // This can't be a raw array if we want to initialise it non-painfully
00107     vector<double> _yedges;
00108 
00109     /// JetShape projection name for each \f$p_\perp\f$ bin.
00110     string _jsnames_pT[11][6];
00111 
00112     //@}
00113 
00114     /// @name Histograms
00115     //@{
00116     Profile1DPtr _profhistRho_pT[11][6];
00117     Profile1DPtr _profhistPsi_pT[11][6];
00118     //@}
00119 
00120   };
00121 
00122 
00123 
00124   // The hook for the plugin system
00125   DECLARE_RIVET_PLUGIN(ATLAS_2011_S8924791);
00126 
00127 }