5 #include <boost/regex.hpp>
31 static std::pair<std::vector<std::string>,
unsigned int>
34 unsigned int articleId = params.
getParameter<
unsigned int>(
"articleID");
37 <<
"Reading article id " << articleId <<
" from MCDB."
42 mcdb::Article article = mcdb.getArticle(articleId);
45 <<
"Title: " << article.title() << std::endl
46 <<
"First author: " << article.authors()[0].firstName() <<
" "
47 << article.authors()[0].lastName() << std::endl
48 <<
"Number of authors: " << article.authors().size() << std::endl
49 <<
"Abstract: " << article.abstract() << std::endl
50 <<
"Generator: " << article.generator().name()
51 <<
", " << article.generator().version() << std::endl
52 <<
"Number of files: " << article.files().size() << std::endl
53 <<
"Files: " << std::endl;
55 std::vector<std::string> supportedProtocols =
57 "supportedProtocols");
60 "filter",
"\\.lhef?$"),
61 boost::regex_constants::normal |
62 boost::regex_constants::icase);
67 unsigned int fcount = 0;
68 std::vector<std::string> fileURLs;
69 for(std::vector<mcdb::File>::iterator
file = article.files().begin();
70 file != article.files().end(); ++
file) {
72 for(std::vector<std::string>::const_iterator prot =
73 supportedProtocols.begin();
74 prot != supportedProtocols.end(); ++prot) {
75 for(std::vector<std::string>::const_iterator
path =
76 file->paths().begin();
78 if (
path->substr(0, prot->length() + 1) ==
90 <<
"MCDB did not contain any URLs with"
91 " supported protocols for at least one"
92 " file." << std::endl;
94 if (!boost::regex_search(fileURL, filter))
98 if (nEvents > 0 && (
int)firstEvent >= nEvents) {
103 fileURLs.push_back(fileURL);
105 edm::LogInfo(
"Generator|LHEInterface") <<
"Adding file n. " << fcount <<
" " << fileURL;
108 return std::make_pair(fileURLs, firstEvent);
119 std::pair<std::vector<std::string>,
unsigned int>
result =
124 "fileNames", result.first);
126 "skipEvents", result.second);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MCDBSource(const edm::ParameterSet ¶ms, const edm::InputSourceDescription &desc)
static std::pair< std::vector< std::string >, unsigned int > getFileURLs(const edm::ParameterSet ¶ms)
static edm::ParameterSet augmentPSetFromMCDB(const edm::ParameterSet ¶ms)
void addUntrackedParameter(std::string const &name, T const &value)