ATLAS_2011_S9002537.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/IdentifiedFinalState.hh"
00006 #include "Rivet/Projections/ChargedFinalState.hh"
00007 #include "Rivet/Projections/MissingMomentum.hh"
00008 #include "Rivet/Projections/FinalState.hh"
00009 
00010 namespace Rivet {
00011 
00012   class ATLAS_2011_S9002537 : public Analysis {
00013 
00014   public:
00015     ATLAS_2011_S9002537(): Analysis("ATLAS_2011_S9002537")
00016     {
00017     }
00018 
00019   public:
00020     void init() {
00021       IdentifiedFinalState Muons(-2.4,2.4,20.*GeV);
00022       Muons.acceptIdPair(MUON);
00023       addProjection(Muons,"muons");
00024 
00025       ChargedFinalState CFS(-2.8,2.8,0.*GeV);
00026       addProjection(CFS,"tracks");
00027 
00028       MissingMomentum missmom(FinalState(-5.,5.,0.*GeV));
00029       addProjection(missmom,"MissingMomentum");
00030 
00031       _h_plus   = bookHistogram1D("_h_plus",  binEdges(1,1,1));
00032       _h_minus  = bookHistogram1D("_h_minus", binEdges(1,1,1));
00033       _h_asym   = bookDataPointSet(1,1,1);
00034     }
00035 
00036     void analyze(const Event& event) {
00037       const IdentifiedFinalState& muons =
00038         applyProjection<IdentifiedFinalState>(event, "muons");
00039 
00040       const ChargedFinalState& tracks =
00041         applyProjection<ChargedFinalState>(event, "tracks");
00042 
00043       if (muons.size()<1) vetoEvent;
00044       ParticleVector selected_muons;
00045       foreach (Particle muon, muons.particles()) {
00046         FourMomentum testmom = muon.momentum();
00047         double ptmu(testmom.pT()), ptsum(-ptmu), ratio(0.);
00048         foreach (Particle track,tracks.particles()) {
00049           FourMomentum trackmom = track.momentum();
00050           if (deltaR(testmom,trackmom)<0.4) {
00051             ptsum += trackmom.pT();
00052             ratio  = ptsum/ptmu;
00053             if (ratio>0.2)
00054               break;
00055           }
00056         }
00057         if (ratio<0.2)
00058           selected_muons.push_back(muon);
00059       }
00060       if (selected_muons.size()<1) vetoEvent;
00061 
00062       const FourMomentum muonmom = selected_muons[0].momentum();
00063       const MissingMomentum& missmom = applyProjection<MissingMomentum>(event, "MissingMomentum");
00064       FourMomentum missvec = -missmom.visibleMomentum();
00065       if (fabs(missvec.Et())<25) vetoEvent;
00066 
00067       double MTW = sqrt(2.*missvec.pT()*muonmom.pT()*(1.-cos(deltaPhi(missvec.phi(),muonmom.phi()))));
00068       if (MTW<40.*GeV) vetoEvent;
00069 
00070       if (selected_muons[0].pdgId()>0)
00071         _h_minus->fill(muonmom.eta(),event.weight());
00072       else
00073         _h_plus->fill(muonmom.eta(),event.weight());
00074     }
00075 
00076 
00077     /// Normalise histograms etc., after the run
00078     void finalize() {
00079       int Nbins = _h_plus->axis().bins();
00080       std::vector<double> asym, asym_err;
00081       for (int i=0; i<Nbins; i++) {
00082         double num   = _h_plus->binHeight(i) - _h_minus->binHeight(i);
00083         double denom = _h_plus->binHeight(i) + _h_minus->binHeight(i);
00084         double err   = _h_plus->binError(i)  + _h_minus->binError(i);
00085 
00086         if (num==0 || denom==0) {
00087           asym.push_back(0.);
00088           asym_err.push_back(0.);
00089         }
00090         else {
00091           asym.push_back(num/denom);
00092           asym_err.push_back(num/denom*((err/num)+(err/denom)));
00093         }
00094       }
00095       _h_asym->setCoordinate(1, asym, asym_err);
00096 
00097       histogramFactory().destroy(_h_plus);
00098       histogramFactory().destroy(_h_minus);
00099     }
00100 
00101   private:
00102     AIDA::IHistogram1D  *_h_plus, *_h_minus;
00103     AIDA::IDataPointSet *_h_asym;
00104 
00105   };
00106 
00107   AnalysisBuilder<ATLAS_2011_S9002537> plugin_ATLAS_2011_S9002537;
00108 }