rivet is hosted by Hepforge, IPPP Durham
H1_1995_S3167097.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Projections/DISFinalState.hh"
00005 #include "Rivet/Projections/CentralEtHCM.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// @brief H1 energy flow in DIS
00011   /// @todo Check this analysis!
00012   /// @author Leif Lonnblad
00013   class H1_1995_S3167097 : public Analysis {
00014   public:
00015 
00016     /// Constructor
00017     H1_1995_S3167097() : Analysis("H1_1995_S3167097")
00018     {
00019     }
00020 
00021 
00022     /// @name Analysis methods
00023     //@{
00024 
00025     void init() {
00026       const DISKinematics& diskin = addProjection(DISKinematics(), "Kinematics");
00027       const DISFinalState& fshcm = addProjection(DISFinalState(diskin, DISFinalState::HCM), "FS");
00028       addProjection(CentralEtHCM(fshcm), "Y1HCM");
00029 
00030       _hEtFlow = vector<Histo1DPtr>(_nbin);
00031       _hEtFlowStat = vector<Histo1DPtr>(_nbin);
00032       _nev = vector<double>(_nbin);
00033       /// @todo Automate this sort of thing so that the analysis code is more readable.
00034       for (size_t i = 0; i < _nbin; ++i) {
00035         string istr(1, char('1' + i));
00036         _hEtFlow[i] = bookHisto1D(istr, _nb, _xmin, _xmax);
00037         _hEtFlowStat[i] = bookHisto1D(istr, _nb, _xmin, _xmax);
00038       }
00039       _hAvEt = bookHisto1D("21tmp", _nbin, 1.0, 10.0);
00040       _hAvX  = bookHisto1D("22tmp", _nbin, 1.0, 10.0);
00041       _hAvQ2 = bookHisto1D("23tmp", _nbin, 1.0, 10.0);
00042       _hN    = bookHisto1D("24", _nbin, 1.0, 10.0);
00043     }
00044 
00045 
00046     /// Calculate the bin number from the DISKinematics projection
00047     int _getbin(const DISKinematics& dk) {
00048       if ( dk.Q2() > 5.0*GeV2 && dk.Q2() <= 10.0*GeV2 ) {
00049         if ( dk.x() > 0.0001 && dk.x() <= 0.0002 )
00050           return 0;
00051         else if ( dk.x() > 0.0002 && dk.x() <= 0.0005 && dk.Q2() > 6.0*GeV2 )
00052           return 1;
00053       }
00054       else if ( dk.Q2() > 10.0*GeV2 && dk.Q2() <= 20.0*GeV2 ){
00055         if ( dk.x() > 0.0002 && dk.x() <= 0.0005 )
00056           return 2;
00057         else if ( dk.x() > 0.0005 && dk.x() <= 0.0008 )
00058           return 3;
00059         else if ( dk.x() > 0.0008 && dk.x() <= 0.0015 )
00060           return 4;
00061         else if ( dk.x() > 0.0015 && dk.x() <= 0.0040 )
00062           return 5;
00063       }
00064       else if ( dk.Q2() > 20.0*GeV2 && dk.Q2() <= 50.0*GeV2 ){
00065         if ( dk.x() > 0.0005 && dk.x() <= 0.0014 )
00066           return 6;
00067         else if ( dk.x() > 0.0014 && dk.x() <= 0.0030 )
00068           return 7;
00069         else if ( dk.x() > 0.0030 && dk.x() <= 0.0100 )
00070           return 8;
00071       }
00072       return -1;
00073     }
00074 
00075 
00076     void analyze(const Event& event) {
00077       const FinalState& fs = applyProjection<FinalState>(event, "FS");
00078       const DISKinematics& dk = applyProjection<DISKinematics>(event, "Kinematics");
00079       const CentralEtHCM y1 = applyProjection<CentralEtHCM>(event, "Y1HCM");
00080 
00081       const int ibin = _getbin(dk);
00082       if (ibin < 0) vetoEvent;
00083       const double weight = event.weight();
00084 
00085       for (size_t i = 0, N = fs.particles().size(); i < N; ++i) {
00086         const double rap = fs.particles()[i].momentum().rapidity();
00087         const double et = fs.particles()[i].momentum().Et();
00088         _hEtFlow[ibin]->fill(rap, weight * et/GeV);
00089         _hEtFlowStat[ibin]->fill(rap, weight * et/GeV);
00090       }
00091 
00092       _nev[ibin] += weight;
00093       _hAvEt->fill(ibin + 1.5, weight * y1.sumEt()/GeV);
00094       _hAvX->fill(ibin + 1.5, weight * dk.x());
00095       _hAvQ2->fill(ibin + 1.5, weight * dk.Q2()/GeV2);
00096       _hN->fill(ibin + 1.5, weight);
00097     }
00098 
00099 
00100     void finalize() {
00101       for (size_t ibin = 0; ibin < _nbin; ++ibin) {
00102         scale( _hEtFlow[ibin], 1.0/(_nev[ibin]*double(_nb)/(_xmax-_xmin)));
00103         scale( _hEtFlowStat[ibin], 1.0/(_nev[ibin]*double(_nb)/(_xmax-_xmin)));
00104       }
00105 
00106       /// @todo Automate this sort of thing so that the analysis code is more readable.
00107       // \todo YODA divide
00108       // Scatter2DPtr h;
00109       // h = histogramFactory().divide("/H1_1995_S3167097/21", *_hAvEt, *_hN);
00110       // h->setTitle(_hAvEt->title());
00111       // histogramFactory().destroy(_hAvEt);
00112 
00113       // h = histogramFactory().divide("/H1_1995_S3167097/22", *_hAvX, *_hN);
00114       // h->setTitle(_hAvX->title());
00115       // histogramFactory().destroy(_hAvX);
00116 
00117       // h = histogramFactory().divide("/H1_1995_S3167097/23", *_hAvQ2, *_hN);
00118       // h->setTitle(_hAvQ2->title());
00119       // histogramFactory().destroy(_hAvQ2);
00120     }
00121 
00122     //@}
00123 
00124 
00125   private:
00126 
00127     /// Some integer constants used.
00128     /// @todo Remove statics!
00129     static const size_t _nb = 24, _nbin = 9;
00130 
00131     /// Some double constants used.
00132     /// @todo Remove statics!
00133     static const double _xmin, _xmax;
00134 
00135     /// Histograms for the \f$ E_T \f$ flows
00136     vector<Histo1DPtr> _hEtFlow, _hEtFlowStat;
00137 
00138     /// Histograms for averages in different kinematical bins.
00139     Histo1DPtr _hAvEt, _hAvX, _hAvQ2, _hN;
00140 
00141     /// Helper vector;
00142     vector<double> _nev;
00143   };
00144 
00145 
00146   // Init statics
00147   const double H1_1995_S3167097::_xmin = -6.0;
00148   const double H1_1995_S3167097::_xmax = 6.0;
00149 
00150 
00151 
00152   // The hook for the plugin system
00153   DECLARE_RIVET_PLUGIN(H1_1995_S3167097);
00154 
00155 }