rivet is hosted by Hepforge, IPPP Durham
ATLAS_2010_S8918562.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include "Rivet/Analysis.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   /// Rivet analysis class for ATLAS 2010 minimum bias analysis
00010   class ATLAS_2010_S8918562 : public Analysis {
00011   public:
00012 
00013     /// Helper for collectively filling Nch, pT, eta, and pT vs. Nch histograms
00014     void fillPtEtaNch(const ChargedFinalState& cfs, int nchcut, double weight,
00015                       Histo1DPtr h_nch, Histo1DPtr h_pt,
00016                       Histo1DPtr h_eta, Profile1DPtr h_ptnch = Profile1DPtr()) {
00017 
00018       // Get number of particles and skip if event fails cut
00019       const int nch = cfs.size();
00020       if (nch < nchcut) return;
00021 
00022       // Fill nch
00023       h_nch->fill(nch, weight);
00024       // Loop over particles, fill pT, eta and ptnch
00025       foreach (const Particle& p, cfs.particles()) {
00026         const double pt = p.pT();
00027         h_pt->fill(pt/GeV, weight/pt);
00028         h_eta->fill(p.eta(), weight);
00029         if (h_ptnch != 0) h_ptnch->fill(nch, pt/GeV, weight);
00030       }
00031     }
00032 
00033 
00034     /// Default constructor
00035     ATLAS_2010_S8918562() : Analysis("ATLAS_2010_S8918562") {
00036       _sumW_pt100_nch2 = 0;
00037       _sumW_pt100_nch20 = 0;
00038       _sumW_pt500_nch1 = 0;
00039       _sumW_pt500_nch6 = 0;
00040       _sumW_pt2500_nch1 = 0;
00041     }
00042 
00043 
00044     /// Initialization, called once before running
00045     void init() {
00046       // Projections
00047       const ChargedFinalState cfs100(-2.5, 2.5, 100.0*MeV);
00048       addProjection(cfs100, "CFS100");
00049       const ChargedFinalState cfs500(-2.5, 2.5, 500.0*MeV);
00050       addProjection(cfs500, "CFS500");
00051       const ChargedFinalState cfs2500(-2.5, 2.5, 2500.0*MeV);
00052       addProjection(cfs2500, "CFS2500");
00053 
00054       // Book histograms
00055       if (fuzzyEquals(sqrtS()/GeV, 900)) {
00056         _hist_pt100_nch2_nch = bookHisto1D(18, 1, 1);
00057         _hist_pt100_nch2_pt = bookHisto1D(11, 1, 1);
00058         _hist_pt100_nch2_eta = bookHisto1D(4, 1, 1);
00059         _hist_pt100_nch2_ptnch = bookProfile1D(24, 1, 1);
00060 
00061         _hist_pt100_nch20_nch = bookHisto1D(34, 1, 1);
00062         _hist_pt100_nch20_pt = bookHisto1D(30, 1, 1);
00063         _hist_pt100_nch20_eta = bookHisto1D(26, 1, 1);
00064 
00065         _hist_pt500_nch1_nch = bookHisto1D(15, 1, 1);
00066         _hist_pt500_nch1_pt = bookHisto1D(8, 1, 1);
00067         _hist_pt500_nch1_eta = bookHisto1D(1, 1, 1);
00068         _hist_pt500_nch1_ptnch = bookProfile1D(22, 1, 1);
00069 
00070         _hist_pt500_nch6_nch = bookHisto1D(20, 1, 1);
00071         _hist_pt500_nch6_pt = bookHisto1D(13, 1, 1);
00072         _hist_pt500_nch6_eta = bookHisto1D(6, 1, 1);
00073 
00074         _hist_pt2500_nch1_nch = bookHisto1D(36, 1, 1);
00075         _hist_pt2500_nch1_pt = bookHisto1D(32, 1, 1);
00076         _hist_pt2500_nch1_eta = bookHisto1D(28, 1, 1);
00077         _hist_pt2500_nch1_ptnch = bookProfile1D(38, 1, 1);
00078 
00079       } else if (fuzzyEquals(sqrtS()/GeV, 2360)) {
00080 
00081         _hist_pt500_nch1_nch = bookHisto1D(16, 1, 1);
00082         _hist_pt500_nch1_pt = bookHisto1D(9, 1, 1);
00083         _hist_pt500_nch1_eta = bookHisto1D(2, 1, 1);
00084         // This one histogram might be called while unbooked, so ensure its pointer is null!
00085         _hist_pt500_nch1_ptnch = Profile1DPtr();
00086 
00087       } else if (fuzzyEquals(sqrtS()/GeV, 7000)) {
00088 
00089         _hist_pt100_nch2_nch = bookHisto1D(19, 1, 1);
00090         _hist_pt100_nch2_pt = bookHisto1D(12, 1, 1);
00091         _hist_pt100_nch2_eta = bookHisto1D(5, 1, 1);
00092         _hist_pt100_nch2_ptnch = bookProfile1D(25, 1, 1);
00093 
00094         _hist_pt100_nch20_nch = bookHisto1D(35, 1, 1);
00095         _hist_pt100_nch20_pt = bookHisto1D(31, 1, 1);
00096         _hist_pt100_nch20_eta = bookHisto1D(27, 1, 1);
00097 
00098         _hist_pt500_nch1_nch = bookHisto1D(17, 1, 1);
00099         _hist_pt500_nch1_pt = bookHisto1D(10, 1, 1);
00100         _hist_pt500_nch1_eta = bookHisto1D(3, 1, 1);
00101         _hist_pt500_nch1_ptnch = bookProfile1D(23, 1, 1);
00102 
00103         _hist_pt500_nch6_nch = bookHisto1D(21, 1, 1);
00104         _hist_pt500_nch6_pt = bookHisto1D(14, 1, 1);
00105         _hist_pt500_nch6_eta = bookHisto1D(7, 1, 1);
00106 
00107         _hist_pt2500_nch1_nch = bookHisto1D(37, 1, 1);
00108         _hist_pt2500_nch1_pt = bookHisto1D(33, 1, 1);
00109         _hist_pt2500_nch1_eta = bookHisto1D(29, 1, 1);
00110         _hist_pt2500_nch1_ptnch = bookProfile1D(39, 1, 1);
00111 
00112       } else {
00113         throw LogicError("The ATLAS_2010_S8918562 analysis is only valid for sqrt(s) = 900, 2360 and 7000 GeV!");
00114       }
00115 
00116     }
00117 
00118 
00119 
00120     void analyze(const Event& event) {
00121       const double weight = event.weight();
00122 
00123       // 100 GeV final states
00124       if (!fuzzyEquals(sqrtS()/GeV, 2360)) {
00125         const ChargedFinalState& cfs100 = applyProjection<ChargedFinalState>(event, "CFS100");
00126         // nch>=2
00127         if (cfs100.size() >= 2) _sumW_pt100_nch2 += weight;
00128         fillPtEtaNch(cfs100, 2, weight, _hist_pt100_nch2_nch, _hist_pt100_nch2_pt, _hist_pt100_nch2_eta, _hist_pt100_nch2_ptnch);
00129         // nch>=20
00130         if (cfs100.size() >= 20) _sumW_pt100_nch20 += weight;
00131         fillPtEtaNch(cfs100, 20, weight, _hist_pt100_nch20_nch, _hist_pt100_nch20_pt, _hist_pt100_nch20_eta);
00132       }
00133 
00134       // 500 GeV final states
00135       const ChargedFinalState& cfs500 = applyProjection<ChargedFinalState>(event, "CFS500");
00136       // nch>=1
00137       if (cfs500.size() >= 1) _sumW_pt500_nch1 += weight;
00138       fillPtEtaNch(cfs500, 1, weight, _hist_pt500_nch1_nch, _hist_pt500_nch1_pt, _hist_pt500_nch1_eta, _hist_pt500_nch1_ptnch);
00139       // nch>=6
00140       if (!fuzzyEquals(sqrtS()/GeV, 2360)) {
00141         if (cfs500.size() >= 6) _sumW_pt500_nch6 += weight;
00142         fillPtEtaNch(cfs500, 6, weight, _hist_pt500_nch6_nch, _hist_pt500_nch6_pt, _hist_pt500_nch6_eta);
00143       }
00144 
00145       // 2500 GeV final states
00146       if (!fuzzyEquals(sqrtS()/GeV, 2360)) {
00147         const ChargedFinalState& cfs2500 = applyProjection<ChargedFinalState>(event, "CFS2500");
00148         // nch>=1
00149         if (cfs2500.size() >= 1) _sumW_pt2500_nch1 += weight;
00150         fillPtEtaNch(cfs2500, 1, weight, _hist_pt2500_nch1_nch, _hist_pt2500_nch1_pt, _hist_pt2500_nch1_eta, _hist_pt2500_nch1_ptnch);
00151       }
00152 
00153     }
00154 
00155 
00156 
00157     void finalize() {
00158 
00159       if (!fuzzyEquals(sqrtS()/GeV, 2360)) {
00160         if (_sumW_pt100_nch2 > 0) {
00161           scale(_hist_pt100_nch2_nch, 1.0/_sumW_pt100_nch2);
00162           scale(_hist_pt100_nch2_pt, 1.0/_sumW_pt100_nch2/TWOPI/5);
00163           scale(_hist_pt100_nch2_eta, 1.0/_sumW_pt100_nch2);
00164         }
00165 
00166         if (_sumW_pt100_nch20 > 0) {
00167           scale(_hist_pt100_nch20_nch, 1.0/_sumW_pt100_nch20);
00168           scale(_hist_pt100_nch20_pt, 1.0/_sumW_pt100_nch20/TWOPI/5);
00169           scale(_hist_pt100_nch20_eta, 1.0/_sumW_pt100_nch20);
00170         }
00171 
00172         if (_sumW_pt500_nch6 > 0) {
00173           scale(_hist_pt500_nch6_nch, 1.0/_sumW_pt500_nch6);
00174           scale(_hist_pt500_nch6_pt, 1.0/_sumW_pt500_nch6/TWOPI/5);
00175           scale(_hist_pt500_nch6_eta, 1.0/_sumW_pt500_nch6);
00176         }
00177 
00178         if (_sumW_pt2500_nch1 > 0) {
00179           scale(_hist_pt2500_nch1_nch, 1.0/_sumW_pt2500_nch1);
00180           scale(_hist_pt2500_nch1_pt, 1.0/_sumW_pt2500_nch1/TWOPI/5);
00181           scale(_hist_pt2500_nch1_eta, 1.0/_sumW_pt2500_nch1);
00182         }
00183       }
00184 
00185       if (_sumW_pt500_nch1 > 0) {
00186         scale(_hist_pt500_nch1_nch, 1.0/_sumW_pt500_nch1);
00187         scale(_hist_pt500_nch1_pt, 1.0/_sumW_pt500_nch1/TWOPI/5);
00188         scale(_hist_pt500_nch1_eta, 1.0/_sumW_pt500_nch1);
00189       }
00190     }
00191 
00192 
00193   private:
00194 
00195     double _sumW_pt100_nch2, _sumW_pt100_nch20, _sumW_pt500_nch1,
00196       _sumW_pt500_nch6, _sumW_pt2500_nch1;
00197 
00198     Histo1DPtr _hist_pt100_nch2_nch,
00199       _hist_pt100_nch20_nch, _hist_pt500_nch1_nch,
00200       _hist_pt500_nch6_nch, _hist_pt2500_nch1_nch;
00201 
00202     Histo1DPtr _hist_pt100_nch2_pt,
00203       _hist_pt100_nch20_pt, _hist_pt500_nch1_pt,
00204       _hist_pt500_nch6_pt, _hist_pt2500_nch1_pt;
00205 
00206     Histo1DPtr _hist_pt100_nch2_eta,
00207       _hist_pt100_nch20_eta, _hist_pt500_nch1_eta,
00208       _hist_pt500_nch6_eta, _hist_pt2500_nch1_eta;
00209 
00210     Profile1DPtr _hist_pt100_nch2_ptnch,
00211       _hist_pt500_nch1_ptnch, _hist_pt2500_nch1_ptnch;
00212 
00213   };
00214 
00215 
00216 
00217   // The hook for the plugin system
00218   DECLARE_RIVET_PLUGIN(ATLAS_2010_S8918562);
00219 
00220 }