ATLAS_2012_I1125575.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/ChargedFinalState.hh" 00004 #include "Rivet/Projections/FastJets.hh" 00005 #include "Rivet/Tools/BinnedHistogram.hh" 00006 00007 namespace Rivet { 00008 00009 00010 /// ATLAS charged particle jet underlying event and jet radius dependence 00011 class ATLAS_2012_I1125575 : public Analysis { 00012 public: 00013 00014 /// @name Constructors etc. 00015 //@{ 00016 00017 /// Constructor 00018 ATLAS_2012_I1125575() 00019 : Analysis("ATLAS_2012_I1125575") 00020 { } 00021 00022 //@} 00023 00024 00025 /// @name Analysis methods 00026 //@{ 00027 00028 /// Book histograms and initialise projections before the run 00029 void init() { 00030 00031 const ChargedFinalState jet_input(-2.5, 2.5, 0.5*GeV); 00032 addProjection(jet_input, "JET_INPUT"); 00033 00034 const ChargedFinalState track_input(-1.5, 1.5, 0.5*GeV); 00035 addProjection(track_input, "TRACK_INPUT"); 00036 00037 const FastJets jets02(jet_input, FastJets::ANTIKT, 0.2); 00038 addProjection(jets02, "JETS_02"); 00039 00040 const FastJets jets04(jet_input, FastJets::ANTIKT, 0.4); 00041 addProjection(jets04, "JETS_04"); 00042 00043 const FastJets jets06(jet_input, FastJets::ANTIKT, 0.6); 00044 addProjection(jets06, "JETS_06"); 00045 00046 const FastJets jets08(jet_input, FastJets::ANTIKT, 0.8); 00047 addProjection(jets08, "JETS_08"); 00048 00049 const FastJets jets10(jet_input, FastJets::ANTIKT, 1.0); 00050 addProjection(jets10, "JETS_10"); 00051 00052 // Mean number of tracks 00053 initializeProfiles(_h_meanNch, 1); 00054 00055 // Mean of the average track pT in each region 00056 initializeProfiles(_h_meanPtAvg, 2); 00057 00058 // Mean of the scalar sum of track pT in each region 00059 initializeProfiles(_h_meanPtSum, 3); 00060 00061 // Distribution of Nch, in bins of leading track-jet pT 00062 initializeHistograms(_h_Nch, 4); 00063 00064 // Distribution of average track-jet pT, in bins of leading track-jet pT 00065 initializeHistograms(_h_PtAvg, 5); 00066 00067 // Distribution of sum of track-jet pT, in bins of leading track-jet pT 00068 initializeHistograms(_h_PtSum, 6); 00069 00070 for (int i = 0; i < 5; ++i) 00071 _nEvents[i] = 0.0; 00072 } 00073 00074 00075 void initializeProfiles(Profile1DPtr plots[5][2], int distribution) { 00076 for (int i = 0; i < 5; ++i) { 00077 for (int j = 0; j < 2; ++j) { 00078 plots[i][j] = bookProfile1D(distribution, i+1, j+1); 00079 } 00080 } 00081 } 00082 00083 00084 void initializeHistograms(BinnedHistogram<double> plots[5][2], int distribution) { 00085 Scatter2D refscatter = refData(1, 1, 1); 00086 for (int i = 0; i < 5; ++i) { 00087 for (int y = 0; y < 2; ++y) { 00088 for (size_t j = 0; j < refscatter.numPoints(); ++j) { 00089 int histogram_number = ((j+1)*2)-((y+1)%2); 00090 double low_edge = refscatter.point(j).xMin(); 00091 double high_edge = refscatter.point(j).xMax(); 00092 plots[i][y].addHistogram(low_edge, high_edge, bookHisto1D(distribution, i+1, histogram_number)); 00093 } 00094 } 00095 } 00096 } 00097 00098 00099 /// Perform the per-event analysis 00100 void analyze(const Event& event) { 00101 const double weight = event.weight(); 00102 00103 vector<Jets*> all_jets; 00104 Jets jets_02 = applyProjection<FastJets>(event, "JETS_02").jetsByPt(Cuts::pT > 4*GeV && Cuts::abseta < 1.5); 00105 all_jets.push_back(&jets_02); 00106 Jets jets_04 = applyProjection<FastJets>(event, "JETS_04").jetsByPt(Cuts::pT > 4*GeV && Cuts::abseta < 1.5); 00107 all_jets.push_back(&jets_04); 00108 Jets jets_06 = applyProjection<FastJets>(event, "JETS_06").jetsByPt(Cuts::pT > 4*GeV && Cuts::abseta < 1.5); 00109 all_jets.push_back(&jets_06); 00110 Jets jets_08 = applyProjection<FastJets>(event, "JETS_08").jetsByPt(Cuts::pT > 4*GeV && Cuts::abseta < 1.5); 00111 all_jets.push_back(&jets_08); 00112 Jets jets_10 = applyProjection<FastJets>(event, "JETS_10").jetsByPt(Cuts::pT > 4*GeV && Cuts::abseta < 1.5); 00113 all_jets.push_back(&jets_10); 00114 00115 // Count the number of tracks in the away and transverse regions, for each set of jets 00116 double n_ch[5][2] = { {0,0}, {0,0}, {0,0}, {0,0}, {0,0} }; 00117 // Also add up the sum pT 00118 double sumpt[5][2] = { {0,0}, {0,0}, {0,0}, {0,0}, {0,0} }; 00119 // ptmean = sumpt / n_ch 00120 double ptavg[5][2] = { {0,0}, {0,0}, {0,0}, {0,0}, {0,0} }; 00121 // lead jet pT defines which bin we want to fill 00122 double lead_jet_pts[5] = {0.0}; 00123 00124 // Loop over each of the jet radii: 00125 for (int i = 0; i < 5; ++i) { 00126 if (all_jets[i]->size() < 1) continue; 00127 00128 // Find the lead jet pT 00129 lead_jet_pts[i] = all_jets[i]->at(0).pT(); 00130 00131 // Loop over each of the charged particles 00132 const Particles& tracks = applyProjection<ChargedFinalState>(event, "TRACK_INPUT").particlesByPt(); 00133 foreach(const Particle& t, tracks) { 00134 00135 // Get the delta-phi between the track and the leading jet 00136 double dphi = deltaPhi(all_jets[i]->at(0), t); 00137 00138 // Find out which region this puts it in. 00139 // 0 = away region, 1 = transverse region, 2 = toward region 00140 int region = region_index(dphi); 00141 00142 // If the track is in the toward region, ignore it. 00143 if (region == 2) continue; 00144 00145 // Otherwise, increment the relevant counters 00146 ++n_ch[i][region]; 00147 sumpt[i][region] += t.pT(); 00148 00149 } 00150 // Calculate the pT_avg for the away and transverse regions. 00151 // (And make sure we don't try to divide by zero.) 00152 ptavg[i][0] = (n_ch[i][0] == 0 ? 0.0 : sumpt[i][0] / n_ch[i][0]); 00153 ptavg[i][1] = (n_ch[i][1] == 0 ? 0.0 : sumpt[i][1] / n_ch[i][1]); 00154 00155 _nEvents[i] += weight; 00156 } 00157 00158 fillProfiles(_h_meanNch, n_ch, lead_jet_pts, weight, 1.0 / (2*PI)); 00159 fillProfiles(_h_meanPtAvg, ptavg, lead_jet_pts, weight, 1.0); 00160 fillProfiles(_h_meanPtSum, sumpt, lead_jet_pts, weight, 1.0 / (2*PI)); 00161 00162 fillHistograms(_h_Nch, n_ch, lead_jet_pts, weight); 00163 fillHistograms(_h_PtAvg, ptavg, lead_jet_pts, weight); 00164 fillHistograms(_h_PtSum, sumpt, lead_jet_pts, weight); 00165 } 00166 00167 00168 void fillProfiles(Profile1DPtr plots[5][2], double var[5][2], double lead_pt[5], double weight, double scale) { 00169 for (int i=0; i<5; ++i) { 00170 double pt = lead_pt[i]; 00171 for (int j=0; j<2; ++j) { 00172 double v = var[i][j]; 00173 plots[i][j]->fill(pt, v*scale, weight); 00174 } 00175 } 00176 } 00177 00178 00179 void fillHistograms(BinnedHistogram<double> plots[5][2], double var[5][2], double lead_pt[5], double weight) { 00180 for (int i=0; i<5; ++i) { 00181 double pt = lead_pt[i]; 00182 for (int j=0; j<2; ++j) { 00183 double v = var[i][j]; 00184 plots[i][j].fill(pt, v, weight); 00185 } 00186 } 00187 } 00188 00189 00190 int region_index(double dphi) { 00191 assert(inRange(dphi, 0.0, PI, CLOSED, CLOSED)); 00192 if (dphi < PI/3.0) return 2; 00193 if (dphi < 2*PI/3.0) return 1; 00194 return 0; 00195 } 00196 00197 00198 /// Normalise histograms etc., after the run 00199 void finalize() { 00200 finalizeHistograms(_h_Nch); 00201 finalizeHistograms(_h_PtAvg); 00202 finalizeHistograms(_h_PtSum); 00203 } 00204 00205 00206 void finalizeHistograms(BinnedHistogram<double> plots[5][2]) { 00207 for (int i = 0; i < 5; ++i) { 00208 for (int j = 0; j < 2; ++j) { 00209 vector<Histo1DPtr> histos = plots[i][j].getHistograms(); 00210 foreach(Histo1DPtr h, histos) { 00211 scale(h, 1.0/_nEvents[i]); 00212 } 00213 } 00214 } 00215 } 00216 00217 //@} 00218 00219 00220 private: 00221 00222 // Data members like post-cuts event weight counters go here 00223 double _nEvents[5]; 00224 00225 Profile1DPtr _h_meanNch[5][2]; 00226 Profile1DPtr _h_meanPtAvg[5][2]; 00227 Profile1DPtr _h_meanPtSum[5][2]; 00228 00229 BinnedHistogram<double> _h_Nch[5][2]; 00230 BinnedHistogram<double> _h_PtAvg[5][2]; 00231 BinnedHistogram<double> _h_PtSum[5][2]; 00232 00233 }; 00234 00235 00236 00237 // The hook for the plugin system 00238 DECLARE_RIVET_PLUGIN(ATLAS_2012_I1125575); 00239 00240 } Generated on Thu Mar 10 2016 08:29:47 for The Rivet MC analysis system by ![]() |