rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1093738.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/Projections/FinalState.hh"
00008 #include "Rivet/Projections/LeadingParticlesFinalState.hh"
00009 #include "Rivet/Projections/VetoedFinalState.hh"
00010 #include "Rivet/Jet.hh"
00011 #include "Rivet/Projections/FastJets.hh"
00012 
00013 #include "fastjet/internal/base.hh"
00014 #include "fastjet/JetDefinition.hh"
00015 #include "fastjet/AreaDefinition.hh"
00016 #include "fastjet/ClusterSequence.hh"
00017 #include "fastjet/ClusterSequenceArea.hh"
00018 #include "fastjet/PseudoJet.hh"
00019 
00020 namespace Rivet {
00021 
00022 
00023   /// @brief Measurement of isolated gamma + jet + X differential cross-sections
00024   ///
00025   /// Inclusive isolated gamma + jet cross-sections, differential in pT(gamma), for
00026   /// various photon and jet rapidity configurations.
00027   ///
00028   /// @author Giovanni Marchiori
00029   class ATLAS_2012_I1093738 : public Analysis {
00030   public:
00031 
00032     // Constructor
00033     ATLAS_2012_I1093738()
00034       : Analysis("ATLAS_2012_I1093738")
00035     {
00036       _eta_bins_ph.push_back(0.0);
00037       _eta_bins_ph.push_back(1.37);
00038       _eta_bins_ph.push_back(1.52);
00039       _eta_bins_ph.push_back(2.37);
00040 
00041       _eta_bins_jet.push_back(0.0);
00042       _eta_bins_jet.push_back(1.2);
00043       _eta_bins_jet.push_back(2.8);
00044       _eta_bins_jet.push_back(4.4);
00045 
00046       _eta_bins_areaoffset.push_back(0.0);
00047       _eta_bins_areaoffset.push_back(1.5);
00048       _eta_bins_areaoffset.push_back(3.0);
00049     }
00050 
00051   public:
00052 
00053     // Book histograms and initialise projections before the run
00054     void init() {
00055       // Final state
00056       FinalState fs;
00057       addProjection(fs, "FS");
00058 
00059       // Voronoi eta-phi tassellation with KT jets, for ambient energy density calculation
00060       FastJets fj(fs, FastJets::KT, 0.5);
00061       _area_def = new fastjet::AreaDefinition(fastjet::VoronoiAreaSpec());
00062       fj.useJetArea(_area_def);
00063       addProjection(fj, "KtJetsD05");
00064 
00065       // Leading photon
00066       LeadingParticlesFinalState photonfs(FinalState(-1.37, 1.37, 25.0*GeV));
00067       photonfs.addParticleId(PID::PHOTON);
00068       addProjection(photonfs, "LeadingPhoton");
00069 
00070       // FS excluding the leading photon
00071       VetoedFinalState vfs(fs);
00072       vfs.addVetoOnThisFinalState(photonfs);
00073       addProjection(vfs, "JetFS");
00074 
00075       // Jets
00076       FastJets jetpro(vfs, FastJets::ANTIKT, 0.4);
00077       jetpro.useInvisibles();
00078       addProjection(jetpro, "Jets");
00079 
00080       _h_phbarrel_jetcentral_SS = bookHisto1D(1, 1, 1);
00081       _h_phbarrel_jetmedium_SS  = bookHisto1D(2, 1, 1);
00082       _h_phbarrel_jetforward_SS = bookHisto1D(3, 1, 1);
00083 
00084       _h_phbarrel_jetcentral_OS = bookHisto1D(4, 1, 1);
00085       _h_phbarrel_jetmedium_OS  = bookHisto1D(5, 1, 1);
00086       _h_phbarrel_jetforward_OS = bookHisto1D(6, 1, 1);
00087     }
00088 
00089 
00090     int getEtaBin(double eta_w, int what) const {
00091       double eta = fabs(eta_w);
00092       int v_iter = 0;
00093       if (what==0) {
00094         for (v_iter=0; v_iter < (int)_eta_bins_ph.size()-1; v_iter++){
00095           if (eta >= _eta_bins_ph.at(v_iter) && eta < _eta_bins_ph.at(v_iter+1))
00096             break;
00097         }
00098       }
00099       else if (what==1) {
00100         for (v_iter=0; v_iter < (int)_eta_bins_jet.size()-1; v_iter++){
00101           if (eta >= _eta_bins_jet.at(v_iter) && eta < _eta_bins_jet.at(v_iter+1))
00102             break;
00103         }
00104       }
00105       else {
00106         for (v_iter=0; v_iter < (int)_eta_bins_areaoffset.size()-1; v_iter++){
00107           if (eta >= _eta_bins_areaoffset.at(v_iter) && eta < _eta_bins_areaoffset.at(v_iter+1))
00108             break;
00109         }
00110       }
00111       return v_iter;
00112     }
00113 
00114 
00115     // Perform the per-event analysis
00116     void analyze(const Event& event) {
00117       const double weight = event.weight();
00118 
00119       // Get the photon
00120       const FinalState& photonfs = applyProjection<FinalState>(event, "LeadingPhoton");
00121       if (photonfs.particles().size() < 1) vetoEvent;
00122 
00123       const FourMomentum photon = photonfs.particles().front().momentum();
00124       double eta_P = photon.eta();
00125       double phi_P = photon.phi();
00126 
00127       // Get the jet
00128       Jets jets = applyProjection<FastJets>(event, "Jets").jetsByPt(20.0*GeV);
00129       if (jets.size()==0) {
00130         vetoEvent;
00131       }
00132       FourMomentum leadingJet = jets[0].momentum();
00133 
00134       // Require jet separated from photon
00135       if (deltaR(eta_P, phi_P, leadingJet.eta(), leadingJet.phi())<1.0) {
00136         vetoEvent;
00137       }
00138 
00139       // Veto if leading jet is outside plotted rapidity regions
00140       const double abs_y1 = fabs(leadingJet.rapidity());
00141       if (abs_y1 > 4.4) {
00142         vetoEvent;
00143       }
00144 
00145       // compute the median event energy density
00146       const unsigned int skipnhardjets = 0;
00147       _ptDensity.clear();
00148       _sigma.clear();
00149       _Njets.clear();
00150       std::vector< std::vector<double> > ptDensities;
00151       std::vector<double> emptyVec;
00152       ptDensities.assign(_eta_bins_areaoffset.size()-1,emptyVec);
00153 
00154       FastJets fast_jets = applyProjection<FastJets>(event, "KtJetsD05");
00155 
00156       const fastjet::ClusterSequenceArea* clust_seq_area = fast_jets.clusterSeqArea();
00157       foreach (const fastjet::PseudoJet& jet, fast_jets.pseudoJets(0.0*GeV)) {
00158         double eta = fabs(jet.eta());
00159         double pt = fabs(jet.perp());
00160         double area = clust_seq_area->area(jet);
00161         if (area > 10e-4 && fabs(eta)<_eta_bins_areaoffset[_eta_bins_areaoffset.size()-1]) {
00162           ptDensities.at(getEtaBin(fabs(eta),2)).push_back(pt/area);
00163         }
00164       }
00165 
00166       for (int b = 0; b<(int)_eta_bins_areaoffset.size()-1; b++) {
00167         double median = 0.0;
00168         double sigma = 0.0;
00169         int Njets = 0;
00170         if (ptDensities[b].size() > skipnhardjets) {
00171           std::sort(ptDensities[b].begin(), ptDensities[b].end());
00172           int nDens = ptDensities[b].size() - skipnhardjets;
00173           if ( nDens%2 == 0 ) {
00174             median = (ptDensities[b][nDens/2]+ptDensities[b][(nDens-2)/2])/2;
00175           } else {
00176             median = ptDensities[b][(nDens-1)/2];
00177           }
00178           sigma = ptDensities[b][(int)(.15865*nDens)];
00179           Njets = nDens;
00180         }
00181         _ptDensity.push_back(median);
00182         _sigma.push_back(sigma);
00183         _Njets.push_back(Njets);
00184       }
00185 
00186 
00187       // compute photon isolation
00188 
00189       // std EtCone
00190       Particles fs = applyProjection<FinalState>(event, "JetFS").particles();
00191       FourMomentum mom_in_EtCone;
00192       float iso_dR = 0.4;
00193       float cluster_eta_width = 0.25*5.0;
00194       float cluster_phi_width = (PI/128.)*7.0;
00195       foreach (const Particle& p, fs) {
00196         // check if it's in the cone of .4
00197         if (deltaR(eta_P, phi_P, p.eta(), p.phi()) >= iso_dR) continue;
00198 
00199         // check if it's in the 5x7 central core
00200         if (fabs(eta_P-p.eta()) < cluster_eta_width*0.5 &&
00201             fabs(phi_P-p.phi()) < cluster_phi_width*0.5) continue;
00202 
00203         mom_in_EtCone += p.momentum();
00204       }
00205 
00206       // now figure out the correction (area*density)
00207       float EtCone_area = PI*iso_dR*iso_dR - cluster_eta_width*cluster_phi_width;
00208       float correction = _ptDensity[getEtaBin(eta_P,2)]*EtCone_area;
00209 
00210       // require photon to be isolated
00211       if (mom_in_EtCone.Et()-correction > 4.0*GeV) vetoEvent;
00212 
00213       int photon_jet_sign = sign( leadingJet.rapidity() * photon.rapidity() );
00214 
00215       // Fill histos
00216       float abs_jet_rapidity = fabs(leadingJet.rapidity());
00217       float photon_pt = photon.pT()/GeV;
00218       float abs_photon_eta = fabs(photon.eta());
00219 
00220       if (abs_photon_eta<1.37) {
00221 
00222         if (abs_jet_rapidity < 1.2) {
00223 
00224           if (photon_jet_sign >= 1) {
00225             _h_phbarrel_jetcentral_SS->fill(photon_pt, weight);
00226           } else {
00227             _h_phbarrel_jetcentral_OS->fill(photon_pt, weight);
00228           }
00229 
00230         } else if (abs_jet_rapidity < 2.8) {
00231 
00232           if (photon_jet_sign >= 1) {
00233             _h_phbarrel_jetmedium_SS->fill(photon_pt, weight);
00234           } else {
00235             _h_phbarrel_jetmedium_OS->fill(photon_pt, weight);
00236           }
00237 
00238         } else if (abs_jet_rapidity < 4.4) {
00239 
00240           if (photon_jet_sign >= 1) {
00241             _h_phbarrel_jetforward_SS->fill(photon_pt, weight);
00242           } else {
00243             _h_phbarrel_jetforward_OS->fill(photon_pt, weight);
00244           }
00245         }
00246 
00247       }
00248     }
00249 
00250 
00251     /// Normalise histograms etc., after the run
00252     void finalize() {
00253       scale(_h_phbarrel_jetcentral_SS, crossSection()/sumOfWeights());
00254       scale(_h_phbarrel_jetcentral_OS, crossSection()/sumOfWeights());
00255       scale(_h_phbarrel_jetmedium_SS, crossSection()/sumOfWeights());
00256       scale(_h_phbarrel_jetmedium_OS, crossSection()/sumOfWeights());
00257       scale(_h_phbarrel_jetforward_SS, crossSection()/sumOfWeights());
00258       scale(_h_phbarrel_jetforward_OS, crossSection()/sumOfWeights());
00259     }
00260 
00261 
00262   private:
00263 
00264     Histo1DPtr _h_phbarrel_jetcentral_SS;
00265     Histo1DPtr _h_phbarrel_jetmedium_SS;
00266     Histo1DPtr _h_phbarrel_jetforward_SS;
00267 
00268     Histo1DPtr _h_phbarrel_jetcentral_OS;
00269     Histo1DPtr _h_phbarrel_jetmedium_OS;
00270     Histo1DPtr _h_phbarrel_jetforward_OS;
00271 
00272     fastjet::AreaDefinition* _area_def;
00273 
00274     std::vector<float> _eta_bins_ph;
00275     std::vector<float> _eta_bins_jet;
00276     std::vector<float> _eta_bins_areaoffset;
00277 
00278     std::vector<float> _ptDensity;
00279     std::vector<float> _sigma;
00280     std::vector<float> _Njets;
00281   };
00282 
00283 
00284 
00285   // The hook for the plugin system
00286   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1093738);
00287 
00288 }