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