CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/GeneratorInterface/RivetInterface/src/CMS_2010_S8656010.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Projections/Beam.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   class CMS_2010_S8656010 : public Analysis {
00011   public:
00012 
00013     CMS_2010_S8656010() : Analysis("CMS_2010_S8656010") {
00014        setBeams(PROTON, PROTON);
00015        setNeedsCrossSection(false);
00016     }
00017 
00018 //AK =====================================================INIT
00019     void init() {
00020       ChargedFinalState cfs(-2.5, 2.5, 0.0*GeV);
00021       addProjection(cfs, "CFS");
00022       addProjection(Beam(), "Beam");
00023 
00024       _Nevt_after_cuts = 0;
00025       
00026       if(fuzzyEquals(sqrtS(), 7000*GeV, 1E-3)){
00027         _h_dNch_dpT[0] = bookHistogram1D(1, 1, 1);
00028         _h_dNch_dpT[1] = bookHistogram1D(1, 1, 2);
00029         _h_dNch_dpT[2] = bookHistogram1D(1, 1, 3);
00030         _h_dNch_dpT[3] = bookHistogram1D(1, 1, 4);
00031 
00032         _h_dNch_dpT[4] = bookHistogram1D(2, 1, 1);
00033         _h_dNch_dpT[5] = bookHistogram1D(2, 1, 2);
00034         _h_dNch_dpT[6] = bookHistogram1D(2, 1, 3);
00035         _h_dNch_dpT[7] = bookHistogram1D(2, 1, 4);
00036 
00037         _h_dNch_dpT[8] = bookHistogram1D(3, 1, 1);
00038         _h_dNch_dpT[9] = bookHistogram1D(3, 1, 2);
00039         _h_dNch_dpT[10] = bookHistogram1D(3, 1, 3);
00040         _h_dNch_dpT[11] = bookHistogram1D(3, 1, 4);
00041 
00042         _h_dNch_dpT_all = bookHistogram1D(4, 1, 1);
00043 
00044         _h_dNch_dEta = bookHistogram1D(5, 1, 1);
00045       }
00046       return;
00047     }
00048 
00049 //AK =====================================================ANALYZE
00050     void analyze(const Event& event) {
00051 
00052       if (!fuzzyEquals(sqrtS(), 7000*GeV, 1E-3) ) {
00053         return;
00054       }
00055 
00056       const double weight = event.weight();
00057 
00058       //charge particles
00059       const ChargedFinalState& charged = applyProjection<ChargedFinalState>(event, "CFS");
00060       
00061       _Nevt_after_cuts += weight;
00062  
00063       foreach (const Particle& p, charged.particles()) {
00064         const double pT = p.momentum().pT();            
00065         const double eta = p.momentum().eta();
00066         
00067         // The data is actually a duplicated folded distribution.  This should mimic it.
00068         _h_dNch_dEta->fill(eta, 0.5*weight);
00069         _h_dNch_dEta->fill(-eta, 0.5*weight);
00070         if (fabs(eta)<2.4 && pT>0.1) {
00071           if (pT<6.0) {
00072             _h_dNch_dpT_all->fill(pT, weight/pT);
00073             if (pT<2.0) {
00074               int ietabin = fabs(eta)/0.2;
00075               _h_dNch_dpT[ietabin]->fill(pT, weight);
00076             }
00077           }
00078         }
00079       }
00080       return;
00081     }
00082     
00083 //AK =====================================================FINALIZE
00084     void finalize() {
00085 
00086       if (!fuzzyEquals(sqrtS(), 7000*GeV, 1E-3) ) {
00087         return;
00088       }
00089 
00090       const double normfac = 1.0/_Nevt_after_cuts; // Normalizing to unit eta is automatic
00091       // The pT distributions in bins of eta must be normalized to unit eta.  This is a factor of 2
00092       // for the |eta| times 0.2 (eta range).
00093       // The pT distributions over all eta are normalized to unit eta (2.0*2.4) and by 1/2*pi*pT. 
00094       // The 1/pT part is taken care of in the filling.  The 1/2pi is taken care of here.
00095       const double normpT = normfac/(2.0*0.2);
00096       const double normpTall = normfac/(2.0*3.141592654*2.0*2.4);
00097 
00098       for (int ietabin=0; ietabin < 12; ietabin++){
00099         scale(_h_dNch_dpT[ietabin], normpT);
00100       }
00101       scale(_h_dNch_dpT_all, normpTall);
00102       scale(_h_dNch_dEta, normfac);
00103       return;
00104     }
00105 
00106 //AK =====================================================DECLARATIONS
00107   private:
00108 
00109     AIDA::IHistogram1D* _h_dNch_dpT[12];
00110     AIDA::IHistogram1D* _h_dNch_dpT_all;
00111 
00112     AIDA::IHistogram1D* _h_dNch_dEta;
00113         
00114     double _Nevt_after_cuts;
00115 
00116    };
00117 
00118 
00119   // This global object acts as a hook for the plugin system
00120   AnalysisBuilder<CMS_2010_S8656010> plugin_CMS_2010_S8656010;
00121 
00122 }
00123