rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_CONF_2012_001.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_CONF_2012_001 : public Analysis {
00016   public:
00017 
00018     /// @name Constructors etc.
00019     //@{
00020 
00021     /// Constructor
00022     ATLAS_2012_CONF_2012_001()
00023       : Analysis("ATLAS_2012_CONF_2012_001")
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_leptonpT.push_back(bookHisto1D(1,1,1));
00064       _hist_leptonpT.push_back(bookHisto1D(2,1,1));
00065       _hist_leptonpT.push_back(bookHisto1D(3,1,1));
00066       _hist_leptonpT.push_back(bookHisto1D(4,1,1));
00067       _hist_njet   = bookHisto1D(5,1,1);
00068       _hist_etmiss = bookHisto1D(6,1,1);
00069       _hist_mSFOS  = bookHisto1D(7,1,1);
00070       _hist_meff   = bookHisto1D(8,1,1);
00071 
00072       _hist_leptonpT_MC.push_back(bookHisto1D("hist_lepton_pT_1", 26, 0., 260));
00073       _hist_leptonpT_MC.push_back(bookHisto1D("hist_lepton_pT_2", 15, 0., 150));
00074       _hist_leptonpT_MC.push_back(bookHisto1D("hist_lepton_pT_3", 20, 0., 100));
00075       _hist_leptonpT_MC.push_back(bookHisto1D("hist_lepton_pT_4", 20, 0., 100));
00076       _hist_njet_MC   = bookHisto1D("hist_njet", 7, -0.5, 6.5);
00077       _hist_etmiss_MC = bookHisto1D("hist_etmiss",11,0.,220.);
00078       _hist_mSFOS_MC  = bookHisto1D("hist_m_SFOS",13,0.,260.);
00079       _hist_meff_MC   = bookHisto1D("hist_m_eff",19,0.,950.);
00080 
00081       _count_SR1 = bookHisto1D("count_SR1", 1, 0., 1.);
00082       _count_SR2 = bookHisto1D("count_SR2", 1, 0., 1.);
00083     }
00084 
00085 
00086     /// Perform the per-event analysis
00087     void analyze(const Event& event) {
00088       const double weight = event.weight();
00089       // get the jet candidates
00090       Jets cand_jets;
00091       foreach (const Jet& jet,
00092                applyProjection<FastJets>(event, "AntiKtJets04").jetsByPt(20.0*GeV) ) {
00093         if ( fabs( jet.eta() ) < 2.8 ) {
00094           cand_jets.push_back(jet);
00095         }
00096       }
00097 
00098       // candidate muons
00099       Particles cand_mu;
00100       Particles chg_tracks =
00101         applyProjection<ChargedFinalState>(event, "cfs").particles();
00102       foreach ( const Particle & mu,
00103                 applyProjection<IdentifiedFinalState>(event, "muons").particlesByPt() ) {
00104         double pTinCone = -mu.pT();
00105         foreach ( const Particle & track, chg_tracks ) {
00106           if ( deltaR(mu.momentum(),track.momentum()) <= 0.2 )
00107             pTinCone += track.pT();
00108         }
00109         if ( pTinCone < 1.8*GeV )
00110           cand_mu.push_back(mu);
00111       }
00112 
00113       // candidate electrons
00114       Particles cand_e;
00115       foreach ( const Particle & e,
00116                 applyProjection<IdentifiedFinalState>(event, "elecs").particlesByPt() ) {
00117         double eta = e.eta();
00118         // remove electrons with pT<15 in old veto region
00119         if( fabs(eta)>1.37 && fabs(eta) < 1.52 && e.momentum().perp()< 15.*GeV)
00120           continue;
00121         double pTinCone = -e.momentum().perp();
00122         foreach ( const Particle & track, chg_tracks ) {
00123           if ( deltaR(e.momentum(),track.momentum()) <= 0.2 )
00124             pTinCone += track.pT();
00125         }
00126         if (pTinCone/e.momentum().perp()<0.1) {
00127           cand_e.push_back(e);
00128         }
00129       }
00130 
00131       // resolve jet/lepton ambiguity
00132       Jets recon_jets;
00133       foreach ( const Jet& jet, cand_jets ) {
00134         bool away_from_e = true;
00135         foreach ( const Particle & e, cand_e ) {
00136           if ( deltaR(e.momentum(),jet.momentum()) <= 0.2 ) {
00137             away_from_e = false;
00138             break;
00139           }
00140         }
00141         if ( away_from_e )
00142           recon_jets.push_back( jet );
00143       }
00144 
00145       // only keep electrons more than R=0.4 from jets
00146       Particles cand2_e;
00147       for(unsigned int ie=0;ie<cand_e.size();++ie) {
00148         const Particle & e = cand_e[ie];
00149         // at least 0.4 from any jets
00150         bool away = true;
00151         foreach ( const Jet& jet, recon_jets ) {
00152           if ( deltaR(e.momentum(),jet.momentum()) < 0.4 ) {
00153             away = false;
00154             break;
00155           }
00156         }
00157         // and 0.1 from any muons
00158         if ( away ) {
00159           foreach ( const Particle & mu, cand_mu ) {
00160             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00161               away = false;
00162               break;
00163             }
00164           }
00165         }
00166         // and 0.1 from electrons
00167         for(unsigned int ie2=0;ie2<cand_e.size();++ie2) {
00168           if(ie==ie2) continue;
00169           if ( deltaR(e.momentum(),cand_e[ie2].momentum()) < 0.1 ) {
00170             away = false;
00171             break;
00172           }
00173         }
00174         // if isolated keep it
00175         if ( away ) cand2_e.push_back( e );
00176       }
00177       // remove e+e- pairs with mass < 20.
00178       Particles recon_e;
00179       for(unsigned int ie=0;ie<cand2_e.size();++ie) {
00180     bool pass = true;
00181     for(unsigned int ie2=0;ie2<cand2_e.size();++ie2) {
00182       if(cand2_e[ie].pdgId()*cand2_e[ie2].pdgId()>0) continue;
00183       double mtest = (cand2_e[ie].momentum()+cand2_e[ie2].momentum()).mass();
00184       if(mtest<=20.) {
00185         pass = false;
00186         break;
00187       }
00188     }
00189     if(pass) recon_e.push_back(cand2_e[ie]);
00190       }
00191 
00192       // only keep muons more than R=0.4 from jets
00193       Particles cand2_mu;
00194       for(unsigned int imu=0;imu<cand_mu.size();++imu) {
00195         const Particle & mu = cand_mu[imu];
00196         bool away = true;
00197         // at least 0.4 from any jets
00198         foreach ( const Jet& jet, recon_jets ) {
00199           if ( deltaR(mu.momentum(),jet.momentum()) < 0.4 ) {
00200             away = false;
00201             break;
00202           }
00203         }
00204         // and 0.1 from any electrona
00205         if ( away ) {
00206           foreach ( const Particle & e, cand_e ) {
00207             if ( deltaR(mu.momentum(),e.momentum()) < 0.1 ) {
00208               away = false;
00209               break;
00210             }
00211           }
00212         }
00213         // and 0.1 from muons
00214         for(unsigned int imu2=0;imu2<cand_mu.size();++imu2) {
00215           if(imu==imu2) continue;
00216           if ( deltaR(mu.momentum(),cand_mu[imu2].momentum()) < 0.1 ) {
00217             away = false;
00218             break;
00219           }
00220         }
00221         if ( away )
00222           cand2_mu.push_back( mu );
00223       }
00224 
00225       // remove mu+mu- pairs with mass < 20.
00226       Particles recon_mu;
00227       for(unsigned int imu=0;imu<cand2_mu.size();++imu) {
00228     bool pass = true;
00229     for(unsigned int imu2=0;imu2<cand2_mu.size();++imu2) {
00230       if(cand2_mu[imu].pdgId()*cand2_mu[imu2].pdgId()>0) continue;
00231       double mtest = (cand2_mu[imu].momentum()+cand2_mu[imu2].momentum()).mass();
00232       if(mtest<=20.) {
00233         pass = false;
00234         break;
00235       }
00236     }
00237     if(pass) recon_mu.push_back(cand2_mu[imu]);
00238       }
00239 
00240       // pTmiss
00241       Particles vfs_particles =
00242         applyProjection<VisibleFinalState>(event, "vfs").particles();
00243       FourMomentum pTmiss;
00244       foreach ( const Particle & p, vfs_particles ) {
00245         pTmiss -= p.momentum();
00246       }
00247       double eTmiss = pTmiss.pT();
00248 
00249       // now only use recon_jets, recon_mu, recon_e
00250 
00251       // reject events with less than 4 electrons and muons
00252       if ( recon_mu.size() + recon_e.size() < 4 ) {
00253         MSG_DEBUG("To few charged leptons left after selection");
00254         vetoEvent;
00255       }
00256 
00257       // ATLAS calo problem
00258       if(rand()/static_cast<double>(RAND_MAX)<=0.42) {
00259         foreach ( const Particle & e, recon_e ) {
00260           double eta = e.eta();
00261           double phi = e.momentum().azimuthalAngle(MINUSPI_PLUSPI);
00262           if(eta>-0.1&&eta<1.5&&phi>-0.9&&phi<-0.5)
00263             vetoEvent;
00264         }
00265         foreach ( const Jet & jet, recon_jets ) {
00266           double eta = jet.rapidity();
00267           double phi = jet.momentum().azimuthalAngle(MINUSPI_PLUSPI);
00268           if(jet.momentum().perp()>40 && eta>-0.1&&eta<1.5&&phi>-0.9&&phi<-0.5)
00269             vetoEvent;
00270         }
00271       }
00272 
00273       // check at least one e/mu passing trigger
00274       if( !( !recon_e .empty() && recon_e[0] .momentum().perp()>25.)  &&
00275           !( !recon_mu.empty() && recon_mu[0].momentum().perp()>20.) ) {
00276         MSG_DEBUG("Hardest lepton fails trigger");
00277         vetoEvent;
00278       }
00279 
00280       // calculate meff
00281       double meff = eTmiss;
00282       foreach ( const Particle & e , recon_e  )
00283         meff += e.momentum().perp();
00284       foreach ( const Particle & mu, recon_mu )
00285         meff += mu.momentum().perp();
00286       foreach ( const Jet & jet, recon_jets ) {
00287         double pT = jet.momentum().perp();
00288         if(pT>40.) meff += pT;
00289       }
00290 
00291       double mSFOS=1e30, mdiff=1e30;
00292       // mass of SFOS pairs closest to the Z mass
00293       for(unsigned int ix=0;ix<recon_e.size();++ix) {
00294         for(unsigned int iy=ix+1;iy<recon_e.size();++iy) {
00295           if(recon_e[ix].pdgId()*recon_e[iy].pdgId()>0) continue;
00296           double mtest = (recon_e[ix].momentum()+recon_e[iy].momentum()).mass();
00297           if(fabs(mtest-90.)<mdiff) {
00298             mSFOS = mtest;
00299             mdiff = fabs(mtest-90.);
00300           }
00301         }
00302       }
00303       for(unsigned int ix=0;ix<recon_mu.size();++ix) {
00304         for(unsigned int iy=ix+1;iy<recon_mu.size();++iy) {
00305           if(recon_mu[ix].pdgId()*recon_mu[iy].pdgId()>0) continue;
00306           double mtest = (recon_mu[ix].momentum()+recon_mu[iy].momentum()).mass();
00307           if(fabs(mtest-91.118)<mdiff) {
00308             mSFOS = mtest;
00309             mdiff = fabs(mtest-91.118);
00310           }
00311         }
00312       }
00313 
00314       // make the control plots
00315       // lepton pT
00316       unsigned int ie=0,imu=0;
00317       for(unsigned int ix=0;ix<4;++ix) {
00318         double pTe  = ie <recon_e .size() ?
00319           recon_e [ie ].momentum().perp() : -1*GeV;
00320         double pTmu = imu<recon_mu.size() ?
00321           recon_mu[imu].momentum().perp() : -1*GeV;
00322         if(pTe>pTmu) {
00323           _hist_leptonpT   [ix]->fill(pTe ,weight);
00324           _hist_leptonpT_MC[ix]->fill(pTe ,weight);
00325           ++ie;
00326         }
00327         else {
00328           _hist_leptonpT   [ix]->fill(pTmu,weight);
00329           _hist_leptonpT_MC[ix]->fill(pTmu,weight);
00330           ++imu;
00331         }
00332       }
00333       // njet
00334       _hist_njet   ->fill(recon_jets.size(),weight);
00335       _hist_njet_MC->fill(recon_jets.size(),weight);
00336       // etmiss
00337       _hist_etmiss   ->fill(eTmiss,weight);
00338       _hist_etmiss_MC->fill(eTmiss,weight);
00339       if(mSFOS<1e30) {
00340         _hist_mSFOS   ->fill(mSFOS,weight);
00341         _hist_mSFOS_MC->fill(mSFOS,weight);
00342       }
00343       _hist_meff   ->fill(meff,weight);
00344       _hist_meff_MC->fill(meff,weight);
00345 
00346       // finally the counts
00347       if(eTmiss>50.) {
00348         _count_SR1->fill(0.5,weight);
00349         if(mdiff>10.) _count_SR2->fill(0.5,weight);
00350       }
00351     }
00352 
00353     //@}
00354 
00355     void finalize() {
00356       double norm = crossSection()/femtobarn*2.06/sumOfWeights();
00357       // these are number of events at 2.06fb^-1 per 10 GeV
00358       scale(_hist_leptonpT   [0],norm*10.);
00359       scale(_hist_leptonpT   [1],norm*10.);
00360       scale(_hist_leptonpT_MC[0],norm*10.);
00361       scale(_hist_leptonpT_MC[1],norm*10.);
00362       // these are number of events at 2.06fb^-1 per 5 GeV
00363       scale(_hist_leptonpT   [2],norm*5.);
00364       scale(_hist_leptonpT   [3],norm*5.);
00365       scale(_hist_leptonpT_MC[2],norm*5.);
00366       scale(_hist_leptonpT_MC[3],norm*5.);
00367       // these are number of events at 2.06fb^-1 per 20 GeV
00368       scale(_hist_etmiss      ,norm*20.);
00369       scale(_hist_mSFOS       ,norm*20.);
00370       scale(_hist_etmiss_MC   ,norm*20.);
00371       scale(_hist_mSFOS_MC    ,norm*20.);
00372       // these are number of events at 2.06fb^-1 per 50 GeV
00373       scale(_hist_meff        ,norm*50.);
00374       scale(_hist_meff_MC     ,norm*50.);
00375       // these are number of events at 2.06fb^-1
00376       scale(_hist_njet        ,norm);
00377       scale(_hist_njet_MC     ,norm);
00378       scale(_count_SR1,norm);
00379       scale(_count_SR2,norm);
00380     }
00381 
00382   private:
00383 
00384     /// @name Histograms
00385     //@{
00386     vector<Histo1DPtr> _hist_leptonpT,_hist_leptonpT_MC;
00387     Histo1DPtr _hist_njet;
00388     Histo1DPtr _hist_njet_MC;
00389     Histo1DPtr _hist_etmiss;
00390     Histo1DPtr _hist_etmiss_MC;
00391     Histo1DPtr _hist_mSFOS;
00392     Histo1DPtr _hist_mSFOS_MC;
00393     Histo1DPtr _hist_meff;
00394     Histo1DPtr _hist_meff_MC;
00395     Histo1DPtr _count_SR1;
00396     Histo1DPtr _count_SR2;
00397     //@}
00398 
00399   };
00400 
00401   // The hook for the plugin system
00402   DECLARE_RIVET_PLUGIN(ATLAS_2012_CONF_2012_001);
00403 
00404 }