rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1190891.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   /// @author Peter Richardson
00015   class ATLAS_2012_I1190891 : public Analysis {
00016   public:
00017 
00018     /// @name Constructors etc.
00019     //@{
00020 
00021     /// Constructor
00022     ATLAS_2012_I1190891()
00023       : Analysis("ATLAS_2012_I1190891")
00024     {    }
00025 
00026     //@}
00027 
00028 
00029   public:
00030 
00031     /// @name Analysis methods
00032     //@{
00033 
00034     /// Book histograms and initialise projections before the run
00035     void init() {
00036 
00037       // projection to find the electrons
00038       IdentifiedFinalState elecs(EtaIn(-2.47, 2.47) 
00039                  & (Cuts::pT >= 10.0*GeV));
00040       elecs.acceptIdPair(PID::ELECTRON);
00041       addProjection(elecs, "elecs");
00042 
00043       // projection to find the muons
00044       IdentifiedFinalState muons(EtaIn(-2.4, 2.4) 
00045                  & (Cuts::pT >= 10.0*GeV));
00046       muons.acceptIdPair(PID::MUON);
00047       addProjection(muons, "muons");
00048 
00049       // for pTmiss
00050       addProjection(VisibleFinalState(-4.9,4.9),"vfs");
00051 
00052       VetoedFinalState vfs;
00053       vfs.addVetoPairId(PID::MUON);
00054 
00055       /// Jet finder
00056       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4),
00057                     "AntiKtJets04");
00058 
00059       // all tracks (to do deltaR with leptons)
00060       addProjection(ChargedFinalState(-3.0,3.0),"cfs");
00061 
00062       // Book histograms
00063       _hist_etmiss = bookHisto1D("hist_etmiss",10,0.,500.);
00064       _hist_meff   = bookHisto1D("hist_m_eff",7,0.,1050.);
00065       _count_SR1 = bookHisto1D("count_SR1", 1, 0., 1.);
00066       _count_SR2 = bookHisto1D("count_SR2", 1, 0., 1.);
00067     }
00068 
00069 
00070     /// Perform the per-event analysis
00071     void analyze(const Event& event) {
00072       const double weight = event.weight();
00073       // get the jet candidates
00074       Jets cand_jets;
00075       foreach (const Jet& jet,
00076                applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00077         if ( fabs( jet.eta() ) < 2.5 ) {
00078           cand_jets.push_back(jet);
00079         }
00080       }
00081 
00082       // candidate muons
00083       Particles cand_mu;
00084       Particles chg_tracks =
00085         applyProjection<ChargedFinalState>(event, "cfs").particles();
00086       foreach ( const Particle & mu,
00087                 applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt() ) {
00088         double pTinCone = -mu.pT();
00089         foreach ( const Particle & track, chg_tracks ) {
00090           if ( deltaR(mu.momentum(),track.momentum()) <= 0.2 )
00091             pTinCone += track.pT();
00092         }
00093         if ( pTinCone < 1.8*GeV )
00094           cand_mu.push_back(mu);
00095       }
00096 
00097       // candidate electrons
00098       Particles cand_e;
00099       foreach ( const Particle & e,
00100                 applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt() ) {
00101         double pTinCone = -e.momentum().perp();
00102         foreach ( const Particle & track, chg_tracks ) {
00103           if ( deltaR(e.momentum(),track.momentum()) <= 0.2 )
00104             pTinCone += track.pT();
00105         }
00106         if (pTinCone/e.momentum().perp()<0.1) {
00107           cand_e.push_back(e);
00108         }
00109       }
00110 
00111       // resolve jet/lepton ambiguity
00112       Jets recon_jets;
00113       foreach ( const Jet& jet, cand_jets ) {
00114         bool away_from_e = true;
00115         foreach ( const Particle & e, cand_e ) {
00116           if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00117             away_from_e = false;
00118             break;
00119           }
00120         }
00121         if ( away_from_e )
00122           recon_jets.push_back( jet );
00123       }
00124 
00125       // only keep electrons more than R=0.4 from jets
00126       Particles cand2_e;
00127       for(unsigned int ie=0;ie<cand_e.size();++ie) {
00128         const Particle & e = cand_e[ie];
00129         // at least 0.4 from any jets
00130         bool away = true;
00131         foreach ( const Jet& jet, recon_jets ) {
00132           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 ) {
00133             away = false;
00134             break;
00135           }
00136         }
00137         // and 0.1 from any muons
00138         if ( away ) {
00139           foreach ( const Particle & mu, cand_mu ) {
00140             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00141               away = false;
00142               break;
00143             }
00144           }
00145         }
00146         // and 0.1 from electrons ( keep higher energy)
00147         for(unsigned int ie2=0;ie2<cand_e.size();++ie2) {
00148           if(ie==ie2) continue;
00149           if ( deltaR(e.momentum(),cand_e[ie2].momentum()) < 0.1 &&
00150                e.momentum().E() < cand_e[ie2].momentum().E() ) {
00151             away = false;
00152             break;
00153           }
00154         }
00155         // if isolated keep it
00156         if ( away )
00157           cand2_e.push_back( e );
00158       }
00159 
00160       // remove e+e- pairs with mass < 20.
00161       Particles recon_e;
00162       for(unsigned int ie=0;ie<cand2_e.size();++ie) {
00163         bool pass = true;
00164         for(unsigned int ie2=0;ie2<cand2_e.size();++ie2) {
00165           if(cand2_e[ie].pdgId()*cand2_e[ie2].pdgId()>0) continue;
00166           double mtest = (cand2_e[ie].momentum()+cand2_e[ie2].momentum()).mass();
00167           if(mtest<=20.) {
00168             pass = false;
00169             break;
00170           }
00171         }
00172         if(pass) recon_e.push_back(cand2_e[ie]);
00173       }
00174 
00175       // only keep muons more than R=0.4 from jets
00176       Particles cand2_mu;
00177       for(unsigned int imu=0;imu<cand_mu.size();++imu) {
00178         const Particle & mu = cand_mu[imu];
00179         bool away = true;
00180         // at least 0.4 from any jets
00181         foreach ( const Jet& jet, recon_jets ) {
00182           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00183             away = false;
00184             break;
00185           }
00186         }
00187         // and 0.1 from any electrona
00188         if ( away ) {
00189           foreach ( const Particle & e, cand_e ) {
00190             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00191               away = false;
00192               break;
00193             }
00194           }
00195         }
00196         if ( away )
00197           cand2_mu.push_back( mu );
00198       }
00199 
00200       // remove mu+mu- pairs with mass < 20.
00201       Particles recon_mu;
00202       for(unsigned int imu=0;imu<cand2_mu.size();++imu) {
00203         bool pass = true;
00204         for(unsigned int imu2=0;imu2<cand2_mu.size();++imu2) {
00205           if(cand2_mu[imu].pdgId()*cand2_mu[imu2].pdgId()>0) continue;
00206           double mtest = (cand2_mu[imu].momentum()+cand2_mu[imu2].momentum()).mass();
00207           if(mtest<=20.) {
00208             pass = false;
00209             break;
00210           }
00211         }
00212         if(pass) recon_mu.push_back(cand2_mu[imu]);
00213       }
00214 
00215       // pTmiss
00216       Particles vfs_particles =
00217         applyProjection<VisibleFinalState>(event, "vfs").particles();
00218       FourMomentum pTmiss;
00219       foreach ( const Particle & p, vfs_particles ) {
00220         pTmiss -= p.momentum();
00221       }
00222       double eTmiss = pTmiss.pT();
00223 
00224       // now only use recon_jets, recon_mu, recon_e
00225 
00226       // reject events with less than 4 electrons and muons
00227       if ( recon_mu.size() + recon_e.size() < 4 ) {
00228         MSG_DEBUG("To few charged leptons left after selection");
00229         vetoEvent;
00230       }
00231 
00232       // check if passes single lepton trigger
00233       bool passSingle =
00234         ( !recon_e .empty() && recon_e[0] .momentum().perp()>25. )||
00235         ( !recon_mu.empty() && recon_mu[0].momentum().perp()>20.);
00236 
00237       // or two lepton trigger
00238       bool passDouble =
00239         ( recon_mu.size()>=2 && recon_mu[1].momentum().perp()>12.) ||
00240         ( recon_e .size()>=2 && recon_e [1].momentum().perp()>17.) ||
00241         ( !recon_e.empty() && !recon_mu.empty() &&
00242           recon_e[0].momentum().perp()>15. &&  recon_mu[0].momentum().perp()>10.);
00243 
00244       // must pass a trigger
00245       if( !passSingle && !passDouble ) {
00246         MSG_DEBUG("Hardest lepton fails trigger");
00247         vetoEvent;
00248       }
00249 
00250       // calculate meff
00251       double meff = eTmiss;
00252       foreach ( const Particle & e , recon_e  )
00253         meff += e.momentum().perp();
00254       foreach ( const Particle & mu, recon_mu )
00255         meff += mu.momentum().perp();
00256       foreach ( const Jet & jet, recon_jets ) {
00257         double pT = jet.momentum().perp();
00258         if(pT>40.) meff += pT;
00259       }
00260 
00261       // mass of SFOS pairs closest to the Z mass
00262       for(unsigned int ix=0;ix<recon_e.size();++ix) {
00263         for(unsigned int iy=ix+1;iy<recon_e.size();++iy) {
00264           if(recon_e[ix].pdgId()*recon_e[iy].pdgId()>0) continue;
00265           double mtest = (recon_e[ix].momentum()+recon_e[iy].momentum()).mass();
00266           if(mtest>81.2 && mtest<101.2) vetoEvent;
00267         }
00268       }
00269       for(unsigned int ix=0;ix<recon_mu.size();++ix) {
00270         for(unsigned int iy=ix+1;iy<recon_mu.size();++iy) {
00271           if(recon_mu[ix].pdgId()*recon_mu[iy].pdgId()>0) continue;
00272           double mtest = (recon_mu[ix].momentum()+recon_mu[iy].momentum()).mass();
00273           if(mtest>81.2 && mtest<101.2) vetoEvent;
00274         }
00275       }
00276 
00277       // make the control plots
00278       _hist_etmiss ->fill(eTmiss,weight);
00279       _hist_meff   ->fill(meff  ,weight);
00280       // finally the counts
00281       if(eTmiss>50.) _count_SR1->fill(0.5,weight);
00282       if(meff >300.) _count_SR2->fill(0.5,weight);
00283     }
00284 
00285     //@}
00286 
00287     void finalize() {
00288       double norm = crossSection()/femtobarn*4.7/sumOfWeights();
00289       scale(_hist_etmiss,norm* 50.);
00290       scale(_hist_meff  ,norm*150.);
00291       scale(_count_SR1,norm);
00292       scale(_count_SR2,norm);
00293     }
00294 
00295   private:
00296 
00297     /// @name Histograms
00298     //@{
00299     Histo1DPtr _hist_etmiss;
00300     Histo1DPtr _hist_meff;
00301     Histo1DPtr _count_SR1;
00302     Histo1DPtr _count_SR2;
00303     //@}
00304 
00305   };
00306 
00307   // The hook for the plugin system
00308   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1190891);
00309 
00310 }