LHCB_2013_I1208105.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Analysis.hh" 00003 #include "Rivet/Projections/FinalState.hh" 00004 #include "Rivet/Projections/ChargedFinalState.hh" 00005 00006 namespace Rivet { 00007 00008 00009 class LHCB_2013_I1208105 : public Analysis { 00010 public: 00011 00012 LHCB_2013_I1208105() 00013 : Analysis("LHCB_2013_I1208105") 00014 { } 00015 00016 00017 void init() { 00018 // Projections 00019 addProjection(FinalState(1.9, 4.9), "forwardFS"); 00020 addProjection(FinalState(-3.5,-1.5), "backwardFS"); 00021 addProjection(ChargedFinalState(1.9, 4.9), "forwardCFS"); 00022 addProjection(ChargedFinalState(-3.5,-1.5), "backwardCFS"); 00023 00024 // Histos 00025 _s_chEF_minbias = bookScatter2D(1, 1, 1, true); 00026 _s_chEF_hard = bookScatter2D(2, 1, 1, true); 00027 _s_chEF_diff = bookScatter2D(3, 1, 1, true); 00028 _s_chEF_nondiff = bookScatter2D(4, 1, 1, true); 00029 _s_totEF_minbias = bookScatter2D(5, 1, 1, true); 00030 _s_totEF_hard = bookScatter2D(6, 1, 1, true); 00031 _s_totEF_diff = bookScatter2D(7, 1, 1, true); 00032 _s_totEF_nondiff = bookScatter2D(8, 1, 1, true); 00033 00034 // Temporary profiles and histos 00035 /// @todo Convert to declared/registered temp histos 00036 _tp_chEF_minbias.reset(new YODA::Profile1D(refData(1,1,1))); 00037 _tp_chEF_hard.reset(new YODA::Profile1D(refData(2,1,1))); 00038 _tp_chEF_diff.reset(new YODA::Profile1D(refData(3,1,1))); 00039 _tp_chEF_nondiff.reset(new YODA::Profile1D(refData(4,1,1))); 00040 _tp_totEF_minbias.reset(new YODA::Profile1D(refData(5,1,1))); 00041 _tp_totEF_hard.reset(new YODA::Profile1D(refData(6,1,1))); 00042 _tp_totEF_diff.reset(new YODA::Profile1D(refData(7,1,1))); 00043 _tp_totEF_nondiff.reset(new YODA::Profile1D(refData(8,1,1))); 00044 // 00045 _th_chN_minbias.reset(new YODA::Histo1D(refData(1,1,1))); 00046 _th_chN_hard.reset(new YODA::Histo1D(refData(2,1,1))); 00047 _th_chN_diff.reset(new YODA::Histo1D(refData(3,1,1))); 00048 _th_chN_nondiff.reset(new YODA::Histo1D(refData(4,1,1))); 00049 _th_totN_minbias.reset(new YODA::Histo1D(refData(5,1,1))); 00050 _th_totN_hard.reset(new YODA::Histo1D(refData(6,1,1))); 00051 _th_totN_diff.reset(new YODA::Histo1D(refData(7,1,1))); 00052 _th_totN_nondiff.reset(new YODA::Histo1D(refData(8,1,1))); 00053 00054 // Counters 00055 _mbSumW = 0.0; _hdSumW = 0.0; _dfSumW = 0.0; _ndSumW = 0.0; 00056 _mbchSumW = 0.0; _hdchSumW = 0.0; _dfchSumW = 0.0; _ndchSumW = 0.0; 00057 } 00058 00059 00060 /// Perform the per-event analysis 00061 void analyze(const Event& event) { 00062 const double weight = event.weight(); 00063 00064 const FinalState& ffs = applyProjection<FinalState>(event, "forwardFS"); 00065 const FinalState& bfs = applyProjection<FinalState>(event, "backwardFS"); 00066 const ChargedFinalState& fcfs = applyProjection<ChargedFinalState>(event, "forwardCFS"); 00067 const ChargedFinalState& bcfs = applyProjection<ChargedFinalState>(event, "backwardCFS"); 00068 00069 // Veto this event completely if there are no forward *charged* particles 00070 if (fcfs.empty()) vetoEvent; 00071 00072 // Charged and neutral version 00073 { 00074 // Decide empirically if this is a "hard" or "diffractive" event 00075 bool ishardEvt = false; 00076 foreach (const Particle& p, ffs.particles()) { 00077 if (p.pT() > 3.0*GeV) { ishardEvt = true; break; } 00078 } 00079 // Decide empirically if this is a "diffractive" event 00080 /// @todo Can be "diffractive" *and* "hard"? 00081 bool isdiffEvt = (bfs.size() == 0); 00082 00083 // Update event-type weight counters 00084 _mbSumW += weight; 00085 (isdiffEvt ? _dfSumW : _ndSumW) += weight; 00086 if (ishardEvt) _hdSumW += weight; 00087 00088 // Plot energy flow 00089 foreach (const Particle& p, ffs.particles()) { 00090 const double eta = p.eta(); 00091 const double energy = p.E(); 00092 _tp_totEF_minbias->fill(eta, energy, weight); 00093 _th_totN_minbias->fill(eta, weight); 00094 if (ishardEvt) { 00095 _tp_totEF_hard->fill(eta, energy, weight); 00096 _th_totN_hard->fill(eta, weight); 00097 } 00098 if (isdiffEvt) { 00099 _tp_totEF_diff->fill(eta, energy, weight); 00100 _th_totN_diff->fill(eta, weight); 00101 } else { 00102 _tp_totEF_nondiff->fill(eta, energy, weight); 00103 _th_totN_nondiff->fill(eta, weight); 00104 } 00105 } 00106 } 00107 00108 00109 // Charged-only version 00110 { 00111 bool ishardEvt = false; 00112 foreach (const Particle& p, fcfs.particles()) { 00113 if (p.pT() > 3.0*GeV) { ishardEvt = true; break; } 00114 } 00115 // Decide empirically if this is a "diffractive" event 00116 /// @todo Can be "diffractive" *and* "hard"? 00117 bool isdiffEvt = (bcfs.size() == 0); 00118 00119 // Update event-type weight counters 00120 _mbchSumW += weight; 00121 (isdiffEvt ? _dfchSumW : _ndchSumW) += weight; 00122 if (ishardEvt) _hdchSumW += weight; 00123 00124 // Plot energy flow 00125 foreach (const Particle& p, fcfs.particles()) { 00126 const double eta = p.eta(); 00127 const double energy = p.E(); 00128 _tp_chEF_minbias->fill(eta, energy, weight); 00129 _th_chN_minbias->fill(eta, weight); 00130 if (ishardEvt) { 00131 _tp_chEF_hard->fill(eta, energy, weight); 00132 _th_chN_hard->fill(eta, weight); 00133 } 00134 if (isdiffEvt) { 00135 _tp_chEF_diff->fill(eta, energy, weight); 00136 _th_chN_diff->fill(eta, weight); 00137 } else { 00138 _tp_chEF_nondiff->fill(eta, energy, weight); 00139 _th_chN_nondiff->fill(eta, weight); 00140 } 00141 } 00142 } 00143 00144 } 00145 00146 00147 void finalize() { 00148 for (size_t i = 0; i < _s_totEF_minbias->numPoints(); ++i) { 00149 const double val = _tp_totEF_minbias->bin(i).mean() * _th_totN_minbias->bin(i).height(); 00150 const double err = (_tp_totEF_minbias->bin(i).mean() * _th_totN_minbias->bin(i).heightErr() + 00151 _tp_totEF_minbias->bin(i).stdErr() * _th_totN_minbias->bin(i).height()); 00152 _s_totEF_minbias->point(i).setY(val/_mbSumW, err/_mbSumW); 00153 } 00154 for (size_t i = 0; i < _s_totEF_hard->numPoints(); ++i) { 00155 const double val = _tp_totEF_hard->bin(i).mean() * _th_totN_hard->bin(i).height(); 00156 const double err = (_tp_totEF_hard->bin(i).mean() * _th_totN_hard->bin(i).heightErr() + 00157 _tp_totEF_hard->bin(i).stdErr() * _th_totN_hard->bin(i).height()); 00158 _s_totEF_hard->point(i).setY(val/_hdSumW, err/_hdSumW); 00159 } 00160 for (size_t i = 0; i < _s_totEF_diff->numPoints(); ++i) { 00161 const double val = _tp_totEF_diff->bin(i).mean() * _th_totN_diff->bin(i).height(); 00162 const double err = (_tp_totEF_diff->bin(i).mean() * _th_totN_diff->bin(i).heightErr() + 00163 _tp_totEF_diff->bin(i).stdErr() * _th_totN_diff->bin(i).height()); 00164 _s_totEF_diff->point(i).setY(val/_dfSumW, err/_dfSumW); 00165 } 00166 for (size_t i = 0; i < _s_totEF_nondiff->numPoints(); ++i) { 00167 const double val = _tp_totEF_nondiff->bin(i).mean() * _th_totN_nondiff->bin(i).height(); 00168 const double err = (_tp_totEF_nondiff->bin(i).mean() * _th_totN_nondiff->bin(i).heightErr() + 00169 _tp_totEF_nondiff->bin(i).stdErr() * _th_totN_nondiff->bin(i).height()); 00170 _s_totEF_nondiff->point(i).setY(val/_ndSumW, err/_ndSumW); 00171 } 00172 for (size_t i = 0; i < _s_chEF_minbias->numPoints(); ++i) { 00173 const double val = _tp_chEF_minbias->bin(i).mean() * _th_chN_minbias->bin(i).height(); 00174 const double err = (_tp_chEF_minbias->bin(i).mean() * _th_chN_minbias->bin(i).heightErr() + 00175 _tp_chEF_minbias->bin(i).stdErr() * _th_chN_minbias->bin(i).height()); 00176 _s_chEF_minbias->point(i).setY(val/_mbchSumW, err/_mbchSumW); 00177 } 00178 for (size_t i = 0; i < _s_chEF_hard->numPoints(); ++i) { 00179 const double val = _tp_chEF_hard->bin(i).mean() * _th_chN_hard->bin(i).height(); 00180 const double err = (_tp_chEF_hard->bin(i).mean() * _th_chN_hard->bin(i).heightErr() + 00181 _tp_chEF_hard->bin(i).stdErr() * _th_chN_hard->bin(i).height()); 00182 _s_chEF_hard->point(i).setY(val/_hdchSumW, err/_hdchSumW); 00183 } 00184 for (size_t i = 0; i < _s_chEF_diff->numPoints(); ++i) { 00185 const double val = _tp_chEF_diff->bin(i).mean() * _th_chN_diff->bin(i).height(); 00186 const double err = (_tp_chEF_diff->bin(i).mean() * _th_chN_diff->bin(i).heightErr() + 00187 _tp_chEF_diff->bin(i).stdErr() * _th_chN_diff->bin(i).height()); 00188 _s_chEF_diff->point(i).setY(val/_dfchSumW, err/_dfchSumW); 00189 } 00190 for (size_t i = 0; i < _s_chEF_nondiff->numPoints(); ++i) { 00191 const double val = _tp_chEF_nondiff->bin(i).mean() * _th_chN_nondiff->bin(i).height(); 00192 const double err = (_tp_chEF_nondiff->bin(i).mean() * _th_chN_nondiff->bin(i).heightErr() + 00193 _tp_chEF_nondiff->bin(i).stdErr() * _th_chN_nondiff->bin(i).height()); 00194 _s_chEF_nondiff->point(i).setY(val/_ndchSumW, err/_ndchSumW); 00195 } 00196 } 00197 00198 00199 private: 00200 00201 /// @name Histograms and counters 00202 /// 00203 /// @note Histograms correspond to charged and total EF for each class of events: 00204 /// minimum bias, hard scattering, diffractive enriched and non-diffractive enriched. 00205 //@{ 00206 00207 // Scatters to be filled in finalize with 1/d_eta <N(eta)><E(eta)> 00208 Scatter2DPtr _s_totEF_minbias, _s_totEF_hard, _s_totEF_diff, _s_totEF_nondiff; 00209 Scatter2DPtr _s_chEF_minbias, _s_chEF_hard, _s_chEF_diff, _s_chEF_nondiff; 00210 00211 // Temp profiles containing <E(eta)> 00212 shared_ptr<YODA::Profile1D> _tp_totEF_minbias, _tp_totEF_hard, _tp_totEF_diff, _tp_totEF_nondiff; 00213 shared_ptr<YODA::Profile1D> _tp_chEF_minbias, _tp_chEF_hard, _tp_chEF_diff, _tp_chEF_nondiff; 00214 00215 // Temp profiles containing <N(eta)> 00216 shared_ptr<YODA::Histo1D> _th_totN_minbias, _th_totN_hard, _th_totN_diff, _th_totN_nondiff; 00217 shared_ptr<YODA::Histo1D> _th_chN_minbias, _th_chN_hard, _th_chN_diff, _th_chN_nondiff; 00218 00219 // Sums of weights (~ #events) in each event class 00220 double _mbSumW, _hdSumW, _dfSumW, _ndSumW; 00221 double _mbchSumW, _hdchSumW, _dfchSumW, _ndchSumW; 00222 00223 //@} 00224 00225 }; 00226 00227 00228 // Hook for the plugin system 00229 DECLARE_RIVET_PLUGIN(LHCB_2013_I1208105); 00230 00231 } Generated on Wed Oct 7 2015 12:09:13 for The Rivet MC analysis system by ![]() |