Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:42

0001 #include <iostream>
0002 #include <iomanip>
0003 #include <sstream>
0004 #include <string>
0005 
0006 #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h"
0007 #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
0008 
0009 void LHEEventProduct::const_iterator::next() {
0010   const lhef::HEPEUP &hepeup = event->hepeup();
0011   int line = this->line++;
0012 
0013   if (!line) {
0014     std::ostringstream ss;
0015     ss << std::setprecision(7) << std::scientific << std::uppercase << "    " << hepeup.NUP << "  " << hepeup.IDPRUP
0016        << "  " << event->originalXWGTUP() << "  " << hepeup.SCALUP << "  " << hepeup.AQEDUP << "  " << hepeup.AQCDUP
0017        << std::endl;
0018     tmp = ss.str();
0019     return;
0020   }
0021   line--;
0022 
0023   if (line < hepeup.NUP) {
0024     std::ostringstream ss;
0025     ss << std::setprecision(10) << std::scientific << std::uppercase << "\t" << hepeup.IDUP[line] << "\t"
0026        << hepeup.ISTUP[line] << "\t" << hepeup.MOTHUP[line].first << "\t" << hepeup.MOTHUP[line].second << "\t"
0027        << hepeup.ICOLUP[line].first << "\t" << hepeup.ICOLUP[line].second << "\t" << hepeup.PUP[line][0] << "\t"
0028        << hepeup.PUP[line][1] << "\t" << hepeup.PUP[line][2] << "\t" << hepeup.PUP[line][3] << "\t"
0029        << hepeup.PUP[line][4] << std::setprecision(3) << "\t" << hepeup.VTIMUP[line] << std::setprecision(1)
0030        << std::fixed << "\t" << hepeup.SPINUP[line] << std::endl;
0031     tmp = ss.str();
0032     return;
0033   }
0034   line -= hepeup.NUP;
0035 
0036   if (event->pdf()) {
0037     if (!line) {
0038       const PDF &pdf = *event->pdf();
0039       std::ostringstream ss;
0040       ss << std::setprecision(7) << std::scientific << std::uppercase << "#pdf  " << pdf.id.first << "  "
0041          << pdf.id.second << "  " << pdf.x.first << "  " << pdf.x.second << "  " << pdf.scalePDF << "  "
0042          << pdf.xPDF.first << "  " << pdf.xPDF.second << std::endl;
0043       tmp = ss.str();
0044       return;
0045     }
0046     line--;
0047   }
0048 
0049   if (line < (int)event->comments_size()) {
0050     tmp = *(event->comments_begin() + line);
0051     return;
0052   }
0053   line -= event->comments_size();
0054 
0055   if (!line) {
0056     tmp = "</event>\n";
0057     return;
0058   }
0059 
0060   tmp.clear();
0061   this->line = npos;
0062 }
0063 
0064 LHEEventProduct::const_iterator LHEEventProduct::begin() const {
0065   const_iterator result;
0066   result.event = this;
0067   result.line = 0;
0068   result.tmp = "<event>\n";
0069   return result;
0070 }