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