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