15 : outputDir_(iConfig.getParameter<std::
string>(
"fileDir")),
16 outputFileName_(iConfig.getParameter<std::
string>(
"outputBinaryFile")),
17 maxNumberOfBinaries_(iConfig.getParameter<int>(
"maxNumberOfBinaries")) {
34 if (fileBlobCollection.
isValid()) {
36 edm::LogInfo(
"MillePedeFileActions") <<
"Root file contains " << fileBlobCollection->size() <<
" FileBlob(s).";
38 for (
const auto& blob : *fileBlobCollection) {
45 char theNumberedOutputFileName[200];
50 <<
"Writing FileBlob file to file " <<
outputDir_ + theNumberedOutputFileName <<
".";
58 edm::LogError(
"MillePedeFileActions") <<
"Error: The root file does not contain any vector of FileBlob.";
66 gzFile
fp = gzopen(fileName.c_str(),
"wb");
68 edm::LogError(
"MillePedeFileActions") <<
"Problem while opening gzipped file '" << fileName <<
"'.";
70 auto nBytes = gzwrite(fp, &uncompressedBlob->front(), uncompressedBlob->size());
71 if (nBytes == 0 || nBytes !=
static_cast<decltype(nBytes)
>(uncompressedBlob->size())) {
72 edm::LogError(
"MillePedeFileActions") <<
"Problem while writing FileBlob to gzipped file '" << fileName <<
"'.";
74 auto zerr = gzclose(fp);
76 edm::LogError(
"MillePedeFileActions") <<
"Problem while closing gzipped file '" << fileName <<
"'.";
87 "Keep the fileDir empty if you want to write to the current "
92 "Base filename of the files that will be created. This must "
94 "a placeholder for an index number in the standard C formatting "
99 "Name of the module that should have generated the blob in the "
100 "root file. Make sure you overwrite this, if you have changed "
101 "this is the configuration of the MillePedeFileConverter.");
103 desc.
add<
int>(
"maxNumberOfBinaries", 1000)
105 "Number of binaries to be extracted from the input files. "
106 "Use a negative value to apply no limit.");
108 descriptions.
add(
"millePedeFileExtractor", desc);
110 "This is the generic cfi file for the "
111 "MillePedeFileExtractor");
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Log< level::Error, false > LogError
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Log< level::Info, false > LogInfo
void setComment(std::string const &value)
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< std::vector< unsigned char > > getUncompressedBlob() const
i didn't want to do two copies ... hope this works.