MC_GENERIC.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 00010 00011 /// Generic analysis looking at various distributions of final state particles 00012 class MC_GENERIC : public Analysis { 00013 public: 00014 00015 /// Constructor 00016 MC_GENERIC() 00017 : Analysis("MC_GENERIC") 00018 { } 00019 00020 00021 public: 00022 00023 /// @name Analysis methods 00024 //@{ 00025 00026 /// Book histograms and initialise projections before the run 00027 void init() { 00028 00029 // Projections 00030 const FinalState cnfs(-5.0, 5.0, 500*MeV); 00031 addProjection(cnfs, "FS"); 00032 addProjection(ChargedFinalState(-5.0, 5.0, 500*MeV), "CFS"); 00033 00034 // Histograms 00035 // @todo Choose E/pT ranged based on input energies... can't do anything about kin. cuts, though 00036 _histMult = bookHisto1D("Mult", 100, -0.5, 199.5); 00037 _histMultCh = bookHisto1D("MultCh", 100, -0.5, 199.5); 00038 00039 _histPt = bookHisto1D("Pt", 300, 0, 30); 00040 _histPtCh = bookHisto1D("PtCh", 300, 0, 30); 00041 00042 _histE = bookHisto1D("E", 100, 0, 200); 00043 _histECh = bookHisto1D("ECh", 100, 0, 200); 00044 00045 _histEtaSumEt = bookProfile1D("EtaSumEt", 25, 0, 5); 00046 00047 _histEta = bookHisto1D("Eta", 50, -5, 5); 00048 _histEtaCh = bookHisto1D("EtaCh", 50, -5, 5); 00049 _tmphistEtaPlus = Histo1D(25, 0, 5); 00050 _tmphistEtaMinus = Histo1D(25, 0, 5); 00051 _tmphistEtaChPlus = Histo1D(25, 0, 5); 00052 _tmphistEtaChMinus = Histo1D(25, 0, 5); 00053 00054 _histRapidity = bookHisto1D("Rapidity", 50, -5, 5); 00055 _histRapidityCh = bookHisto1D("RapidityCh", 50, -5, 5); 00056 _tmphistRapPlus = Histo1D(25, 0, 5); 00057 _tmphistRapMinus = Histo1D(25, 0, 5); 00058 _tmphistRapChPlus = Histo1D(25, 0, 5); 00059 _tmphistRapChMinus = Histo1D(25, 0, 5); 00060 00061 _histPhi = bookHisto1D("Phi", 50, 0, TWOPI); 00062 _histPhiCh = bookHisto1D("PhiCh", 50, 0, TWOPI); 00063 00064 _histEtaPMRatio = bookScatter2D("EtaPMRatio"); 00065 _histEtaChPMRatio = bookScatter2D("EtaChPMRatio"); 00066 _histRapidityPMRatio = bookScatter2D("RapidityPMRatio"); 00067 _histRapidityChPMRatio = bookScatter2D("RapidityChPMRatio"); 00068 } 00069 00070 00071 00072 /// Perform the per-event analysis 00073 void analyze(const Event& event) { 00074 const double weight = event.weight(); 00075 00076 // Charged + neutral final state 00077 const FinalState& cnfs = applyProjection<FinalState>(event, "FS"); 00078 MSG_DEBUG("Total multiplicity = " << cnfs.size()); 00079 _histMult->fill(cnfs.size(), weight); 00080 foreach (const Particle& p, cnfs.particles()) { 00081 const double eta = p.eta(); 00082 _histEta->fill(eta, weight); 00083 _histEtaSumEt->fill(fabs(eta), p.Et(), weight); 00084 if (eta > 0) _tmphistEtaPlus.fill(fabs(eta), weight); 00085 else _tmphistEtaMinus.fill(fabs(eta), weight); 00086 // 00087 const double rapidity = p.rapidity(); 00088 _histRapidity->fill(rapidity, weight); 00089 if (rapidity > 0) _tmphistRapPlus.fill(fabs(rapidity), weight); 00090 else _tmphistRapMinus.fill(fabs(rapidity), weight); 00091 // 00092 _histPt->fill(p.pT()/GeV, weight); 00093 _histE->fill(p.E()/GeV, weight); 00094 _histPhi->fill(p.phi(), weight); 00095 } 00096 00097 const FinalState& cfs = applyProjection<FinalState>(event, "CFS"); 00098 MSG_DEBUG("Total charged multiplicity = " << cfs.size()); 00099 _histMultCh->fill(cfs.size(), weight); 00100 foreach (const Particle& p, cfs.particles()) { 00101 const double eta = p.eta(); 00102 _histEtaCh->fill(eta, weight); 00103 if (eta > 0) { 00104 _tmphistEtaChPlus.fill(fabs(eta), weight); 00105 } else { 00106 _tmphistEtaChMinus.fill(fabs(eta), weight); 00107 } 00108 const double rapidity = p.rapidity(); 00109 _histRapidityCh->fill(rapidity, weight); 00110 if (rapidity > 0) { 00111 _tmphistRapChPlus.fill(fabs(rapidity), weight); 00112 } else { 00113 _tmphistRapChMinus.fill(fabs(rapidity), weight); 00114 } 00115 _histPtCh->fill(p.pT()/GeV, weight); 00116 _histECh->fill(p.E()/GeV, weight); 00117 _histPhiCh->fill(p.phi(), weight); 00118 } 00119 00120 } 00121 00122 00123 /// Finalize 00124 void finalize() { 00125 normalize(_histMult); 00126 normalize(_histMultCh); 00127 normalize(_histEta); 00128 normalize(_histEtaCh); 00129 normalize(_histRapidity); 00130 normalize(_histRapidityCh); 00131 normalize(_histPt); 00132 normalize(_histPtCh); 00133 normalize(_histE); 00134 normalize(_histECh); 00135 normalize(_histPhi); 00136 normalize(_histPhiCh); 00137 divide(_tmphistEtaPlus, _tmphistEtaMinus, _histEtaPMRatio); 00138 divide(_tmphistEtaChPlus, _tmphistEtaChMinus, _histEtaChPMRatio); 00139 divide(_tmphistRapPlus, _tmphistRapMinus, _histRapidityPMRatio); 00140 divide(_tmphistRapChPlus, _tmphistRapChMinus, _histRapidityChPMRatio); 00141 } 00142 00143 //@} 00144 00145 00146 private: 00147 00148 /// @name Histograms 00149 //@{ 00150 Histo1DPtr _histMult, _histMultCh; 00151 Profile1DPtr _histEtaSumEt; 00152 Histo1DPtr _histEta, _histEtaCh; 00153 Histo1DPtr _histRapidity, _histRapidityCh; 00154 Histo1DPtr _histPt, _histPtCh; 00155 Histo1DPtr _histE, _histECh; 00156 Histo1DPtr _histPhi, _histPhiCh; 00157 Scatter2DPtr _histEtaPMRatio; 00158 Scatter2DPtr _histEtaChPMRatio; 00159 Scatter2DPtr _histRapidityPMRatio; 00160 Scatter2DPtr _histRapidityChPMRatio; 00161 //@} 00162 00163 /// @name Temporary histos used to calculate eta+/eta- ratio plots 00164 //@{ 00165 Histo1D _tmphistEtaPlus, _tmphistEtaMinus; 00166 Histo1D _tmphistEtaChPlus, _tmphistEtaChMinus; 00167 Histo1D _tmphistRapPlus, _tmphistRapMinus; 00168 Histo1D _tmphistRapChPlus, _tmphistRapChMinus; 00169 //@} 00170 00171 }; 00172 00173 00174 // The hook for the plugin system 00175 DECLARE_RIVET_PLUGIN(MC_GENERIC); 00176 00177 } Generated on Thu Mar 10 2016 08:29:51 for The Rivet MC analysis system by ![]() |