ATLAS_2010_S8914702.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 00009 #include "Rivet/Projections/LeadingParticlesFinalState.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 class ATLAS_2010_S8914702 : public Analysis { 00024 public: 00025 00026 /// Constructor 00027 ATLAS_2010_S8914702() 00028 : Analysis("ATLAS_2010_S8914702") 00029 { 00030 _eta_bins.push_back( 0.00); 00031 _eta_bins.push_back( 0.60); 00032 _eta_bins.push_back( 1.37); 00033 _eta_bins.push_back( 1.52); 00034 _eta_bins.push_back( 1.81); 00035 00036 _eta_bins_areaoffset.push_back(0.0); 00037 _eta_bins_areaoffset.push_back(1.5); 00038 _eta_bins_areaoffset.push_back(3.0); 00039 } 00040 00041 00042 /// Book histograms and initialise projections before the run 00043 void init() { 00044 FinalState fs; 00045 addProjection(fs, "FS"); 00046 00047 FastJets fj(fs, FastJets::KT, 0.5); 00048 _area_def = new fastjet::AreaDefinition(fastjet::VoronoiAreaSpec()); 00049 fj.useJetArea(_area_def); 00050 addProjection(fj, "KtJetsD05"); 00051 00052 LeadingParticlesFinalState photonfs(FinalState(-1.81, 1.81, 15.0*GeV)); 00053 photonfs.addParticleId(PID::PHOTON); 00054 addProjection(photonfs, "LeadingPhoton"); 00055 00056 int hist_bin = 0; 00057 for (int i = 0; i < (int)_eta_bins.size()-1; ++i) { 00058 if (fabs(_eta_bins[i] - 1.37) < .0001) continue; 00059 _h_Et_photon[i] = bookHisto1D(1, 1, hist_bin+1); 00060 hist_bin += 1; 00061 } 00062 } 00063 00064 00065 int getEtaBin(double eta_w, bool area_eta) const { 00066 double eta = fabs(eta_w); 00067 int v_iter = 0; 00068 if (!area_eta) { 00069 for (v_iter=0; v_iter < (int)_eta_bins.size()-1; ++v_iter) { 00070 if (eta >= _eta_bins.at(v_iter) && eta < _eta_bins.at(v_iter+1)) break; 00071 } 00072 return min(v_iter,(int)_eta_bins.size()-2); 00073 } else { 00074 for (v_iter=0; v_iter < (int)_eta_bins_areaoffset.size()-1; ++v_iter) { 00075 if (eta >= _eta_bins_areaoffset.at(v_iter) && eta < _eta_bins_areaoffset.at(v_iter+1)) break; 00076 } 00077 return v_iter; 00078 } 00079 } 00080 00081 00082 /// Perform the per-event analysis 00083 void analyze(const Event& event) { 00084 const double weight = event.weight(); 00085 00086 Particles photons = applyProjection<LeadingParticlesFinalState>(event, "LeadingPhoton").particles(); 00087 if (photons.size() != 1) { 00088 vetoEvent; 00089 } 00090 00091 FourMomentum leadingPhoton = photons[0].momentum(); 00092 double eta_P = leadingPhoton.eta(); 00093 double phi_P = leadingPhoton.phi(); 00094 00095 if(fabs(eta_P)>=1.37 && fabs(eta_P)<1.52){ 00096 vetoEvent; 00097 } 00098 00099 int eta_bin = getEtaBin(eta_P,false); 00100 00101 Particles fs = applyProjection<FinalState>(event, "FS").particles(); 00102 FourMomentum mom_in_EtCone; 00103 foreach (const Particle& p, fs) { 00104 // check if it's in the cone of .4 00105 if (deltaR(eta_P, phi_P, p.eta(), p.phi()) >= 0.4) continue; 00106 00107 // check if it's in the 5x7 central core 00108 if (fabs(eta_P-p.eta()) < .025*5.0*0.5 && 00109 fabs(phi_P-p.phi()) < (PI/128.)*7.0*0.5) continue; 00110 mom_in_EtCone += p.momentum(); 00111 } 00112 MSG_DEBUG("Done with initial EtCone."); 00113 00114 // Now compute the median energy density 00115 _ptDensity.clear(); 00116 _sigma.clear(); 00117 _Njets.clear(); 00118 00119 std::vector< std::vector<double> > ptDensities; 00120 std::vector<double> emptyVec; 00121 ptDensities.assign(_eta_bins_areaoffset.size()-1,emptyVec); 00122 00123 FastJets fast_jets = applyProjection<FastJets>(event, "KtJetsD05"); 00124 const fastjet::ClusterSequenceArea* clust_seq_area = fast_jets.clusterSeqArea(); 00125 foreach (const fastjet::PseudoJet& jet, fast_jets.pseudoJets(0.0*GeV)) { 00126 //const double y = jet.absrap(); 00127 const double eta = fabs(jet.eta()); 00128 const double pt = fabs(jet.perp()); 00129 00130 // Get the cluster sequence 00131 double area = clust_seq_area->area(jet); 00132 00133 if (area > 10e-4 && fabs(eta)<_eta_bins_areaoffset[_eta_bins_areaoffset.size()-1]) { 00134 ptDensities.at(getEtaBin(fabs(eta),true)).push_back(pt/area); 00135 } 00136 } 00137 00138 for (int b = 0; b < (int)_eta_bins_areaoffset.size()-1; ++b) { 00139 double median = 0.0; 00140 double sigma = 0.0; 00141 int Njets = 0; 00142 if (ptDensities[b].size() > 0) { 00143 std::sort(ptDensities[b].begin(), ptDensities[b].end()); 00144 int nDens = ptDensities[b].size(); 00145 if (nDens % 2 == 0) { 00146 median = (ptDensities[b][nDens/2]+ptDensities[b][(nDens-2)/2])/2; 00147 } else { 00148 median = ptDensities[b][(nDens-1)/2]; 00149 } 00150 sigma = ptDensities[b][(int)(.15865*nDens)]; 00151 Njets = nDens; 00152 } 00153 _ptDensity.push_back(median); 00154 _sigma.push_back(sigma); 00155 _Njets.push_back(Njets); 00156 } 00157 00158 // Now figure out the correction 00159 float EtCone_area = PI*.4*.4 - (7.0*.025)*(5.0*PI/128.); 00160 float correction = _ptDensity[getEtaBin(eta_P,true)]*EtCone_area; 00161 MSG_DEBUG("Jet area correction done."); 00162 00163 // Shouldn't need to subtract photon 00164 // NB. Using expected cut at hadron/particle level, not cut at reco level 00165 if (mom_in_EtCone.Et() - correction/*-leadingPhoton.Et()*/ > 4.0*GeV) { 00166 vetoEvent; 00167 } 00168 MSG_DEBUG("Passed isolation cut."); 00169 00170 _h_Et_photon[eta_bin]->fill(leadingPhoton.Et(), weight); 00171 } 00172 00173 00174 /// Normalise histograms etc., after the run 00175 void finalize() { 00176 for (int i = 0; i < (int)_eta_bins.size()-1; ++i) { 00177 if (fabs(_eta_bins[i] - 1.37) < .0001) continue; 00178 scale(_h_Et_photon[i], crossSection()/sumOfWeights()); 00179 } 00180 } 00181 00182 00183 private: 00184 00185 Histo1DPtr _h_Et_photon[6]; 00186 00187 fastjet::AreaDefinition* _area_def; 00188 00189 std::vector<float> _eta_bins; 00190 std::vector<float> _eta_bins_areaoffset; 00191 00192 std::vector<float> _ptDensity; 00193 std::vector<float> _sigma; 00194 std::vector<float> _Njets; 00195 }; 00196 00197 00198 00199 // The hook for the plugin system 00200 DECLARE_RIVET_PLUGIN(ATLAS_2010_S8914702); 00201 00202 } Generated on Wed Oct 7 2015 12:09:09 for The Rivet MC analysis system by ![]() |