rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1112263.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/VetoedFinalState.hh"
00008 #include "Rivet/Projections/IdentifiedFinalState.hh"
00009 #include "Rivet/Projections/FastJets.hh"
00010 #include "Rivet/Tools/RivetMT2.hh"
00011 
00012 namespace Rivet {
00013 
00014   using namespace Cuts;
00015 
00016 
00017   /// @author Peter Richardson
00018   class ATLAS_2012_I1112263 : public Analysis {
00019   public:
00020 
00021     /// @name Constructors etc.
00022     //@{
00023 
00024     /// Constructor
00025     ATLAS_2012_I1112263()
00026       : Analysis("ATLAS_2012_I1112263")
00027     {    }
00028 
00029     //@}
00030 
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                  & (pT >= 10.0*GeV));
00041       elecs.acceptIdPair(PID::ELECTRON);
00042       addProjection(elecs, "elecs");
00043 
00044       // projection to find the muons
00045       IdentifiedFinalState muons(etaIn(-2.4, 2.4) 
00046                  & (pT >= 10.0*GeV));
00047       muons.acceptIdPair(PID::MUON);
00048       addProjection(muons, "muons");
00049 
00050       // for pTmiss
00051       addProjection(VisibleFinalState(-4.9,4.9),"vfs");
00052 
00053       VetoedFinalState vfs;
00054       vfs.addVetoPairId(PID::MUON);
00055 
00056       /// Jet finder
00057       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4),
00058                     "AntiKtJets04");
00059 
00060       // all tracks (to do deltaR with leptons)
00061       addProjection(ChargedFinalState(-3.0,3.0),"cfs");
00062 
00063       // Book histograms
00064       _hist_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_1_SR1",11,0.,220.));
00065       _hist_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_2_SR1", 7,0.,140.));
00066       _hist_leptonpT_SR1.push_back(bookHisto1D("hist_lepton_pT_3_SR1", 8,0.,160.));
00067       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_1_SR2",11,0.,220.));
00068       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_2_SR2", 7,0.,140.));
00069       _hist_leptonpT_SR2.push_back(bookHisto1D("hist_lepton_pT_3_SR2", 8,0.,160.));
00070       _hist_etmiss_SR1_A = bookHisto1D("hist_etmiss_SR1_A",15,10.,310.);
00071       _hist_etmiss_SR1_B = bookHisto1D("hist_etmiss_SR1_B", 9,10.,190.);
00072       _hist_etmiss_SR2_A = bookHisto1D("hist_etmiss_SR2_A",15,10.,310.);
00073       _hist_etmiss_SR2_B = bookHisto1D("hist_etmiss_SR2_B", 9,10.,190.);
00074       _hist_mSFOS= bookHisto1D("hist_mSFOF",9,0.,180.);
00075 
00076       _count_SR1 = bookHisto1D("count_SR1", 1, 0., 1.);
00077       _count_SR2 = bookHisto1D("count_SR2", 1, 0., 1.);
00078     }
00079 
00080 
00081     /// Perform the per-event analysis
00082     void analyze(const Event& event) {
00083 
00084       // Get the jet candidates
00085       Jets cand_jets;
00086       foreach (const Jet& jet, applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00087         if ( fabs( jet.eta() ) < 2.8 ) {
00088           cand_jets.push_back(jet);
00089         }
00090       }
00091 
00092       // Candidate muons
00093       Particles cand_mu;
00094       Particles chg_tracks =
00095         applyProjection<ChargedFinalState>(event, "cfs").particles();
00096       foreach ( const Particle & mu, applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt() ) {
00097         double pTinCone = -mu.pT();
00098         foreach ( const Particle & track, chg_tracks ) {
00099           if ( deltaR(mu.momentum(),track.momentum()) <= 0.2 )
00100             pTinCone += track.pT();
00101         }
00102         if ( pTinCone < 1.8*GeV )
00103           cand_mu.push_back(mu);
00104       }
00105 
00106       // Candidate electrons
00107       Particles cand_e;
00108       foreach ( const Particle & e, applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt() ) {
00109         double eta = e.eta();
00110         // Remove electrons with pT<15 in old veto region
00111         // (NOT EXPLICIT IN THIS PAPER BUT IN SIMILAR 4 LEPTON PAPER and THIS DESCRPITION
00112         //  IS MUCH WORSE SO ASSUME THIS IS DONE)
00113         if ( fabs(eta)>1.37 && fabs(eta) < 1.52 && e.perp()< 15.*GeV)
00114           continue;
00115         double pTinCone = -e.perp();
00116         foreach ( const Particle & track, chg_tracks ) {
00117           if ( deltaR(e.momentum(),track.momentum()) <= 0.2 )
00118             pTinCone += track.pT();
00119         }
00120         if (pTinCone/e.perp()<0.1) {
00121           cand_e.push_back(e);
00122         }
00123       }
00124 
00125       // Resolve jet/lepton ambiguity
00126       // (NOT EXPLICIT IN THIS PAPER BUT IN SIMILAR 4 LEPTON PAPER and THIS DESCRPITION
00127       //  IS MUCH WORSE SO ASSUME THIS IS DONE)
00128       Jets recon_jets;
00129       foreach ( const Jet& jet, cand_jets ) {
00130         bool away_from_e = true;
00131         foreach ( const Particle & e, cand_e ) {
00132           if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00133             away_from_e = false;
00134             break;
00135           }
00136         }
00137         if ( away_from_e )
00138           recon_jets.push_back( jet );
00139       }
00140 
00141       // Only keep electrons more than R=0.4 from jets
00142       Particles recon_e;
00143       foreach ( const Particle & e, cand_e ) {
00144         bool away = true;
00145         foreach ( const Jet& jet, recon_jets ) {
00146           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 ) {
00147             away = false;
00148             break;
00149           }
00150         }
00151         // ... and 0.1 from any muons
00152         if ( ! away ) {
00153           foreach ( const Particle & mu, cand_e ) {
00154             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00155               away = false;
00156               break;
00157             }
00158           }
00159         }
00160         if ( away )
00161           recon_e.push_back( e );
00162       }
00163       // Only keep muons more than R=0.4 from jets
00164       Particles recon_mu;
00165       foreach ( const Particle & mu, cand_mu ) {
00166         bool away = true;
00167         foreach ( const Jet& jet, recon_jets ) {
00168           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00169             away = false;
00170             break;
00171           }
00172         }
00173         // ... and 0.1 from any electrona
00174         if ( ! away ) {
00175           foreach ( const Particle & e, cand_e ) {
00176             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00177               away = false;
00178               break;
00179             }
00180           }
00181         }
00182         if ( away )
00183           recon_mu.push_back( mu );
00184       }
00185 
00186       // pTmiss
00187       Particles vfs_particles =
00188         applyProjection<VisibleFinalState>(event, "vfs").particles();
00189       FourMomentum pTmiss;
00190       foreach ( const Particle & p, vfs_particles ) {
00191         pTmiss -= p.momentum();
00192       }
00193       double eTmiss = pTmiss.pT();
00194 
00195       // Now only use recon_jets, recon_mu, recon_e
00196 
00197       // Reject events with wrong number of leptons
00198       if ( recon_mu.size() + recon_e.size() != 3 ) {
00199         MSG_DEBUG("To few charged leptons left after selection");
00200         vetoEvent;
00201       }
00202 
00203       // ATLAS calo problem
00204       if (rand()/static_cast<double>(RAND_MAX) <= 0.42) {
00205         foreach ( const Particle & e, recon_e ) {
00206           double eta = e.eta();
00207           double phi = e.azimuthalAngle(MINUSPI_PLUSPI);
00208           if (inRange(eta, -0.1, 1.5) && inRange(phi, -0.9, -0.5)) vetoEvent;
00209         }
00210         foreach ( const Jet & jet, recon_jets ) {
00211           const double eta = jet.rapidity();
00212           const double phi = jet.azimuthalAngle(MINUSPI_PLUSPI);
00213           if (jet.perp() > 40*GeV && inRange(eta, -0.1, 1.5) && inRange(phi, -0.9, -0.5)) vetoEvent;
00214         }
00215       }
00216 
00217       if ( !( !recon_e .empty() && recon_e[0] .perp() > 25*GeV) &&
00218            !( !recon_mu.empty() && recon_mu[0].perp() > 20*GeV) ) {
00219         MSG_DEBUG("Hardest lepton fails trigger");
00220         vetoEvent;
00221       }
00222 
00223       // eTmiss cut
00224       if (eTmiss < 50*GeV) vetoEvent;
00225 
00226       // Check at least 1 SFOS pair
00227       double mSFOS=1e30, mdiff=1e30*GeV;
00228       size_t nSFOS=0;
00229       for (size_t ix = 0; ix < recon_e.size(); ++ix) {
00230         for (size_t iy = ix+1; iy < recon_e.size(); ++iy) {
00231           if (recon_e[ix].pid()*recon_e[iy].pid() > 0) continue;
00232           ++nSFOS;
00233           double mtest = (recon_e[ix].momentum() + recon_e[iy].momentum()).mass();
00234           // Veto is mass<20
00235           if (mtest < 20*GeV) vetoEvent;
00236           if (fabs(mtest - 90*GeV) < mdiff) {
00237             mSFOS = mtest;
00238             mdiff = fabs(mtest - 90*GeV);
00239           }
00240         }
00241       }
00242       for (size_t ix = 0; ix < recon_mu.size(); ++ix) {
00243         for (size_t iy = ix+1; iy < recon_mu.size(); ++iy) {
00244           if (recon_mu[ix].pid()*recon_mu[iy].pid() > 0) continue;
00245           ++nSFOS;
00246           double mtest = (recon_mu[ix].momentum() + recon_mu[iy].momentum()).mass();
00247           // Veto is mass < 20*GeV
00248           if (mtest < 20*GeV) vetoEvent;
00249           if (fabs(mtest - 90*GeV) < mdiff) {
00250             mSFOS = mtest;
00251             mdiff = fabs(mtest - 90*GeV);
00252           }
00253         }
00254       }
00255       // Require at least 1 SFOS pair
00256       if (nSFOS == 0) vetoEvent;
00257       // b-jet veto in SR!
00258       if (mdiff > 10*GeV) {
00259         foreach (const Jet & jet, recon_jets ) {
00260           if (jet.bTagged() && rand()/static_cast<double>(RAND_MAX) <= 0.60) vetoEvent;
00261         }
00262       }
00263 
00264       // Histogram filling
00265       const double weight = event.weight();
00266 
00267       // Region SR1, Z depleted
00268       if (mdiff > 10*GeV) {
00269         _count_SR1->fill(0.5, weight);
00270         _hist_etmiss_SR1_A->fill(eTmiss, weight);
00271         _hist_etmiss_SR1_B->fill(eTmiss, weight);
00272         _hist_mSFOS->fill(mSFOS, weight);
00273       }
00274       // Region SR2, Z enriched
00275       else {
00276         _count_SR2->fill(0.5, weight);
00277         _hist_etmiss_SR2_A->fill(eTmiss, weight);
00278         _hist_etmiss_SR2_B->fill(eTmiss, weight);
00279       }
00280       // Make the control plots
00281       // lepton pT
00282       size_t ie=0, imu=0;
00283       for (size_t ix = 0; ix < 3; ++ix) {
00284         Histo1DPtr hist = (mdiff > 10*GeV) ? _hist_leptonpT_SR1[ix] :  _hist_leptonpT_SR2[ix];
00285         double pTe  = (ie  < recon_e .size()) ? recon_e [ie ].perp() : -1*GeV;
00286         double pTmu = (imu < recon_mu.size()) ? recon_mu[imu].perp() : -1*GeV;
00287         if (pTe > pTmu) {
00288           hist->fill(pTe, weight);
00289           ++ie;
00290         } else {
00291           hist->fill(pTmu, weight);
00292           ++imu;
00293         }
00294       }
00295 
00296     }
00297 
00298 
00299     void finalize() {
00300       const double norm = crossSection()/femtobarn*2.06/sumOfWeights();
00301       // These are number of events at 2.06fb^-1 per 20 GeV
00302       for (size_t ix = 0; ix < 3; ++ix) {
00303         scale(_hist_leptonpT_SR1[ix], norm*20.);
00304         scale(_hist_leptonpT_SR2[ix], norm*20.);
00305       }
00306       scale(_hist_etmiss_SR1_A, norm*20.);
00307       scale(_hist_etmiss_SR1_B, norm*20.);
00308       scale(_hist_etmiss_SR2_A, norm*20.);
00309       scale(_hist_etmiss_SR2_B, norm*20.);
00310       scale(_hist_mSFOS, norm*20.);
00311       // These are number of events at 2.06fb^-1
00312       scale(_count_SR1, norm);
00313       scale(_count_SR2, norm);
00314     }
00315 
00316     //@}
00317 
00318 
00319   private:
00320 
00321   /// @name Histograms
00322   //@{
00323   vector<Histo1DPtr> _hist_leptonpT_SR1, _hist_leptonpT_SR2;
00324   Histo1DPtr _hist_etmiss_SR1_A, _hist_etmiss_SR1_B, _hist_etmiss_SR2_A, _hist_etmiss_SR2_B;
00325   Histo1DPtr _hist_mSFOS, _count_SR1, _count_SR2;
00326   //@}
00327 
00328   };
00329 
00330   // The hook for the plugin system
00331   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1112263);
00332 
00333 }