rivet is hosted by Hepforge, IPPP Durham
ATLAS_2011_CONF_2011_098.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Tools/BinnedHistogram.hh"
00004 #include "Rivet/Projections/FinalState.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/VisibleFinalState.hh"
00007 #include "Rivet/Projections/IdentifiedFinalState.hh"
00008 #include "Rivet/Projections/FastJets.hh"
00009 // #include "Rivet/Tools/RivetMT2.hh"
00010 
00011 namespace Rivet {
00012 
00013   using namespace Cuts;
00014 
00015 
00016   class ATLAS_2011_CONF_2011_098 : public Analysis {
00017   public:
00018 
00019     /// @name Constructors etc.
00020     //@{
00021 
00022     /// Constructor
00023     ATLAS_2011_CONF_2011_098()
00024       : Analysis("ATLAS_2011_CONF_2011_098"),
00025     //debug variables
00026     threeJA(0), threeJB(0), threeJC(0), threeJD(0), bj(0), jets(0), zerolept(0), eTmisscut(0)
00027     {    }
00028 
00029     //@}
00030 
00031 
00032   public:
00033 
00034     /// @name Analysis methods
00035     //@{
00036 
00037     /// Book histograms and initialise projections before the run
00038     void init() {
00039 
00040       // projection to find the electrons
00041       IdentifiedFinalState elecs(etaIn(-2.47, 2.47) 
00042                  & (pT >= 20.0*GeV));
00043       elecs.acceptIdPair(PID::ELECTRON);
00044       addProjection(elecs, "elecs");
00045 
00046 
00047       // projection to find the muons
00048       IdentifiedFinalState muons(etaIn(-2.4, 2.4) 
00049                  & (pT >= 10.0*GeV));
00050       muons.acceptIdPair(PID::MUON);
00051       addProjection(muons, "muons");
00052 
00053       /// Jet finder
00054       addProjection(FastJets(FinalState(), FastJets::ANTIKT, 0.4),
00055                     "AntiKtJets04");
00056 
00057 
00058       // all tracks (to do deltaR with leptons)
00059       addProjection(ChargedFinalState(-3.0,3.0),"cfs");
00060 
00061       // for pTmiss
00062       addProjection(VisibleFinalState(-4.9,4.9),"vfs");
00063 
00064 
00065       /// Book histograms
00066       _count_threeJA     = bookHisto1D("count_threeJA", 1, 0., 1.);
00067       _count_threeJB     = bookHisto1D("count_threeJB", 1, 0., 1.);
00068       _count_threeJC     = bookHisto1D("count_threeJC", 1, 0., 1.);
00069       _count_threeJD     = bookHisto1D("count_threeJD", 1, 0., 1.);
00070       _hist_meff_1bjet   = bookHisto1D("meff_1bjet", 32, 0., 1600.);
00071       _hist_eTmiss_1bjet = bookHisto1D("eTmiss_1bjet", 6, 0., 600.);
00072       _hist_pTj_1bjet    = bookHisto1D("pTjet_1bjet", 20, 0., 800.);
00073       _hist_meff_2bjet   = bookHisto1D("meff_2bjet", 32, 0., 1600.);
00074       _hist_eTmiss_2bjet = bookHisto1D("eTmiss_2bjet", 6, 0., 600.);
00075       _hist_pTj_2bjet    = bookHisto1D("pTjet_2bjet", 20, 0., 800.);
00076 
00077 
00078     }
00079 
00080 
00081     /// Perform the per-event analysis
00082     void analyze(const Event& event) {
00083 
00084       const double weight = event.weight();
00085 
00086       // Temp: calorimeter module failure with 10% acceptance loss;
00087       // region unknown ==> randomly choose 10% of events to be vetoed
00088 
00089       if ( rand()/static_cast<double>(RAND_MAX) < 0.1 )
00090         vetoEvent;
00091 
00092       Jets tmp_cand_jets;
00093       foreach (const Jet& jet,
00094                applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00095         if ( fabs( jet.eta() ) < 2.8 ) {
00096           tmp_cand_jets.push_back(jet);
00097         }
00098       }
00099 
00100       Particles cand_e =
00101         applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt();
00102       Particles cand_mu =
00103         applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt();
00104       Particles chg_tracks =
00105         applyProjection<ChargedFinalState>(event, "cfs").particles();
00106 
00107 //cerr << "cand_e.size(): " << cand_e.size() << "   cand_mu.size(): " << cand_mu.size() << '\n';
00108 
00109 
00110       Jets cand_jets;
00111       foreach ( const Jet& jet, tmp_cand_jets ) {
00112         if ( fabs( jet.eta() ) >= 2.8 )
00113           cand_jets.push_back( jet );
00114         else {
00115           bool away_from_e = true;
00116           foreach ( const Particle & e, cand_e ) {
00117             if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00118               away_from_e = false;
00119               break;
00120             }
00121           }
00122           if ( away_from_e )
00123             cand_jets.push_back( jet );
00124         }
00125       }
00126 
00127       Particles cand_lept;
00128 
00129       bool isolated_e;
00130       foreach ( const Particle & e, cand_e ) {
00131         isolated_e = true;
00132         foreach ( const Jet& jet, cand_jets ) {
00133           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 )
00134             isolated_e = false;
00135         }
00136         if ( isolated_e == true )
00137           cand_lept.push_back( e );
00138       }
00139 
00140 
00141       bool isolated_mu;
00142       foreach ( const Particle & mu, cand_mu ) {
00143     isolated_mu = true;
00144     foreach ( const Jet& jet, cand_jets ) {
00145       if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 )
00146         isolated_mu = false;
00147         }
00148         if ( isolated_mu == true)
00149           cand_lept.push_back( mu );
00150       }
00151 
00152 
00153       // pTmiss
00154       Particles vfs_particles
00155         = applyProjection<VisibleFinalState>(event, "vfs").particles();
00156       FourMomentum pTmiss;
00157       foreach ( const Particle & p, vfs_particles ) {
00158         pTmiss -= p.momentum();
00159       }
00160       double eTmiss = pTmiss.pT();
00161 
00162 
00163       // bjets
00164       Jets bjets,recon_jets;
00165       foreach (const Jet& j, cand_jets) {
00166     if(fabs( j.eta() ) <= 2.8) {
00167       recon_jets.push_back(j);
00168       if ( fabs( j.eta() ) <= 2.5 && j.perp()>50. &&
00169            j.bTagged() && rand()/static_cast<double>(RAND_MAX) < 0.5 )
00170         bjets.push_back(j);
00171     }
00172       }
00173 
00174       if (bjets.empty())  {
00175         MSG_DEBUG("No b-jet axes in acceptance");
00176         vetoEvent;
00177       }
00178 
00179       ++bj;
00180 
00181 
00182 
00183       // Jets event selection
00184       if ( recon_jets.size() < 3 )
00185         vetoEvent;
00186       if ( recon_jets[0].pT() <= 130*GeV )
00187         vetoEvent;
00188       if ( recon_jets[1].pT() <= 50*GeV ||
00189        recon_jets[2].pT() <= 50*GeV )
00190         vetoEvent;
00191       ++jets;
00192 
00193       // eTmiss cut
00194       if ( eTmiss <= 130*GeV )
00195         vetoEvent;
00196 
00197       ++eTmisscut;
00198 
00199       // 0-lepton requirement
00200       if ( !cand_lept.empty() )
00201         vetoEvent;
00202       ++zerolept;
00203 
00204       // m_eff cut
00205       double m_eff = eTmiss
00206         + recon_jets[0].pT()
00207         + recon_jets[1].pT()
00208         + recon_jets[2].pT();
00209 
00210       if ( eTmiss / m_eff <= 0.25 )
00211         vetoEvent;
00212 
00213 
00214       // min_dPhi
00215       double min_dPhi = 999.999;
00216       for ( int i = 0; i < 3; ++i ) {
00217         double dPhi = deltaPhi( pTmiss.phi(), recon_jets[i].phi() );
00218         min_dPhi = min( min_dPhi, dPhi );
00219       }
00220 
00221       if ( min_dPhi <= 0.4 )
00222         vetoEvent;
00223 
00224 
00225 
00226     // ==================== FILL ====================
00227 
00228 
00229       // 1 bjet
00230       if ( bjets.size() >= 1 ) {
00231 
00232         _hist_meff_1bjet->fill(m_eff, weight);
00233         _hist_eTmiss_1bjet->fill(eTmiss, weight);
00234         _hist_pTj_1bjet->fill(recon_jets[0].pT(), weight);
00235 
00236         // 3JA region
00237         if ( m_eff > 200*GeV ) {
00238       ++threeJA;
00239         _count_threeJA->fill(0.5, weight);
00240         }
00241 
00242         // 3JB region
00243         if ( m_eff > 700*GeV ) {
00244       ++threeJB;
00245         _count_threeJB->fill(0.5, weight);
00246         }
00247       }
00248 
00249       // 2 bjets
00250       if ( bjets.size() >= 2 ) {
00251 
00252         _hist_meff_2bjet->fill(m_eff, weight);
00253         _hist_eTmiss_2bjet->fill(eTmiss, weight);
00254         _hist_pTj_2bjet->fill(recon_jets[0].pT(), weight);
00255 
00256         // 3JC region
00257         if ( m_eff > 500*GeV ) {
00258       ++threeJC;
00259           _count_threeJC->fill(0.5, weight);
00260         }
00261 
00262         // 3JD region
00263         if ( m_eff > 700*GeV ) {
00264       ++threeJD;
00265           _count_threeJD->fill(0.5, weight);
00266         }
00267       }
00268 
00269 
00270 
00271 
00272     }
00273 
00274     //@}
00275 
00276 
00277     void finalize() {
00278       scale( _hist_meff_1bjet, 50. * 830. * crossSection()/sumOfWeights() );
00279       scale( _hist_eTmiss_1bjet, 100. * 830. * crossSection()/sumOfWeights() );
00280       scale( _hist_pTj_1bjet, 40. * 830. * crossSection()/sumOfWeights() );
00281       scale( _hist_meff_2bjet, 50. * 830. * crossSection()/sumOfWeights() );
00282       scale( _hist_eTmiss_2bjet, 100. * 830. * crossSection()/sumOfWeights() );
00283       scale( _hist_pTj_2bjet, 40. * 830. * crossSection()/sumOfWeights() );
00284 
00285 // cerr<< '\n'<<'\n'
00286 // << "Saw "
00287 // << bj << " events aft bjets cut, "
00288 // << jets << " events aft jet cuts, "
00289 // << eTmisscut << " events aft eTmiss cut, "
00290 // << zerolept << " events after 0-lept cut. "
00291 // << '\n'
00292 // << threeJA << " 3JA events, "
00293 // << threeJB << " 3JB events, "
00294 // << threeJC << " 3JC events, "
00295 // << threeJD << " 3JD events. "
00296 // << '\n'
00297 // ;
00298 
00299     }
00300 
00301 
00302   private:
00303 
00304     /// @name Histograms
00305     //@{
00306     Histo1DPtr _count_threeJA;
00307     Histo1DPtr _count_threeJB;
00308     Histo1DPtr _count_threeJC;
00309     Histo1DPtr _count_threeJD;
00310     Histo1DPtr _hist_meff_1bjet;
00311     Histo1DPtr _hist_eTmiss_1bjet;
00312     Histo1DPtr _hist_pTj_1bjet;
00313     Histo1DPtr _hist_meff_2bjet;
00314     Histo1DPtr _hist_eTmiss_2bjet;
00315     Histo1DPtr _hist_pTj_2bjet;
00316 
00317     //@}
00318 
00319 
00320 // debug variables
00321 int threeJA;
00322 int threeJB;
00323 int threeJC;
00324 int threeJD;
00325 int bj;
00326 int jets;
00327 int zerolept;
00328 int eTmisscut;
00329 
00330   };
00331 
00332 
00333 
00334   // The hook for the plugin system
00335   DECLARE_RIVET_PLUGIN(ATLAS_2011_CONF_2011_098);
00336 
00337 }