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/Projections/DISFinalState.hh"
00004 #include "Rivet/Projections/CentralEtHCM.hh"
00005 
00006 namespace Rivet {
00007 
00008 
00009   /// H1 energy flow in DIS
00010   ///
00011   /// @todo Make histograms match those in HepData and use autobooking
00012   /// @author Leif Lonnblad
00013   /// @author Andy Buckley
00014   class H1_1995_S3167097 : public Analysis {
00015   public:
00016 
00017     /// Constructor
00018     H1_1995_S3167097()
00019       : Analysis("H1_1995_S3167097")
00020     {    }
00021 
00022 
00023     /// @name Analysis methods
00024     //@{
00025 
00026     void init() {
00027       // Projections
00028       const DISKinematics& diskin = addProjection(DISKinematics(), "Kinematics");
00029       const DISFinalState& fshcm = addProjection(DISFinalState(diskin, DISFinalState::HCM), "FS");
00030       addProjection(CentralEtHCM(fshcm), "Y1HCM");
00031 
00032       // Histograms
00033       /// @todo Convert to use autobooking and correspond to HepData data tables
00034       _sumw.resize(9);
00035       _hEtFlow.resize(9);
00036       for (size_t i = 0; i < 9; ++i)
00037         _hEtFlow[i] = bookHisto1D(lexical_cast<string>(i), 24, -6, 6);
00038       _tmphAvEt = Histo1D(9, 1.0, 10.0);
00039       _tmphAvX  = Histo1D(9, 1.0, 10.0);
00040       _tmphAvQ2 = Histo1D(9, 1.0, 10.0);
00041       _tmphN    = Histo1D(9, 1.0, 10.0);
00042     }
00043 
00044 
00045     /// Calculate the bin number from the DISKinematics projection
00046     size_t _getbin(const DISKinematics& dk) {
00047       if (inRange(dk.Q2()/GeV2, 5.0, 10.0)) {
00048         if (inRange(dk.x(), 1e-4, 2e-4)) return 0;
00049         if (inRange(dk.x(), 2e-4, 5e-4) && dk.Q2() > 6.0*GeV2) return 1;
00050       } else if (inRange(dk.Q2()/GeV2, 10.0, 20.0)) {
00051         if (inRange(dk.x(), 2e-4, 5e-4)) return 2;
00052         if (inRange(dk.x(), 5e-4, 8e-4)) return 3;
00053         if (inRange(dk.x(), 8e-4, 1.5e-3)) return 4;
00054         if (inRange(dk.x(), 1.5e-3, 4e-3)) return 5;
00055       } else if (inRange(dk.Q2()/GeV2, 20.0, 50.0)) {
00056         if (inRange(dk.x(), 5e-4, 1.4e-3)) return 6;
00057         if (inRange(dk.x(), 1.4e-3, 3e-3)) return 7;
00058         if (inRange(dk.x(), 3e-3, 1e-2)) return 8;
00059       }
00060       return -1;
00061     }
00062 
00063 
00064     void analyze(const Event& event) {
00065       const FinalState& fs = applyProjection<FinalState>(event, "FS");
00066       const DISKinematics& dk = applyProjection<DISKinematics>(event, "Kinematics");
00067       const CentralEtHCM y1 = applyProjection<CentralEtHCM>(event, "Y1HCM");
00068 
00069       const int ibin = _getbin(dk);
00070       if (ibin < 0) vetoEvent;
00071       const double weight = event.weight();
00072 
00073       for (size_t i = 0, N = fs.particles().size(); i < N; ++i) {
00074         const double rap = fs.particles()[i].rapidity();
00075         const double et = fs.particles()[i].momentum().Et();
00076         _hEtFlow[ibin]->fill(rap, weight * et/GeV);
00077       }
00078 
00079       _sumw[ibin] += weight;
00080       _tmphAvEt.fill(ibin + 1.5, weight * y1.sumEt()/GeV);
00081       _tmphAvX.fill(ibin + 1.5, weight * dk.x());
00082       _tmphAvQ2.fill(ibin + 1.5, weight * dk.Q2()/GeV2);
00083       _tmphN.fill(ibin + 1.5, weight);
00084     }
00085 
00086 
00087     void finalize() {
00088       for (size_t ibin = 0; ibin < 9; ++ibin)
00089         scale(_hEtFlow[ibin], 0.5/_sumw[ibin]);
00090       /// @todo Improve this!
00091       addAnalysisObject(Scatter2DPtr( new Scatter2D(_tmphAvEt/_tmphN, histoPath("21")) ));
00092       addAnalysisObject(Scatter2DPtr( new Scatter2D(_tmphAvX/_tmphN,  histoPath("22")) ));
00093       addAnalysisObject(Scatter2DPtr( new Scatter2D(_tmphAvQ2/_tmphN, histoPath("23")) ));
00094     }
00095 
00096     //@}
00097 
00098 
00099   private:
00100 
00101     /// Histograms for the \f$ E_T \f$ flow
00102     vector<Histo1DPtr> _hEtFlow;
00103 
00104     /// Temporary histograms for averages in different kinematical bins.
00105     Histo1D _tmphAvEt, _tmphAvX, _tmphAvQ2, _tmphN;
00106 
00107     /// Weights counters for each kinematic bin
00108     vector<double> _sumw;
00109 
00110   };
00111 
00112 
00113   // The hook for the plugin system
00114   DECLARE_RIVET_PLUGIN(H1_1995_S3167097);
00115 
00116 }