CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/GeneratorInterface/RivetInterface/src/CMS_2012_I1184941.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Projections/FinalState.hh"
00006 #include "Rivet/Tools/Logging.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   class CMS_2012_I1184941 : public Analysis {
00012   public:
00013 
00014     CMS_2012_I1184941()
00015       : Analysis("CMS_2012_I1184941")
00016     {   }
00017 
00018   public:
00019 
00020     void init() {
00021 
00022       FinalState fs;                    
00023       addProjection(fs, "FS");
00024 
00025       const FastJets jets(FinalState(-4.4, 4.4, 0.0*GeV), FastJets::ANTIKT, 0.5);
00026       addProjection(jets, "AntiKtJets05");
00027 
00028       _hist_1 = bookHistogram1D(1, 1, 1);
00029 
00030     }
00031 
00032     void analyze(const Event& event) {
00033 
00034       const double weight = event.weight();
00035 
00036       double xiM = 0.;
00037       double xiP = 0.;
00038       const double jetptCut = 20*GeV;
00039 
00040       const Jets jets = applyProjection < FastJets > (event, "AntiKtJets05").jetsByPt();
00041 
00042       MSG_DEBUG("jet size = " << jets.size());
00043 
00044       if (jets.size() < 2) vetoEvent;  //require a dijet system
00045 
00046       MSG_DEBUG("jet1 pt = " << jets[1].momentum().pT());
00047 
00048       if (jets[1].momentum().pT() < jetptCut) vetoEvent; // cut on leading and 2nd leading jet. 
00049 
00050       const FinalState& fsp = applyProjection < FinalState > (event, "FS");
00051 
00052       foreach(const Particle& p, fsp.particlesByEta())
00053       {
00054                 double eta = p.momentum().eta();
00055                 double energy = p.momentum().E();
00056                 double costheta = cos(p.momentum().theta());
00057 
00058                 if ( eta < 4.9 ) {
00059                         xiP += (energy + energy*costheta);
00060                 }
00061                 if ( -4.9 < eta ) {
00062                         xiM += (energy - energy*costheta);
00063                 }
00064       }
00065         
00066       xiP = xiP / (sqrtS()/GeV);
00067       xiM = xiM / (sqrtS()/GeV);
00068 
00069       _hist_1->fill( xiM, weight ); // Fill the histogram both with xiP and xiM, and get the average in the endjob.
00070       _hist_1->fill( xiP, weight );
00071 
00072     }
00073 
00074     void finalize() {
00075 
00076       scale( _hist_1, crossSection()/microbarn/sumOfWeights() / 2.);
00077 
00078     }
00079 
00080   private:
00081 
00082     AIDA::IHistogram1D* _hist_1;
00083 
00084   };
00085 
00086   // The hook for the plugin system
00087   //AK DECLARE_RIVET_PLUGIN(CMS_2012_I1184941);
00088   AnalysisBuilder<CMS_2012_I1184941> plugin_CMS_2012_I1184941;
00089 
00090 }