![]() |
![]() |
#include <LHERunInfoProduct.h>
Classes | |
class | const_iterator |
class | Header |
Public Types | |
typedef std::vector < std::string > ::const_iterator | comments_const_iterator |
typedef std::vector< Header > ::const_iterator | headers_const_iterator |
typedef std::vector< Header > ::size_type | size_type |
typedef std::vector< std::pair < std::string, std::string > > | weights_defs |
Public Member Functions | |
void | addComment (const std::string &line) |
void | addHeader (const Header &header) |
const_iterator | begin () const |
comments_const_iterator | comments_begin () const |
comments_const_iterator | comments_end () const |
size_type | comments_size () const |
const_iterator | end () const |
headers_const_iterator | headers_begin () const |
headers_const_iterator | headers_end () const |
size_type | headers_size () const |
const lhef::HEPRUP & | heprup () const |
const_iterator | init () const |
bool | isProductEqual (const LHERunInfoProduct &other) const |
LHERunInfoProduct (const lhef::HEPRUP &heprup) | |
LHERunInfoProduct () | |
bool | mergeProduct (const LHERunInfoProduct &other) |
bool | operator!= (const LHERunInfoProduct &other) const |
bool | operator== (const LHERunInfoProduct &other) const |
~LHERunInfoProduct () | |
Static Public Member Functions | |
static const std::string & | endOfFile () |
static bool | isTagComparedInMerge (const std::string &tag) |
Private Attributes | |
std::vector< std::string > | comments_ |
std::vector< Header > | headers_ |
lhef::HEPRUP | heprup_ |
Definition at line 13 of file LHERunInfoProduct.h.
typedef std::vector<std::string>::const_iterator LHERunInfoProduct::comments_const_iterator |
Definition at line 47 of file LHERunInfoProduct.h.
typedef std::vector<Header>::const_iterator LHERunInfoProduct::headers_const_iterator |
Definition at line 45 of file LHERunInfoProduct.h.
typedef std::vector<Header>::size_type LHERunInfoProduct::size_type |
Definition at line 44 of file LHERunInfoProduct.h.
typedef std::vector<std::pair<std::string,std::string> > LHERunInfoProduct::weights_defs |
Definition at line 15 of file LHERunInfoProduct.h.
LHERunInfoProduct::LHERunInfoProduct | ( | ) | [inline] |
Definition at line 49 of file LHERunInfoProduct.h.
{}
LHERunInfoProduct::LHERunInfoProduct | ( | const lhef::HEPRUP & | heprup | ) | [inline] |
Definition at line 50 of file LHERunInfoProduct.h.
: heprup_(heprup) {}
LHERunInfoProduct::~LHERunInfoProduct | ( | ) | [inline] |
Definition at line 51 of file LHERunInfoProduct.h.
{}
void LHERunInfoProduct::addComment | ( | const std::string & | line | ) | [inline] |
Definition at line 54 of file LHERunInfoProduct.h.
References comments_.
Referenced by LHESource::beginRun(), ExternalLHEProducer::beginRunProduce(), ExternalLHEProducer::produce(), and LHESource::readEvent_().
void LHERunInfoProduct::addHeader | ( | const Header & | header | ) | [inline] |
Definition at line 53 of file LHERunInfoProduct.h.
References headers_.
Referenced by LHESource::beginRun(), ExternalLHEProducer::beginRunProduce(), mergeProduct(), ExternalLHEProducer::produce(), and LHESource::readEvent_().
{ headers_.push_back(header); }
LHERunInfoProduct::const_iterator LHERunInfoProduct::begin | ( | void | ) | const |
Definition at line 138 of file LHERunInfoProduct.cc.
References LHERunInfoProduct::const_iterator::header, headers_begin(), LHERunInfoProduct::const_iterator::kHeader, LHERunInfoProduct::const_iterator::line, LHERunInfoProduct::const_iterator::mode, query::result, LHERunInfoProduct::const_iterator::runInfo, and LHERunInfoProduct::const_iterator::tmp.
{ const_iterator result; result.runInfo = this; result.header = headers_begin(); result.mode = const_iterator::kHeader; result.line = 0; result.tmp = "<LesHouchesEvents version=\"1.0\">\n"; return result; }
comments_const_iterator LHERunInfoProduct::comments_begin | ( | ) | const [inline] |
Definition at line 63 of file LHERunInfoProduct.h.
References comments_.
Referenced by lhef::LHERunInfo::LHERunInfo(), and LHERunInfoProduct::const_iterator::next().
{ return comments_.begin(); }
comments_const_iterator LHERunInfoProduct::comments_end | ( | ) | const [inline] |
Definition at line 64 of file LHERunInfoProduct.h.
References comments_.
Referenced by lhef::LHERunInfo::LHERunInfo().
{ return comments_.end(); }
size_type LHERunInfoProduct::comments_size | ( | ) | const [inline] |
Definition at line 62 of file LHERunInfoProduct.h.
References comments_.
Referenced by LHERunInfoProduct::const_iterator::next().
{ return comments_.size(); }
const_iterator LHERunInfoProduct::end | ( | void | ) | const [inline] |
Definition at line 112 of file LHERunInfoProduct.h.
{ return const_iterator(); }
const std::string & LHERunInfoProduct::endOfFile | ( | ) | [static] |
Definition at line 163 of file LHERunInfoProduct.cc.
References AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by LHEWriter::endRun().
{ static const std::string theEnd("</LesHouchesEvents>\n"); return theEnd; }
headers_const_iterator LHERunInfoProduct::headers_begin | ( | ) | const [inline] |
Definition at line 59 of file LHERunInfoProduct.h.
References headers_.
Referenced by begin(), lhef::LHERunInfo::LHERunInfo(), and mergeProduct().
{ return headers_.begin(); }
headers_const_iterator LHERunInfoProduct::headers_end | ( | ) | const [inline] |
Definition at line 60 of file LHERunInfoProduct.h.
References headers_.
Referenced by lhef::LHERunInfo::LHERunInfo(), mergeProduct(), and LHERunInfoProduct::const_iterator::next().
{ return headers_.end(); }
size_type LHERunInfoProduct::headers_size | ( | ) | const [inline] |
const lhef::HEPRUP& LHERunInfoProduct::heprup | ( | ) | const [inline] |
Definition at line 56 of file LHERunInfoProduct.h.
References heprup_.
Referenced by LHERunInfoProduct::const_iterator::next(), and LHE2HepMCConverter::produce().
{ return heprup_; }
LHERunInfoProduct::const_iterator LHERunInfoProduct::init | ( | void | ) | const |
Definition at line 151 of file LHERunInfoProduct.cc.
References LHERunInfoProduct::const_iterator::kInit, LHERunInfoProduct::const_iterator::line, LHERunInfoProduct::const_iterator::mode, query::result, LHERunInfoProduct::const_iterator::runInfo, and LHERunInfoProduct::const_iterator::tmp.
{ const_iterator result; result.runInfo = this; result.mode = const_iterator::kInit; result.line = 0; result.tmp = "<init>\n"; return result; }
bool LHERunInfoProduct::isProductEqual | ( | const LHERunInfoProduct & | other | ) | const [inline] |
Definition at line 122 of file LHERunInfoProduct.h.
{ return *this == other; }
bool LHERunInfoProduct::isTagComparedInMerge | ( | const std::string & | tag | ) | [static] |
Definition at line 208 of file LHERunInfoProduct.cc.
Referenced by edm::LHEProvenanceHelper::lheAugment(), and mergeProduct().
bool LHERunInfoProduct::mergeProduct | ( | const LHERunInfoProduct & | other | ) |
Definition at line 212 of file LHERunInfoProduct.cc.
References addHeader(), filterCSVwithJSON::copy, lhef::HEPRUP::EBMUP, Exception, headers_, headers_begin(), headers_end(), heprup_, i, lhef::HEPRUP::IDBMUP, lhef::HEPRUP::IDWTUP, isTagComparedInMerge(), lhef::HEPRUP::LPRUP, max(), lhef::HEPRUP::NPRUP, lhef::HEPRUP::PDFGUP, lhef::HEPRUP::PDFSUP, lhef::HEPRUP::resize(), mathSSE::sqrt(), x, lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.
{ if (heprup_.IDBMUP != other.heprup_.IDBMUP || heprup_.EBMUP != other.heprup_.EBMUP || heprup_.PDFGUP != other.heprup_.PDFGUP || heprup_.PDFSUP != other.heprup_.PDFSUP || heprup_.IDWTUP != other.heprup_.IDWTUP) { throw cms::Exception("ProductsNotMergeable") << "Error in LHERunInfoProduct: LHE headers differ. " "Cannot merge products." << std::endl; } bool compatibleHeaders = headers_ == other.headers_; // try to merge different, but compatible headers while(!compatibleHeaders) { // okay, something is different. // Let's try to merge, but don't duplicate identical headers // and test the rest against a whitelist std::set<Header, HeaderLess> headers; std::copy(headers_begin(), headers_end(), std::inserter(headers, headers.begin())); bool failed = false; for(std::vector<LHERunInfoProduct::Header>::const_iterator header = other.headers_begin(); header != other.headers_end(); ++header) { if (headers.count(*header)) { continue; } if(isTagComparedInMerge(header->tag())) { failed = true; } else { addHeader(*header); headers.insert(*header); } } if (failed) { break; } compatibleHeaders = true; } // still not compatible after fixups if (!compatibleHeaders) { throw cms::Exception("ProductsNotMergeable") << "Error in LHERunInfoProduct: LHE headers differ. " "Cannot merge products." << std::endl; } // it is exactly the same, so merge if (heprup_ == other.heprup_) return true; // the input files are different ones, presumably generation // of the same process in different runs with identical run number // attempt merge of processes and cross-sections std::map<int, XSec> processes; for(int i = 0; i < heprup_.NPRUP; i++) { int id = heprup_.LPRUP[i]; XSec &x = processes[id]; x.xsec = heprup_.XSECUP[i]; x.err = heprup_.XERRUP[i]; x.max = heprup_.XMAXUP[i]; } for(int i = 0; i < other.heprup_.NPRUP; i++) { int id = other.heprup_.LPRUP[i]; XSec &x = processes[id]; if (x.xsec) { double wgt1 = 1.0 / (x.err * x.err); double wgt2 = 1.0 / (other.heprup_.XERRUP[i] * other.heprup_.XERRUP[i]); x.xsec = (wgt1 * x.xsec + wgt2 * other.heprup_.XSECUP[i]) / (wgt1 + wgt2); x.err = 1.0 / std::sqrt(wgt1 + wgt2); x.max = std::max(x.max, other.heprup_.XMAXUP[i]); } else { x.xsec = other.heprup_.XSECUP[i]; x.err = other.heprup_.XERRUP[i]; x.max = other.heprup_.XMAXUP[i]; } } heprup_.resize(processes.size()); unsigned int i = 0; for(std::map<int, XSec>::const_iterator iter = processes.begin(); iter != processes.end(); ++iter, i++) { heprup_.LPRUP[i] = iter->first; heprup_.XSECUP[i] = iter->second.xsec; heprup_.XERRUP[i] = iter->second.err; heprup_.XMAXUP[i] = iter->second.max; } return true; }
bool LHERunInfoProduct::operator!= | ( | const LHERunInfoProduct & | other | ) | const [inline] |
Definition at line 118 of file LHERunInfoProduct.h.
{ return !(*this == other); }
bool LHERunInfoProduct::operator== | ( | const LHERunInfoProduct & | other | ) | const [inline] |
std::vector<std::string> LHERunInfoProduct::comments_ [private] |
Definition at line 129 of file LHERunInfoProduct.h.
Referenced by addComment(), comments_begin(), comments_end(), comments_size(), and operator==().
std::vector<Header> LHERunInfoProduct::headers_ [private] |
Definition at line 128 of file LHERunInfoProduct.h.
Referenced by addHeader(), headers_begin(), headers_end(), headers_size(), mergeProduct(), and operator==().
lhef::HEPRUP LHERunInfoProduct::heprup_ [private] |
Definition at line 127 of file LHERunInfoProduct.h.
Referenced by heprup(), mergeProduct(), and operator==().