00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Projections/ChargedFinalState.hh"
00005 #include "Rivet/Tools/Logging.hh"
00006 #include "LWH/Profile1D.h"
00007 #include "LWH/Histogram1D.h"
00008
00009 namespace Rivet {
00010
00011
00012 class ATLAS_2010_S8894728 : public Analysis {
00013 public:
00014
00015 ATLAS_2010_S8894728() : Analysis("ATLAS_2010_S8894728") { }
00016
00017
00018 void init() {
00019 const ChargedFinalState cfs100(-2.5, 2.5, 100*MeV);
00020 addProjection(cfs100, "CFS100");
00021 const ChargedFinalState cfs500(-2.5, 2.5, 500*MeV);
00022 addProjection(cfs500, "CFS500");
00023 const ChargedFinalState cfslead(-2.5, 2.5, 1.0*GeV);
00024 addProjection(cfslead, "CFSlead");
00025
00026
00027 int isqrts = -1;
00028 if (fuzzyEquals(sqrtS(), 900*GeV)) isqrts = 0;
00029 else if (fuzzyEquals(sqrtS(), 7*TeV)) isqrts = 1;
00030 assert(isqrts >= 0);
00031
00032
00033 _hist_nch_transverse_500[0] = bookProfile1D(1+isqrts, 1, 1);
00034 _hist_nch_toward_500 = bookProfile1D(1+isqrts, 1, 2);
00035 _hist_nch_away_500 = bookProfile1D(1+isqrts, 1, 3);
00036
00037
00038 _hist_ptsum_transverse_500[0] = bookProfile1D(3+isqrts, 1, 1);
00039 _hist_ptsum_toward_500 = bookProfile1D(3+isqrts, 1, 2);
00040 _hist_ptsum_away_500 = bookProfile1D(3+isqrts, 1, 3);
00041
00042
00043
00044 for (size_t i = 1; i < 4; ++i) {
00045 _hist_nch_transverse_500[i] = new LWH::Profile1D(binEdges(1+isqrts, 1, 1));
00046 _hist_ptsum_transverse_500[i] = new LWH::Profile1D(binEdges(3+isqrts, 1, 1));
00047 }
00048
00049 _dps_sdnch_transverse_500 = bookDataPointSet(5+isqrts, 1, 1);
00050 _dps_sdptsum_transverse_500 = bookDataPointSet(7+isqrts, 1, 1);
00051
00052
00053 _hist_ptavg_transverse_500 = bookProfile1D(9+isqrts, 1, 1);
00054 _hist_ptavg_toward_500 = bookProfile1D(9+isqrts, 1, 2);
00055 _hist_ptavg_away_500 = bookProfile1D(9+isqrts, 1, 3);
00056
00057
00058 _hist_dn_dpt_transverse_500 = bookProfile1D(11+isqrts, 1, 1);
00059 _hist_dn_dpt_toward_500 = bookProfile1D(11+isqrts, 1, 2);
00060 _hist_dn_dpt_away_500 = bookProfile1D(11+isqrts, 1, 3);
00061
00062
00063 _hist_N_vs_dPhi_1_500 = bookProfile1D(13+isqrts, 1, 1);
00064 _hist_N_vs_dPhi_2_500 = bookProfile1D(13+isqrts, 1, 2);
00065 _hist_N_vs_dPhi_3_500 = bookProfile1D(13+isqrts, 1, 3);
00066 _hist_N_vs_dPhi_5_500 = bookProfile1D(13+isqrts, 1, 4);
00067
00068 _hist_pT_vs_dPhi_1_500 = bookProfile1D(15+isqrts, 1, 1);
00069 _hist_pT_vs_dPhi_2_500 = bookProfile1D(15+isqrts, 1, 2);
00070 _hist_pT_vs_dPhi_3_500 = bookProfile1D(15+isqrts, 1, 3);
00071 _hist_pT_vs_dPhi_5_500 = bookProfile1D(15+isqrts, 1, 4);
00072
00073
00074 _hist_nch_transverse_100 = bookProfile1D(17+isqrts, 1, 1);
00075 _hist_nch_toward_100 = bookProfile1D(17+isqrts, 1, 2);
00076 _hist_nch_away_100 = bookProfile1D(17+isqrts, 1, 3);
00077 _hist_ptsum_transverse_100 = bookProfile1D(19+isqrts, 1, 1);
00078 _hist_ptsum_toward_100 = bookProfile1D(19+isqrts, 1, 2);
00079 _hist_ptsum_away_100 = bookProfile1D(19+isqrts, 1, 3);
00080
00081
00082 if (isqrts == 1) {
00083 _hist_nch_vs_eta_transverse_100 = bookProfile1D(21, 1, 1);
00084 _hist_ptsum_vs_eta_transverse_100 = bookProfile1D(22, 1, 1);
00085 }
00086
00087 }
00088
00089
00090
00091 inline int region_index(double dphi) {
00092 assert(inRange(dphi, 0.0, PI, CLOSED, CLOSED));
00093 if (dphi < PI/3.0) return 0;
00094 if (dphi < 2*PI/3.0) return 1;
00095 return 2;
00096 }
00097
00098
00099 void analyze(const Event& event) {
00100 const double weight = event.weight();
00101
00102
00103 const ChargedFinalState& cfslead = applyProjection<ChargedFinalState>(event, "CFSlead");
00104 if (cfslead.size() < 1) {
00105 vetoEvent;
00106 }
00107
00108
00109 const ChargedFinalState& charged500 = applyProjection<ChargedFinalState>(event, "CFS500");
00110
00111
00112 ParticleVector particles500 = charged500.particlesByPt();
00113 Particle p_lead = particles500[0];
00114 const double philead = p_lead.momentum().phi();
00115 const double etalead = p_lead.momentum().eta();
00116 const double pTlead = p_lead.momentum().perp();
00117 MSG_DEBUG("Leading track: pT = " << pTlead << ", eta = " << etalead << ", phi = " << philead);
00118
00119
00120 vector<double> num500(3, 0), ptSum500(3, 0.0);
00121
00122
00123 LWH::Histogram1D hist_num_dphi_500(binEdges(13,1,1));
00124 LWH::Histogram1D hist_pt_dphi_500(binEdges(15,1,1));
00125 foreach (const Particle& p, particles500) {
00126 const double pT = p.momentum().pT();
00127 const double dPhi = deltaPhi(philead, p.momentum().phi());
00128 const int ir = region_index(dPhi);
00129 num500[ir] += 1;
00130 ptSum500[ir] += pT;
00131
00132
00133 if (p.genParticle() != p_lead.genParticle()) {
00134 hist_num_dphi_500.fill(dPhi, 1);
00135 hist_pt_dphi_500.fill(dPhi, pT);
00136 }
00137 }
00138
00139
00140
00141
00142 foreach (const Particle& p, particles500) {
00143 const double pT = p.momentum().pT();
00144 const double dPhi = deltaPhi(philead, p.momentum().phi());
00145 const int ir = region_index(dPhi);
00146 switch (ir) {
00147 case 0:
00148 _hist_dn_dpt_toward_500->fill(num500[0], pT, weight);
00149 break;
00150 case 1:
00151 _hist_dn_dpt_transverse_500->fill(num500[1], pT, weight);
00152 break;
00153 case 2:
00154 _hist_dn_dpt_away_500->fill(num500[2], pT, weight);
00155 break;
00156 default:
00157 assert(false && "How did we get here?");
00158 }
00159 }
00160
00161
00162
00163
00164
00165 const double dEtadPhi = (2*2.5 * 2*PI/3.0);
00166
00167 for (int i = 0; i < 4; ++i) {
00168 _hist_nch_transverse_500[i]->fill(pTlead/GeV, pow(num500[1]/dEtadPhi, i+1), weight);
00169 _hist_ptsum_transverse_500[i]->fill(pTlead/GeV, pow(ptSum500[1]/GeV/dEtadPhi, i+1), weight);
00170 }
00171
00172 _hist_nch_toward_500->fill(pTlead/GeV, num500[0]/dEtadPhi, weight);
00173 _hist_nch_away_500->fill(pTlead/GeV, num500[2]/dEtadPhi, weight);
00174 _hist_ptsum_toward_500->fill(pTlead/GeV, ptSum500[0]/GeV/dEtadPhi, weight);
00175 _hist_ptsum_away_500->fill(pTlead/GeV, ptSum500[2]/GeV/dEtadPhi, weight);
00176
00177
00178 if (num500[1] > 0) _hist_ptavg_transverse_500->fill(pTlead/GeV, ptSum500[1]/GeV/num500[1], weight);
00179 if (num500[0] > 0) _hist_ptavg_toward_500->fill(pTlead/GeV, ptSum500[0]/GeV/num500[0], weight);
00180 if (num500[2] > 0) _hist_ptavg_away_500->fill(pTlead/GeV, ptSum500[2]/GeV/num500[2], weight);
00181
00182
00183
00184
00185
00186
00187 const size_t nbins = binEdges(13,1,1).size() - 1;
00188 std::vector<double> ptcut;
00189 if (fuzzyEquals(sqrtS(), 900*GeV)) {
00190 ptcut += 1.0; ptcut += 1.5; ptcut += 2.0; ptcut += 2.5;
00191 }
00192 else if (fuzzyEquals(sqrtS(), 7*TeV)) {
00193 ptcut += 1.0; ptcut += 2.0; ptcut += 3.0; ptcut += 5.0;
00194 }
00195 assert(ptcut.size() == 4);
00196 for (size_t i = 0; i < nbins; ++i) {
00197
00198 const double binmean_num = hist_num_dphi_500.binMean(i);
00199 const double binvalue_num = hist_num_dphi_500.binHeight(i)/hist_num_dphi_500.axis().binWidth(i)/10.0;
00200 if (pTlead/GeV >= ptcut[0]) _hist_N_vs_dPhi_1_500->fill(binmean_num, binvalue_num, weight);
00201 if (pTlead/GeV >= ptcut[1]) _hist_N_vs_dPhi_2_500->fill(binmean_num, binvalue_num, weight);
00202 if (pTlead/GeV >= ptcut[2]) _hist_N_vs_dPhi_3_500->fill(binmean_num, binvalue_num, weight);
00203 if (pTlead/GeV >= ptcut[3]) _hist_N_vs_dPhi_5_500->fill(binmean_num, binvalue_num, weight);
00204
00205 const double binmean_pt = hist_pt_dphi_500.binMean(i);
00206 const double binvalue_pt = hist_pt_dphi_500.binHeight(i)/hist_pt_dphi_500.axis().binWidth(i)/10.0;
00207 if (pTlead/GeV >= ptcut[0]) _hist_pT_vs_dPhi_1_500->fill(binmean_pt, binvalue_pt, weight);
00208 if (pTlead/GeV >= ptcut[1]) _hist_pT_vs_dPhi_2_500->fill(binmean_pt, binvalue_pt, weight);
00209 if (pTlead/GeV >= ptcut[2]) _hist_pT_vs_dPhi_3_500->fill(binmean_pt, binvalue_pt, weight);
00210 if (pTlead/GeV >= ptcut[3]) _hist_pT_vs_dPhi_5_500->fill(binmean_pt, binvalue_pt, weight);
00211 }
00212
00213
00214
00215
00216
00217
00218 const ChargedFinalState& charged100 = applyProjection<ChargedFinalState>(event, "CFS100");
00219
00220
00221 vector<double> num100(3, 0), ptSum100(3, 0.0);
00222 foreach (const Particle& p, charged100.particles()) {
00223 const double pT = p.momentum().pT();
00224 const double dPhi = deltaPhi(philead, p.momentum().phi());
00225 const int ir = region_index(dPhi);
00226 num100[ir] += 1;
00227 ptSum100[ir] += pT;
00228 }
00229
00230
00231 _hist_nch_transverse_100->fill(pTlead/GeV, num100[1]/dEtadPhi, weight);
00232 _hist_nch_toward_100->fill(pTlead/GeV, num100[0]/dEtadPhi, weight);
00233 _hist_nch_away_100->fill(pTlead/GeV, num100[2]/dEtadPhi, weight);
00234 _hist_ptsum_transverse_100->fill(pTlead/GeV, ptSum100[1]/GeV/dEtadPhi, weight);
00235 _hist_ptsum_toward_100->fill(pTlead/GeV, ptSum100[0]/GeV/dEtadPhi, weight);
00236 _hist_ptsum_away_100->fill(pTlead/GeV, ptSum100[2]/GeV/dEtadPhi, weight);
00237
00238
00239 if (fuzzyEquals(sqrtS(), 7*TeV) && pTlead > 5*GeV) {
00240
00241 _hist_nch_vs_eta_transverse_100->fill(etalead, num100[1]/dEtadPhi, weight);
00242 _hist_ptsum_vs_eta_transverse_100->fill(etalead, ptSum100[1]/GeV/dEtadPhi, weight);
00243 }
00244
00245 }
00246
00247
00248 void finalize() {
00249
00250 _moments_to_stddev(_hist_nch_transverse_500, _dps_sdnch_transverse_500);
00251 _moments_to_stddev(_hist_ptsum_transverse_500, _dps_sdptsum_transverse_500);
00252 }
00253
00254
00255 private:
00256
00257
00258 inline void _moments_to_stddev(AIDA::IProfile1D* moment_profiles[], AIDA::IDataPointSet* target_dps) {
00259 for (int b = 0; b < target_dps->size(); ++b) {
00260
00261 const double numentries = moment_profiles[0]->binEntries(b);
00262 const double var = moment_profiles[1]->binHeight(b) - pow(moment_profiles[0]->binHeight(b), 2);
00263 const double sd = isZero(var) ? 0 : sqrt(var);
00264 target_dps->point(b)->coordinate(1)->setValue(sd);
00265 if (sd == 0 || numentries < 3) {
00266 MSG_WARNING("Need at least 3 bin entries and a non-zero central value to calculate "
00267 << "an error on standard deviation profiles (bin " << b << ")");
00268 target_dps->point(b)->coordinate(1)->setErrorPlus(0);
00269 target_dps->point(b)->coordinate(1)->setErrorMinus(0);
00270 continue;
00271 }
00272
00273 const double var_on_var = moment_profiles[3]->binHeight(b)
00274 - 4 * moment_profiles[2]->binHeight(b) * moment_profiles[0]->binHeight(b)
00275 - pow(moment_profiles[1]->binHeight(b), 2)
00276 + 8 * moment_profiles[1]->binHeight(b) * pow(moment_profiles[0]->binHeight(b), 2)
00277 - 4 * pow(moment_profiles[0]->binHeight(b), 4);
00278 const double stderr_on_var = sqrt(var_on_var/(numentries-2.0));
00279 const double stderr_on_sd = stderr_on_var / (2.0*sd);
00280 target_dps->point(b)->coordinate(1)->setErrorPlus(stderr_on_sd);
00281 target_dps->point(b)->coordinate(1)->setErrorMinus(stderr_on_sd);
00282 }
00283 }
00284
00285
00286 private:
00287
00288 AIDA::IProfile1D* _hist_nch_transverse_500[4];
00289 AIDA::IProfile1D* _hist_nch_toward_500;
00290 AIDA::IProfile1D* _hist_nch_away_500;
00291
00292 AIDA::IProfile1D* _hist_ptsum_transverse_500[4];
00293 AIDA::IProfile1D* _hist_ptsum_toward_500;
00294 AIDA::IProfile1D* _hist_ptsum_away_500;
00295
00296 AIDA::IDataPointSet* _dps_sdnch_transverse_500;
00297 AIDA::IDataPointSet* _dps_sdptsum_transverse_500;
00298
00299 AIDA::IProfile1D* _hist_ptavg_transverse_500;
00300 AIDA::IProfile1D* _hist_ptavg_toward_500;
00301 AIDA::IProfile1D* _hist_ptavg_away_500;
00302
00303 AIDA::IProfile1D* _hist_dn_dpt_transverse_500;
00304 AIDA::IProfile1D* _hist_dn_dpt_toward_500;
00305 AIDA::IProfile1D* _hist_dn_dpt_away_500;
00306
00307 AIDA::IProfile1D* _hist_N_vs_dPhi_1_500;
00308 AIDA::IProfile1D* _hist_N_vs_dPhi_2_500;
00309 AIDA::IProfile1D* _hist_N_vs_dPhi_3_500;
00310 AIDA::IProfile1D* _hist_N_vs_dPhi_5_500;
00311
00312 AIDA::IProfile1D* _hist_pT_vs_dPhi_1_500;
00313 AIDA::IProfile1D* _hist_pT_vs_dPhi_2_500;
00314 AIDA::IProfile1D* _hist_pT_vs_dPhi_3_500;
00315 AIDA::IProfile1D* _hist_pT_vs_dPhi_5_500;
00316
00317 AIDA::IProfile1D* _hist_nch_transverse_100;
00318 AIDA::IProfile1D* _hist_nch_toward_100;
00319 AIDA::IProfile1D* _hist_nch_away_100;
00320 AIDA::IProfile1D* _hist_ptsum_transverse_100;
00321 AIDA::IProfile1D* _hist_ptsum_toward_100;
00322 AIDA::IProfile1D* _hist_ptsum_away_100;
00323
00324 AIDA::IProfile1D* _hist_nch_vs_eta_transverse_100;
00325 AIDA::IProfile1D* _hist_ptsum_vs_eta_transverse_100;
00326
00327 };
00328
00329
00330
00331
00332 DECLARE_RIVET_PLUGIN(ATLAS_2010_S8894728);
00333
00334 }