14 : outputDir_(iConfig.getParameter<std::
string>(
"fileDir")),
15 outputFileName_(iConfig.getParameter<std::
string>(
"outputBinaryFile")),
16 maxNumberOfBinaries_(iConfig.getParameter<int>(
"maxNumberOfBinaries")) {
22 <<
"Limiting the number of extracted binary files to "
37 if (fileBlobCollection.
isValid()) {
40 <<
"Root file contains " << fileBlobCollection->size() <<
" FileBlob(s).";
42 for (
const auto& blob: *fileBlobCollection) {
48 char theNumberedOutputFileName[200];
53 <<
"Writing FileBlob file to file "
54 <<
outputDir_ + theNumberedOutputFileName <<
".";
63 <<
"Error: The root file does not contain any vector of FileBlob.";
73 gzFile
fp = gzopen(fileName.c_str(),
"wb");
76 <<
"Problem while opening gzipped file '" << fileName <<
"'.";
78 auto nBytes = gzwrite(fp, &uncompressedBlob->front(), uncompressedBlob->size());
80 nBytes !=
static_cast<decltype(nBytes)
>(uncompressedBlob->size())) {
82 <<
"Problem while writing FileBlob to gzipped file '" << fileName <<
"'.";
84 auto zerr = gzclose(fp);
87 <<
"Problem while closing gzipped file '" << fileName <<
"'.";
99 "Keep the fileDir empty if you want to write to the current "
102 desc.
add<
std::string>(
"outputBinaryFile",
"milleBinary%04d.dat")->setComment(
103 "Base filename of the files that will be created. This must "
105 "a placeholder for an index number in the standard C formatting "
106 "style, like %04d.");
109 "Name of the module that should have generated the blob in the "
110 "root file. Make sure you overwrite this, if you have changed "
111 "this is the configuration of the MillePedeFileConverter.");
113 desc.
add<
int>(
"maxNumberOfBinaries", 1000)->setComment(
114 "Number of binaries to be extracted from the input files. "
115 "Use a negative value to apply no limit.");
117 descriptions.
add(
"millePedeFileExtractor", desc);
119 "This is the generic cfi file for the "
120 "MillePedeFileExtractor");
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void setComment(std::string const &value)
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.