CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
LHERunInfoProduct::const_iterator Class Reference

#include <LHERunInfoProduct.h>

Public Types

typedef std::ptrdiff_t difference_type
 
typedef std::forward_iterator_tag iterator_category
 
typedef std::string * pointer
 
typedef std::string & reference
 
typedef std::string value_type
 

Public Member Functions

 const_iterator ()
 
bool operator!= (const const_iterator &other) const
 
const std::string & operator* () const
 
const_iteratoroperator++ ()
 
const_iterator operator++ (int dummy)
 
const std::string * operator-> () const
 
bool operator== (const const_iterator &other) const
 
 ~const_iterator ()
 

Private Types

enum  Mode {
  kHeader, kBody, kInit, kDone,
  kFooter
}
 

Private Member Functions

void next ()
 

Private Attributes

headers_const_iterator header
 
Header::const_iterator iter
 
unsigned int line
 
Mode mode
 
const LHERunInfoProductrunInfo
 
std::string tmp
 

Friends

class LHERunInfoProduct
 

Detailed Description

Definition at line 68 of file LHERunInfoProduct.h.

Member Typedef Documentation

Definition at line 72 of file LHERunInfoProduct.h.

typedef std::forward_iterator_tag LHERunInfoProduct::const_iterator::iterator_category

Definition at line 70 of file LHERunInfoProduct.h.

Definition at line 73 of file LHERunInfoProduct.h.

Definition at line 74 of file LHERunInfoProduct.h.

Definition at line 71 of file LHERunInfoProduct.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

LHERunInfoProduct::const_iterator::const_iterator ( )
inline
LHERunInfoProduct::const_iterator::~const_iterator ( )
inline

Definition at line 77 of file LHERunInfoProduct.h.

References LHERunInfoProduct::Header::operator==(), and trackingPlots::other.

77 {}

Member Function Documentation

void LHERunInfoProduct::const_iterator::next ( void  )
private

Definition at line 40 of file LHERunInfoProduct.cc.

References LHERunInfoProduct::comments_begin(), LHERunInfoProduct::comments_size(), lhef::HEPRUP::EBMUP, header, LHERunInfoProduct::headers_end(), LHERunInfoProduct::heprup(), lhef::HEPRUP::IDBMUP, lhef::HEPRUP::IDWTUP, createfilelist::int, iter, kBody, kDone, kFooter, kHeader, kInit, line, lhef::HEPRUP::LPRUP, mode, lhef::HEPRUP::NPRUP, lhef::HEPRUP::PDFGUP, lhef::HEPRUP::PDFSUP, runInfo, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, tmp, lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.

41 {
42  tmp.clear();
43 
44  do {
45  switch(mode) {
46  case kHeader:
47  if (header == runInfo->headers_end()) {
48  if (line++ == 1)
49  tmp = "</header>\n";
50  else {
51  mode = kInit;
52  tmp = "<init>\n";
53  line = 0;
54  }
55  break;
56  } else if (!line) {
57  line++;
58  tmp = "<header>\n";
59  break;
60  } else {
61  mode = kBody;
62  const std::string &tag = header->tag();
63  tmp = tag.empty() ? "<!--" :
64  (tag == "<>") ? "" : ("<" + tag + ">");
65  iter = header->begin();
66  continue;
67  }
68 
69  case kBody:
70  if (iter == header->end()) {
71  mode = kHeader;
72  const std::string &tag = header->tag();
73  tmp += tag.empty() ? "-->" :
74  (tag == "<>") ? "" : ("</" + tag + ">");
75  tmp += "\n";
76  header++;
77  } else {
78  tmp += *iter++;
79  if (iter == header->end() &&
80  (tmp.empty() ||
81  (tmp[tmp.length() - 1] != '\r' &&
82  tmp[tmp.length() - 1] != '\n')))
83  continue;
84  }
85  break;
86 
87  case kInit: {
88  const lhef::HEPRUP &heprup = runInfo->heprup();
89  if (!line++) {
90  std::ostringstream ss;
91  ss << std::setprecision(7)
92  << std::scientific
93  << std::uppercase
94  << " " << heprup.IDBMUP.first
95  << " " << heprup.IDBMUP.second
96  << " " << heprup.EBMUP.first
97  << " " << heprup.EBMUP.second
98  << " " << heprup.PDFGUP.first
99  << " " << heprup.PDFGUP.second
100  << " " << heprup.PDFSUP.first
101  << " " << heprup.PDFSUP.second
102  << " " << heprup.IDWTUP
103  << " " << heprup.NPRUP << std::endl;
104  tmp = ss.str();
105  break;
106  }
107  if (line >= (unsigned int)heprup.NPRUP +
108  runInfo->comments_size() + 2) {
109  tmp = "</init>\n";
110  mode = kFooter;
111  break;
112  } else if (line >= (unsigned int)heprup.NPRUP + 2) {
113  tmp = *(runInfo->comments_begin() + (line -
114  (unsigned int)heprup.NPRUP - 2));
115  break;
116  }
117 
118  std::ostringstream ss;
119  ss << std::setprecision(7)
120  << std::scientific
121  << std::uppercase
122  << "\t" << heprup.XSECUP[line - 2]
123  << "\t" << heprup.XERRUP[line - 2]
124  << "\t" << heprup.XMAXUP[line - 2]
125  << "\t" << heprup.LPRUP[line - 2] << std::endl;
126  tmp = ss.str();
127  } break;
128 
129  case kFooter:
130  mode = kDone;
131 
132  default:
133  /* ... */;
134  }
135  } while(false);
136 }
std::pair< double, double > EBMUP
Definition: LesHouches.h:91
const LHERunInfoProduct * runInfo
headers_const_iterator headers_end() const
std::pair< int, int > IDBMUP
Definition: LesHouches.h:86
const lhef::HEPRUP & heprup() const
std::pair< int, int > PDFGUP
Definition: LesHouches.h:97
std::vector< double > XERRUP
Definition: LesHouches.h:127
std::vector< double > XMAXUP
Definition: LesHouches.h:132
size_type comments_size() const
comments_const_iterator comments_begin() const
std::pair< int, int > PDFSUP
Definition: LesHouches.h:103
std::vector< double > XSECUP
Definition: LesHouches.h:121
std::vector< int > LPRUP
Definition: LesHouches.h:137
bool LHERunInfoProduct::const_iterator::operator!= ( const const_iterator other) const
inline

Definition at line 80 of file LHERunInfoProduct.h.

References LHERunInfoProduct::Header::operator==().

81  { return !operator == (other); }
bool operator==(const const_iterator &other) const
const std::string& LHERunInfoProduct::const_iterator::operator* ( void  ) const
inline

Definition at line 88 of file LHERunInfoProduct.h.

References tmp.

88 { return tmp; }
const_iterator& LHERunInfoProduct::const_iterator::operator++ ( void  )
inline

Definition at line 83 of file LHERunInfoProduct.h.

References GetRecoTauVFromDQM_MC_cff::next.

84  { next(); return *this; }
const_iterator LHERunInfoProduct::const_iterator::operator++ ( int  dummy)
inline

Definition at line 85 of file LHERunInfoProduct.h.

References GetRecoTauVFromDQM_MC_cff::next.

const std::string* LHERunInfoProduct::const_iterator::operator-> ( ) const
inline

Definition at line 89 of file LHERunInfoProduct.h.

References tmp.

89 { return &tmp; }
bool LHERunInfoProduct::const_iterator::operator== ( const const_iterator other) const

Definition at line 17 of file LHERunInfoProduct.cc.

References RecoTauValidation_cfi::header, mps_splice::line, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, and trackingPlots::other.

18 {
19  if (mode != other.mode)
20  return false;
21 
22  switch(mode) {
23  case kFooter:
24  case kDone:
25  return true;
26 
27  case kHeader:
28  return header == other.header;
29 
30  case kBody:
31  return header == other.header && iter == other.iter;
32 
33  case kInit:
34  return line == other.line;
35  }
36 
37  return false;
38 }

Friends And Related Function Documentation

friend class LHERunInfoProduct
friend

Definition at line 92 of file LHERunInfoProduct.h.

Member Data Documentation

headers_const_iterator LHERunInfoProduct::const_iterator::header
private
Header::const_iterator LHERunInfoProduct::const_iterator::iter
private

Definition at line 106 of file LHERunInfoProduct.h.

Referenced by next().

unsigned int LHERunInfoProduct::const_iterator::line
private

Definition at line 108 of file LHERunInfoProduct.h.

Referenced by LHERunInfoProduct::begin(), LHERunInfoProduct::init(), and next().

Mode LHERunInfoProduct::const_iterator::mode
private

Definition at line 107 of file LHERunInfoProduct.h.

Referenced by LHERunInfoProduct::begin(), LHERunInfoProduct::init(), and next().

const LHERunInfoProduct* LHERunInfoProduct::const_iterator::runInfo
private

Definition at line 104 of file LHERunInfoProduct.h.

Referenced by LHERunInfoProduct::begin(), LHERunInfoProduct::init(), and next().

std::string LHERunInfoProduct::const_iterator::tmp
private

Definition at line 109 of file LHERunInfoProduct.h.

Referenced by LHERunInfoProduct::begin(), LHERunInfoProduct::init(), and next().