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