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