CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/GeneratorInterface/RivetInterface/src/CMS_2011_I930319.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #include "Rivet/Analysis.hh"
00004 #include "Rivet/RivetAIDA.hh"
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 #include "Rivet/Projections/ChargedFinalState.hh"
00008 #include "Rivet/Projections/FastJets.hh"
00009 #include "Rivet/Projections/Beam.hh"
00010 #include "Rivet/Projections/VetoedFinalState.hh"
00011 
00012 namespace Rivet 
00013 {
00014   class CMS_2011_I930319 : public Analysis 
00015   {
00016   
00017   public:
00018     
00019 
00021     CMS_2011_I930319()
00022       : Analysis("CMS_2011_I930319")
00023       
00024       {
00025         setBeams(PROTON,PROTON);
00026       }
00027                 
00028         //counters 
00029         double evcounter_mb;
00030         double evcounter_dijet;
00031  
00032 
00033   void init() {
00034     const FinalState fs(-6.0,6.0,0.0*GeV);             
00035     addProjection(fs, "FS"); 
00036     addProjection(FastJets(fs, FastJets::ANTIKT, 0.5), "Jets"); 
00037     
00038     VetoedFinalState fsv(fs);
00039     fsv.vetoNeutrinos();
00040     fsv.addVetoPairDetail(MUON, 0.0*GeV, 99999.9*GeV);
00041     addProjection(fsv, "fsv");
00042         
00043     // for the MB ND selection
00044     const ChargedFinalState fschrgd(-6.0,6.0,0.0*GeV);             
00045     addProjection(fschrgd, "fschrgd"); 
00046     VetoedFinalState fschrgdv(fschrgd);
00047     fschrgdv.vetoNeutrinos();
00048     addProjection(fschrgdv, "fschrgdv");
00049     
00050     evcounter_mb = 0;
00051     evcounter_dijet = 0;
00052     
00053     if(fuzzyEquals(sqrtS()/GeV, 900, 1E-3)){
00054       _hist_mb_09        = bookHistogram1D(1,1,1); // energy flow in MB, 0.9 TeV
00055       _hist_dijet_09     = bookHistogram1D(2,1,1); // energy flow in dijet events, 0.9 TeV
00056     }
00057 
00058     if(fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)){     
00059       _hist_mb_7         = bookHistogram1D(3,1,1); // energy flow in MB, 7 TeV
00060       _hist_dijet_7      = bookHistogram1D(4,1,1); // energy flow in dijet events, 7 TeV
00061     }
00062 
00063   }
00064 
00065   void analyze(const Event& event) {
00066     const double weight = event.weight();     
00067     
00068     // Skip if the event is empty
00069     const FinalState& fsv = applyProjection<FinalState>(event, "fsv");
00070     if (fsv.empty()) vetoEvent;
00071       
00072     
00073     
00074     // Veto diffraction according to defined hadron level.
00075     double count_chrg_forward = 0;
00076     double count_chrg_backward = 0;
00077     const FinalState& fschrgdv = applyProjection<FinalState>(event, "fschrgdv");
00078 
00079     foreach (const Particle& p, fschrgdv.particles()) {
00080       if( 3.9 < p.momentum().pseudorapidity() && 
00081           p.momentum().pseudorapidity() < 4.4){count_chrg_forward++;}
00082       if(-4.4 < p.momentum().pseudorapidity() && 
00083          p.momentum().pseudorapidity() < -3.9){count_chrg_backward++;}
00084       
00085     }   
00086 
00087     if(count_chrg_forward*count_chrg_backward==0) {
00088       vetoEvent;
00089     }
00090     
00091     const FastJets& jetpro = applyProjection<FastJets>(event, "Jets"); 
00092     const Jets& jets = jetpro.jetsByPt(7.0*GeV);
00093     
00094         
00095     //  ============================== MINIMUM BIAS EVENTS                                      
00096   
00097     //loop over particles to calculate the energy
00098     evcounter_mb += weight;
00099     foreach (const Particle& p, fsv.particles()) {
00100 
00101       if(fuzzyEquals(sqrtS()/GeV, 900, 1E-3)) {_hist_mb_09 -> 
00102           fill(fabs(p.momentum().pseudorapidity()), weight * p.momentum().E()/GeV );}
00103 
00104       if(fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)) {_hist_mb_7 -> 
00105           fill(fabs(p.momentum().pseudorapidity()), weight * p.momentum().E()/GeV );}  
00106 
00107     } 
00108     
00109     
00110     //  ============================== DIJET EVENTS  
00111          
00112     if(jets.size()>1){
00113       
00114       signed int index_1 = -1;  //for the jet with the 1.highest pT
00115       signed int index_2 = -1;  //for the jet with the 2.highest pT
00116       
00117       double tempmax_1 = -100;
00118       double tempmax_2 = -100;
00119       
00120       //jet with the 1.highest pt       
00121       for(signed int ijets = 0; ijets < (int)jets.size(); ijets++){
00122         if(tempmax_1 == -100 || tempmax_1 < jets[ijets].momentum().pT()/GeV)
00123           {     
00124             tempmax_1 = jets[ijets].momentum().pT()/GeV;
00125             index_1 = ijets;
00126           }             
00127       }
00128       
00129           
00130       //jet with the 2. highest pt      
00131       for(signed int ijets = 0; ijets < (int)jets.size(); ijets++){             
00132         if(tempmax_2 == -100 || tempmax_2 < jets[ijets].momentum().pT()/GeV){   
00133           if(jets[ijets].momentum().pT()/GeV < tempmax_1){
00134             tempmax_2 = jets[ijets].momentum().pT()/GeV;
00135             index_2 = ijets;
00136           }
00137         }                               
00138       }
00139       
00140       
00141       if(index_1 != -1 && index_2 != -1){
00142  
00143         double diffphi = jets[index_2].momentum().phi() - jets[index_1].momentum().phi();                                
00144         if(diffphi < -PI){ diffphi += 2.0*PI; }
00145         if(diffphi > PI){ diffphi -= 2.0*PI; }
00146         diffphi = fabs(diffphi);
00147         
00148         
00149         // *******
00150         // 900 GeV 
00151         // *******
00152         
00153         if(fuzzyEquals(sqrtS()/GeV, 900, 1E-3)){        
00154 
00155           //pt cut
00156           if(jets[index_1].momentum().pT()/GeV > 8.0 && jets[index_2].momentum().pT()/GeV >8.0){                                
00157 
00158             //eta cut for the central jets
00159             if(fabs(jets[index_1].momentum().pseudorapidity()) < 2.5 && 
00160                fabs(jets[index_2].momentum().pseudorapidity()) < 2.5){
00161               
00162               //back to back condition of the jets
00163               if(fabs(diffphi-PI) < 1.0){       
00164                 evcounter_dijet += weight;                                              
00165                 
00166                 //  E-flow                                              
00167                 foreach (const Particle& p, fsv.particles()){   
00168                   _hist_dijet_09->
00169                     fill(fabs(p.momentum().pseudorapidity()), weight*p.momentum().E()/GeV);
00170                 
00171                 }//foreach particle        
00172               }//if(dphi)                                       
00173             }// else (eta cut central region)
00174           }//pt cut                     
00175         }// energy 
00176         
00177               
00178                       
00179         // ********     
00180         // 7000 GeV             
00181         // ********
00182        
00183         if(fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)){
00184           
00185           //pt cut
00186           if(jets[index_1].momentum().pT()/GeV > 20.0 && jets[index_2].momentum().pT()/GeV > 20.0){     
00187 
00188             //eta cut for the central jets
00189             if(fabs(jets[index_1].momentum().pseudorapidity()) < 2.5 && 
00190                fabs(jets[index_2].momentum().pseudorapidity()) < 2.5){
00191               
00192               //back to back condition of the jets
00193               if(fabs(diffphi-PI) < 1.0){       
00194                 evcounter_dijet += weight;
00195                 
00196                 //E-flow                                                                                                                                                                                                
00197                 foreach (const Particle& p, fsv.particles()){                                                           
00198                   _hist_dijet_7->
00199                     fill(fabs(p.momentum().pseudorapidity()), weight*p.momentum().E()/GeV);
00200     
00201                 }//foreach particle
00202               }//if(dphi)
00203             }// else (eta cut central region)
00204           }//pt cut
00205         }// energy                      
00206         
00207       }// if index        
00208     }// analysis 
00209   }
00210 
00211     
00212   void finalize() {      
00213       
00214     const double norm_dijet = evcounter_dijet*2.0 ; //AK norm factor 2 for the +/- region
00215     const double norm_mb = evcounter_mb*2.0 ;
00216     
00217     if(fuzzyEquals(sqrtS()/GeV, 900, 1E-3)){
00218         scale(_hist_mb_09, 1.0/norm_mb);
00219         scale(_hist_dijet_09, 1.0/norm_dijet);
00220     }
00221 
00222     if(fuzzyEquals(sqrtS()/GeV, 7000, 1E-3)){
00223       scale(_hist_dijet_7, 1.0/norm_dijet);
00224       scale(_hist_mb_7, 1.0/norm_mb);
00225     }          
00226     
00227     getLog() << Log::INFO << " " << endl;
00228     getLog() << Log::INFO << "Number of MB events:  " << norm_mb << endl;
00229     getLog() << Log::INFO << "Number of di-jet events :  " << norm_dijet  <<endl;
00230     
00231   }
00232     
00233     
00234   private:
00235     
00236     AIDA::IHistogram1D *_hist_mb_09;
00237     AIDA::IHistogram1D *_hist_dijet_09;
00238     AIDA::IHistogram1D *_hist_mb_7;
00239     AIDA::IHistogram1D *_hist_dijet_7;
00240     
00241     
00242   };
00243   
00244   
00245   
00246   // This global object acts as a hook for the plugin system
00247   AnalysisBuilder<CMS_2011_I930319> plugin_CMS_2011_I930319;
00248   
00249   
00250 
00251 }