ATLAS_2011_S9002537.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/RivetYODA.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 = bookHisto1D(1,1,1,"_h_plus"); 00035 _h_minus = bookHisto1D(1,1,1,"_h_minus"); 00036 _h_asym = bookScatter2D(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->numBins(); 00084 for (int i=0; i<Nbins; i++) { 00085 double x = _h_plus->bin(i).midpoint(); 00086 double ex = _h_plus->bin(i).width()/2.; 00087 double num = _h_plus->bin(i).area() - _h_minus->bin(i).area(); 00088 double denom = _h_plus->bin(i).area() + _h_minus->bin(i).area(); 00089 double err = _h_plus->bin(i).areaErr() + _h_minus->bin(i).areaErr(); 00090 00091 double asym, asym_err; 00092 if (num==0 || denom==0) { 00093 asym = 0; 00094 asym_err = 0; 00095 } 00096 else { 00097 asym = num/denom; 00098 asym_err = num/denom*((err/num)+(err/denom)); 00099 } 00100 _h_asym->addPoint(x, asym, ex, asym_err); 00101 } 00102 00103 // todo YODA deleteplot 00104 // histogramFactory().destroy(_h_plus); 00105 // histogramFactory().destroy(_h_minus); 00106 } 00107 00108 00109 private: 00110 00111 Histo1DPtr _h_plus, _h_minus; 00112 Scatter2DPtr _h_asym; 00113 00114 }; 00115 00116 00117 // The hook for the plugin system 00118 DECLARE_RIVET_PLUGIN(ATLAS_2011_S9002537); 00119 00120 } Generated on Fri Dec 21 2012 15:03:38 for The Rivet MC analysis system by ![]() |