ATLAS_2011_S9120807.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include <iostream>
00003 #include <sstream>
00004 #include <string>
00005 
00006 #include "Rivet/Analysis.hh"
00007 #include "Rivet/RivetAIDA.hh"
00008 #include "Rivet/Tools/Logging.hh"
00009 #include "Rivet/Projections/FinalState.hh"
00010 
00011 #include "Rivet/Projections/IdentifiedFinalState.hh"
00012 #include "Rivet/Jet.hh"
00013 #include "Rivet/Projections/FastJets.hh"
00014 
00015 #include "fastjet/internal/base.hh"
00016 #include "fastjet/JetDefinition.hh"
00017 #include "fastjet/AreaDefinition.hh"
00018 #include "fastjet/ClusterSequence.hh"
00019 #include "fastjet/ClusterSequenceArea.hh"
00020 #include "fastjet/PseudoJet.hh"
00021 
00022 
00023 namespace Rivet {
00024 
00025   /// @brief Measurement of isolated diphoton + X differential cross-sections
00026   ///
00027   /// Inclusive isolated gamma gamma cross-sections, differential in M(gg), pT(gg),
00028   /// dphi(gg)
00029   ///
00030   /// @author Giovanni Marchiori
00031 
00032   class ATLAS_2011_S9120807 : public Analysis {
00033   public:
00034 
00035     /// Constructor
00036     ATLAS_2011_S9120807()
00037       : Analysis("ATLAS_2011_S9120807")
00038     {
00039       setBeams(PROTON, PROTON);
00040       setNeedsCrossSection(true);
00041 
00042       _eta_bins_areaoffset.push_back(0.0);
00043       _eta_bins_areaoffset.push_back(1.5);
00044       _eta_bins_areaoffset.push_back(3.0);
00045     }
00046 
00047   public:
00048 
00049     /// Book histograms and initialise projections before the run
00050     void init() {
00051       FinalState fs;
00052       addProjection(fs, "FS");
00053 
00054       FastJets fj(fs, FastJets::KT, 0.5);
00055       _area_def = new fastjet::AreaDefinition(fastjet::VoronoiAreaSpec());
00056       fj.useJetArea(_area_def);
00057       addProjection(fj, "KtJetsD05");
00058 
00059       IdentifiedFinalState photonfs(-2.37, 2.37, 16.0*GeV);
00060       photonfs.acceptId(PHOTON);
00061       addProjection(photonfs, "Photon");
00062 
00063       _h_M    = bookHistogram1D(1, 1, 1);
00064       _h_pT   = bookHistogram1D(2, 1, 1);
00065       _h_dPhi = bookHistogram1D(3, 1, 1);
00066     }
00067 
00068 
00069     int getEtaBin(double eta_w) const {
00070       double eta = fabs(eta_w);
00071 
00072       int v_iter=0;
00073       for(v_iter=0; v_iter < (int)_eta_bins_areaoffset.size()-1; v_iter++){
00074         if(inRange(eta, _eta_bins_areaoffset[v_iter], _eta_bins_areaoffset[v_iter+1]))
00075           break;
00076       }
00077       return v_iter;
00078     }
00079 
00080 
00081     /// Perform the per-event analysis
00082     void analyze(const Event& event) {
00083 
00084       const double weight = event.weight();
00085 
00086       ///
00087       /// require at least 2 photons in final state
00088       ///
00089       ParticleVector photons = applyProjection<IdentifiedFinalState>(event, "Photon").particlesByPt();
00090       if (photons.size() < 2){
00091         vetoEvent;
00092       }
00093 
00094       ///
00095       /// compute the median energy density
00096       ///
00097       _ptDensity.clear();
00098       _sigma.clear();
00099       _Njets.clear();
00100       std::vector< std::vector<double> > ptDensities;
00101       std::vector<double> emptyVec;
00102       ptDensities.assign(_eta_bins_areaoffset.size()-1,emptyVec);
00103 
00104       const fastjet::ClusterSequenceArea* clust_seq_area = applyProjection<FastJets>(event, "KtJetsD05").clusterSeqArea();
00105       foreach (const fastjet::PseudoJet& jet, applyProjection<FastJets>(event, "KtJetsD05").pseudoJets(0.0*GeV)) {
00106         double eta = fabs(jet.eta());
00107         double pt = fabs(jet.perp());
00108 
00109         /// get the cluster sequence
00110         double area = clust_seq_area->area(jet);
00111 
00112         if(area > 10e-4 && fabs(eta)<_eta_bins_areaoffset[_eta_bins_areaoffset.size()-1]){
00113           ptDensities.at(getEtaBin(fabs(eta))).push_back(pt/area);
00114         }
00115       }
00116 
00117       for(int b=0; b<(int)_eta_bins_areaoffset.size()-1;b++){
00118         double median = 0.0;
00119         double sigma = 0.0;
00120         int Njets = 0;
00121         if(ptDensities[b].size() > 0)
00122           {
00123             std::sort(ptDensities[b].begin(), ptDensities[b].end());
00124             int nDens = ptDensities[b].size();
00125             if( nDens%2 == 0 )
00126               median = (ptDensities[b][nDens/2]+ptDensities[b][(nDens-2)/2])/2;
00127             else
00128               median = ptDensities[b][(nDens-1)/2];
00129             sigma = ptDensities[b][(int)(.15865*nDens)];
00130             Njets = nDens;
00131           }
00132         _ptDensity.push_back(median);
00133         _sigma.push_back(sigma);
00134         _Njets.push_back(Njets);
00135       }
00136 
00137 
00138       ///
00139       /// Loop over photons and fill vector of isolated ones
00140       ///
00141       ParticleVector isolated_photons;
00142       foreach (const Particle& photon, photons) {
00143 
00144         ///
00145         /// remove photons in crack
00146         ///
00147         double eta_P = photon.momentum().eta();
00148         if(fabs(eta_P)>=1.37 && fabs(eta_P)<1.52) continue;
00149 
00150         double phi_P = photon.momentum().phi();
00151 
00152         ///
00153         /// compute isolation
00154         ///
00155 
00156         /// std EtCone
00157         ParticleVector fs = applyProjection<FinalState>(event, "FS").particles();
00158         FourMomentum mom_in_EtCone;
00159         foreach (const Particle& p, fs) {
00160           /// check if it's in the cone of .4
00161           if (deltaR(eta_P, phi_P, p.momentum().eta(), p.momentum().phi()) >= 0.4) continue;
00162 
00163           /// check if it's in the 5x7 central core
00164           if (fabs(eta_P-p.momentum().eta()) < .025*7.0*0.5 &&
00165               fabs(phi_P-p.momentum().phi()) < (PI/128.)*5.0*0.5) continue;
00166 
00167           mom_in_EtCone += p.momentum();
00168         }
00169 
00170         /// now figure out the correction (area*density)
00171         float EtCone_area = PI*.4*.4 - (7.0*.025)*(5.0*PI/128.);
00172         float correction = _ptDensity[getEtaBin(eta_P)]*EtCone_area;
00173 
00174         /// shouldn't need to subtract photon
00175         /// note: using expected cut at hadron/particle level, not cut at reco level
00176         if(mom_in_EtCone.Et()-correction > 4.0*GeV){
00177           continue;
00178         }
00179 
00180         /// add photon to list of isolated ones
00181         isolated_photons.push_back(photon);
00182       }
00183 
00184       ///
00185       /// require at least two isolated photons
00186       ///
00187       if (isolated_photons.size() < 2) {
00188         vetoEvent;
00189       }
00190 
00191       ///
00192       /// select leading pT pair
00193       ///
00194       std::sort(isolated_photons.begin(), isolated_photons.end(), cmpParticleByPt);
00195       FourMomentum y1=isolated_photons[0].momentum();
00196       FourMomentum y2=isolated_photons[1].momentum();
00197 
00198       ///
00199       /// require the two photons to be separated (dR>0.4)
00200       ///
00201       if (deltaR(y1, y2)<0.4) {
00202         vetoEvent;
00203       }
00204 
00205       FourMomentum yy=y1+y2;
00206       double Myy = yy.mass()/GeV;
00207       double pTyy = yy.pT()/GeV;
00208       double dPhiyy = mapAngle0ToPi(y1.phi()-y2.phi());
00209 
00210       _h_M->fill(Myy, weight);
00211       _h_pT->fill(pTyy, weight);
00212       _h_dPhi->fill(dPhiyy, weight);
00213     }
00214 
00215 
00216     /// Normalise histograms etc., after the run
00217     void finalize() {
00218       scale(_h_M, crossSection()/sumOfWeights());
00219       scale(_h_pT, crossSection()/sumOfWeights());
00220       scale(_h_dPhi, crossSection()/sumOfWeights());
00221     }
00222 
00223   private:
00224 
00225     AIDA::IHistogram1D *_h_M;
00226     AIDA::IHistogram1D *_h_pT;
00227     AIDA::IHistogram1D *_h_dPhi;
00228 
00229     fastjet::AreaDefinition* _area_def;
00230 
00231     std::vector<float> _eta_bins_areaoffset;
00232 
00233     std::vector<float> _ptDensity;
00234     std::vector<float> _sigma;
00235     std::vector<float> _Njets;
00236   };
00237 
00238 
00239   // This global object acts as a hook for the plugin system
00240   AnalysisBuilder<ATLAS_2011_S9120807> plugin_ATLAS_2011_S9120807;
00241 }