rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1091481.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Tools/ParticleIdUtils.hh"
00007 #include <iostream>
00008 #include <fstream>
00009 
00010 namespace Rivet {
00011 
00012 
00013   class ATLAS_2012_I1091481 : public Analysis {
00014   public:
00015 
00016     /// Constructor
00017     ATLAS_2012_I1091481()
00018       : Analysis("ATLAS_2012_I1091481")
00019     {
00020     }
00021 
00022 
00023   public:
00024 
00025     /// Book histograms and initialise projections before the run
00026     void init() {
00027 
00028       /// @todo Initialise and register projections here
00029       ChargedFinalState cfs100(-2.5, 2.5, 0.1*GeV);
00030       addProjection(cfs100,"CFS100");
00031       ChargedFinalState cfs500(-2.5, 2.5, 0.5*GeV);
00032       addProjection(cfs500,"CFS500");
00033 
00034 
00035       // collision energy
00036       int isqrts = -1;
00037       if (fuzzyEquals(sqrtS(), 900*GeV)) isqrts = 2;
00038       else if (fuzzyEquals(sqrtS(), 7*TeV)) isqrts = 1;
00039       assert(isqrts >= 0);
00040 
00041       _sE_10_100   = bookHisto1D(isqrts, 1, 1);
00042       _sE_1_100    = bookHisto1D(isqrts, 1, 2);
00043       _sE_10_500   = bookHisto1D(isqrts, 1, 3);
00044 
00045       _sEta_10_100 = bookHisto1D(isqrts, 2, 1);
00046       _sEta_1_100  = bookHisto1D(isqrts, 2, 2);
00047       _sEta_10_500 = bookHisto1D(isqrts, 2, 3);
00048     }
00049 
00050     // Recalculate particle energy assuming pion mass
00051     double getPionEnergy(const Particle& p) {
00052       double m_pi = 0.1396*GeV;
00053       double p2  = p.momentum().vector3().mod2()/(GeV*GeV);
00054       return sqrt(pow(m_pi,2) + p2);
00055     }
00056 
00057     // S_eta core for one event
00058     //
00059     //  -1 + 1/Nch * |sum_j^Nch exp[i*(xi eta_j - Phi_j)]|^2
00060     //
00061     double getSeta(const ParticleVector& part, double xi) {
00062       std::complex<double> c_eta (0.0, 0.0);
00063       foreach (const Particle& p, part) {
00064         double eta = p.momentum().eta();
00065         double phi = p.momentum().phi();
00066         double arg = xi*eta-phi;
00067          std::complex<double> temp(cos(arg), sin(arg));
00068          c_eta += temp;
00069       }
00070       // Not 100% sure about the -1 here
00071       return std::norm(c_eta)/part.size() - 1.0;
00072     }
00073 
00074     // S_E core for one event
00075     //
00076     //  -1 + 1/Nch * |sum_j^Nch exp[i*(omega X_j - Phi_j)]|^2
00077     double getSE(const ParticleVector& part, double omega) {
00078       double Xj = 0.0;
00079       std::complex<double> c_E (0.0, 0.0);
00080       for (unsigned int i=0; i<part.size(); i++) {
00081         Xj += 0.5*getPionEnergy(part[i]);
00082         double phi = part[i].momentum().phi();
00083         double arg = omega*Xj - phi;
00084          std::complex<double> temp(cos(arg), sin(arg));
00085          c_E += temp;
00086         Xj += 0.5*getPionEnergy(part[i]);
00087       }
00088       // Not 100% sure about the -1 here
00089       return std::norm(c_E)/part.size() - 1.0;
00090     }
00091 
00092     // Convenient fill function
00093     void fillS(Histo1DPtr h, const ParticleVector& part, double weight, bool SE=true) {
00094       // Loop over bins, take bin centers as parameter values
00095       for (size_t i=0; i< h->numBins(); i++) {
00096         double x = h->bin(i).midpoint();
00097         double y;
00098         if (SE) y = getSE(part, x);
00099         else    y = getSeta(part, x);
00100         h->fill(x, y*weight);
00101       }
00102     }
00103 
00104     /// Perform the per-event analysis
00105     void analyze(const Event& event) {
00106       double weight = event.weight();
00107 
00108       // Charged fs
00109       const ChargedFinalState& cfs100 = applyProjection<ChargedFinalState>(event, "CFS100");
00110       const ParticleVector    part100 = cfs100.particlesByEta();
00111       const ChargedFinalState& cfs500 = applyProjection<ChargedFinalState>(event, "CFS500");
00112       const ParticleVector&   part500 = cfs500.particlesByEta();
00113 
00114       // Veto event if the most inclusive phase space has less than 10 particles and the max pT is > 10 GeV
00115       if (part100.size() < 11) vetoEvent;
00116       double ptmax = cfs100.particlesByPt()[0].momentum().pT()/GeV;
00117       if (ptmax > 10.0) vetoEvent;
00118 
00119       // Fill the pt>100, pTmax<10 GeV histos
00120       fillS(_sE_10_100, part100, weight, true);
00121       fillS(_sEta_10_100, part100, weight, false);
00122 
00123       // Fill the pt>100, pTmax<1 GeV histos
00124       if (ptmax < 1.0) {
00125         fillS(_sE_1_100,   part100, weight, true);
00126         fillS(_sEta_1_100, part100, weight, false);
00127       }
00128 
00129       // Fill the pt>500, pTmax<10 GeV histos
00130       if (part500.size() > 10) {
00131         fillS(_sE_10_500, part500, weight, true);
00132         fillS(_sEta_10_500, part500, weight, false);
00133       }
00134     }
00135 
00136     /// Normalise histograms etc., after the run
00137     void finalize() {
00138       // The scaling takes the multiple fills per event into account
00139       // --- not sure about the normalisation
00140       scale(_sE_10_100, 1.0/(sumOfWeights()*_sE_10_100->numBins()));
00141       scale(_sE_1_100 , 1.0/(sumOfWeights()*_sE_1_100 ->numBins()));
00142       scale(_sE_10_500, 1.0/(sumOfWeights()*_sE_10_500->numBins()));
00143 
00144       scale(_sEta_10_100, 1.0/(sumOfWeights()*_sEta_10_100->numBins()));
00145       scale(_sEta_1_100 , 1.0/(sumOfWeights()*_sEta_1_100 ->numBins()));
00146       scale(_sEta_10_500, 1.0/(sumOfWeights()*_sEta_10_500->numBins()));
00147     }
00148 
00149     //@}
00150 
00151   private:
00152 
00153     Histo1DPtr _sE_10_100;
00154     Histo1DPtr _sE_1_100;
00155     Histo1DPtr _sE_10_500;
00156 
00157     Histo1DPtr _sEta_10_100;
00158     Histo1DPtr _sEta_1_100;
00159     Histo1DPtr _sEta_10_500;
00160   };
00161 
00162   // The hook for the plugin system
00163   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1091481);
00164 }