rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_CONF_2012_153.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   class ATLAS_2012_CONF_2012_153 : public Analysis {
00018   public:
00019 
00020     /// @name Constructors etc.
00021     //@{
00022 
00023     /// Constructor
00024     ATLAS_2012_CONF_2012_153()
00025       : Analysis("ATLAS_2012_CONF_2012_153")
00026     {    }
00027 
00028     //@}
00029 
00030     //@}
00031 
00032 
00033 
00034   public:
00035 
00036     /// @name Analysis methods
00037     //@{
00038 
00039     /// Book histograms and initialise projections before the run
00040     void init() {
00041 
00042       // projection to find the electrons
00043       IdentifiedFinalState elecs(etaIn(-2.47, 2.47) 
00044                  & (pT >= 10.0*GeV));
00045       elecs.acceptIdPair(PID::ELECTRON);
00046       addProjection(elecs, "elecs");
00047 
00048 
00049       // projection to find the muons
00050       IdentifiedFinalState muons(etaIn(-2.4, 2.4) 
00051                  & (pT >= 10.0*GeV));
00052       muons.acceptIdPair(PID::MUON);
00053       addProjection(muons, "muons");
00054 
00055       // for pTmiss
00056       addProjection(VisibleFinalState(-4.9,4.9),"vfs");
00057 
00058       VetoedFinalState vfs;
00059       vfs.addVetoPairId(PID::MUON);
00060 
00061       /// Jet finder
00062       addProjection(FastJets(vfs, FastJets::ANTIKT, 0.4),
00063                     "AntiKtJets04");
00064 
00065       // all tracks (to do deltaR with leptons)
00066       addProjection(ChargedFinalState(-3.0,3.0),"cfs");
00067 
00068       vector<double> edges_meff;
00069       edges_meff.push_back(   0);
00070       edges_meff.push_back( 150);
00071       edges_meff.push_back( 300);
00072       edges_meff.push_back( 500);
00073       edges_meff.push_back(1000);
00074       edges_meff.push_back(1500);
00075 
00076       vector<double> edges_eT;
00077       edges_eT.push_back(0);
00078       edges_eT.push_back(50);
00079       edges_eT.push_back(150);
00080       edges_eT.push_back(300);
00081       edges_eT.push_back(500);
00082 
00083       // Book histograms
00084       _hist_electrons = bookHisto1D("hist_electrons_before", 11, -0.5,10.5);
00085       _hist_muons     = bookHisto1D("hist_muons_before"    , 11, -0.5,10.5);
00086       _hist_leptons   = bookHisto1D("hist_leptons_before"  , 11, -0.5,10.5);
00087       _hist_4leptons  = bookHisto1D("hist_4leptons", 1, 0.,1.);
00088       _hist_veto      = bookHisto1D("hist_veto", 1, 0., 1.);
00089       _hist_etmiss    = bookHisto1D("hist_etmiss",edges_eT);
00090       _hist_meff      = bookHisto1D("hist_m_eff",edges_meff);
00091       _count_SR1      = bookHisto1D("count_SR1", 1, 0., 1.);
00092       _count_SR2      = bookHisto1D("count_SR2", 1, 0., 1.);
00093 
00094     }
00095 
00096 
00097     /// Perform the per-event analysis
00098     void analyze(const Event& event) {
00099       const double weight = event.weight();
00100       // get the jet candidates
00101       Jets cand_jets;
00102       foreach (const Jet& jet,
00103                applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00104         if ( fabs( jet.eta() ) < 2.5 ) {
00105           cand_jets.push_back(jet);
00106         }
00107       }
00108 
00109       // candidate muons
00110       Particles cand_mu = applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt();
00111 
00112       // candidate electrons
00113       // Discard if two electrons are within R=0.1
00114       Particles temp = applyProjection<IdentifiedFinalState>(event, "elecs").particlesByE();
00115       vector<bool> vetoed(temp.size(),false);
00116       Particles cand_e;
00117       for (unsigned int ix=0; ix<temp.size(); ++ix) {
00118         if(vetoed[ix]) continue;
00119         for (unsigned int iy=ix+1; iy<temp.size(); ++iy) {
00120           if( deltaR(temp[ix].momentum(),temp[iy].momentum()) < 0.1 ) {
00121             vetoed[iy] = true;
00122           }
00123         }
00124         if(!vetoed[ix]) cand_e.push_back(temp[ix]);
00125       }
00126 
00127       // Sort by transverse momentum
00128       std::sort(cand_e.begin(), cand_e.end(), cmpMomByPt);
00129 
00130       // resolve jet/lepton ambiguity
00131       Jets recon_jets;
00132       foreach ( const Jet& jet, cand_jets ) {
00133         bool away_from_e = true;
00134         foreach ( const Particle & e, cand_e ) {
00135           if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00136             away_from_e = false;
00137             break;
00138           }
00139         }
00140         if ( away_from_e )
00141           recon_jets.push_back( jet );
00142       }
00143 
00144       // only keep electrons more than R=0.4 from jets
00145       Particles cand2_e;
00146       foreach (const Particle & e, cand_e) {
00147         // at least 0.4 from any jets
00148         bool away = true;
00149         foreach ( const Jet& jet, recon_jets ) {
00150           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 ) {
00151             away = false;
00152             break;
00153           }
00154         }
00155         // if isolated keep it
00156         if ( away )
00157           cand2_e.push_back( e );
00158       }
00159 
00160       // only keep muons more than R=0.4 from jets
00161       Particles cand2_mu;
00162       foreach(const Particle & mu, cand_mu ) {
00163         bool away = true;
00164         // at least 0.4 from any jets
00165         foreach ( const Jet& jet, recon_jets ) {
00166           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00167             away = false;
00168             break;
00169           }
00170         }
00171         if ( away )
00172           cand2_mu.push_back( mu );
00173       }
00174 
00175       // electron and muon more than 0.1 apart
00176       Particles cand3_e;
00177       foreach ( const Particle & e, cand2_e ) {
00178         bool away = true;
00179         foreach( const Particle & mu, cand2_mu ) {
00180           if( deltaR(e.momentum(),mu.momentum()) < 0.1) {
00181             away = false;
00182             break;
00183           }
00184         }
00185         if(away) cand3_e.push_back(e);
00186       }
00187       Particles cand3_mu;
00188       foreach( const Particle & mu, cand2_mu ) {
00189         bool away = true;
00190         foreach ( const Particle & e, cand2_e ) {
00191           if( deltaR(e.momentum(),mu.momentum()) < 0.1) {
00192             away = false;
00193             break;
00194           }
00195         }
00196         if(away) cand3_mu.push_back(mu);
00197       }
00198 
00199       // pTmiss
00200       Particles vfs_particles =
00201         applyProjection<VisibleFinalState>(event, "vfs").particles();
00202       FourMomentum pTmiss;
00203       foreach ( const Particle & p, vfs_particles ) {
00204         pTmiss -= p.momentum();
00205       }
00206       double eTmiss = pTmiss.pT();
00207 
00208       // apply electron isolation
00209       Particles chg_tracks =
00210         applyProjection<ChargedFinalState>(event, "cfs").particles();
00211       Particles cand4_e;
00212       foreach ( const Particle & e, cand3_e ) {
00213         // charge isolation
00214         double pTinCone = -e.perp();
00215         foreach ( const Particle & track, chg_tracks ) {
00216           if(track.perp()>0.4 &&
00217              deltaR(e.momentum(),track.momentum()) <= 0.3 )
00218             pTinCone += track.pT();
00219         }
00220         if (pTinCone/e.perp()>0.16) continue;
00221         // all particles isolation
00222         pTinCone = -e.perp();
00223         foreach ( const Particle & p, vfs_particles ) {
00224           if(p.abspid()!=PID::MUON &&
00225              deltaR(e.momentum(),p.momentum()) <= 0.3 )
00226             pTinCone += p.pT();
00227         }
00228         if (pTinCone/e.perp()<0.18) {
00229           cand4_e.push_back(e);
00230         }
00231       }
00232 
00233       // apply muon isolation
00234       Particles cand4_mu;
00235       foreach ( const Particle & mu, cand3_mu ) {
00236         double pTinCone = -mu.perp();
00237         foreach ( const Particle & track, chg_tracks ) {
00238           if(track.perp()>1.0 &&
00239              deltaR(mu.momentum(),track.momentum()) <= 0.3 )
00240             pTinCone += track.pT();
00241         }
00242         if (pTinCone/mu.perp()<0.12) {
00243           cand4_mu.push_back(mu);
00244         }
00245       }
00246 
00247       // same SOSF pairs m>12.
00248       Particles recon_e;
00249       foreach(const Particle & e, cand4_e) {
00250         bool veto=false;
00251         foreach(const Particle & e2, cand4_e) {
00252           if(e.pid()*e2.pid()<0&&(e.momentum()+e2.momentum()).mass()<12.) {
00253             veto=true;
00254             break;
00255           }
00256         }
00257         if(!veto) recon_e.push_back(e);
00258       }
00259       Particles recon_mu;
00260       foreach(const Particle & mu, cand4_mu) {
00261         bool veto=false;
00262         foreach(const Particle & mu2, cand4_mu) {
00263           if(mu.pid()*mu2.pid()<0&&(mu.momentum()+mu2.momentum()).mass()<12.) {
00264             veto=true;
00265             break;
00266           }
00267         }
00268         if(!veto) recon_mu.push_back(mu);
00269       }
00270 
00271       // now only use recon_jets, recon_mu, recon_e
00272       _hist_electrons->fill(recon_e.size(), weight);
00273       _hist_muons->fill(recon_mu.size(), weight);
00274       _hist_leptons->fill(recon_mu.size() + recon_e.size(), weight);
00275       if( recon_mu.size() + recon_e.size() > 3) {
00276         _hist_4leptons->fill(0.5, weight);
00277       }
00278 
00279       // reject events with less than 4 electrons and muons
00280       if ( recon_mu.size() + recon_e.size() < 4 ) {
00281         MSG_DEBUG("To few charged leptons left after selection");
00282         vetoEvent;
00283       }
00284 
00285 
00286       // or two lepton trigger
00287       bool passDouble =
00288         (recon_mu.size()>=2 && ( (recon_mu[1].perp()>14.) ||
00289                                  (recon_mu[0].perp()>18. && recon_mu[1].perp()>10.) )) ||
00290         (recon_e.size() >=2 && ( (recon_e [1].perp()>14.) ||
00291                                  (recon_e [0].perp()>25. && recon_e [1].perp()>10.) )) ||
00292         (!recon_e.empty() && !recon_mu.empty() &&
00293          ( (recon_e[0].perp()>14. && recon_mu[0].perp()>10.)||
00294            (recon_e[0].perp()>10. && recon_mu[0].perp()>18.) ));
00295 
00296       // must pass a trigger
00297        if(!passDouble ) {
00298          MSG_DEBUG("Hardest lepton fails trigger");
00299          _hist_veto->fill(0.5, weight);
00300          vetoEvent;
00301        }
00302 
00303       // calculate meff
00304       double meff = eTmiss;
00305       foreach ( const Particle & e , recon_e  )
00306         meff += e.perp();
00307       foreach ( const Particle & mu, recon_mu )
00308         meff += mu.perp();
00309       foreach ( const Jet & jet, recon_jets ) {
00310         double pT = jet.perp();
00311         if(pT>40.) meff += pT;
00312       }
00313 
00314       // 2/3 leptons --> find 1 SFOS pair in range and veto event
00315       // 4+  leptons --> find 2 SFOS pairs and in range veto event
00316       for(unsigned int ix=0;ix<recon_e.size();++ix) {
00317         for(unsigned int iy=ix+1;iy<recon_e.size();++iy) {
00318           if(recon_e[ix].pid()*recon_e[iy].pid()>0) continue;
00319           FourMomentum ppair = recon_e[ix].momentum()+recon_e[iy].momentum();
00320           double mtest = ppair.mass();
00321           if(mtest>81.2 && mtest<101.2) vetoEvent;
00322 
00323           // check triplets with electron
00324           for(unsigned int iz=0;iz<recon_e.size();++iz) {
00325             if(iz==ix||iz==iy) continue;
00326             mtest = (ppair+recon_e[iz].momentum()).mass();
00327             if(mtest>81.2 && mtest<101.2) vetoEvent;
00328           }
00329 
00330           // check triplets with muon
00331           for(unsigned int iz=0;iz<recon_mu.size();++iz) {
00332             mtest = (ppair+recon_mu[iz].momentum()).mass();
00333             if(mtest>81.2 && mtest<101.2) vetoEvent;
00334           }
00335 
00336           // check quadruplets with electrons
00337           for(unsigned int iz=0;iz<recon_e.size();++iz) {
00338             for(unsigned int iw=iz+1;iw<recon_e.size();++iw) {
00339               if(iz==ix||iz==iy||iw==ix||iw==iy) continue;
00340               if(recon_e[iz].pid()*recon_e[iw].pid()>0) continue;
00341               mtest = (ppair+recon_e[iz].momentum()+recon_e[iw].momentum()).mass();
00342               if(mtest>81.2 && mtest<101.2) vetoEvent;
00343             }
00344           }
00345           // check quadruplets with muons
00346           for(unsigned int iz=0;iz<recon_mu.size();++iz) {
00347             for(unsigned int iw=iz+1;iw<recon_mu.size();++iw) {
00348               if(recon_mu[iz].pid()*recon_mu[iw].pid()>0) continue;
00349               mtest = (ppair+recon_mu[iz].momentum()+recon_mu[iw].momentum()).mass();
00350               if(mtest>81.2 && mtest<101.2) vetoEvent;
00351             }
00352           }
00353         }
00354       }
00355 
00356       // Muon pairs
00357       for(unsigned int ix=0;ix<recon_mu.size();++ix) {
00358         for(unsigned int iy=ix+1;iy<recon_mu.size();++iy) {
00359           if(recon_mu[ix].pid()*recon_mu[iy].pid()>0) continue;
00360           FourMomentum ppair = recon_mu[ix].momentum()+recon_mu[iy].momentum();
00361           double mtest = ppair.mass();
00362           if(mtest>81.2 && mtest<101.2) vetoEvent;
00363 
00364          // check triplets with muon
00365           for(unsigned int iz=0;iz<recon_mu.size();++iz) {
00366             if(iz==ix||iz==iy) continue;
00367             mtest = (ppair+recon_mu[iz].momentum()).mass();
00368             if(mtest>81.2 && mtest<101.2) vetoEvent;
00369           }
00370 
00371          // check triplets with electron
00372           for(unsigned int iz=0;iz<recon_e.size();++iz) {
00373             mtest = (ppair+recon_e[iz].momentum()).mass();
00374             if(mtest>81.2 && mtest<101.2) vetoEvent;
00375           }
00376 
00377         // check muon quadruplets
00378           for(unsigned int iz=0;iz<recon_mu.size();++iz) {
00379             for(unsigned int iw=iz+1;iy<recon_mu.size();++iy) {
00380               if(iz==ix||iz==iy||iw==ix||iw==iy) continue;
00381               if(recon_mu[iz].pid()*recon_mu[iw].pid()>0) continue;
00382               mtest = (ppair+recon_mu[iz].momentum()+recon_mu[iw].momentum()).mass();
00383               if(mtest>81.2 && mtest<101.2) vetoEvent;
00384             }
00385           }
00386         }
00387       }
00388 
00389       //make the control plots
00390       _hist_etmiss ->fill(eTmiss,weight);
00391       _hist_meff   ->fill(meff  ,weight);
00392       // finally the counts
00393       if(eTmiss>50.) _count_SR1->fill(0.5,weight);
00394       if(meff  >0. ) _count_SR2->fill(0.5,weight);
00395 
00396     }
00397 
00398     //@}
00399 
00400     void finalize() {
00401       double norm = crossSection()/femtobarn*13./sumOfWeights();
00402       scale(_hist_etmiss,norm*20.);
00403       scale(_hist_meff  ,norm*20.);
00404       scale(_count_SR1,norm);
00405       scale(_count_SR2,norm);
00406     }
00407 
00408   private:
00409 
00410     /// @name Histograms
00411     //@{
00412     Histo1DPtr _hist_electrons;
00413     Histo1DPtr _hist_muons;
00414     Histo1DPtr _hist_leptons;
00415     Histo1DPtr _hist_4leptons;
00416     Histo1DPtr _hist_veto;
00417     Histo1DPtr _hist_etmiss;
00418     Histo1DPtr _hist_meff;
00419     Histo1DPtr _count_SR1;
00420     Histo1DPtr _count_SR2;
00421     //@}
00422 
00423   };
00424 
00425   // The hook for the plugin system
00426   DECLARE_RIVET_PLUGIN(ATLAS_2012_CONF_2012_153);
00427 
00428 }