CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/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.1*GeV);
00021       addProjection(cfs, "CFS");
00022       addProjection(Beam(), "Beam");
00023  
00024       FinalState hfs(-5.5, 5.5, 0.1*GeV);
00025       addProjection(hfs, "HFS");
00026 
00027       _Nevt_after_cuts = 0;
00028         
00029       //eta bins
00030       _netabins=12;
00031       for (int ietabin=0; ietabin <= _netabins; ietabin++){     
00032         _etabins[ietabin]=0.2*ietabin;
00033       }
00034       
00035       
00036         //AK 7 TeV - pt spectra in eta bins
00037         _h_dNch_dpT_7[0] = bookHistogram1D(1, 1, 1);
00038         _h_dNch_dpT_7[1] = bookHistogram1D(1, 1, 2);
00039         _h_dNch_dpT_7[2] = bookHistogram1D(1, 1, 3);
00040         _h_dNch_dpT_7[3] = bookHistogram1D(1, 1, 4);
00041         
00042         _h_dNch_dpT_7[4] = bookHistogram1D(2, 1, 1);
00043         _h_dNch_dpT_7[5] = bookHistogram1D(2, 1, 2);
00044         _h_dNch_dpT_7[6] = bookHistogram1D(2, 1, 3);
00045         _h_dNch_dpT_7[7] = bookHistogram1D(2, 1, 4);
00046         
00047         _h_dNch_dpT_7[8] = bookHistogram1D(3, 1, 1);
00048         _h_dNch_dpT_7[9] = bookHistogram1D(3, 1, 2);
00049         _h_dNch_dpT_7[10] = bookHistogram1D(3, 1, 3);
00050         _h_dNch_dpT_7[11] = bookHistogram1D(3, 1, 4);
00051         
00052         _h_dNch_dEta_7 = bookHistogram1D(5, 1, 1);
00053         
00054     }
00055 
00056 //AK =====================================================ANALYZE
00057     void analyze(const Event& event) {
00058       const double weight = event.weight();
00059 
00060 // This "trigger" is commented out for now - a HF tower is not defined on particle level
00061 // better: turn off Single Diffraction in the MC
00062 //AK       const FinalState& hadronic = applyProjection<FinalState>(event, "HFS");
00063 //AK       double HFEsumplus = 0.0;
00064 //AK       double HFEsumminus = 0.0;
00065 //AK       foreach (const Particle& p, hadronic.particles()) {
00066 //AK         double Ehad = p.momentum().E();            
00067 //AK         double etahad = p.momentum().eta();
00068 //AK       
00069 //AK         if(etahad < 5.2  && etahad > 3.15 )
00070 //AK            HFEsumplus = HFEsumplus + Ehad;
00071 //AK         
00072 //AK         if(etahad > -5.2  && etahad < -3.15 )
00073 //AK            HFEsumminus = HFEsumminus + Ehad;
00074 //AK         
00075 //AK        }
00076 //AK    if (!(HFEsumplus > 3.0 && HFEsumminus > 3.0)) vetoEvent;
00077 
00078       //charge particles
00079       const ChargedFinalState& charged = applyProjection<ChargedFinalState>(event, "CFS");
00080       if (charged.particles().size()<1) {
00081         vetoEvent;
00082          
00083       } 
00084       
00085       
00086       _Nevt_after_cuts += weight;
00087  
00088       foreach (const Particle& p, charged.particles()) {
00089         double pT = p.momentum().pT();          
00090         double eta = p.momentum().eta();
00091         
00092          if(fuzzyEquals(sqrtS(), 7000, 1E-3)){
00093            _h_dNch_dEta_7->fill(eta, weight);           
00094            for (int ietabin=0; ietabin <= (_netabins-1); ietabin++){    
00095               if (fabs(eta) < _etabins[ietabin+1] && fabs(eta) > _etabins[ietabin]){
00096               _h_dNch_dpT_7[ietabin]->fill(pT, weight);   
00097               }
00098             }
00099          }
00100          
00101       }
00102     }
00103     
00104 //AK =====================================================FINALIZE
00105     void finalize() {
00106         double normfac=1.0/_Nevt_after_cuts;  
00107         getLog() << Log::INFO << "Number of events after event selection: " << _Nevt_after_cuts << endl;        
00108 
00109         if(fuzzyEquals(sqrtS(), 7000, 1E-3)){
00110            for (int ietabin=0; ietabin < _netabins; ietabin++){
00111             scale(_h_dNch_dpT_7[ietabin], normfac/(0.2*2.0)); //AK normalize to events and rapidity-bin
00112            }
00113            scale(_h_dNch_dEta_7, normfac);
00114         }
00115         
00116     }
00117 
00118 
00119 //AK =====================================================DECLARATIONS
00120   private:
00121 
00122 
00123     AIDA::IHistogram1D* _h_dNch_dpT_7[12];
00124     AIDA::IHistogram1D* _h_dNch_dEta_7;
00125         
00126     int _netabins;
00127     double _Nevt_after_cuts;
00128     double _etabins[13];
00129 
00130 
00131    };
00132 
00133 
00134   // This global object acts as a hook for the plugin system
00135   AnalysisBuilder<CMS_2010_S8656010> plugin_CMS_2010_S8656010;
00136 
00137 }
00138