rivet is hosted by Hepforge, IPPP Durham
ATLAS_2011_S9002537.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/IdentifiedFinalState.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Projections/MissingMomentum.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   class ATLAS_2011_S9002537 : public Analysis {
00012   public:
00013 
00014     ATLAS_2011_S9002537()
00015       : Analysis("ATLAS_2011_S9002537")
00016     {  }
00017 
00018 
00019     void init() {
00020       IdentifiedFinalState Muons(-2.4, 2.4, 20*GeV);
00021       Muons.acceptIdPair(PID::MUON);
00022       addProjection(Muons, "muons");
00023 
00024       ChargedFinalState CFS(-2.8, 2.8, 0*GeV);
00025       addProjection(CFS, "tracks");
00026 
00027       MissingMomentum missmom(FinalState(-5,5, 0*GeV));
00028       addProjection(missmom, "MissingMomentum");
00029 
00030       /// @todo Will need to register TMP histograms for future histogramming
00031       _tmp_h_plus  = Histo1D(refData(1,1,1));
00032       _tmp_h_minus = Histo1D(refData(1,1,1));
00033       _h_asym = bookScatter2D(1, 1, 1);
00034     }
00035 
00036 
00037     void analyze(const Event& event) {
00038 
00039       const IdentifiedFinalState& muons = applyProjection<IdentifiedFinalState>(event, "muons");
00040       if (muons.size() < 1) vetoEvent;
00041       const ChargedFinalState& tracks = applyProjection<ChargedFinalState>(event, "tracks");
00042 
00043       Particles selected_muons;
00044       foreach (Particle muon, muons.particles()) {
00045         FourMomentum testmom = muon.momentum();
00046         double ptmu(testmom.pT()), ptsum(-ptmu), ratio(0.);
00047         foreach (Particle track, tracks.particles()) {
00048           const FourMomentum& trackmom = track.momentum();
00049           if (deltaR(testmom, trackmom) < 0.4) {
00050             ptsum += trackmom.pT();
00051             ratio  = ptsum/ptmu;
00052             if (ratio > 0.2) break;
00053           }
00054         }
00055         if (ratio < 0.2) selected_muons.push_back(muon);
00056       }
00057       if (selected_muons.size() < 1) vetoEvent;
00058 
00059       const FourMomentum muonmom = selected_muons[0].momentum();
00060       const MissingMomentum& missmom = applyProjection<MissingMomentum>(event, "MissingMomentum");
00061       FourMomentum missvec = -missmom.visibleMomentum();
00062       if (fabs(missvec.Et()) < 25*GeV) vetoEvent;
00063 
00064       double MTW = sqrt( 2 * missvec.pT() * muonmom.pT() * (1 - cos( deltaPhi(missvec.phi(), muonmom.phi()) )) );
00065       if (MTW < 40*GeV) vetoEvent;
00066 
00067       Histo1D& htmp = (selected_muons[0].pdgId() > 0) ? _tmp_h_minus : _tmp_h_plus;
00068       htmp.fill(muonmom.eta(), event.weight());
00069     }
00070 
00071 
00072     /// Normalise histograms etc., after the run
00073     void finalize() {
00074       assert(_tmp_h_plus.numBins() == _tmp_h_minus.numBins());
00075       for (size_t i = 0; i < _tmp_h_plus.numBins(); ++i) {
00076         const double num   = _tmp_h_plus.bin(i).sumW() - _tmp_h_minus.bin(i).sumW();
00077         const double denom = _tmp_h_plus.bin(i).sumW() + _tmp_h_minus.bin(i).sumW();
00078         const double relerr = _tmp_h_plus.bin(i).relErr()  + _tmp_h_minus.bin(i).relErr();
00079         const double asym = (num != 0 && denom != 0) ? num / denom : 0;
00080         const double asym_err = (num != 0 && denom != 0) ? asym*relerr : 0;
00081         _h_asym->addPoint(_tmp_h_plus.bin(i).midpoint(), asym, _tmp_h_plus.bin(i).width()/2.0, asym_err);
00082       }
00083     }
00084 
00085 
00086   private:
00087 
00088     Scatter2DPtr _h_asym;
00089     /// @todo Will need to register TMP histograms for future histogramming
00090     Histo1D  _tmp_h_plus, _tmp_h_minus;
00091 
00092   };
00093 
00094 
00095   // The hook for the plugin system
00096   DECLARE_RIVET_PLUGIN(ATLAS_2011_S9002537);
00097 
00098 }