Go to the documentation of this file.00001 #include <iostream>
00002 #include <iomanip>
00003 #include <sstream>
00004 #include <string>
00005
00006 #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h"
00007 #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
00008
00009 void LHEEventProduct::const_iterator::next()
00010 {
00011 const lhef::HEPEUP &hepeup = event->hepeup();
00012 int line = this->line++;
00013
00014 if (!line) {
00015 std::ostringstream ss;
00016 ss << std::setprecision(7)
00017 << std::scientific
00018 << std::uppercase
00019 << " " << hepeup.NUP
00020 << " " << hepeup.IDPRUP
00021 << " " << event->originalXWGTUP()
00022 << " " << hepeup.SCALUP
00023 << " " << hepeup.AQEDUP
00024 << " " << hepeup.AQCDUP << std::endl;
00025 tmp = ss.str();
00026 return;
00027 }
00028 line--;
00029
00030 if (line < hepeup.NUP) {
00031 std::ostringstream ss;
00032 ss << std::setprecision(10)
00033 << std::scientific
00034 << std::uppercase
00035 << "\t" << hepeup.IDUP[line]
00036 << "\t" << hepeup.ISTUP[line]
00037 << "\t" << hepeup.MOTHUP[line].first
00038 << "\t" << hepeup.MOTHUP[line].second
00039 << "\t" << hepeup.ICOLUP[line].first
00040 << "\t" << hepeup.ICOLUP[line].second
00041 << "\t" << hepeup.PUP[line][0]
00042 << "\t" << hepeup.PUP[line][1]
00043 << "\t" << hepeup.PUP[line][2]
00044 << "\t" << hepeup.PUP[line][3]
00045 << "\t" << hepeup.PUP[line][4]
00046 << std::setprecision(3)
00047 << "\t" << hepeup.VTIMUP[line]
00048 << std::setprecision(1)
00049 << std::fixed
00050 << "\t" << hepeup.SPINUP[line] << std::endl;
00051 tmp = ss.str();
00052 return;
00053 }
00054 line -= hepeup.NUP;
00055
00056 if (event->pdf()) {
00057 if (!line) {
00058 const PDF &pdf = *event->pdf();
00059 std::ostringstream ss;
00060 ss << std::setprecision(7)
00061 << std::scientific
00062 << std::uppercase
00063 << "#pdf " << pdf.id.first
00064 << " " << pdf.id.second
00065 << " " << pdf.x.first
00066 << " " << pdf.x.second
00067 << " " << pdf.scalePDF
00068 << " " << pdf.xPDF.first
00069 << " " << pdf.xPDF.second << std::endl;
00070 tmp = ss.str();
00071 return;
00072 }
00073 line--;
00074 }
00075
00076 if (line < (int)event->comments_size()) {
00077 tmp = *(event->comments_begin() + line);
00078 return;
00079 }
00080 line -= event->comments_size();
00081
00082 if (!line) {
00083 tmp = "</event>\n";
00084 return;
00085 }
00086
00087 tmp.clear();
00088 this->line = npos;
00089 }
00090
00091 LHEEventProduct::const_iterator LHEEventProduct::begin() const
00092 {
00093 const_iterator result;
00094 result.event = this;
00095 result.line = 0;
00096 result.tmp = "<event>\n";
00097 return result;
00098 }